Allow to join an open group
Also: * Refactor interacting with a remote event so that you can interact with a remote group as well * Add a setting for group admins to pick between an open and invite-only group * Fix new groups without posts/todos/resources/events/conversations URL set * Repair local groups that haven't got their posts/todos/resources/events/conversations URL set * Add a scheduled job to refresh remote groups every hour * Add a user setting to pick when to receive notifications when there's new members to approve (will be used when this feature is available) * Fix pagination for members Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -63,13 +63,14 @@ export default class CreateDiscussion extends Vue {
|
||||
|
||||
async createDiscussion(): Promise<void> {
|
||||
try {
|
||||
if (!this.group.id || !this.currentActor.id) return;
|
||||
const { data } = await this.$apollo.mutate({
|
||||
mutation: CREATE_DISCUSSION,
|
||||
variables: {
|
||||
title: this.discussion.title,
|
||||
text: this.discussion.text,
|
||||
actorId: this.group.id,
|
||||
creatorId: this.currentActor.id,
|
||||
actorId: parseInt(this.group.id, 10),
|
||||
creatorId: parseInt(this.currentActor.id, 10),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -67,27 +67,6 @@
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
<!-- <div class="field" v-if="event.attributedTo.id">-->
|
||||
<!-- <label class="label">{{ $t('Hide the organizer') }}</label>-->
|
||||
<!-- <b-switch v-model="event.options.hideOrganizerWhenGroupEvent">-->
|
||||
<!-- {{ $t("Don't show @{organizer} as event host alongside @{group}", {organizer: event.organizerActor.preferredUsername, group: event.attributedTo.preferredUsername}) }}-->
|
||||
<!-- <small>-->
|
||||
<!-- <br>-->
|
||||
<!-- {{ $t('All group members and other eventual server admins will still be able to view this information.') }}-->
|
||||
<!-- </small>-->
|
||||
<!-- </b-switch>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!--<b-field :label="$t('Category')">
|
||||
<b-select placeholder="Select a category" v-model="event.category">
|
||||
<option
|
||||
v-for="category in categories"
|
||||
:value="category"
|
||||
:key="category"
|
||||
>{{ $t(category) }}</option>
|
||||
</b-select>
|
||||
</b-field>-->
|
||||
|
||||
<subtitle>{{ $t("Who can view this event and participate") }}</subtitle>
|
||||
<div class="field">
|
||||
<b-radio
|
||||
@@ -370,6 +349,8 @@ import IdentityPickerWrapper from "@/views/Account/IdentityPickerWrapper.vue";
|
||||
import Subtitle from "@/components/Utils/Subtitle.vue";
|
||||
import { Route } from "vue-router";
|
||||
import { formatList } from "@/utils/i18n";
|
||||
import { CommentModeration } from "../../types/event-options.model";
|
||||
import { ParticipantRole } from "../../types/participant.model";
|
||||
import OrganizerPickerWrapper from "../../components/Event/OrganizerPickerWrapper.vue";
|
||||
import {
|
||||
CREATE_EVENT,
|
||||
@@ -378,13 +359,11 @@ import {
|
||||
FETCH_EVENT,
|
||||
} from "../../graphql/event";
|
||||
import {
|
||||
CommentModeration,
|
||||
EventJoinOptions,
|
||||
EventModel,
|
||||
EventStatus,
|
||||
EventVisibility,
|
||||
IEvent,
|
||||
ParticipantRole,
|
||||
} from "../../types/event.model";
|
||||
import {
|
||||
CURRENT_ACTOR_CLIENT,
|
||||
|
||||
@@ -88,10 +88,10 @@
|
||||
:participation="participations[0]"
|
||||
:event="event"
|
||||
:current-actor="currentActor"
|
||||
@joinEvent="joinEvent"
|
||||
@joinModal="isJoinModalActive = true"
|
||||
@joinEventWithConfirmation="joinEventWithConfirmation"
|
||||
@confirmLeave="confirmLeave"
|
||||
@join-event="joinEvent"
|
||||
@join-modal="isJoinModalActive = true"
|
||||
@join-event-with-confirmation="joinEventWithConfirmation"
|
||||
@confirm-leave="confirmLeave"
|
||||
/>
|
||||
<b-button
|
||||
type="is-text"
|
||||
@@ -504,7 +504,6 @@
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Watch } from "vue-property-decorator";
|
||||
import BIcon from "buefy/src/components/icon/Icon.vue";
|
||||
import { GraphQLError } from "graphql";
|
||||
import {
|
||||
EVENT_PERSON_PARTICIPATION,
|
||||
EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED,
|
||||
@@ -517,8 +516,6 @@ import {
|
||||
EventStatus,
|
||||
EventVisibility,
|
||||
IEvent,
|
||||
IParticipant,
|
||||
ParticipantRole,
|
||||
EventJoinOptions,
|
||||
} from "../../types/event.model";
|
||||
import { IActor, IPerson, Person, usernameWithDomain } from "../../types/actor";
|
||||
@@ -549,6 +546,7 @@ import Tag from "../../components/Tag.vue";
|
||||
import EventMetadataBlock from "../../components/Event/EventMetadataBlock.vue";
|
||||
import ActorCard from "../../components/Account/ActorCard.vue";
|
||||
import PopoverActorCard from "../../components/Account/PopoverActorCard.vue";
|
||||
import { IParticipant, ParticipantRole } from "../../types/participant.model";
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
|
||||
@@ -38,71 +38,9 @@ export default class EventList extends Vue {
|
||||
|
||||
locationText = "";
|
||||
|
||||
// created() {
|
||||
// this.fetchData(this.$router.currentRoute.params.location);
|
||||
// }
|
||||
|
||||
// beforeRouteUpdate(to, from, next) {
|
||||
// this.fetchData(to.params.location);
|
||||
// next();
|
||||
// }
|
||||
|
||||
// @Watch('locationChip')
|
||||
// onLocationChipChange(val) {
|
||||
// if (val === false) {
|
||||
// this.$router.push({ name: RouteName.EVENT_LIST });
|
||||
// }
|
||||
// }
|
||||
|
||||
// geocode(lat, lon) {
|
||||
// console.log({ lat, lon });
|
||||
// console.log(ngeohash.encode(lat, lon, 10));
|
||||
// return ngeohash.encode(lat, lon, 10);
|
||||
// }
|
||||
|
||||
// fetchData(location: string) {
|
||||
// let queryString = '/events';
|
||||
// if (location) {
|
||||
// queryString += `?geohash=${location}`;
|
||||
// const { latitude, longitude } = ngeohash.decode(location);
|
||||
// this.locationText = `${latitude.toString()} : ${longitude.toString()}`;
|
||||
// }
|
||||
// this.locationChip = true;
|
||||
// // FIXME: remove eventFetch
|
||||
// // eventFetch(queryString, this.$store)
|
||||
// // .then(response => response.json())
|
||||
// // .then((response) => {
|
||||
// // this.loading = false;
|
||||
// // this.events = response.data;
|
||||
// // console.log(this.events);
|
||||
// // });
|
||||
// }
|
||||
|
||||
// deleteEvent(event: IEvent) {
|
||||
// const router = this.$router;
|
||||
// // FIXME: remove eventFetch
|
||||
// // eventFetch(`/events/${event.uuid}`, this.$store, { method: 'DELETE' })
|
||||
// // .then(() => router.push('/events'));
|
||||
// }
|
||||
|
||||
viewEvent(event: IEvent) {
|
||||
viewEvent(event: IEvent): void {
|
||||
this.$router.push({ name: RouteName.EVENT, params: { uuid: event.uuid } });
|
||||
}
|
||||
|
||||
// downloadIcsEvent(event: IEvent) {
|
||||
// // FIXME: remove eventFetch
|
||||
// // eventFetch(`/events/${event.uuid}/ics`, this.$store, { responseType: 'arraybuffer' })
|
||||
// // .then(response => response.text())
|
||||
// // .then((response) => {
|
||||
// // const blob = new Blob([ response ], { type: 'text/calendar' });
|
||||
// // const link = document.createElement('a');
|
||||
// // link.href = window.URL.createObjectURL(blob);
|
||||
// // link.download = `${event.title}.ics`;
|
||||
// // document.body.appendChild(link);
|
||||
// // link.click();
|
||||
// // document.body.removeChild(link);
|
||||
// // });
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
:key="participation.id"
|
||||
:participation="participation"
|
||||
:options="{ hideDate: false }"
|
||||
@eventDeleted="eventDeleted"
|
||||
@event-deleted="eventDeleted"
|
||||
class="participation"
|
||||
/>
|
||||
</div>
|
||||
@@ -57,7 +57,7 @@
|
||||
:key="participation.id"
|
||||
:participation="participation"
|
||||
:options="{ hideDate: false }"
|
||||
@eventDeleted="eventDeleted"
|
||||
@event-deleted="eventDeleted"
|
||||
class="participation"
|
||||
/>
|
||||
</div>
|
||||
@@ -88,14 +88,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { IParticipant, Participant, ParticipantRole } from "../../types/participant.model";
|
||||
import { LOGGED_USER_PARTICIPATIONS, LOGGED_USER_DRAFTS } from "../../graphql/actor";
|
||||
import {
|
||||
EventModel,
|
||||
IEvent,
|
||||
IParticipant,
|
||||
Participant,
|
||||
ParticipantRole,
|
||||
} from "../../types/event.model";
|
||||
import { EventModel, IEvent } from "../../types/event.model";
|
||||
import EventListCard from "../../components/Event/EventListCard.vue";
|
||||
import EventCard from "../../components/Event/EventCard.vue";
|
||||
import Subtitle from "../../components/Utils/Subtitle.vue";
|
||||
@@ -207,7 +202,7 @@ export default class MyEvents extends Vue {
|
||||
return MyEvents.monthlyParticipations(this.pastParticipations, true);
|
||||
}
|
||||
|
||||
loadMoreFutureParticipations() {
|
||||
loadMoreFutureParticipations(): void {
|
||||
this.futurePage += 1;
|
||||
this.$apollo.queries.futureParticipations.fetchMore({
|
||||
// New variables
|
||||
@@ -236,7 +231,7 @@ export default class MyEvents extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
loadMorePastParticipations() {
|
||||
loadMorePastParticipations(): void {
|
||||
this.pastPage += 1;
|
||||
this.$apollo.queries.pastParticipations.fetchMore({
|
||||
// New variables
|
||||
@@ -265,7 +260,7 @@ export default class MyEvents extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
eventDeleted(eventid: string) {
|
||||
eventDeleted(eventid: string): void {
|
||||
this.futureParticipations = this.futureParticipations.filter(
|
||||
(participation) => participation.event.id !== eventid
|
||||
);
|
||||
|
||||
@@ -185,12 +185,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue, Watch, Ref } from "vue-property-decorator";
|
||||
import {
|
||||
IEvent,
|
||||
IEventParticipantStats,
|
||||
IParticipant,
|
||||
ParticipantRole,
|
||||
} from "../../types/event.model";
|
||||
import { IParticipant, ParticipantRole } from "../../types/participant.model";
|
||||
import { IEvent, IEventParticipantStats } from "../../types/event.model";
|
||||
import { PARTICIPANTS, UPDATE_PARTICIPANT } from "../../graphql/event";
|
||||
import { CURRENT_ACTOR_CLIENT } from "../../graphql/actor";
|
||||
import { IPerson, usernameWithDomain } from "../../types/actor";
|
||||
|
||||
@@ -109,11 +109,25 @@
|
||||
>
|
||||
<p class="buttons">
|
||||
<b-tooltip
|
||||
:label="$t('You can only get invited to groups right now.')"
|
||||
v-if="group.openness !== Openness.OPEN"
|
||||
:label="$t('This group is invite-only')"
|
||||
position="is-bottom"
|
||||
>
|
||||
<b-button disabled type="is-primary">{{ $t("Join group") }}</b-button>
|
||||
</b-tooltip>
|
||||
<b-button disabled type="is-primary">{{ $t("Join group") }}</b-button></b-tooltip
|
||||
>
|
||||
<b-button v-else-if="currentActor.id" @click="joinGroup" type="is-primary">{{
|
||||
$t("Join group")
|
||||
}}</b-button>
|
||||
<b-button
|
||||
tag="router-link"
|
||||
:to="{
|
||||
name: RouteName.GROUP_JOIN,
|
||||
params: { preferredUsername: usernameWithDomain(group) },
|
||||
}"
|
||||
v-else
|
||||
type="is-primary"
|
||||
>{{ $t("Join group") }}</b-button
|
||||
>
|
||||
<b-dropdown aria-role="list" position="is-bottom-left">
|
||||
<b-button slot="trigger" role="button" icon-right="dots-horizontal"> </b-button>
|
||||
<b-dropdown-item
|
||||
@@ -348,7 +362,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Watch } from "vue-property-decorator";
|
||||
import EventCard from "@/components/Event/EventCard.vue";
|
||||
import { IActor, usernameWithDomain, MemberRole, IMember } from "@/types/actor";
|
||||
import { IActor, usernameWithDomain, MemberRole, IMember, Openness } from "@/types/actor";
|
||||
import Subtitle from "@/components/Utils/Subtitle.vue";
|
||||
import CompactTodo from "@/components/Todo/CompactTodo.vue";
|
||||
import EventMinimalistCard from "@/components/Event/EventMinimalistCard.vue";
|
||||
@@ -365,6 +379,7 @@ import { IReport } from "@/types/report.model";
|
||||
import { IConfig } from "@/types/config.model";
|
||||
import GroupMixin from "@/mixins/group";
|
||||
import { mixins } from "vue-class-component";
|
||||
import { JOIN_GROUP } from "@/graphql/member";
|
||||
import RouteName from "../../router/name";
|
||||
import GroupSection from "../../components/Group/GroupSection.vue";
|
||||
import ReportModal from "../../components/Report/ReportModal.vue";
|
||||
@@ -414,6 +429,8 @@ export default class Group extends mixins(GroupMixin) {
|
||||
|
||||
usernameWithDomain = usernameWithDomain;
|
||||
|
||||
Openness = Openness;
|
||||
|
||||
showMap = false;
|
||||
|
||||
isReportModalActive = false;
|
||||
@@ -425,6 +442,15 @@ export default class Group extends mixins(GroupMixin) {
|
||||
}
|
||||
}
|
||||
|
||||
async joinGroup(): Promise<void> {
|
||||
this.$apollo.mutate({
|
||||
mutation: JOIN_GROUP,
|
||||
variables: {
|
||||
groupId: this.group.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
acceptInvitation(): void {
|
||||
if (this.groupMember) {
|
||||
const index = this.person.memberships.elements.findIndex(
|
||||
@@ -508,6 +534,12 @@ export default class Group extends mixins(GroupMixin) {
|
||||
.map(({ parent: { id } }) => id);
|
||||
}
|
||||
|
||||
@Watch("isCurrentActorAGroupMember")
|
||||
refetchGroupData(): void {
|
||||
console.log("refetchGroupData");
|
||||
this.$apollo.queries.group.refetch();
|
||||
}
|
||||
|
||||
get isCurrentActorAGroupMember(): boolean {
|
||||
return this.groupMemberships !== undefined && this.groupMemberships.includes(this.group.id);
|
||||
}
|
||||
|
||||
@@ -77,22 +77,24 @@
|
||||
</b-select>
|
||||
</b-field>
|
||||
<b-table
|
||||
:data="group.members.elements"
|
||||
v-if="members"
|
||||
:data="members.elements"
|
||||
ref="queueTable"
|
||||
:loading="this.$apollo.loading"
|
||||
paginated
|
||||
backend-pagination
|
||||
:current-page.sync="page"
|
||||
:pagination-simple="true"
|
||||
:aria-next-label="$t('Next page')"
|
||||
:aria-previous-label="$t('Previous page')"
|
||||
:aria-page-label="$t('Page')"
|
||||
:aria-current-label="$t('Current page')"
|
||||
:total="group.members.total"
|
||||
:total="members.total"
|
||||
:per-page="MEMBERS_PER_PAGE"
|
||||
backend-sorting
|
||||
:default-sort-direction="'desc'"
|
||||
:default-sort="['insertedAt', 'desc']"
|
||||
@page-change="(newPage) => (page = newPage)"
|
||||
@page-change="triggerLoadMoreMemberPageChange"
|
||||
@sort="(field, order) => $emit('sort', field, order)"
|
||||
>
|
||||
<b-table-column field="actor.preferredUsername" :label="$t('Member')" v-slot="props">
|
||||
@@ -184,7 +186,7 @@ import { mixins } from "vue-class-component";
|
||||
import { FETCH_GROUP } from "@/graphql/group";
|
||||
import RouteName from "../../router/name";
|
||||
import { INVITE_MEMBER, GROUP_MEMBERS, REMOVE_MEMBER, UPDATE_MEMBER } from "../../graphql/member";
|
||||
import { IGroup, usernameWithDomain } from "../../types/actor";
|
||||
import { usernameWithDomain } from "../../types/actor";
|
||||
import { IMember, MemberRole } from "../../types/actor/group.model";
|
||||
|
||||
@Component({
|
||||
@@ -194,7 +196,7 @@ import { IMember, MemberRole } from "../../types/actor/group.model";
|
||||
variables() {
|
||||
return {
|
||||
name: this.$route.params.preferredUsername,
|
||||
page: 1,
|
||||
page: this.page,
|
||||
limit: this.MEMBERS_PER_PAGE,
|
||||
roles: this.roles,
|
||||
};
|
||||
@@ -216,7 +218,7 @@ export default class GroupMembers extends mixins(GroupMixin) {
|
||||
|
||||
RouteName = RouteName;
|
||||
|
||||
page = 1;
|
||||
page = parseInt((this.$route.query.page as string) || "1", 10);
|
||||
|
||||
MEMBERS_PER_PAGE = 10;
|
||||
|
||||
@@ -227,10 +229,20 @@ export default class GroupMembers extends mixins(GroupMixin) {
|
||||
if (Object.values(MemberRole).includes(roleQuery as MemberRole)) {
|
||||
this.roles = roleQuery as MemberRole;
|
||||
}
|
||||
this.page = parseInt((this.$route.query.page as string) || "1", 10);
|
||||
}
|
||||
|
||||
async inviteMember(): Promise<void> {
|
||||
try {
|
||||
this.inviteError = "";
|
||||
const { roles, MEMBERS_PER_PAGE, group, page } = this;
|
||||
const variables = {
|
||||
name: usernameWithDomain(group),
|
||||
page,
|
||||
limit: MEMBERS_PER_PAGE,
|
||||
roles,
|
||||
};
|
||||
console.log("variables", variables);
|
||||
await this.$apollo.mutate<{ inviteMember: IMember }>({
|
||||
mutation: INVITE_MEMBER,
|
||||
variables: {
|
||||
@@ -238,7 +250,10 @@ export default class GroupMembers extends mixins(GroupMixin) {
|
||||
targetActorUsername: this.newMemberUsername,
|
||||
},
|
||||
refetchQueries: [
|
||||
{ query: FETCH_GROUP, variables: { name: this.$route.params.preferredUsername } },
|
||||
{
|
||||
query: GROUP_MEMBERS,
|
||||
variables,
|
||||
},
|
||||
],
|
||||
});
|
||||
this.$notifier.success(
|
||||
@@ -257,34 +272,49 @@ export default class GroupMembers extends mixins(GroupMixin) {
|
||||
}
|
||||
|
||||
@Watch("page")
|
||||
loadMoreMembers(): void {
|
||||
this.$apollo.queries.event.fetchMore({
|
||||
triggerLoadMoreMemberPageChange(page: string): void {
|
||||
this.$router.replace({
|
||||
name: RouteName.GROUP_MEMBERS_SETTINGS,
|
||||
query: { ...this.$route.query, page },
|
||||
});
|
||||
}
|
||||
|
||||
@Watch("roles")
|
||||
triggerLoadMoreMemberRoleChange(roles: string): void {
|
||||
this.$router.replace({
|
||||
name: RouteName.GROUP_MEMBERS_SETTINGS,
|
||||
query: { ...this.$route.query, roles },
|
||||
});
|
||||
}
|
||||
|
||||
async loadMoreMembers(): Promise<void> {
|
||||
const { roles, MEMBERS_PER_PAGE, group, page } = this;
|
||||
await this.$apollo.queries.members.fetchMore({
|
||||
// New variables
|
||||
variables: {
|
||||
page: this.page,
|
||||
limit: this.MEMBERS_PER_PAGE,
|
||||
variables() {
|
||||
return {
|
||||
name: usernameWithDomain(group),
|
||||
page,
|
||||
limit: MEMBERS_PER_PAGE,
|
||||
roles,
|
||||
};
|
||||
},
|
||||
// Transform the previous result with new data
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
if (!fetchMoreResult) return previousResult;
|
||||
const oldMembers = previousResult.group.members;
|
||||
const newMembers = fetchMoreResult.group.members;
|
||||
|
||||
return {
|
||||
group: {
|
||||
...previousResult.event,
|
||||
members: {
|
||||
elements: [...oldMembers.elements, ...newMembers.elements],
|
||||
total: newMembers.total,
|
||||
__typename: oldMembers.__typename,
|
||||
},
|
||||
},
|
||||
elements: [...oldMembers.elements, ...newMembers.elements],
|
||||
total: newMembers.total,
|
||||
__typename: oldMembers.__typename,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async removeMember(memberId: string): Promise<void> {
|
||||
console.log("removeMember", memberId);
|
||||
const { roles, MEMBERS_PER_PAGE, group, page } = this;
|
||||
try {
|
||||
await this.$apollo.mutate<{ removeMember: IMember }>({
|
||||
mutation: REMOVE_MEMBER,
|
||||
@@ -293,7 +323,17 @@ export default class GroupMembers extends mixins(GroupMixin) {
|
||||
memberId,
|
||||
},
|
||||
refetchQueries: [
|
||||
{ query: FETCH_GROUP, variables: { name: this.$route.params.preferredUsername } },
|
||||
{
|
||||
query: GROUP_MEMBERS,
|
||||
variables() {
|
||||
return {
|
||||
name: usernameWithDomain(group),
|
||||
page,
|
||||
limit: MEMBERS_PER_PAGE,
|
||||
roles,
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
this.$notifier.success(
|
||||
|
||||
@@ -102,6 +102,31 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="label">{{ $t("New members") }}</p>
|
||||
<div class="field">
|
||||
<b-radio v-model="group.openness" name="groupOpenness" :native-value="Openness.OPEN">
|
||||
{{ $t("Anyone can join freely") }}<br />
|
||||
<small>{{
|
||||
$t(
|
||||
"Anyone wanting to be a member from your group will be able to from your group page."
|
||||
)
|
||||
}}</small>
|
||||
</b-radio>
|
||||
</div>
|
||||
<div class="field">
|
||||
<b-radio
|
||||
v-model="group.openness"
|
||||
name="groupOpenness"
|
||||
:native-value="Openness.INVITE_ONLY"
|
||||
>{{ $t("Manually invite new members") }}<br />
|
||||
<small>{{
|
||||
$t(
|
||||
"The only way for your group to get new members is if an admininistrator invites them."
|
||||
)
|
||||
}}</small>
|
||||
</b-radio>
|
||||
</div>
|
||||
|
||||
<full-address-auto-complete
|
||||
:label="$t('Group address')"
|
||||
v-model="group.physicalAddress"
|
||||
@@ -129,7 +154,7 @@ import { mixins } from "vue-class-component";
|
||||
import GroupMixin from "@/mixins/group";
|
||||
import RouteName from "../../router/name";
|
||||
import { UPDATE_GROUP, DELETE_GROUP } from "../../graphql/group";
|
||||
import { IGroup, usernameWithDomain } from "../../types/actor";
|
||||
import { IGroup, usernameWithDomain, Openness } from "../../types/actor";
|
||||
import { Address, IAddress } from "../../types/address.model";
|
||||
|
||||
@Component({
|
||||
@@ -157,6 +182,8 @@ export default class GroupSettings extends mixins(GroupMixin) {
|
||||
UNLISTED: "UNLISTED",
|
||||
};
|
||||
|
||||
Openness = Openness;
|
||||
|
||||
showCopiedTooltip = false;
|
||||
|
||||
async updateGroup(): Promise<void> {
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
:member="member"
|
||||
@leave="leaveGroup(member.parent)"
|
||||
/>
|
||||
<b-pagination
|
||||
:total="membershipsPages.total"
|
||||
v-model="page"
|
||||
:per-page="limit"
|
||||
:aria-next-label="$t('Next page')"
|
||||
:aria-previous-label="$t('Previous page')"
|
||||
:aria-page-label="$t('Page')"
|
||||
:aria-current-label="$t('Current page')"
|
||||
>
|
||||
</b-pagination>
|
||||
</section>
|
||||
<b-message v-if="$apollo.loading === false && memberships.length === 0" type="is-danger">
|
||||
{{ $t("No groups found") }}
|
||||
@@ -54,10 +64,11 @@ import RouteName from "../../router/name";
|
||||
membershipsPages: {
|
||||
query: LOGGED_USER_MEMBERSHIPS,
|
||||
fetchPolicy: "cache-and-network",
|
||||
variables: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
beforeDateTime: new Date().toISOString(),
|
||||
variables() {
|
||||
return {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
};
|
||||
},
|
||||
update: (data) => data.loggedUser.memberships,
|
||||
},
|
||||
@@ -76,6 +87,10 @@ export default class MyGroups extends Vue {
|
||||
|
||||
RouteName = RouteName;
|
||||
|
||||
page = 1;
|
||||
|
||||
limit = 10;
|
||||
|
||||
acceptInvitation(member: IMember): Promise<Route> {
|
||||
return this.$router.push({
|
||||
name: RouteName.GROUP,
|
||||
@@ -94,11 +109,21 @@ export default class MyGroups extends Vue {
|
||||
}
|
||||
|
||||
async leaveGroup(group: IGroup): Promise<void> {
|
||||
const { page, limit } = this;
|
||||
await this.$apollo.mutate({
|
||||
mutation: LEAVE_GROUP,
|
||||
variables: {
|
||||
groupId: group.id,
|
||||
},
|
||||
refetchQueries: [
|
||||
{
|
||||
query: LOGGED_USER_MEMBERSHIPS,
|
||||
variables: {
|
||||
page,
|
||||
limit,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<EventListCard
|
||||
v-for="participation in row[1]"
|
||||
v-if="isInLessThanSevenDays(row[0])"
|
||||
@eventDeleted="eventDeleted"
|
||||
@event-deleted="eventDeleted"
|
||||
:key="participation[1].id"
|
||||
:participation="participation[1]"
|
||||
/>
|
||||
@@ -148,7 +148,7 @@
|
||||
v-for="participation in lastWeekEvents"
|
||||
:key="participation.id"
|
||||
:participation="participation"
|
||||
@eventDeleted="eventDeleted"
|
||||
@event-deleted="eventDeleted"
|
||||
:options="{ hideDate: false }"
|
||||
/>
|
||||
</div>
|
||||
@@ -174,6 +174,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { IParticipant, Participant, ParticipantRole } from "../types/participant.model";
|
||||
import { FETCH_EVENTS } from "../graphql/event";
|
||||
import EventListCard from "../components/Event/EventListCard.vue";
|
||||
import EventCard from "../components/Event/EventCard.vue";
|
||||
@@ -182,7 +183,7 @@ import { IPerson, Person } from "../types/actor";
|
||||
import { ICurrentUser } from "../types/current-user.model";
|
||||
import { CURRENT_USER_CLIENT, USER_SETTINGS } from "../graphql/user";
|
||||
import RouteName from "../router/name";
|
||||
import { IEvent, IParticipant, Participant, ParticipantRole } from "../types/event.model";
|
||||
import { IEvent } from "../types/event.model";
|
||||
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
||||
import { CONFIG } from "../graphql/config";
|
||||
import { IConfig } from "../types/config.model";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="container section">
|
||||
<b-notification v-if="$apollo.queries.searchEvents.loading">
|
||||
{{ $t("Redirecting to event…") }}
|
||||
<b-notification v-if="$apollo.queries.interact.loading">
|
||||
{{ $t("Redirecting to content…") }}
|
||||
</b-notification>
|
||||
<b-notification v-if="$apollo.queries.searchEvents.skip" type="is-danger">
|
||||
<b-notification v-if="$apollo.queries.interact.skip" type="is-danger">
|
||||
{{ $t("Resource provided is not an URL") }}
|
||||
</b-notification>
|
||||
</div>
|
||||
@@ -11,48 +11,58 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { SEARCH_EVENTS } from "@/graphql/search";
|
||||
import { INTERACT } from "@/graphql/search";
|
||||
import { IEvent } from "@/types/event.model";
|
||||
import { IGroup, usernameWithDomain } from "@/types/actor";
|
||||
import RouteName from "../router/name";
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
searchEvents: {
|
||||
query: SEARCH_EVENTS,
|
||||
interact: {
|
||||
query: INTERACT,
|
||||
variables() {
|
||||
return {
|
||||
searchText: this.$route.query.url,
|
||||
uri: this.$route.query.uri,
|
||||
};
|
||||
},
|
||||
skip() {
|
||||
try {
|
||||
const url = this.$route.query.url as string;
|
||||
const url = this.$route.query.uri as string;
|
||||
const uri = new URL(url);
|
||||
return !(uri instanceof URL);
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
async result({ data }) {
|
||||
if (
|
||||
data.searchEvents &&
|
||||
data.searchEvents.total > 0 &&
|
||||
data.searchEvents.elements.length > 0
|
||||
) {
|
||||
const event = data.searchEvents.elements[0];
|
||||
await this.$router.replace({
|
||||
name: RouteName.EVENT,
|
||||
params: { uuid: event.uuid },
|
||||
});
|
||||
async result({ data: { interact } }) {
|
||||
switch (interact.__typename) {
|
||||
case "Group":
|
||||
await this.$router.replace({
|
||||
name: RouteName.GROUP,
|
||||
params: { preferredUsername: usernameWithDomain(interact) },
|
||||
});
|
||||
break;
|
||||
case "Event":
|
||||
await this.$router.replace({
|
||||
name: RouteName.EVENT,
|
||||
params: { uuid: interact.uuid },
|
||||
});
|
||||
break;
|
||||
default:
|
||||
this.error = this.$t("This URL is not supported");
|
||||
}
|
||||
// await this.$router.replace({
|
||||
// name: RouteName.EVENT,
|
||||
// params: { uuid: event.uuid },
|
||||
// });
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
export default class Interact extends Vue {
|
||||
searchEvents!: IEvent[];
|
||||
interact!: IEvent | IGroup;
|
||||
|
||||
RouteName = RouteName;
|
||||
error!: string;
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Watch } from "vue-property-decorator";
|
||||
import { USER_SETTINGS, SET_USER_SETTINGS } from "../../graphql/user";
|
||||
import { IUser, INotificationPendingParticipationEnum } from "../../types/current-user.model";
|
||||
import { IUser, INotificationPendingEnum } from "../../types/current-user.model";
|
||||
import RouteName from "../../router/name";
|
||||
|
||||
@Component({
|
||||
@@ -120,7 +120,7 @@ export default class Notifications extends Vue {
|
||||
|
||||
notificationBeforeEvent = false;
|
||||
|
||||
notificationPendingParticipation = INotificationPendingParticipationEnum.NONE;
|
||||
notificationPendingParticipation = INotificationPendingEnum.NONE;
|
||||
|
||||
notificationPendingParticipationValues: Record<string, unknown> = {};
|
||||
|
||||
@@ -128,10 +128,10 @@ export default class Notifications extends Vue {
|
||||
|
||||
mounted(): void {
|
||||
this.notificationPendingParticipationValues = {
|
||||
[INotificationPendingParticipationEnum.NONE]: this.$t("Do not receive any mail"),
|
||||
[INotificationPendingParticipationEnum.DIRECT]: this.$t("Receive one email per request"),
|
||||
[INotificationPendingParticipationEnum.ONE_HOUR]: this.$t("Hourly email summary"),
|
||||
[INotificationPendingParticipationEnum.ONE_DAY]: this.$t("Daily email summary"),
|
||||
[INotificationPendingEnum.NONE]: this.$t("Do not receive any mail"),
|
||||
[INotificationPendingEnum.DIRECT]: this.$t("Receive one email per request"),
|
||||
[INotificationPendingEnum.ONE_HOUR]: this.$t("Hourly email summary"),
|
||||
[INotificationPendingEnum.ONE_DAY]: this.$t("Daily email summary"),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -160,8 +160,6 @@ export default class Login extends Vue {
|
||||
email: validateEmailField,
|
||||
};
|
||||
|
||||
private redirect: string | null = null;
|
||||
|
||||
submitted = false;
|
||||
|
||||
mounted(): void {
|
||||
@@ -170,7 +168,6 @@ export default class Login extends Vue {
|
||||
|
||||
const { query } = this.$route;
|
||||
this.errorCode = query.code as LoginErrorCode;
|
||||
this.redirect = query.redirect as string;
|
||||
}
|
||||
|
||||
async loginAction(e: Event): Promise<Route | void> {
|
||||
@@ -219,11 +216,14 @@ export default class Login extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.redirect) {
|
||||
this.$router.push(this.redirect);
|
||||
if (this.$route.query.redirect) {
|
||||
console.log("redirect", this.$route.query.redirect);
|
||||
this.$router.push(this.$route.query.redirect as string);
|
||||
return;
|
||||
}
|
||||
window.localStorage.setItem("welcome-back", "yes");
|
||||
this.$router.push({ name: RouteName.HOME });
|
||||
return;
|
||||
} catch (err) {
|
||||
this.submitted = false;
|
||||
console.error(err);
|
||||
|
||||
Reference in New Issue
Block a user