Add identity pickers on event creation & join

Also it now saves current actor in localStorage and initalizes it in
Apollo Cache (just like user stuff). This allows not relying on
loggedPerson query anymore.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-11 09:59:01 +02:00
parent e3150a685c
commit 6bceb5b463
23 changed files with 469 additions and 146 deletions

View File

@@ -109,7 +109,7 @@ import { EventRouteName } from '@/router/event';
import { ActorRouteName } from '@/router/actor';
import { AdminRouteName } from '@/router/admin';
import { ModerationRouteName } from '@/router/moderation';
import { LOGGED_PERSON } from '@/graphql/actor';
import { CURRENT_ACTOR_CLIENT } from '@/graphql/actor';
import { IPerson } from '@/types/actor';
import { DELETE_EVENT } from '@/graphql/event';
import { uniq } from 'lodash';
@@ -127,15 +127,15 @@ import { uniq } from 'lodash';
this.errors = uniq(graphQLErrors.map(({ message }) => message));
},
},
loggedPerson: {
query: LOGGED_PERSON,
currentActor: {
query: CURRENT_ACTOR_CLIENT,
},
},
})
export default class Report extends Vue {
@Prop({ required: true }) reportId!: number;
report!: IReport;
loggedPerson!: IPerson;
currentActor!: IPerson;
errors: string[] = [];
ReportStatusEnum = ReportStatusEnum;
@@ -152,7 +152,7 @@ export default class Report extends Vue {
mutation: CREATE_REPORT_NOTE,
variables: {
reportId: this.report.id,
moderatorId: this.loggedPerson.id,
moderatorId: this.currentActor.id,
content: this.noteContent,
},
update: (store, { data }) => {
@@ -165,7 +165,7 @@ export default class Report extends Vue {
return;
}
const note = data.createReportNote;
note.moderator = this.loggedPerson;
note.moderator = this.currentActor;
report.notes = report.notes.concat([note]);
@@ -199,7 +199,7 @@ export default class Report extends Vue {
mutation: DELETE_EVENT,
variables: {
eventId: this.report.event.id.toString(),
actorId: this.loggedPerson.id,
actorId: this.currentActor.id,
},
});
@@ -220,7 +220,7 @@ export default class Report extends Vue {
mutation: UPDATE_REPORT,
variables: {
reportId: this.report.id,
moderatorId: this.loggedPerson.id,
moderatorId: this.currentActor.id,
status,
},
update: (store, { data }) => {