Make sure anonymous participation doesn't show up when logged-in
And improve a little typescript usage Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
4e6c37bb75
commit
9b726fabb5
@ -104,11 +104,11 @@
|
|||||||
/>
|
/>
|
||||||
<b-button
|
<b-button
|
||||||
type="is-text"
|
type="is-text"
|
||||||
v-if="anonymousParticipation !== null"
|
v-if="!actorIsParticipant && anonymousParticipation !== null"
|
||||||
@click="cancelAnonymousParticipation"
|
@click="cancelAnonymousParticipation"
|
||||||
>{{ $t("Cancel anonymous participation") }}</b-button
|
>{{ $t("Cancel anonymous participation") }}</b-button
|
||||||
>
|
>
|
||||||
<small v-if="anonymousParticipation">
|
<small v-if="!actorIsParticipant && anonymousParticipation">
|
||||||
{{ $t("You are participating in this event anonymously") }}
|
{{ $t("You are participating in this event anonymously") }}
|
||||||
<b-tooltip
|
<b-tooltip
|
||||||
:label="
|
:label="
|
||||||
@ -120,7 +120,7 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</b-tooltip>
|
</b-tooltip>
|
||||||
</small>
|
</small>
|
||||||
<small v-else-if="anonymousParticipation === false">
|
<small v-else-if="!actorIsParticipant && anonymousParticipation === false">
|
||||||
{{
|
{{
|
||||||
$t(
|
$t(
|
||||||
"You are participating in this event anonymously but didn't confirm participation"
|
"You are participating in this event anonymously but didn't confirm participation"
|
||||||
@ -622,13 +622,13 @@ import PopoverActorCard from "../../components/Account/PopoverActorCard.vue";
|
|||||||
metaInfo() {
|
metaInfo() {
|
||||||
return {
|
return {
|
||||||
// if no subcomponents specify a metaInfo.title, this title will be used
|
// if no subcomponents specify a metaInfo.title, this title will be used
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
title: this.eventTitle,
|
title: this.eventTitle,
|
||||||
// all titles will be injected into this template
|
// all titles will be injected into this template
|
||||||
titleTemplate: "%s | Mobilizon",
|
titleTemplate: "%s | Mobilizon",
|
||||||
meta: [
|
meta: [
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
{ name: "description", content: this.eventDescription },
|
{ name: "description", content: this.eventDescription },
|
||||||
],
|
],
|
||||||
@ -680,17 +680,17 @@ export default class Event extends EventMixin {
|
|||||||
|
|
||||||
messageForConfirmation = "";
|
messageForConfirmation = "";
|
||||||
|
|
||||||
get eventTitle() {
|
get eventTitle(): undefined | string {
|
||||||
if (!this.event) return undefined;
|
if (!this.event) return undefined;
|
||||||
return this.event.title;
|
return this.event.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
get eventDescription() {
|
get eventDescription(): undefined | string {
|
||||||
if (!this.event) return undefined;
|
if (!this.event) return undefined;
|
||||||
return this.event.description;
|
return this.event.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
async mounted() {
|
async mounted(): Promise<void> {
|
||||||
this.identity = this.currentActor;
|
this.identity = this.currentActor;
|
||||||
if (this.$route.hash.includes("#comment-")) {
|
if (this.$route.hash.includes("#comment-")) {
|
||||||
this.loadComments = true;
|
this.loadComments = true;
|
||||||
@ -766,12 +766,13 @@ export default class Event extends EventMixin {
|
|||||||
/**
|
/**
|
||||||
* Delete the event, then redirect to home.
|
* Delete the event, then redirect to home.
|
||||||
*/
|
*/
|
||||||
async openDeleteEventModalWrapper() {
|
async openDeleteEventModalWrapper(): Promise<void> {
|
||||||
await this.openDeleteEventModal(this.event, this.currentActor);
|
await this.openDeleteEventModal(this.event, this.currentActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reportEvent(content: string, forward: boolean) {
|
async reportEvent(content: string, forward: boolean): Promise<void> {
|
||||||
this.isReportModalActive = false;
|
this.isReportModalActive = false;
|
||||||
|
// 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.event.organizerActor) return;
|
||||||
@ -800,12 +801,12 @@ export default class Event extends EventMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
joinEventWithConfirmation(actor: IPerson) {
|
joinEventWithConfirmation(actor: IPerson): void {
|
||||||
this.isJoinConfirmationModalActive = true;
|
this.isJoinConfirmationModalActive = true;
|
||||||
this.actorForConfirmation = actor;
|
this.actorForConfirmation = actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
async joinEvent(identity: IPerson, message: string | null = null) {
|
async joinEvent(identity: IPerson, message: string | null = null): Promise<void> {
|
||||||
this.isJoinConfirmationModalActive = false;
|
this.isJoinConfirmationModalActive = false;
|
||||||
this.isJoinModalActive = false;
|
this.isJoinModalActive = false;
|
||||||
try {
|
try {
|
||||||
@ -874,7 +875,7 @@ export default class Event extends EventMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmLeave() {
|
confirmLeave(): void {
|
||||||
this.$buefy.dialog.confirm({
|
this.$buefy.dialog.confirm({
|
||||||
title: this.$t('Leaving event "{title}"', {
|
title: this.$t('Leaving event "{title}"', {
|
||||||
title: this.event.title,
|
title: this.event.title,
|
||||||
@ -895,7 +896,7 @@ export default class Event extends EventMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Watch("participations")
|
@Watch("participations")
|
||||||
watchParticipations() {
|
watchParticipations(): void {
|
||||||
if (this.participations.length > 0) {
|
if (this.participations.length > 0) {
|
||||||
if (
|
if (
|
||||||
this.oldParticipationRole &&
|
this.oldParticipationRole &&
|
||||||
@ -934,7 +935,7 @@ export default class Event extends EventMixin {
|
|||||||
this.$notifier.info(this.$t("Your participation status has been changed") as string);
|
this.$notifier.info(this.$t("Your participation status has been changed") as string);
|
||||||
}
|
}
|
||||||
|
|
||||||
async downloadIcsEvent() {
|
async downloadIcsEvent(): Promise<void> {
|
||||||
const data = await (
|
const data = await (
|
||||||
await fetch(`${GRAPHQL_API_ENDPOINT}/events/${this.uuid}/export/ics`)
|
await fetch(`${GRAPHQL_API_ENDPOINT}/events/${this.uuid}/export/ics`)
|
||||||
).text();
|
).text();
|
||||||
@ -947,10 +948,12 @@ export default class Event extends EventMixin {
|
|||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerShare() {
|
triggerShare(): void {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore-start
|
// @ts-ignore-start
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
navigator
|
navigator
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.share({
|
.share({
|
||||||
title: this.event.title,
|
title: this.event.title,
|
||||||
@ -962,10 +965,11 @@ export default class Event extends EventMixin {
|
|||||||
this.isShareModalActive = true;
|
this.isShareModalActive = true;
|
||||||
// send popup
|
// send popup
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore-end
|
// @ts-ignore-end
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleErrors(errors: GraphQLError[]) {
|
async handleErrors(errors: GraphQLError[]): Promise<void> {
|
||||||
if (
|
if (
|
||||||
errors[0].message.includes("not found") ||
|
errors[0].message.includes("not found") ||
|
||||||
errors[0].message.includes("has invalid value $uuid")
|
errors[0].message.includes("has invalid value $uuid")
|
||||||
@ -974,7 +978,7 @@ export default class Event extends EventMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get actorIsParticipant() {
|
get actorIsParticipant(): boolean {
|
||||||
if (this.actorIsOrganizer) return true;
|
if (this.actorIsOrganizer) return true;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -982,13 +986,13 @@ export default class Event extends EventMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get actorIsOrganizer() {
|
get actorIsOrganizer(): boolean {
|
||||||
return (
|
return (
|
||||||
this.participations.length > 0 && this.participations[0].role === ParticipantRole.CREATOR
|
this.participations.length > 0 && this.participations[0].role === ParticipantRole.CREATOR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get endDate() {
|
get endDate(): Date {
|
||||||
return this.event.endsOn !== null && this.event.endsOn > this.event.beginsOn
|
return this.event.endsOn !== null && this.event.endsOn > this.event.beginsOn
|
||||||
? this.event.endsOn
|
? this.event.endsOn
|
||||||
: this.event.beginsOn;
|
: this.event.beginsOn;
|
||||||
@ -1014,7 +1018,7 @@ export default class Event extends EventMixin {
|
|||||||
return isParticipatingInThisEvent(this.uuid);
|
return isParticipatingInThisEvent(this.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelAnonymousParticipation() {
|
async cancelAnonymousParticipation(): Promise<void> {
|
||||||
const token = (await getLeaveTokenForParticipation(this.uuid)) as string;
|
const token = (await getLeaveTokenForParticipation(this.uuid)) as string;
|
||||||
await this.leaveEvent(this.event, this.config.anonymous.actorId, token);
|
await this.leaveEvent(this.event, this.config.anonymous.actorId, token);
|
||||||
await removeAnonymousParticipation(this.uuid);
|
await removeAnonymousParticipation(this.uuid);
|
||||||
@ -1023,7 +1027,7 @@ export default class Event extends EventMixin {
|
|||||||
|
|
||||||
get ableToReport(): boolean {
|
get ableToReport(): boolean {
|
||||||
return (
|
return (
|
||||||
this.config && (this.currentActor.id != undefined || this.config.anonymous.reports.allowed)
|
this.config && (this.currentActor.id !== undefined || this.config.anonymous.reports.allowed)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user