Merge branch 'fixes' into 'main'

Various fixes

See merge request framasoft/mobilizon!1309
This commit is contained in:
Thomas Citharel 2022-10-31 18:24:42 +00:00
commit c8d5bdd4af
21 changed files with 412 additions and 250 deletions

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

@ -113,10 +113,6 @@ address {
span.addressDescription { span.addressDescription {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;
flex: 1 0 auto;
min-width: 100%;
max-width: 4rem;
overflow: hidden; overflow: hidden;
} }

View file

@ -1,7 +1,7 @@
<template> <template>
<div class=""> <div class="">
<participation-section <participation-section
v-if="event && currentActor && identities && anonymousParticipationConfig" v-if="event && anonymousParticipationConfig"
:participation="participations[0]" :participation="participations[0]"
:event="event" :event="event"
:anonymousParticipation="anonymousParticipation" :anonymousParticipation="anonymousParticipation"
@ -15,27 +15,6 @@
@cancel-anonymous-participation="cancelAnonymousParticipation" @cancel-anonymous-participation="cancelAnonymousParticipation"
/> />
<div class="flex flex-col"> <div class="flex flex-col">
<template v-if="!event?.draft">
<p
v-if="event?.visibility === EventVisibility.PUBLIC"
class="inline-flex gap-1"
>
<Earth />
{{ t("Public event") }}
</p>
<p
v-if="event?.visibility === EventVisibility.UNLISTED"
class="inline-flex gap-1"
>
<Link />
{{ t("Private event") }}
</p>
</template>
<template v-if="!event?.local && organizer?.domain">
<a :href="event?.url">
<tag>{{ organizer?.domain }}</tag>
</a>
</template>
<p class="inline-flex gap-1"> <p class="inline-flex gap-1">
<TicketConfirmationOutline /> <TicketConfirmationOutline />
<router-link <router-link
@ -327,18 +306,10 @@ import { IEvent } from "@/types/event.model";
import ParticipationSection from "@/components/Participation/ParticipationSection.vue"; import ParticipationSection from "@/components/Participation/ParticipationSection.vue";
import ReportModal from "@/components/Report/ReportModal.vue"; import ReportModal from "@/components/Report/ReportModal.vue";
import IdentityPicker from "@/views/Account/IdentityPicker.vue"; import IdentityPicker from "@/views/Account/IdentityPicker.vue";
import { import { EventJoinOptions, ParticipantRole, MemberRole } from "@/types/enums";
EventVisibility,
EventJoinOptions,
ParticipantRole,
MemberRole,
} from "@/types/enums";
import { GRAPHQL_API_ENDPOINT } from "@/api/_entrypoint"; import { GRAPHQL_API_ENDPOINT } from "@/api/_entrypoint";
import { computed, defineAsyncComponent, inject, onMounted, ref } from "vue"; import { computed, defineAsyncComponent, inject, onMounted, ref } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import Tag from "@/components/TagElement.vue";
import Earth from "vue-material-design-icons/Earth.vue";
import Link from "vue-material-design-icons/Link.vue";
import Flag from "vue-material-design-icons/Flag.vue"; import Flag from "vue-material-design-icons/Flag.vue";
import CalendarPlus from "vue-material-design-icons/CalendarPlus.vue"; import CalendarPlus from "vue-material-design-icons/CalendarPlus.vue";
import ContentDuplicate from "vue-material-design-icons/ContentDuplicate.vue"; import ContentDuplicate from "vue-material-design-icons/ContentDuplicate.vue";

View file

@ -1,6 +1,6 @@
<template> <template>
<article <article
class="bg-white dark:bg-gray-700 dark:text-white dark:hover:text-white rounded-lg shadow-md max-w-3xl p-2" class="bg-white dark:bg-zinc-700 dark:text-white dark:hover:text-white rounded-lg shadow-md max-w-3xl p-2"
> >
<div class="flex gap-2"> <div class="flex gap-2">
<div class=""> <div class="">

View file

@ -4,7 +4,7 @@
<o-field <o-field
:label-for="id" :label-for="id"
:message="fieldErrors" :message="fieldErrors"
:variant="{ danger: fieldErrors }" :variant="fieldErrors ? 'danger' : ''"
class="!-mt-2" class="!-mt-2"
:labelClass="labelClass" :labelClass="labelClass"
> >

View file

@ -165,8 +165,8 @@ import TimerSandEmpty from "vue-material-design-icons/TimerSandEmpty.vue";
const props = defineProps<{ const props = defineProps<{
participation: IParticipant | undefined; participation: IParticipant | undefined;
event: IEvent; event: IEvent;
currentActor: IPerson; currentActor: IPerson | undefined;
identities: IPerson[]; identities: IPerson[] | undefined;
}>(); }>();
const emit = defineEmits([ const emit = defineEmits([

View file

@ -0,0 +1,20 @@
<template>
<div class="bg-white dark:bg-slate-800 shadow rounded-md w-full mx-auto">
<div class="animate-pulse flex flex-col sm:flex-row space-3-4 items-center">
<div class="object-cover h-40 w-72 bg-slate-700 m-2 md:m-4 shrink-0" />
<div
class="flex gap-3 flex self-start flex-col justify-between m-2 md:m-4 w-full px-2 md:px-4"
>
<div class="h-3 bg-slate-700 w-52 hidden sm:block"></div>
<div class="h-5 bg-slate-700 w-72 lg:w-96"></div>
<div class="flex items-center">
<div
class="rounded-full object-cover h-6 w-6 bg-slate-700 mx-2 shrink-0"
/>
<div class="h-3 bg-slate-700 w-52"></div>
</div>
</div>
</div>
</div>
</template>

View file

@ -0,0 +1,16 @@
<template>
<div class="bg-white dark:bg-slate-800 shadow rounded-md w-full mx-auto">
<div class="animate-pulse flex flex-col sm:flex-row space-3-4 items-center">
<div
class="object-cover h-40 w-40 rounded-full bg-slate-700 m-2 md:m-4 shrink-0"
/>
<div
class="flex gap-3 flex self-start flex-col justify-between m-2 md:m-4 self-center w-full px-2 md:px-4"
>
<div class="h-5 bg-slate-700 w-64"></div>
<div class="h-3 bg-slate-700 w-52"></div>
</div>
</div>
</div>
</template>

View file

@ -138,8 +138,8 @@ const props = withDefaults(
participation: IParticipant | undefined; participation: IParticipant | undefined;
event: IEvent; event: IEvent;
anonymousParticipation?: boolean | null; anonymousParticipation?: boolean | null;
currentActor: IPerson; currentActor: IPerson | undefined;
identities: IPerson[]; identities: IPerson[] | undefined;
anonymousParticipationConfig: IAnonymousParticipationConfig; anonymousParticipationConfig: IAnonymousParticipationConfig;
}>(), }>(),
{ {

View file

@ -1,41 +1,36 @@
<template> <template>
<section class="container mx-auto hero"> <section class="container mx-auto max-w-2xl">
<div class="hero-body" v-if="event">
<div class="container mx-auto">
<h2 class="text-2xl"> <h2 class="text-2xl">
{{ $t("You wish to participate to the following event") }} {{ t("You wish to participate to the following event") }}
</h2> </h2>
<EventListViewCard v-if="event" :event="event" /> <EventListViewCard v-if="event" :event="event" />
<div class="columns has-text-centered"> <div class="flex flex-wrap gap-4 items-center w-full my-6">
<div class="column"> <div class="bg-white dark:bg-zinc-700 rounded-md p-4 flex-1">
<router-link <router-link :to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }">
:to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }" <figure class="flex justify-center my-2">
>
<figure class="image is-128x128">
<img <img
src="../../assets/undraw_profile.svg" src="/img/undraw_profile.svg"
alt="Profile illustration" alt="Profile illustration"
width="128"
height="128"
/> />
</figure> </figure>
<o-button variant="primary">{{ <o-button variant="primary">{{
$t("I have a Mobilizon account") t("I have a Mobilizon account")
}}</o-button> }}</o-button>
</router-link> </router-link>
<p> <p>
<small> <small>
{{ {{
$t( t("Either on the {instance} instance or on another instance.", {
"Either on the {instance} instance or on another instance.",
{
instance: host, instance: host,
} })
)
}} }}
</small> </small>
<o-tooltip <o-tooltip
variant="dark" variant="dark"
:label=" :label="
$t( t(
'Mobilizon is a federated network. You can interact with this event from a different server.' 'Mobilizon is a federated network. You can interact with this event from a different server.'
) )
" "
@ -44,13 +39,10 @@
</o-tooltip> </o-tooltip>
</p> </p>
</div> </div>
<vertical-divider
:content="$t('Or')"
v-if="anonymousParticipationAllowed"
/>
<div <div
class="column" class="bg-white dark:bg-zinc-700 rounded-md p-4 flex-1"
v-if=" v-if="
event &&
anonymousParticipationAllowed && anonymousParticipationAllowed &&
hasAnonymousEmailParticipationMethod hasAnonymousEmailParticipationMethod
" "
@ -59,48 +51,49 @@
:to="{ name: RouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT }" :to="{ name: RouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT }"
v-if="event.local" v-if="event.local"
> >
<figure class="image is-128x128"> <figure class="flex justify-center my-2">
<img <img
src="../../assets/undraw_mail_2.svg" width="128"
height="128"
src="/img/undraw_mail_2.svg"
alt="Privacy illustration" alt="Privacy illustration"
/> />
</figure> </figure>
<o-button variant="primary">{{ <o-button variant="primary">{{
$t("I don't have a Mobilizon account") t("I don't have a Mobilizon account")
}}</o-button> }}</o-button>
</router-link> </router-link>
<a :href="`${event.url}/participate/without-account`" v-else> <a :href="`${event.url}/participate/without-account`" v-else>
<figure class="image is-128x128"> <figure class="flex justify-center my-2">
<img <img
src="../../assets/undraw_mail_2.svg" src="/img/undraw_mail_2.svg"
width="128"
height="128"
alt="Privacy illustration" alt="Privacy illustration"
/> />
</figure> </figure>
<o-button variant="primary">{{ <o-button variant="primary">{{
$t("I don't have a Mobilizon account") t("I don't have a Mobilizon account")
}}</o-button> }}</o-button>
</a> </a>
<p> <p>
<small>{{ $t("Participate using your email address") }}</small> <small>{{ t("Participate using your email address") }}</small>
<br /> <br />
<small v-if="!event.local"> <small v-if="!event.local">
{{ $t("You will be redirected to the original instance") }} {{ t("You will be redirected to the original instance") }}
</small> </small>
</p> </p>
</div> </div>
</div> </div>
<div class="has-text-centered"> <div class="has-text-centered">
<o-button tag="a" variant="text" @click="router.go(-1)">{{ <o-button tag="a" variant="text" @click="router.go(-1)">{{
$t("Back to previous page") t("Back to previous page")
}}</o-button> }}</o-button>
</div> </div>
</div>
</div>
</section> </section>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import EventListViewCard from "@/components/Event/EventListViewCard.vue"; import EventListViewCard from "@/components/Event/EventListViewCard.vue";
import VerticalDivider from "@/components/Utils/VerticalDivider.vue";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import { useFetchEvent } from "@/composition/apollo/event"; import { useFetchEvent } from "@/composition/apollo/event";
import { useAnonymousParticipationConfig } from "@/composition/apollo/config"; import { useAnonymousParticipationConfig } from "@/composition/apollo/config";

View file

@ -44,8 +44,8 @@
<button <button
v-if="!isBasicMode" v-if="!isBasicMode"
class="menubar__button" class="menubar__button"
:class="{ 'is-active': editor?.isActive('heading', { level: 1 }) }" :class="{ 'is-active': editor?.isActive('heading', { level: 3 }) }"
@click="editor?.chain().focus().toggleHeading({ level: 1 }).run()" @click="editor?.chain().focus().toggleHeading({ level: 3 }).run()"
type="button" type="button"
:title="t('Heading Level 1')" :title="t('Heading Level 1')"
> >
@ -55,8 +55,8 @@
<button <button
v-if="!isBasicMode" v-if="!isBasicMode"
class="menubar__button" class="menubar__button"
:class="{ 'is-active': editor?.isActive('heading', { level: 2 }) }" :class="{ 'is-active': editor?.isActive('heading', { level: 4 }) }"
@click="editor?.chain().focus().toggleHeading({ level: 2 }).run()" @click="editor?.chain().focus().toggleHeading({ level: 4 }).run()"
type="button" type="button"
:title="t('Heading Level 2')" :title="t('Heading Level 2')"
> >
@ -66,8 +66,8 @@
<button <button
v-if="!isBasicMode" v-if="!isBasicMode"
class="menubar__button" class="menubar__button"
:class="{ 'is-active': editor?.isActive('heading', { level: 3 }) }" :class="{ 'is-active': editor?.isActive('heading', { level: 5 }) }"
@click="editor?.chain().focus().toggleHeading({ level: 3 }).run()" @click="editor?.chain().focus().toggleHeading({ level: 5 }).run()"
type="button" type="button"
:title="t('Heading Level 3')" :title="t('Heading Level 3')"
> >
@ -309,7 +309,9 @@ const editor = useEditor({
extensions: [ extensions: [
Blockquote, Blockquote,
BulletList, BulletList,
Heading, Heading.configure({
levels: [3, 4, 5],
}),
Document, Document,
Paragraph, Paragraph,
Text, Text,

View file

@ -1,13 +1,22 @@
<template> <template>
<section class="container mx-auto hero is-fullheight"> <section class="container mx-auto max-w-2xl">
<div class="hero-body"> <div class="flex flex-wrap gap-4 items-center w-full">
<div class="container mx-auto"> <div class="px-2 flex-1">
<div class="columns is-vcentered"> <h2 class="text-2xl">
<div class="column has-text-centered"> {{
t("I have an account on {instance}.", { instance: instanceName })
}}
</h2>
<i18n-t keypath="My federated identity ends in {domain}">
<template #domain>
<code>@{{ host }}</code>
</template>
</i18n-t>
<o-button <o-button
variant="primary" variant="primary"
size="medium" size="medium"
tag="router-link" tag="router-link"
class="mt-4"
:to="{ :to="{
name: RouteName.LOGIN, name: RouteName.LOGIN,
query: { query: {
@ -15,52 +24,54 @@
redirect: pathAfterLogin, redirect: pathAfterLogin,
}, },
}" }"
>{{ $t("Login on {instance}", { instance: host }) }}</o-button >{{ t("Login on {instance}", { instance: host }) }}</o-button
> >
</div> </div>
<vertical-divider :content="$t('Or')" /> <div class="sm:border-l-4 px-2 sm:px-4 flex-1">
<div class="column">
<h2 class="text-2xl"> <h2 class="text-2xl">
{{ $t("I have an account on another Mobilizon instance.") }} {{ t("I have an account on another Mobilizon instance.") }}
</h2> </h2>
<p>{{ $t("Other software may also support this.") }}</p> <p>{{ t("Other software may also support this.") }}</p>
<p>{{ sentence }}</p> <p>{{ sentence }}</p>
<form @submit.prevent="redirectToInstance"> <form @submit.prevent="redirectToInstance">
<o-field :label="$t('Your federated identity')"> <o-field
:label="t('Your federated identity')"
label-for="remoteProfileInput"
>
<o-field> <o-field>
<o-input <o-input
id="remoteProfileInput"
expanded expanded
autocapitalize="none" autocapitalize="none"
autocorrect="off" autocorrect="off"
v-model="remoteActorAddress" v-model="remoteActorAddress"
:placeholder="$t('profile@instance')" :placeholder="t('profile{\'@\'}instance')"
></o-input> ></o-input>
<p class="control"> <p class="control">
<button class="button is-primary" type="submit"> <o-button type="submit">
{{ $t("Go") }} {{ t("Go") }}
</button> </o-button>
</p> </p>
</o-field> </o-field>
</o-field> </o-field>
</form> </form>
</div> </div>
</div> </div>
<div class="has-text-centered"> <div class="text-center">
<o-button tag="a" variant="text" @click="$router.go(-1)">{{ <o-button tag="a" variant="text" @click="$router.go(-1)">{{
$t("Back to previous page") t("Back to previous page")
}}</o-button> }}</o-button>
</div> </div>
</div>
</div>
</section> </section>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import VerticalDivider from "@/components/Utils/VerticalDivider.vue";
import { LoginErrorCode } from "@/types/enums"; import { LoginErrorCode } from "@/types/enums";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useInstanceName } from "@/composition/apollo/config";
defineProps<{ const props = defineProps<{
uri: string; uri: string;
pathAfterLogin?: string; pathAfterLogin?: string;
sentence?: string; sentence?: string;
@ -68,7 +79,10 @@ defineProps<{
const remoteActorAddress = ref(""); const remoteActorAddress = ref("");
// eslint-disable-next-line class-methods-use-this const { t } = useI18n({ useScope: "global" });
const { instanceName } = useInstanceName();
const host = computed((): string => { const host = computed((): string => {
return window.location.hostname; return window.location.hostname;
}); });
@ -101,7 +115,7 @@ const webFingerFetch = async (
); );
if (link && link.template.includes("{uri}")) { if (link && link.template.includes("{uri}")) {
return link.template.replace("{uri}", encodeURIComponent(this.uri)); return link.template.replace("{uri}", encodeURIComponent(props.uri));
} }
} }
throw new Error("No interaction path found in webfinger data"); throw new Error("No interaction path found in webfinger data");

View file

@ -1,14 +0,0 @@
<template>
<div class="is-divider-vertical" :data-content="dataContent"></div>
</template>
<script lang="ts" setup>
import { computed } from "vue";
const props = withDefaults(defineProps<{ content?: string }>(), {
content: "Or",
});
const dataContent = computed((): string => {
return props.content.toLocaleUpperCase();
});
</script>

View file

@ -1311,7 +1311,7 @@
"more than 1360 contributors": "více než 1360 přispěvatelů", "more than 1360 contributors": "více než 1360 přispěvatelů",
"multitude of interconnected Mobilizon websites": "množství propojených webových stránek Mobilizon", "multitude of interconnected Mobilizon websites": "množství propojených webových stránek Mobilizon",
"new{'@'}email.com": "nový{'@'}email.com", "new{'@'}email.com": "nový{'@'}email.com",
"profile@instance": "profil@instance", "profile{'@'}instance": "profil{'@'}instance",
"report #{report_number}": "hlášení #{report_number}", "report #{report_number}": "hlášení #{report_number}",
"return to the event's page": "návrat na stránku události", "return to the event's page": "návrat na stránku události",
"return to the homepage": "zpět na domovskou stránku", "return to the homepage": "zpět na domovskou stránku",

View file

@ -1425,5 +1425,18 @@
"Message body": "Message body", "Message body": "Message body",
"Describe your event": "Describe your event", "Describe your event": "Describe your event",
"A few lines about your group": "A few lines about your group", "A few lines about your group": "A few lines about your group",
"Write your post": "Write your post" "Write your post": "Write your post",
"Suggestions:": "Suggestions:",
"Make sure that all words are spelled correctly.": "Make sure that all words are spelled correctly.",
"Try different keywords.": "Try different keywords.",
"Try more general keywords.": "Try more general keywords.",
"Try fewer keywords.": "Try fewer keywords.",
"Change the filters.": "Change the filters.",
"No results found for {search}": "No results found for {search}",
"No events found for {search}": "No events found for {search}",
"No groups found for {search}": "No groups found for {search}",
"No event found at this address": "No event found at this address",
"I have an account on {instance}.": "I have an account on {instance}.",
"profile{\\'@\\'}instance": "profile{\\'@\\'}instance",
"My federated identity ends in {domain}": "My federated identity ends in {domain}"
} }

View file

@ -1312,7 +1312,7 @@
"more than 1360 contributors": "plus de 1360 contributeur·rice·s", "more than 1360 contributors": "plus de 1360 contributeur·rice·s",
"multitude of interconnected Mobilizon websites": "multitude de sites web Mobilizon interconnectés", "multitude of interconnected Mobilizon websites": "multitude de sites web Mobilizon interconnectés",
"new{'@'}email.com": "nouvel{'@'}email.com", "new{'@'}email.com": "nouvel{'@'}email.com",
"profile@instance": "profil@instance", "profile{'@'}instance": "profil{'@'}instance",
"report #{report_number}": "le signalement #{report_number}", "report #{report_number}": "le signalement #{report_number}",
"return to the event's page": "retourner sur la page de l'événement", "return to the event's page": "retourner sur la page de l'événement",
"return to the homepage": "retour à la page d'accueil", "return to the homepage": "retour à la page d'accueil",
@ -1423,5 +1423,18 @@
"Message body": "Corps du message", "Message body": "Corps du message",
"Describe your event": "Décrivez votre événement", "Describe your event": "Décrivez votre événement",
"A few lines about your group": "Quelques lignes à propos de votre groupe", "A few lines about your group": "Quelques lignes à propos de votre groupe",
"Write your post": "Écrivez votre billet" "Write your post": "Écrivez votre billet",
"Suggestions:": "Suggestions :",
"Make sure that all words are spelled correctly.": "Vérifiez lorthographe des termes de recherche.",
"Try different keywords.": "Essayez d'autres mots.",
"Try more general keywords.": "Utilisez des mots clés plus généraux.",
"Try fewer keywords.": "Spécifiez un moins grand nombre de mots-clés.",
"Change the filters.": "Changez les filtres.",
"No results found for {search}": "Aucun résultat trouvé pour {search}",
"No events found for {search}": "Aucun événement trouvé pour {search}",
"No groups found for {search}": "Aucun groupe trouvé pour {search}",
"No event found at this address": "Aucun événement trouvé à cette addresse",
"I have an account on {instance}.": "J'ai un compte sur {instance}.",
"profile{\\'@\\'}instance": "profil{\\'@\\'}instance",
"My federated identity ends in {domain}": "Mon identité fédérée se termine par {domain}"
} }

View file

@ -3,14 +3,19 @@
<o-loading v-model:active="eventLoading" /> <o-loading v-model:active="eventLoading" />
<div class="flex flex-col mb-3"> <div class="flex flex-col mb-3">
<event-banner :picture="event?.picture" /> <event-banner :picture="event?.picture" />
<div class="intro-wrapper flex flex-col relative px-2 pb-2"> <div
<div class="date-calendar-icon-wrapper" v-if="event?.beginsOn"> class="flex flex-col relative pb-2 bg-white dark:bg-zinc-700 my-2 rounded"
<date-calendar-icon :date="event.beginsOn.toString()" /> >
<div class="date-calendar-icon-wrapper relative" v-if="event?.beginsOn">
<date-calendar-icon
:date="event.beginsOn.toString()"
class="absolute left-3 -top-16"
/>
</div> </div>
<section class="intro" dir="auto"> <section class="intro px-2 pt-4" dir="auto">
<div class="flex flex-wrap gap-2"> <div class="flex flex-wrap gap-2">
<div class="flex-1"> <div class="flex-1 min-w-[300px]">
<h1 <h1
class="text-4xl font-bold m-0" class="text-4xl font-bold m-0"
dir="auto" dir="auto"
@ -65,7 +70,7 @@
</popover-actor-card> </popover-actor-card>
</span> </span>
</div> </div>
<div class="inline-flex items-center gap-1"> <div class="flex flex-wrap items-center gap-2 gap-y-4 mt-2 my-3">
<p v-if="event?.status !== EventStatus.CONFIRMED"> <p v-if="event?.status !== EventStatus.CONFIRMED">
<tag <tag
variant="warning" variant="warning"
@ -78,7 +83,28 @@
>{{ t("Event cancelled") }}</tag >{{ t("Event cancelled") }}</tag
> >
</p> </p>
<p class="flex gap-1 items-center" dir="auto"> <template v-if="!event?.draft">
<p
v-if="event?.visibility === EventVisibility.PUBLIC"
class="inline-flex gap-1"
>
<Earth />
{{ t("Public event") }}
</p>
<p
v-if="event?.visibility === EventVisibility.UNLISTED"
class="inline-flex gap-1"
>
<Link />
{{ t("Private event") }}
</p>
</template>
<template v-if="!event?.local && organizerDomain">
<a :href="event?.url">
<tag variant="info">{{ organizerDomain }}</tag>
</a>
</template>
<p class="flex flex-wrap gap-1 items-center" dir="auto">
<tag v-if="eventCategory" class="category" capitalize>{{ <tag v-if="eventCategory" class="category" capitalize>{{
eventCategory eventCategory
}}</tag> }}</tag>
@ -110,7 +136,9 @@
<div <div
class="rounded-lg dark:border-violet-title flex flex-wrap flex-col md:flex-row-reverse gap-4" class="rounded-lg dark:border-violet-title flex flex-wrap flex-col md:flex-row-reverse gap-4"
> >
<aside class="rounded bg-white dark:bg-gray-600 shadow-md h-min"> <aside
class="rounded bg-white dark:bg-zinc-700 shadow-md h-min max-w-screen-sm"
>
<div class="sticky p-4"> <div class="sticky p-4">
<event-metadata-sidebar <event-metadata-sidebar
v-if="event" v-if="event"
@ -132,7 +160,7 @@
<div <div
:lang="event?.language" :lang="event?.language"
dir="auto" dir="auto"
class="description-content" class="mt-4 prose md:prose-lg lg:prose-xl dark:prose-invert prose-h1:text-xl prose-h1:font-semibold prose-h2:text-lg prose-h3:text-base md:prose-h1:text-2xl md:prose-h1:font-semibold md:prose-h2:text-xl md:prose-h3:text-lg lg:prose-h1:text-2xl lg:prose-h1:font-semibold lg:prose-h2:text-xl lg:prose-h3:text-lg"
ref="eventDescriptionElement" ref="eventDescriptionElement"
v-html="event.description" v-html="event.description"
/> />
@ -151,7 +179,7 @@
ref="commentsObserver" ref="commentsObserver"
> >
<a href="#comments"> <a href="#comments">
<h2 class="text-xl" id="comments">{{ t("Comments") }}</h2> <h2 class="text-2xl" id="comments">{{ t("Comments") }}</h2>
</a> </a>
<comment-tree v-if="event && loadComments" :event="event" /> <comment-tree v-if="event && loadComments" :event="event" />
</section> </section>
@ -189,13 +217,25 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { EventStatus, ParticipantRole, RoutingType } from "@/types/enums"; import {
EventStatus,
ParticipantRole,
RoutingType,
EventVisibility,
} from "@/types/enums";
import { import {
EVENT_PERSON_PARTICIPATION, EVENT_PERSON_PARTICIPATION,
// EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED, // EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED,
} from "@/graphql/event"; } from "@/graphql/event";
import { displayName, IPerson, usernameWithDomain } from "@/types/actor"; import {
displayName,
IActor,
IPerson,
usernameWithDomain,
} from "@/types/actor";
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue"; import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
import Earth from "vue-material-design-icons/Earth.vue";
import Link from "vue-material-design-icons/Link.vue";
import MultiCard from "@/components/Event/MultiCard.vue"; import MultiCard from "@/components/Event/MultiCard.vue";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
import CommentTree from "@/components/Comment/CommentTree.vue"; import CommentTree from "@/components/Comment/CommentTree.vue";
@ -493,6 +533,20 @@ const eventCategory = computed((): string | undefined => {
})?.label as string; })?.label as string;
}); });
const organizer = computed((): IActor | null => {
if (event.value?.attributedTo?.id) {
return event.value.attributedTo;
}
if (event.value?.organizerActor) {
return event.value.organizerActor;
}
return null;
});
const organizerDomain = computed((): string | undefined => {
return organizer.value?.domain ?? undefined;
});
useHead({ useHead({
title: computed(() => eventTitle.value ?? ""), title: computed(() => eventTitle.value ?? ""),
meta: [{ name: "description", content: eventDescription.value }], meta: [{ name: "description", content: eventDescription.value }],

View file

@ -500,11 +500,16 @@
</div> </div>
<div v-if="mode === ViewMode.LIST"> <div v-if="mode === ViewMode.LIST">
<template v-if="contentType === ContentType.ALL"> <template v-if="contentType === ContentType.ALL">
<template v-if="searchLoading">
<SkeletonGroupResultList v-for="i in 2" :key="i" />
<SkeletonEventResultList v-for="i in 4" :key="i" />
</template>
<o-notification v-if="features && !features.groups" variant="danger"> <o-notification v-if="features && !features.groups" variant="danger">
{{ t("Groups are not enabled on this instance.") }} {{ t("Groups are not enabled on this instance.") }}
</o-notification> </o-notification>
<div v-else-if="searchGroups && searchGroups?.total > 0"> <div v-else-if="searchGroups && searchGroups?.total > 0">
<GroupCard <GroupCard
class="my-2"
v-for="group in searchGroups?.elements" v-for="group in searchGroups?.elements"
:group="group" :group="group"
:key="group.id" :key="group.id"
@ -513,9 +518,6 @@
mode="row" mode="row"
/> />
</div> </div>
<o-notification v-else-if="searchLoading === false" variant="danger">
{{ t("No groups found") }}
</o-notification>
<div v-if="searchEvents && searchEvents.total > 0"> <div v-if="searchEvents && searchEvents.total > 0">
<event-card <event-card
mode="row" mode="row"
@ -529,16 +531,40 @@
class="my-4" class="my-4"
/> />
</div> </div>
<o-notification v-else-if="searchLoading === false" variant="info"> <EmptyContent v-else-if="searchLoading === false" icon="magnify">
<p>{{ t("No events found") }}</p> <span v-if="searchIsUrl">
<p v-if="searchIsUrl && !currentUser?.id"> {{ t("No event found at this address") }}
</span>
<span v-else-if="!search">
{{ t("No results found") }}
</span>
<i18n-t keypath="No results found for {search}" tag="span" v-else>
<template #search>
<b class="">{{ search }}</b>
</template>
</i18n-t>
<template #desc v-if="searchIsUrl && !currentUser?.id">
{{ {{
t( t(
"Only registered users may fetch remote events from their URL." "Only registered users may fetch remote events from their URL."
) )
}} }}
</template>
<template #desc v-else>
<p class="my-2 text-start">
{{ t("Suggestions:") }}
</p> </p>
</o-notification> <ul class="list-disc list-inside text-start">
<li>
{{ t("Make sure that all words are spelled correctly.") }}
</li>
<li>{{ t("Try different keywords.") }}</li>
<li>{{ t("Try more general keywords.") }}</li>
<li>{{ t("Try fewer keywords.") }}</li>
<li>{{ t("Change the filters.") }}</li>
</ul>
</template>
</EmptyContent>
<o-pagination <o-pagination
v-if=" v-if="
(searchEvents && searchEvents?.total > EVENT_PAGE_LIMIT) || (searchEvents && searchEvents?.total > EVENT_PAGE_LIMIT) ||
@ -556,6 +582,9 @@
/> />
</template> </template>
<template v-else-if="contentType === ContentType.EVENTS"> <template v-else-if="contentType === ContentType.EVENTS">
<template v-if="searchLoading">
<SkeletonEventResultList v-for="i in 8" :key="i" />
</template>
<template v-if="searchEvents && searchEvents.total > 0"> <template v-if="searchEvents && searchEvents.total > 0">
<event-card <event-card
mode="row" mode="row"
@ -580,24 +609,51 @@
> >
</o-pagination> </o-pagination>
</template> </template>
<o-notification v-else-if="searchLoading === false" variant="info"> <EmptyContent v-else-if="searchLoading === false" icon="calendar">
<p>{{ t("No events found") }}</p> <span v-if="searchIsUrl">
<p v-if="searchIsUrl && !currentUser?.id"> {{ t("No event found at this address") }}
</span>
<span v-else-if="!search">
{{ t("No events found") }}
</span>
<i18n-t keypath="No events found for {search}" tag="span" v-else>
<template #search>
<b>{{ search }}</b>
</template>
</i18n-t>
<template #desc v-if="searchIsUrl && !currentUser?.id">
{{ {{
t( t(
"Only registered users may fetch remote events from their URL." "Only registered users may fetch remote events from their URL."
) )
}} }}
</template>
<template #desc v-else>
<p class="my-2 text-start">
{{ t("Suggestions:") }}
</p> </p>
</o-notification> <ul class="list-disc list-inside text-start">
<li>
{{ t("Make sure that all words are spelled correctly.") }}
</li>
<li>{{ t("Try different keywords.") }}</li>
<li>{{ t("Try more general keywords.") }}</li>
<li>{{ t("Try fewer keywords.") }}</li>
<li>{{ t("Change the filters.") }}</li>
</ul>
</template>
</EmptyContent>
</template> </template>
<template v-else-if="contentType === ContentType.GROUPS"> <template v-else-if="contentType === ContentType.GROUPS">
<o-notification v-if="features && !features.groups" variant="danger"> <o-notification v-if="features && !features.groups" variant="danger">
{{ t("Groups are not enabled on this instance.") }} {{ t("Groups are not enabled on this instance.") }}
</o-notification> </o-notification>
<template v-else-if="searchLoading">
<SkeletonGroupResultList v-for="i in 6" :key="i" />
</template>
<template v-else-if="searchGroups && searchGroups?.total > 0"> <template v-else-if="searchGroups && searchGroups?.total > 0">
<GroupCard <GroupCard
class="my-2"
v-for="group in searchGroups?.elements" v-for="group in searchGroups?.elements"
:group="group" :group="group"
:key="group.id" :key="group.id"
@ -617,9 +673,33 @@
> >
</o-pagination> </o-pagination>
</template> </template>
<o-notification v-else-if="searchLoading === false" variant="danger"> <EmptyContent
{{ t("No groups found") }} v-else-if="searchLoading === false"
</o-notification> icon="account-multiple"
>
<span v-if="!search">
{{ t("No events found") }}
</span>
<i18n-t keypath="No groups found for {search}" tag="span" v-else>
<template #search>
<b>{{ search }}</b>
</template>
</i18n-t>
<template #desc>
<p class="my-2 text-start">
{{ t("Suggestions:") }}
</p>
<ul class="list-disc list-inside text-start">
<li>
{{ t("Make sure that all words are spelled correctly.") }}
</li>
<li>{{ t("Try different keywords.") }}</li>
<li>{{ t("Try more general keywords.") }}</li>
<li>{{ t("Try fewer keywords.") }}</li>
<li>{{ t("Change the filters.") }}</li>
</ul>
</template>
</EmptyContent>
</template> </template>
</div> </div>
<event-marker-map <event-marker-map
@ -693,6 +773,9 @@ import { IConfig } from "@/types/config.model";
import { TypeNamed } from "@/types/apollo"; import { TypeNamed } from "@/types/apollo";
import { LatLngBounds } from "leaflet"; import { LatLngBounds } from "leaflet";
import lodashSortBy from "lodash/sortBy"; import lodashSortBy from "lodash/sortBy";
import EmptyContent from "@/components/Utils/EmptyContent.vue";
import SkeletonGroupResultList from "@/components/Group/SkeletonGroupResultList.vue";
import SkeletonEventResultList from "@/components/Event/SkeletonEventResultList.vue";
const EventMarkerMap = defineAsyncComponent( const EventMarkerMap = defineAsyncComponent(
() => import("@/components/Search/EventMarkerMap.vue") () => import("@/components/Search/EventMarkerMap.vue")
@ -764,6 +847,10 @@ const arrayTransformer: RouteQueryTransformer<string[]> = {
}, },
}; };
const props = defineProps<{
tag?: string;
}>();
const page = useRouteQuery("page", 1, integerTransformer); const page = useRouteQuery("page", 1, integerTransformer);
const eventPage = useRouteQuery("eventPage", 1, integerTransformer); const eventPage = useRouteQuery("eventPage", 1, integerTransformer);
const groupPage = useRouteQuery("groupPage", 1, integerTransformer); const groupPage = useRouteQuery("groupPage", 1, integerTransformer);
@ -775,7 +862,7 @@ const distance = useRouteQuery("distance", "10_km");
const when = useRouteQuery("when", "any"); const when = useRouteQuery("when", "any");
const contentType = useRouteQuery( const contentType = useRouteQuery(
"contentType", "contentType",
ContentType.ALL, props.tag ? ContentType.EVENTS : ContentType.ALL,
enumTransformer(ContentType) enumTransformer(ContentType)
); );
@ -819,10 +906,6 @@ const EVENT_PAGE_LIMIT = 16;
const GROUP_PAGE_LIMIT = 16; const GROUP_PAGE_LIMIT = 16;
const props = defineProps<{
tag?: string;
}>();
const { features } = useFeatures(); const { features } = useFeatures();
const { eventCategories } = useEventCategories(); const { eventCategories } = useEventCategories();

View file

@ -237,7 +237,7 @@ defmodule Mobilizon.Actors do
{:ok, person} {:ok, person}
{:error, _step, err, _} -> {:error, _step, err, _} ->
Logger.error("Error while creating a new person") Logger.debug("Error while creating a new person")
{:error, err} {:error, err}
end end
end end

View file

@ -166,6 +166,7 @@ defmodule Mobilizon.Events.Event do
|> put_picture(attrs) |> put_picture(attrs)
|> validate_lengths() |> validate_lengths()
|> validate_end_time() |> validate_end_time()
|> unique_constraint(:url)
end end
@spec validate_lengths(Changeset.t()) :: Changeset.t() @spec validate_lengths(Changeset.t()) :: Changeset.t()