Fix showing event origin when the event organizer is a group

Related to !806 and #561

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-02-03 09:34:22 +01:00
parent 773ae75373
commit 5edc402a01
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -125,9 +125,9 @@
<b-icon icon="link" /> <b-icon icon="link" />
</p> </p>
</template> </template>
<template v-if="!event.local"> <template v-if="!event.local && organizer">
<a :href="event.url"> <a :href="event.url">
<tag>{{ event.organizerActor.domain }}</tag> <tag>{{ organizer.domain }}</tag>
</a> </a>
</template> </template>
<p> <p>
@ -443,7 +443,7 @@
<report-modal <report-modal
:on-confirm="reportEvent" :on-confirm="reportEvent"
:title="$t('Report this event')" :title="$t('Report this event')"
:outside-domain="domainForReport" :outside-domain="organizerDomain"
@close="$refs.reportModal.close()" @close="$refs.reportModal.close()"
/> />
</b-modal> </b-modal>
@ -959,7 +959,7 @@ export default class Event extends EventMixin {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
this.$refs.reportModal.close(); this.$refs.reportModal.close();
if (!this.event.organizerActor) return; if (!this.organizer) return;
const eventTitle = this.event.title; const eventTitle = this.event.title;
try { try {
@ -967,7 +967,7 @@ export default class Event extends EventMixin {
mutation: CREATE_REPORT, mutation: CREATE_REPORT,
variables: { variables: {
eventId: this.event.id, eventId: this.event.id,
reportedId: this.actorForReport ? this.actorForReport.id : null, reportedId: this.organizer ? this.organizer.id : null,
content, content,
forward, forward,
}, },
@ -1240,7 +1240,7 @@ export default class Event extends EventMixin {
); );
} }
get actorForReport(): IActor | null { get organizer(): IActor | null {
if (this.event.attributedTo && this.event.attributedTo.id) { if (this.event.attributedTo && this.event.attributedTo.id) {
return this.event.attributedTo; return this.event.attributedTo;
} }
@ -1250,9 +1250,9 @@ export default class Event extends EventMixin {
return null; return null;
} }
get domainForReport(): string | null { get organizerDomain(): string | null {
if (this.actorForReport) { if (this.organizer) {
return this.actorForReport.domain; return this.organizer.domain;
} }
return null; return null;
} }