@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<o-inputitems
|
||||
:modelValue="modelValue"
|
||||
:modelValue="modelValueWithDisplayName"
|
||||
@update:modelValue="(val: IActor[]) => $emit('update:modelValue', val)"
|
||||
:data="availableActors"
|
||||
:allow-autocomplete="true"
|
||||
@@ -21,10 +21,10 @@ import { SEARCH_PERSON_AND_GROUPS } from "@/graphql/search";
|
||||
import { IActor, IGroup, IPerson, displayName } from "@/types/actor";
|
||||
import { Paginate } from "@/types/paginate";
|
||||
import { useLazyQuery } from "@vue/apollo-composable";
|
||||
import { ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import ActorInline from "./ActorInline.vue";
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
modelValue: IActor[];
|
||||
}>();
|
||||
|
||||
@@ -32,6 +32,15 @@ defineEmits<{
|
||||
"update:modelValue": [value: IActor[]];
|
||||
}>();
|
||||
|
||||
const modelValue = computed(() => props.modelValue);
|
||||
|
||||
const modelValueWithDisplayName = computed(() =>
|
||||
modelValue.value.map((actor) => ({
|
||||
...actor,
|
||||
displayName: displayName(actor),
|
||||
}))
|
||||
);
|
||||
|
||||
const {
|
||||
load: loadSearchPersonsAndGroupsQuery,
|
||||
refetch: refetchSearchPersonsAndGroupsQuery,
|
||||
|
||||
@@ -39,8 +39,18 @@
|
||||
v-html="actor.summary"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex pr-2">
|
||||
<Email />
|
||||
<div class="flex pr-2" v-if="actor.type === ActorType.PERSON">
|
||||
<router-link
|
||||
:to="{
|
||||
name: RouteName.CONVERSATION_LIST,
|
||||
query: {
|
||||
newMessage: 'true',
|
||||
personMentions: usernameWithDomain(actor),
|
||||
},
|
||||
}"
|
||||
>
|
||||
<Email />
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div
|
||||
@@ -85,6 +95,8 @@
|
||||
import { displayName, IActor, usernameWithDomain } from "../../types/actor";
|
||||
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
||||
import Email from "vue-material-design-icons/Email.vue";
|
||||
import RouteName from "@/router/name";
|
||||
import { ActorType } from "@/types/enums";
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
|
||||
@@ -24,15 +24,11 @@
|
||||
@{{ usernameWithDomain(actor) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex pr-2 self-center">
|
||||
<Email />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { displayName, IActor, usernameWithDomain } from "../../types/actor";
|
||||
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
||||
import Email from "vue-material-design-icons/Email.vue";
|
||||
|
||||
defineProps<{
|
||||
actor: IActor;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<router-link
|
||||
class="flex gap-2 w-full items-center px-2 py-4 border-b-stone-200 border-b bg-white dark:bg-transparent"
|
||||
class="flex gap-4 w-full items-center px-2 py-4 border-b-stone-200 border-b bg-white dark:bg-transparent"
|
||||
dir="auto"
|
||||
:to="{
|
||||
name: RouteName.CONVERSATION,
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
:currentActor="currentActor"
|
||||
:placeholder="t('Write a new message')"
|
||||
/>
|
||||
<o-notification
|
||||
class="my-2"
|
||||
variant="danger"
|
||||
:closable="false"
|
||||
v-for="error in errors"
|
||||
:key="error"
|
||||
>
|
||||
{{ error }}
|
||||
</o-notification>
|
||||
<footer class="flex gap-2 py-3 mx-2 justify-end">
|
||||
<o-button :disabled="!canSend" nativeType="submit">{{
|
||||
t("Send")
|
||||
@@ -18,13 +27,14 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { IActor, IPerson, usernameWithDomain } from "@/types/actor";
|
||||
import { IActor, IGroup, IPerson, usernameWithDomain } from "@/types/actor";
|
||||
import { computed, defineAsyncComponent, provide, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import ActorAutoComplete from "../../components/Account/ActorAutoComplete.vue";
|
||||
import {
|
||||
DefaultApolloClient,
|
||||
provideApolloClient,
|
||||
useLazyQuery,
|
||||
useMutation,
|
||||
} from "@vue/apollo-composable";
|
||||
import { apolloClient } from "@/vue-apollo";
|
||||
@@ -34,12 +44,15 @@ import { IConversation } from "@/types/conversation";
|
||||
import { useCurrentActorClient } from "@/composition/apollo/actor";
|
||||
import { useRouter } from "vue-router";
|
||||
import RouteName from "@/router/name";
|
||||
import { FETCH_PERSON } from "@/graphql/actor";
|
||||
import { FETCH_GROUP_PUBLIC } from "@/graphql/group";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
mentions?: IActor[];
|
||||
personMentions?: string[];
|
||||
groupMentions?: string[];
|
||||
}>(),
|
||||
{ mentions: () => [] }
|
||||
{ personMentions: () => [], groupMentions: () => [] }
|
||||
);
|
||||
|
||||
provide(DefaultApolloClient, apolloClient);
|
||||
@@ -48,15 +61,36 @@ const router = useRouter();
|
||||
|
||||
const emit = defineEmits(["close"]);
|
||||
|
||||
const actorMentions = ref(props.mentions);
|
||||
const errors = ref<string[]>([]);
|
||||
|
||||
const textMentions = computed(() =>
|
||||
(props.mentions ?? []).map((actor) => usernameWithDomain(actor)).join(" ")
|
||||
const textPersonMentions = computed(() => props.personMentions);
|
||||
const textGroupMentions = computed(() => props.groupMentions);
|
||||
const actorMentions = ref<IActor[]>([]);
|
||||
|
||||
const { load: fetchPerson } = provideApolloClient(apolloClient)(() =>
|
||||
useLazyQuery<{ fetchPerson: IPerson }, { username: string }>(FETCH_PERSON)
|
||||
);
|
||||
const { load: fetchGroup } = provideApolloClient(apolloClient)(() =>
|
||||
useLazyQuery<{ group: IGroup }, { name: string }>(FETCH_GROUP_PUBLIC)
|
||||
);
|
||||
textPersonMentions.value.forEach(async (textPersonMention) => {
|
||||
const result = await fetchPerson(FETCH_PERSON, {
|
||||
username: textPersonMention,
|
||||
});
|
||||
if (!result) return;
|
||||
actorMentions.value.push(result.fetchPerson);
|
||||
});
|
||||
textGroupMentions.value.forEach(async (textGroupMention) => {
|
||||
const result = await fetchGroup(FETCH_GROUP_PUBLIC, {
|
||||
name: textGroupMention,
|
||||
});
|
||||
if (!result) return;
|
||||
actorMentions.value.push(result.group);
|
||||
});
|
||||
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
const text = ref(textMentions.value);
|
||||
const text = ref("");
|
||||
|
||||
const Editor = defineAsyncComponent(
|
||||
() => import("../../components/TextEditor.vue")
|
||||
@@ -70,8 +104,8 @@ const canSend = computed(() => {
|
||||
return actorMentions.value.length > 0 || /@.+/.test(text.value);
|
||||
});
|
||||
|
||||
const { mutate: postPrivateMessageMutate } = provideApolloClient(apolloClient)(
|
||||
() =>
|
||||
const { mutate: postPrivateMessageMutate, onError: onPrivateMessageError } =
|
||||
provideApolloClient(apolloClient)(() =>
|
||||
useMutation<
|
||||
{
|
||||
postPrivateMessage: IConversation;
|
||||
@@ -116,7 +150,13 @@ const { mutate: postPrivateMessageMutate } = provideApolloClient(apolloClient)(
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
);
|
||||
|
||||
onPrivateMessageError((err) => {
|
||||
err.graphQLErrors.forEach((error) => {
|
||||
errors.value.push(error.message);
|
||||
});
|
||||
});
|
||||
|
||||
const sendForm = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
<template>
|
||||
<form @submit="sendForm">
|
||||
<h2>{{ t("New announcement") }}</h2>
|
||||
<p>
|
||||
{{
|
||||
t(
|
||||
"This announcement will be send to all participants with the statuses selected below. They will not be allowed to reply to your announcement, but they can create a new conversation with you."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<o-field class="mt-2 mb-4">
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.PARTICIPANT"
|
||||
:label="t('Participant')"
|
||||
/>
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.NOT_APPROVED"
|
||||
:label="t('Not approved')"
|
||||
/>
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.REJECTED"
|
||||
:label="t('Rejected')"
|
||||
/>
|
||||
</o-field>
|
||||
<Editor
|
||||
v-model="text"
|
||||
mode="basic"
|
||||
@@ -8,6 +33,15 @@
|
||||
:currentActor="currentActor"
|
||||
:placeholder="t('Write a new message')"
|
||||
/>
|
||||
<o-notification
|
||||
class="my-2"
|
||||
variant="danger"
|
||||
:closable="true"
|
||||
v-for="error in errors"
|
||||
:key="error"
|
||||
>
|
||||
{{ error }}
|
||||
</o-notification>
|
||||
<o-button class="mt-3" nativeType="submit">{{ t("Send") }}</o-button>
|
||||
</form>
|
||||
</template>
|
||||
@@ -32,9 +66,15 @@ const props = defineProps<{
|
||||
const event = computed(() => props.event);
|
||||
|
||||
const text = ref("");
|
||||
|
||||
const errors = ref<string[]>([]);
|
||||
|
||||
const selectedRoles = ref<ParticipantRole[]>([ParticipantRole.PARTICIPANT]);
|
||||
|
||||
const {
|
||||
mutate: eventPrivateMessageMutate,
|
||||
onDone: onEventPrivateMessageMutated,
|
||||
onError: onEventPrivateMessageError,
|
||||
} = useMutation<
|
||||
{
|
||||
sendEventPrivateMessage: IConversation;
|
||||
@@ -43,8 +83,7 @@ const {
|
||||
text: string;
|
||||
actorId: string;
|
||||
eventId: string;
|
||||
roles?: string;
|
||||
inReplyToActorId?: ParticipantRole[];
|
||||
roles?: ParticipantRole[];
|
||||
language?: string;
|
||||
}
|
||||
>(SEND_EVENT_PRIVATE_MESSAGE_MUTATION, {
|
||||
@@ -96,6 +135,7 @@ const sendForm = (e: Event) => {
|
||||
event.value.organizerActor?.id ??
|
||||
currentActor.value?.id,
|
||||
eventId: event.value.id,
|
||||
roles: selectedRoles.value,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -103,6 +143,12 @@ onEventPrivateMessageMutated(() => {
|
||||
text.value = "";
|
||||
});
|
||||
|
||||
onEventPrivateMessageError((err) => {
|
||||
err.graphQLErrors.forEach((error) => {
|
||||
errors.value.push(error.message);
|
||||
});
|
||||
});
|
||||
|
||||
const Editor = defineAsyncComponent(
|
||||
() => import("../../components/TextEditor.vue")
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<router-link :to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }">
|
||||
<figure class="flex justify-center my-2">
|
||||
<img
|
||||
src="../../../public/img/undraw_profile.svg"
|
||||
src="/img/undraw_profile.svg"
|
||||
alt="Profile illustration"
|
||||
width="128"
|
||||
height="128"
|
||||
@@ -55,7 +55,7 @@
|
||||
<img
|
||||
width="128"
|
||||
height="128"
|
||||
src="../../../public/img/undraw_mail_2.svg"
|
||||
src="/img/undraw_mail_2.svg"
|
||||
alt="Privacy illustration"
|
||||
/>
|
||||
</figure>
|
||||
@@ -66,7 +66,7 @@
|
||||
<a :href="`${event.url}/participate/without-account`" v-else>
|
||||
<figure class="flex justify-center my-2">
|
||||
<img
|
||||
src="../../../public/img/undraw_mail_2.svg"
|
||||
src="/img/undraw_mail_2.svg"
|
||||
width="128"
|
||||
height="128"
|
||||
alt="Privacy illustration"
|
||||
|
||||
Reference in New Issue
Block a user