fix(lint): fix lint after upgrades

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-08-02 15:09:08 +02:00
parent 7916261c5c
commit 60aceb442a
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
44 changed files with 322 additions and 218 deletions

View File

@ -24,12 +24,15 @@ type schemaType = {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
const types = introspectionQueryResultData.__schema.types as schemaType[]; const types = introspectionQueryResultData.__schema.types as schemaType[];
export const possibleTypes = types.reduce((acc, type) => { export const possibleTypes = types.reduce(
if (type.kind === "INTERFACE") { (acc, type) => {
acc[type.name] = type.possibleTypes.map(({ name }) => name); if (type.kind === "INTERFACE") {
} acc[type.name] = type.possibleTypes.map(({ name }) => name);
return acc; }
}, {} as Record<string, string[]>); return acc;
},
{} as Record<string, string[]>
);
const replaceMergePolicy = <TExisting = any, TIncoming = any>( const replaceMergePolicy = <TExisting = any, TIncoming = any>(
_existing: TExisting, _existing: TExisting,

View File

@ -62,34 +62,40 @@ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const useIsActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const useActivitySubjectParamsFct = useActivitySubjectParams();
const subjectParams = useActivitySubjectParams()(props.activity); const isAuthorCurrentActor = computed(() =>
useIsActivityAuthorCurrentActorFct(props.activity)
);
const subjectParams = computed(() =>
useActivitySubjectParamsFct(props.activity)
);
const translation = computed((): string | undefined => { const translation = computed((): string | undefined => {
switch (props.activity.subject) { switch (props.activity.subject) {
case ActivityDiscussionSubject.DISCUSSION_CREATED: case ActivityDiscussionSubject.DISCUSSION_CREATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the discussion {discussion}."; return "You created the discussion {discussion}.";
} }
return "{profile} created the discussion {discussion}."; return "{profile} created the discussion {discussion}.";
case ActivityDiscussionSubject.DISCUSSION_REPLIED: case ActivityDiscussionSubject.DISCUSSION_REPLIED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You replied to the discussion {discussion}."; return "You replied to the discussion {discussion}.";
} }
return "{profile} replied to the discussion {discussion}."; return "{profile} replied to the discussion {discussion}.";
case ActivityDiscussionSubject.DISCUSSION_RENAMED: case ActivityDiscussionSubject.DISCUSSION_RENAMED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You renamed the discussion from {old_discussion} to {discussion}."; return "You renamed the discussion from {old_discussion} to {discussion}.";
} }
return "{profile} renamed the discussion from {old_discussion} to {discussion}."; return "{profile} renamed the discussion from {old_discussion} to {discussion}.";
case ActivityDiscussionSubject.DISCUSSION_ARCHIVED: case ActivityDiscussionSubject.DISCUSSION_ARCHIVED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You archived the discussion {discussion}."; return "You archived the discussion {discussion}.";
} }
return "{profile} archived the discussion {discussion}."; return "{profile} archived the discussion {discussion}.";
case ActivityDiscussionSubject.DISCUSSION_DELETED: case ActivityDiscussionSubject.DISCUSSION_DELETED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You deleted the discussion {discussion}."; return "You deleted the discussion {discussion}.";
} }
return "{profile} deleted the discussion {discussion}."; return "{profile} deleted the discussion {discussion}.";

View File

@ -52,35 +52,41 @@ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const useIsActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const useActivitySubjectParamsFct = useActivitySubjectParams();
const subjectParams = useActivitySubjectParams()(props.activity); const isAuthorCurrentActor = computed(() =>
useIsActivityAuthorCurrentActorFct(props.activity)
);
const subjectParams = computed(() =>
useActivitySubjectParamsFct(props.activity)
);
const translation = computed((): string | undefined => { const translation = computed((): string | undefined => {
switch (props.activity.subject) { switch (props.activity.subject) {
case ActivityEventSubject.EVENT_CREATED: case ActivityEventSubject.EVENT_CREATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the event {event}."; return "You created the event {event}.";
} }
return "The event {event} was created by {profile}."; return "The event {event} was created by {profile}.";
case ActivityEventSubject.EVENT_UPDATED: case ActivityEventSubject.EVENT_UPDATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You updated the event {event}."; return "You updated the event {event}.";
} }
return "The event {event} was updated by {profile}."; return "The event {event} was updated by {profile}.";
case ActivityEventSubject.EVENT_DELETED: case ActivityEventSubject.EVENT_DELETED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You deleted the event {event}."; return "You deleted the event {event}.";
} }
return "The event {event} was deleted by {profile}."; return "The event {event} was deleted by {profile}.";
case ActivityEventCommentSubject.COMMENT_POSTED: case ActivityEventCommentSubject.COMMENT_POSTED:
if (subjectParams.comment_reply_to) { if (subjectParams.value.comment_reply_to) {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You replied to a comment on the event {event}."; return "You replied to a comment on the event {event}.";
} }
return "{profile} replied to a comment on the event {event}."; return "{profile} replied to a comment on the event {event}.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You posted a comment on the event {event}."; return "You posted a comment on the event {event}.";
} }
return "{profile} posted a comment on the event {event}."; return "{profile} posted a comment on the event {event}.";

View File

@ -44,9 +44,13 @@
<router-link <router-link
v-if="activity.object" v-if="activity.object"
:to="{ :to="{
name: RouteName.GROUP, name: RouteName.GROUP,
params: { preferredUsername: usernameWithDomain(activity.object as IActor) }, params: {
}" preferredUsername: usernameWithDomain(
activity.object as IActor
),
},
}"
>{{ subjectParams.group_name }}</router-link >{{ subjectParams.group_name }}</router-link
> >
<b v-else>{{ subjectParams.group_name }}</b> <b v-else>{{ subjectParams.group_name }}</b>
@ -78,19 +82,25 @@ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const useIsActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const useActivitySubjectParamsFct = useActivitySubjectParams();
const subjectParams = useActivitySubjectParams()(props.activity); const isAuthorCurrentActor = computed(() =>
useIsActivityAuthorCurrentActorFct(props.activity)
);
const subjectParams = computed(() =>
useActivitySubjectParamsFct(props.activity)
);
const translation = computed((): string | undefined => { const translation = computed((): string | undefined => {
switch (props.activity.subject) { switch (props.activity.subject) {
case ActivityGroupSubject.GROUP_CREATED: case ActivityGroupSubject.GROUP_CREATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the group {group}."; return "You created the group {group}.";
} }
return "{profile} created the group {group}."; return "{profile} created the group {group}.";
case ActivityGroupSubject.GROUP_UPDATED: case ActivityGroupSubject.GROUP_UPDATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You updated the group {group}."; return "You updated the group {group}.";
} }
return "{profile} updated the group {group}."; return "{profile} updated the group {group}.";
@ -114,8 +124,8 @@ const group = computed(() => props.activity.object as IGroup);
const details = computed((): string[] => { const details = computed((): string[] => {
const localDetails = []; const localDetails = [];
const changes = subjectParams.group_changes.split(","); const changes = subjectParams.value.group_changes.split(",");
if (changes.includes("name") && subjectParams.old_group_name) { if (changes.includes("name") && subjectParams.value.old_group_name) {
localDetails.push("{old_group_name} was renamed to {group}."); localDetails.push("{old_group_name} was renamed to {group}.");
} }
if (changes.includes("visibility") && group.value.visibility) { if (changes.includes("visibility") && group.value.visibility) {

View File

@ -51,58 +51,63 @@ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const isActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const activitySubjectParamsFct = useActivitySubjectParams();
const isActivityObjectCurrentActor = useIsActivityObjectCurrentActor();
const subjectParams = useActivitySubjectParams()(props.activity); const isAuthorCurrentActor = computed(() =>
isActivityAuthorCurrentActorFct(props.activity)
);
const subjectParams = computed(() => activitySubjectParamsFct(props.activity));
const member = computed(() => props.activity.object as IMember); const member = computed(() => props.activity.object as IMember);
const isObjectMemberCurrentActor = useIsActivityObjectCurrentActor()( const isObjectMemberCurrentActor = computed(() =>
props.activity isActivityObjectCurrentActor(props.activity)
); );
const translation = computed((): string | undefined => { const translation = computed((): string | undefined => {
switch (props.activity.subject) { switch (props.activity.subject) {
case ActivityMemberSubject.MEMBER_REQUEST: case ActivityMemberSubject.MEMBER_REQUEST:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You requested to join the group."; return "You requested to join the group.";
} }
return "{member} requested to join the group."; return "{member} requested to join the group.";
case ActivityMemberSubject.MEMBER_INVITED: case ActivityMemberSubject.MEMBER_INVITED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You invited {member}."; return "You invited {member}.";
} }
return "{member} was invited by {profile}."; return "{member} was invited by {profile}.";
case ActivityMemberSubject.MEMBER_ADDED: case ActivityMemberSubject.MEMBER_ADDED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You added the member {member}."; return "You added the member {member}.";
} }
return "{profile} added the member {member}."; return "{profile} added the member {member}.";
case ActivityMemberSubject.MEMBER_APPROVED: case ActivityMemberSubject.MEMBER_APPROVED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You approved {member}'s membership."; return "You approved {member}'s membership.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "Your membership was approved by {profile}."; return "Your membership was approved by {profile}.";
} }
return "{profile} approved {member}'s membership."; return "{profile} approved {member}'s membership.";
case ActivityMemberSubject.MEMBER_JOINED: case ActivityMemberSubject.MEMBER_JOINED:
return "{member} joined the group."; return "{member} joined the group.";
case ActivityMemberSubject.MEMBER_UPDATED: case ActivityMemberSubject.MEMBER_UPDATED:
if (subjectParams.member_role && subjectParams.old_role) { if (subjectParams.value.member_role && subjectParams.value.old_role) {
return roleUpdate.value; return roleUpdate.value;
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You updated the member {member}."; return "You updated the member {member}.";
} }
return "{profile} updated the member {member}."; return "{profile} updated the member {member}.";
case ActivityMemberSubject.MEMBER_REMOVED: case ActivityMemberSubject.MEMBER_REMOVED:
if (subjectParams.member_role === MemberRole.NOT_APPROVED) { if (subjectParams.value.member_role === MemberRole.NOT_APPROVED) {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You rejected {member}'s membership request."; return "You rejected {member}'s membership request.";
} }
return "{profile} rejected {member}'s membership request."; return "{profile} rejected {member}'s membership request.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You excluded member {member}."; return "You excluded member {member}.";
} }
return "{profile} excluded member {member}."; return "{profile} excluded member {member}.";
@ -111,7 +116,7 @@ const translation = computed((): string | undefined => {
case ActivityMemberSubject.MEMBER_REJECTED_INVITATION: case ActivityMemberSubject.MEMBER_REJECTED_INVITATION:
return "{member} rejected the invitation to join the group."; return "{member} rejected the invitation to join the group.";
case ActivityMemberSubject.MEMBER_ACCEPTED_INVITATION: case ActivityMemberSubject.MEMBER_ACCEPTED_INVITATION:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You accepted the invitation to join the group."; return "You accepted the invitation to join the group.";
} }
return "{member} accepted the invitation to join the group."; return "{member} accepted the invitation to join the group.";
@ -159,69 +164,69 @@ const iconColor = computed((): string | undefined => {
const roleUpdate = computed((): string | undefined => { const roleUpdate = computed((): string | undefined => {
if ( if (
Object.keys(MEMBER_ROLE_VALUE).includes(subjectParams.member_role) && Object.keys(MEMBER_ROLE_VALUE).includes(subjectParams.value.member_role) &&
Object.keys(MEMBER_ROLE_VALUE).includes(subjectParams.old_role) Object.keys(MEMBER_ROLE_VALUE).includes(subjectParams.value.old_role)
) { ) {
if ( if (
MEMBER_ROLE_VALUE[subjectParams.member_role] > MEMBER_ROLE_VALUE[subjectParams.value.member_role] >
MEMBER_ROLE_VALUE[subjectParams.old_role] MEMBER_ROLE_VALUE[subjectParams.value.old_role]
) { ) {
switch (subjectParams.member_role) { switch (subjectParams.value.member_role) {
case MemberRole.MODERATOR: case MemberRole.MODERATOR:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You promoted {member} to moderator."; return "You promoted {member} to moderator.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were promoted to moderator by {profile}."; return "You were promoted to moderator by {profile}.";
} }
return "{profile} promoted {member} to moderator."; return "{profile} promoted {member} to moderator.";
case MemberRole.ADMINISTRATOR: case MemberRole.ADMINISTRATOR:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You promoted {member} to administrator."; return "You promoted {member} to administrator.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were promoted to administrator by {profile}."; return "You were promoted to administrator by {profile}.";
} }
return "{profile} promoted {member} to administrator."; return "{profile} promoted {member} to administrator.";
default: default:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You promoted the member {member} to an unknown role."; return "You promoted the member {member} to an unknown role.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were promoted to an unknown role by {profile}."; return "You were promoted to an unknown role by {profile}.";
} }
return "{profile} promoted {member} to an unknown role."; return "{profile} promoted {member} to an unknown role.";
} }
} else { } else {
switch (subjectParams.member_role) { switch (subjectParams.value.member_role) {
case MemberRole.MODERATOR: case MemberRole.MODERATOR:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You demoted {member} to moderator."; return "You demoted {member} to moderator.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were demoted to moderator by {profile}."; return "You were demoted to moderator by {profile}.";
} }
return "{profile} demoted {member} to moderator."; return "{profile} demoted {member} to moderator.";
case MemberRole.MEMBER: case MemberRole.MEMBER:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You demoted {member} to simple member."; return "You demoted {member} to simple member.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were demoted to simple member by {profile}."; return "You were demoted to simple member by {profile}.";
} }
return "{profile} demoted {member} to simple member."; return "{profile} demoted {member} to simple member.";
default: default:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You demoted the member {member} to an unknown role."; return "You demoted the member {member} to an unknown role.";
} }
if (isObjectMemberCurrentActor) { if (isObjectMemberCurrentActor.value) {
return "You were demoted to an unknown role by {profile}."; return "You were demoted to an unknown role by {profile}.";
} }
return "{profile} demoted {member} to an unknown role."; return "{profile} demoted {member} to an unknown role.";
} }
} }
} else { } else {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You updated the member {member}."; return "You updated the member {member}.";
} }
return "{profile} updated the member {member}"; return "{profile} updated the member {member}";

View File

@ -49,24 +49,30 @@ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const useIsActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const useActivitySubjectParamsFct = useActivitySubjectParams();
const subjectParams = useActivitySubjectParams()(props.activity); const isAuthorCurrentActor = computed(() =>
useIsActivityAuthorCurrentActorFct(props.activity)
);
const subjectParams = computed(() =>
useActivitySubjectParamsFct(props.activity)
);
const translation = computed((): string | undefined => { const translation = computed((): string | undefined => {
switch (props.activity.subject) { switch (props.activity.subject) {
case ActivityPostSubject.POST_CREATED: case ActivityPostSubject.POST_CREATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the post {post}."; return "You created the post {post}.";
} }
return "The post {post} was created by {profile}."; return "The post {post} was created by {profile}.";
case ActivityPostSubject.POST_UPDATED: case ActivityPostSubject.POST_UPDATED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You updated the post {post}."; return "You updated the post {post}.";
} }
return "The post {post} was updated by {profile}."; return "The post {post} was updated by {profile}.";
case ActivityPostSubject.POST_DELETED: case ActivityPostSubject.POST_DELETED:
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You deleted the post {post}."; return "You deleted the post {post}.";
} }
return "The post {post} was deleted by {profile}."; return "The post {post} was deleted by {profile}.";

View File

@ -61,10 +61,15 @@ import { IResource } from "@/types/resource";
const props = defineProps<{ const props = defineProps<{
activity: IActivity; activity: IActivity;
}>(); }>();
const useIsActivityAuthorCurrentActorFct = useIsActivityAuthorCurrentActor();
const useActivitySubjectParamsFct = useActivitySubjectParams();
const isAuthorCurrentActor = useIsActivityAuthorCurrentActor()(props.activity); const isAuthorCurrentActor = computed(() =>
useIsActivityAuthorCurrentActorFct(props.activity)
const subjectParams = useActivitySubjectParams()(props.activity); );
const subjectParams = computed(() =>
useActivitySubjectParamsFct(props.activity)
);
const resource = computed(() => props.activity.object as IResource); const resource = computed(() => props.activity.object as IResource);
@ -74,12 +79,12 @@ const translation = computed((): string | undefined => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
if (props.activity?.object?.type === "folder") { if (props.activity?.object?.type === "folder") {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the folder {resource}."; return "You created the folder {resource}.";
} }
return "{profile} created the folder {resource}."; return "{profile} created the folder {resource}.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You created the resource {resource}."; return "You created the resource {resource}.";
} }
return "{profile} created the resource {resource}."; return "{profile} created the resource {resource}.";
@ -88,23 +93,23 @@ const translation = computed((): string | undefined => {
// @ts-ignore // @ts-ignore
if (props.activity?.object?.type === "folder") { if (props.activity?.object?.type === "folder") {
if (parentDirectory.value === null) { if (parentDirectory.value === null) {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You moved the folder {resource} to the root folder."; return "You moved the folder {resource} to the root folder.";
} }
return "{profile} moved the folder {resource} to the root folder."; return "{profile} moved the folder {resource} to the root folder.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You moved the folder {resource} into {new_path}."; return "You moved the folder {resource} into {new_path}.";
} }
return "{profile} moved the folder {resource} into {new_path}."; return "{profile} moved the folder {resource} into {new_path}.";
} }
if (parentDirectory.value === null) { if (parentDirectory.value === null) {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You moved the resource {resource} to the root folder."; return "You moved the resource {resource} to the root folder.";
} }
return "{profile} moved the resource {resource} to the root folder."; return "{profile} moved the resource {resource} to the root folder.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You moved the resource {resource} into {new_path}."; return "You moved the resource {resource} into {new_path}.";
} }
return "{profile} moved the resource {resource} into {new_path}."; return "{profile} moved the resource {resource} into {new_path}.";
@ -112,12 +117,12 @@ const translation = computed((): string | undefined => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
if (props.activity?.object?.type === "folder") { if (props.activity?.object?.type === "folder") {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You renamed the folder from {old_resource_title} to {resource}."; return "You renamed the folder from {old_resource_title} to {resource}.";
} }
return "{profile} renamed the folder from {old_resource_title} to {resource}."; return "{profile} renamed the folder from {old_resource_title} to {resource}.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You renamed the resource from {old_resource_title} to {resource}."; return "You renamed the resource from {old_resource_title} to {resource}.";
} }
return "{profile} renamed the resource from {old_resource_title} to {resource}."; return "{profile} renamed the resource from {old_resource_title} to {resource}.";
@ -125,12 +130,12 @@ const translation = computed((): string | undefined => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
if (props.activity?.object?.type === "folder") { if (props.activity?.object?.type === "folder") {
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You deleted the folder {resource}."; return "You deleted the folder {resource}.";
} }
return "{profile} deleted the folder {resource}."; return "{profile} deleted the folder {resource}.";
} }
if (isAuthorCurrentActor) { if (isAuthorCurrentActor.value) {
return "You deleted the resource {resource}."; return "You deleted the resource {resource}.";
} }
return "{profile} deleted the resource {resource}."; return "{profile} deleted the resource {resource}.";
@ -180,8 +185,8 @@ const parentPath = (parent: string | undefined): string | undefined => {
}; };
const parentDirectory = computed((): string | undefined | null => { const parentDirectory = computed((): string | undefined | null => {
if (subjectParams.resource_path) { if (subjectParams.value.resource_path) {
const parentPathResult = parentPath(subjectParams.resource_path); const parentPathResult = parentPath(subjectParams.value.resource_path);
const directory = parentPathResult?.split("/"); const directory = parentPathResult?.split("/");
const res = directory?.pop(); const res = directory?.pop();
res === "" ? null : res; res === "" ? null : res;

View File

@ -2,7 +2,7 @@
<div> <div>
<form <form
v-if="isAbleToComment" v-if="isAbleToComment"
@submit.prevent="createCommentForEvent(newComment)" @submit.prevent="createCommentForEvent(newCommentValue)"
class="mt-2" class="mt-2"
> >
<o-notification <o-notification
@ -12,8 +12,11 @@
>{{ t("Comments are closed for everybody else.") }}</o-notification >{{ t("Comments are closed for everybody else.") }}</o-notification
> >
<article class="flex flex-wrap items-start gap-2"> <article class="flex flex-wrap items-start gap-2">
<figure class="" v-if="newComment.actor"> <figure class="" v-if="newCommentValue.actor">
<identity-picker-wrapper :inline="false" v-model="newComment.actor" /> <identity-picker-wrapper
:inline="false"
v-model="newCommentValue.actor"
/>
</figure> </figure>
<div class="flex-1"> <div class="flex-1">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
@ -23,9 +26,9 @@
v-if="currentActor" v-if="currentActor"
:currentActor="currentActor" :currentActor="currentActor"
mode="comment" mode="comment"
v-model="newComment.text" v-model="newCommentValue.text"
:aria-label="t('Comment body')" :aria-label="t('Comment body')"
@submit="createCommentForEvent(newComment)" @submit="createCommentForEvent(newCommentValue)"
:placeholder="t('Write a new comment')" :placeholder="t('Write a new comment')"
/> />
<p class="" v-if="emptyCommentError"> <p class="" v-if="emptyCommentError">
@ -35,7 +38,7 @@
<div class="" v-if="isEventOrganiser"> <div class="" v-if="isEventOrganiser">
<o-switch <o-switch
aria-labelledby="notify-participants-toggle" aria-labelledby="notify-participants-toggle"
v-model="newComment.isAnnouncement" v-model="newCommentValue.isAnnouncement"
>{{ t("Notify participants") }}</o-switch >{{ t("Notify participants") }}</o-switch
> >
</div> </div>
@ -70,10 +73,12 @@
v-for="comment in filteredOrderedComments" v-for="comment in filteredOrderedComments"
:key="comment.id" :key="comment.id"
@create-comment="createCommentForEvent" @create-comment="createCommentForEvent"
@delete-comment="commentToDelete => deleteComment({ @delete-comment="
commentId: commentToDelete.id as string, (commentToDelete) =>
originCommentId: commentToDelete.originComment?.id, deleteComment({
}) commentId: commentToDelete.id as string,
originCommentId: commentToDelete.originComment?.id,
})
" "
/> />
</transition-group> </transition-group>
@ -126,17 +131,19 @@ const Editor = defineAsyncComponent(
() => import("@/components/TextEditor.vue") () => import("@/components/TextEditor.vue")
); );
const newComment = ref<IComment>(props.newComment ?? new CommentModel()); const newCommentProps = computed(() => props.newComment);
const newCommentValue = ref<IComment>(new CommentModel(newCommentProps.value));
const emptyCommentError = ref(false); const emptyCommentError = ref(false);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
watch(currentActor, () => { watch(currentActor, () => {
newComment.value.actor = currentActor.value as IPerson; newCommentValue.value.actor = currentActor.value as IPerson;
}); });
watch(newComment, (newCommentUpdated: IComment) => { watch(newCommentValue, (newCommentUpdated: IComment) => {
if (emptyCommentError.value) { if (emptyCommentError.value) {
emptyCommentError.value = ["", "<p></p>"].includes(newCommentUpdated.text); emptyCommentError.value = ["", "<p></p>"].includes(newCommentUpdated.text);
} }
@ -212,7 +219,7 @@ const {
createCommentForEventMutationDone(() => { createCommentForEventMutationDone(() => {
// and reset the new comment field // and reset the new comment field
newComment.value = new CommentModel(); newCommentValue.value = new CommentModel();
}); });
const notifier = inject<Notifier>("notifier"); const notifier = inject<Notifier>("notifier");

View File

@ -27,9 +27,12 @@ const props = defineProps<{
const selectedIndex = ref(0); const selectedIndex = ref(0);
watch(props.items, () => { watch(
selectedIndex.value = 0; () => props.items,
}); () => {
selectedIndex.value = 0;
}
);
// const onKeyDown = ({ event }: { event: KeyboardEvent }): boolean => { // const onKeyDown = ({ event }: { event: KeyboardEvent }): boolean => {
// if (event.key === "ArrowUp") { // if (event.key === "ArrowUp") {
@ -80,7 +83,9 @@ const selectItem = (index: number): void => {
color: rgba(black, 0.8); color: rgba(black, 0.8);
overflow: hidden; overflow: hidden;
font-size: 0.9rem; font-size: 0.9rem;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0px 10px 20px rgba(0, 0, 0, 0.1); box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.1),
0px 10px 20px rgba(0, 0, 0, 0.1);
} }
.item { .item {

View File

@ -41,12 +41,12 @@ const keys = computed((): string[] => {
return Array.from(monthlyGroupedEvents.value.keys()).sort((a, b) => { return Array.from(monthlyGroupedEvents.value.keys()).sort((a, b) => {
const aParams = a.split("-").map((x) => parseInt(x, 10)) as [ const aParams = a.split("-").map((x) => parseInt(x, 10)) as [
number, number,
number number,
]; ];
const aDate = new Date(...aParams); const aDate = new Date(...aParams);
const bParams = b.split("-").map((x) => parseInt(x, 10)) as [ const bParams = b.split("-").map((x) => parseInt(x, 10)) as [
number, number,
number number,
]; ];
const bDate = new Date(...bParams); const bDate = new Date(...bParams);
return props.order === "DESC" return props.order === "DESC"

View File

@ -22,7 +22,7 @@ const props = defineProps<{
preferredUsername: string; preferredUsername: string;
}>(); }>();
const { group } = useGroup(props.preferredUsername); const { group } = useGroup(computed(() => props.preferredUsername));
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -86,6 +86,8 @@ const imageSource = computed(
rgba(2, 0, 36, 0.75) 90%, rgba(2, 0, 36, 0.75) 90%,
rgba(2, 0, 36, 0.85) 100% rgba(2, 0, 36, 0.85) 100%
); );
transition: opacity 0.1s ease-in-out, visibility 0.1s ease-in-out; transition:
opacity 0.1s ease-in-out,
visibility 0.1s ease-in-out;
} }
</style> </style>

View File

@ -90,9 +90,9 @@ const { onDone, onError, mutate } = useMutation<{
confirmParticipation: IParticipant; confirmParticipation: IParticipant;
}>(CONFIRM_PARTICIPATION); }>(CONFIRM_PARTICIPATION);
mutate({ mutate(() => ({
token: props.token, token: props.token,
}); }));
onDone(async ({ data }) => { onDone(async ({ data }) => {
participation.value = data?.confirmParticipation; participation.value = data?.confirmParticipation;

View File

@ -17,7 +17,7 @@ const props = defineProps<{
uuid: string; uuid: string;
}>(); }>();
const { event } = useFetchEvent(props.uuid); const { event } = useFetchEvent(computed(() => props.uuid));
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -156,7 +156,7 @@ const { anonymousActorId } = useAnonymousActorId();
const props = defineProps<{ const props = defineProps<{
uuid: string; uuid: string;
}>(); }>();
const { event, loading } = useFetchEventBasic(props.uuid); const { event, loading } = useFetchEventBasic(computed(() => props.uuid));
const { t, locale } = useI18n({ useScope: "global" }); const { t, locale } = useI18n({ useScope: "global" });

View File

@ -104,7 +104,7 @@ import { useI18n } from "vue-i18n";
const props = defineProps<{ uuid: string }>(); const props = defineProps<{ uuid: string }>();
const { event } = useFetchEvent(props.uuid); const { event } = useFetchEvent(computed(() => props.uuid));
const { anonymousParticipationConfig } = useAnonymousParticipationConfig(); const { anonymousParticipationConfig } = useAnonymousParticipationConfig();

View File

@ -49,7 +49,7 @@ import RouteName from "@/router/name";
import { IMinimalActor, usernameWithDomain } from "@/types/actor"; import { IMinimalActor, usernameWithDomain } from "@/types/actor";
import ResourceDropdown from "./ResourceDropdown.vue"; import ResourceDropdown from "./ResourceDropdown.vue";
import { UPDATE_RESOURCE } from "@/graphql/resources"; import { UPDATE_RESOURCE } from "@/graphql/resources";
import { inject, ref } from "vue"; import { ComputedRef, computed, inject, ref } from "vue";
import { formatDateTimeString } from "@/filters/datetime"; import { formatDateTimeString } from "@/filters/datetime";
import { useMutation } from "@vue/apollo-composable"; import { useMutation } from "@vue/apollo-composable";
import { resourcePathArray } from "@/components/Resource/utils"; import { resourcePathArray } from "@/components/Resource/utils";
@ -73,11 +73,11 @@ const emit = defineEmits<{
const list = ref([]); const list = ref([]);
const groupObject: Record<string, unknown> = { const groupObject: ComputedRef<Record<string, unknown>> = computed(() => ({
name: `folder-${props.resource?.title}`, name: `folder-${props.resource?.title}`,
pull: false, pull: false,
put: ["resources"], put: ["resources"],
}; }));
const onChange = async (evt: any) => { const onChange = async (evt: any) => {
if (evt.added && evt.added.element) { if (evt.added && evt.added.element) {

View File

@ -92,14 +92,17 @@ const emit = defineEmits(["update-resource", "close-move-modal"]);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
const initialResourceProp = computed(() => props.initialResource);
const usernameProp = computed(() => props.username);
const resourcePath = reactive<{ const resourcePath = reactive<{
path: string | undefined; path: string | undefined;
username: string; username: string;
id: string | undefined; id: string | undefined;
}>({ }>({
id: props.initialResource.parent?.id, id: initialResourceProp.value.parent?.id,
path: props.initialResource.parent?.path, path: initialResourceProp.value.parent?.path,
username: props.username, username: usernameProp.value,
}); });
const RESOURCES_PER_PAGE = 10; const RESOURCES_PER_PAGE = 10;
@ -111,27 +114,30 @@ const { result: resourceResult, refetch } = useQuery<{ resource: IResource }>(
if (resourcePath?.path) { if (resourcePath?.path) {
return { return {
path: resourcePath?.path, path: resourcePath?.path,
username: props.username, username: usernameProp.value,
page: page.value, page: page.value,
limit: RESOURCES_PER_PAGE, limit: RESOURCES_PER_PAGE,
}; };
} }
return { path: "/", username: props.username }; return { path: "/", username: usernameProp.value };
} }
); );
const resource = computed(() => resourceResult.value?.resource); const resource = computed(() => resourceResult.value?.resource);
const goDown = (element: IResource): void => { const goDown = (element: IResource): void => {
if (element.type === "folder" && element.id !== props.initialResource.id) { if (
element.type === "folder" &&
element.id !== initialResourceProp.value.id
) {
resourcePath.id = element.id; resourcePath.id = element.id;
resourcePath.path = element.path; resourcePath.path = element.path;
console.debug("Gone into folder", resourcePath); console.debug("Gone into folder", resourcePath);
} }
}; };
watch(props.initialResource, () => { watch(initialResourceProp, () => {
if (props.initialResource) { if (initialResourceProp.value) {
resourcePath.id = props.initialResource?.parent?.id; resourcePath.id = props.initialResource?.parent?.id;
resourcePath.path = props.initialResource?.parent?.path; resourcePath.path = props.initialResource?.parent?.path;
refetch(); refetch();
@ -144,21 +150,21 @@ const updateResource = (): void => {
emit( emit(
"update-resource", "update-resource",
{ {
id: props.initialResource.id, id: initialResourceProp.value.id,
title: props.initialResource.title, title: initialResourceProp.value.title,
parent: parent, parent: parent,
path: parent?.path ?? "/", path: parent?.path ?? "/",
}, },
props.initialResource.parent initialResourceProp.value.parent
); );
}; };
const moveDisabled = computed((): boolean | undefined => { const moveDisabled = computed((): boolean | undefined => {
return ( return (
(props.initialResource.parent && (initialResourceProp.value.parent &&
resourcePath && resourcePath &&
props.initialResource.parent.path === resourcePath.path) || initialResourceProp.value.parent.path === resourcePath.path) ||
(props.initialResource.parent === undefined && (initialResourceProp.value.parent === undefined &&
resourcePath && resourcePath &&
resourcePath.path === "/") resourcePath.path === "/")
); );

View File

@ -10,7 +10,7 @@
> >
<event-card <event-card
v-if="instanceOfIEvent(activeElement)" v-if="instanceOfIEvent(activeElement)"
:event="(activeElement as IEvent)" :event="activeElement as IEvent"
mode="column" mode="column"
:options="{ :options="{
isRemoteEvent: activeElement.__typename === 'EventResult', isRemoteEvent: activeElement.__typename === 'EventResult',
@ -19,7 +19,7 @@
/> />
<group-card <group-card
v-else v-else
:group="(activeElement as IGroup)" :group="activeElement as IGroup"
mode="column" mode="column"
:isRemoteGroup="activeElement.__typename === 'GroupResult'" :isRemoteGroup="activeElement.__typename === 'GroupResult'"
:isLoggedIn="isLoggedIn" :isLoggedIn="isLoggedIn"
@ -31,7 +31,7 @@
> >
<event-card <event-card
v-if="instanceOfIEvent(activeElement)" v-if="instanceOfIEvent(activeElement)"
:event="(activeElement as IEvent)" :event="activeElement as IEvent"
mode="column" mode="column"
:options="{ :options="{
isRemoteEvent: activeElement.__typename === 'EventResult', isRemoteEvent: activeElement.__typename === 'EventResult',
@ -40,7 +40,7 @@
/> />
<group-card <group-card
v-else v-else
:group="(activeElement as IGroup)" :group="activeElement as IGroup"
mode="column" mode="column"
:isRemoteGroup="activeElement.__typename === 'GroupResult'" :isRemoteGroup="activeElement.__typename === 'GroupResult'"
:isLoggedIn="isLoggedIn" :isLoggedIn="isLoggedIn"
@ -330,7 +330,11 @@ watch([markers, eventMarkers, groupMarkers], () => {
text-align: center; text-align: center;
border-radius: 15px; border-radius: 15px;
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif; font:
12px "Helvetica Neue",
Arial,
Helvetica,
sans-serif;
} }
.marker-cluster span { .marker-cluster span {

View File

@ -325,13 +325,18 @@ const transformPastedHTML = (html: string): string => {
return html; return html;
}; };
const ariaLabel = computed(() => props.ariaLabel);
const headingLevel = computed(() => props.headingLevel);
const placeholder = computed(() => props.placeholder);
const value = computed(() => props.modelValue);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
const editor = useEditor({ const editor = useEditor({
editorProps: { editorProps: {
attributes: { attributes: {
"aria-multiline": isShortMode.value.toString(), "aria-multiline": isShortMode.value.toString(),
"aria-label": props.ariaLabel ?? "", "aria-label": ariaLabel.value ?? "",
role: "textbox", role: "textbox",
class: class:
"prose dark:prose-invert prose-sm lg:prose-lg xl:prose-xl bg-zinc-50 dark:bg-zinc-700 focus:outline-none !max-w-full", "prose dark:prose-invert prose-sm lg:prose-lg xl:prose-xl bg-zinc-50 dark:bg-zinc-700 focus:outline-none !max-w-full",
@ -342,7 +347,7 @@ const editor = useEditor({
Blockquote, Blockquote,
BulletList, BulletList,
Heading.configure({ Heading.configure({
levels: props.headingLevel, levels: headingLevel.value,
}), }),
Document, Document,
Paragraph, Paragraph,
@ -366,18 +371,16 @@ const editor = useEditor({
submit: () => emit("submit"), submit: () => emit("submit"),
}), }),
Placeholder.configure({ Placeholder.configure({
placeholder: props.placeholder ?? t("Write something"), placeholder: placeholder.value ?? t("Write something"),
}), }),
], ],
injectCSS: false, injectCSS: false,
content: props.modelValue, content: value.value,
onUpdate: () => { onUpdate: () => {
emit("update:modelValue", editor.value?.getHTML()); emit("update:modelValue", editor.value?.getHTML());
}, },
}); });
const value = computed(() => props.modelValue);
watch(value, (val: string) => { watch(value, (val: string) => {
if (!editor.value) return; if (!editor.value) return;
if (val !== editor.value.getHTML()) { if (val !== editor.value.getHTML()) {
@ -479,7 +482,9 @@ onBeforeUnmount(() => {
@import "./Editor/style.scss"; @import "./Editor/style.scss";
.menubar { .menubar {
transition: visibility 0.2s 0.4s, opacity 0.2s 0.4s; transition:
visibility 0.2s 0.4s,
opacity 0.2s 0.4s;
&__button { &__button {
font-weight: bold; font-weight: bold;

View File

@ -84,14 +84,19 @@ const emit = defineEmits(["confirm", "cancel", "close"]);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
const hasInput = computed(() => props.hasInput);
const onConfirm = computed(() => props.onConfirm);
const onCancel = computed(() => props.onCancel);
const inputAttrs = computed(() => props.inputAttrs);
// const modalOpened = ref(false); // const modalOpened = ref(false);
const prompt = ref<string>(props.hasInput ? props.inputAttrs?.value ?? "" : ""); const prompt = ref<string>(hasInput.value ? inputAttrs.value.value ?? "" : "");
const input = ref(); const input = ref();
// https://github.com/oruga-ui/oruga/issues/339 // https://github.com/oruga-ui/oruga/issues/339
const promptInputComp = computed(() => input.value?.$refs.input); const promptInputComp = computed(() => input.value?.$refs.input);
if (props.hasInput) { if (hasInput.value) {
useFocus(promptInputComp, { initialValue: true }); useFocus(promptInputComp, { initialValue: true });
} }
@ -128,7 +133,7 @@ const confirm = () => {
return; return;
} }
} }
props.onConfirm(prompt.value); onConfirm.value(prompt.value);
close(); close();
}; };
@ -144,8 +149,8 @@ const close = () => {
*/ */
const cancel = (source: string) => { const cancel = (source: string) => {
emit("cancel", source); emit("cancel", source);
if (props?.onCancel) { if (onCancel.value) {
props?.onCancel(source); onCancel.value(source);
} }
close(); close();
}; };

View File

@ -1,9 +1,10 @@
import { DELETE_EVENT, FETCH_EVENT, FETCH_EVENT_BASIC } from "@/graphql/event"; import { DELETE_EVENT, FETCH_EVENT, FETCH_EVENT_BASIC } from "@/graphql/event";
import { IEvent } from "@/types/event.model"; import { IEvent } from "@/types/event.model";
import { useMutation, useQuery } from "@vue/apollo-composable"; import { useMutation, useQuery } from "@vue/apollo-composable";
import { computed } from "vue"; import { Ref, computed, unref } from "vue";
export function useFetchEvent(uuid?: string) { export function useFetchEvent(uuidValue?: string | Ref<string>) {
const uuid = unref(uuidValue);
const { const {
result: fetchEventResult, result: fetchEventResult,
loading, loading,
@ -26,7 +27,8 @@ export function useFetchEvent(uuid?: string) {
return { event, loading, error, onError, onResult, refetch }; return { event, loading, error, onError, onResult, refetch };
} }
export function useFetchEventBasic(uuid: string) { export function useFetchEventBasic(uuidValue?: string | Ref<string>) {
const uuid = unref(uuidValue);
const { const {
result: fetchEventResult, result: fetchEventResult,
loading, loading,

View File

@ -34,10 +34,13 @@ export const checkProviderConfig = (
export const convertConfig = ( export const convertConfig = (
configs: IKeyValueConfig[] configs: IKeyValueConfig[]
): Record<string, any> => { ): Record<string, any> => {
return configs.reduce((acc, config) => { return configs.reduce(
acc[config.key] = toType(config.value, config.type); (acc, config) => {
return acc; acc[config.key] = toType(config.value, config.type);
}, {} as Record<string, any>); return acc;
},
{} as Record<string, any>
);
}; };
const toType = (value: string, type: string): string | number | boolean => { const toType = (value: string, type: string): string | number | boolean => {

View File

@ -16,6 +16,10 @@ export interface IActor {
} }
export type IMinimalActor = Pick<IActor, "preferredUsername" | "domain">; export type IMinimalActor = Pick<IActor, "preferredUsername" | "domain">;
export type IMinimalActorWithName = Pick<
IActor,
"preferredUsername" | "domain" | "name"
>;
export class Actor implements IActor { export class Actor implements IActor {
id?: string; id?: string;
@ -72,13 +76,13 @@ export function usernameWithDomain(
return actor.preferredUsername; return actor.preferredUsername;
} }
export function displayName(actor: IActor | undefined): string { export function displayName(actor: IMinimalActorWithName | undefined): string {
return actor && actor.name != null && actor.name !== "" return actor && actor.name != null && actor.name !== ""
? actor.name ? actor.name
: usernameWithDomain(actor); : usernameWithDomain(actor);
} }
export function displayNameAndUsername(actor: IActor): string { export function displayNameAndUsername(actor: IMinimalActorWithName): string {
if (actor.name) { if (actor.name) {
return `${actor.name} (@${usernameWithDomain(actor)})`; return `${actor.name} (@${usernameWithDomain(actor)})`;
} }

View File

@ -125,7 +125,8 @@
tag="a" tag="a"
icon-left="rss" icon-left="rss"
@click=" @click="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom')
" "
:href="tokenToURL(feedToken.token, 'atom')" :href="tokenToURL(feedToken.token, 'atom')"
target="_blank" target="_blank"
@ -142,7 +143,8 @@
<o-button <o-button
tag="a" tag="a"
@click=" @click="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics')
" "
icon-left="calendar-sync" icon-left="calendar-sync"
:href="tokenToURL(feedToken.token, 'ics')" :href="tokenToURL(feedToken.token, 'ics')"

View File

@ -80,8 +80,9 @@ const Editor = defineAsyncComponent(
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const { currentActor } = useCurrentActorClient(); const { currentActor } = useCurrentActorClient();
const preferredUsername = computed(() => props.preferredUsername);
const { group } = useGroup(props.preferredUsername); const { group } = useGroup(preferredUsername);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -108,9 +108,12 @@
text: comment.text, text: comment.text,
}) })
" "
@delete-comment="(comment: IComment) => deleteComment({ @delete-comment="
commentId: comment.id as string, (comment: IComment) =>
})" deleteComment({
commentId: comment.id as string,
})
"
/> />
<o-button <o-button
v-if="discussion.comments.elements.length < discussion.comments.total" v-if="discussion.comments.elements.length < discussion.comments.total"
@ -198,11 +201,11 @@ const {
subscribeToMore({ subscribeToMore({
document: DISCUSSION_COMMENT_CHANGED, document: DISCUSSION_COMMENT_CHANGED,
variables: { variables: () => ({
slug: props.slug, slug: props.slug,
page: page.value, page: page.value,
limit: COMMENTS_PER_PAGE, limit: COMMENTS_PER_PAGE,
}, }),
updateQuery( updateQuery(
previousResult: any, previousResult: any,
{ subscriptionData }: { subscriptionData: any } { subscriptionData }: { subscriptionData: any }

View File

@ -90,9 +90,10 @@ const page = useRouteQuery("page", 1, integerTransformer);
const DISCUSSIONS_PER_PAGE = 10; const DISCUSSIONS_PER_PAGE = 10;
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const preferredUsername = computed(() => props.preferredUsername);
const { group, loading: groupLoading } = useGroupDiscussionsList( const { group, loading: groupLoading } = useGroupDiscussionsList(
props.preferredUsername, preferredUsername.value,
{ {
discussionsPage: page.value, discussionsPage: page.value,
discussionsLimit: DISCUSSIONS_PER_PAGE, discussionsLimit: DISCUSSIONS_PER_PAGE,
@ -100,7 +101,7 @@ const { group, loading: groupLoading } = useGroupDiscussionsList(
); );
const { person, loading: personLoading } = usePersonStatusGroup( const { person, loading: personLoading } = usePersonStatusGroup(
props.preferredUsername preferredUsername.value
); );
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -127,7 +127,7 @@
<label class="o-field__label field-label">{{ t("Description") }}</label> <label class="o-field__label field-label">{{ t("Description") }}</label>
<editor-component <editor-component
v-if="currentActor" v-if="currentActor"
:current-actor="(currentActor as IPerson)" :current-actor="currentActor as IPerson"
v-model="event.description" v-model="event.description"
:aria-label="t('Event description body')" :aria-label="t('Event description body')"
:placeholder="t('Describe your event')" :placeholder="t('Describe your event')"

View File

@ -360,7 +360,7 @@ const {
onError: onFetchEventError, onError: onFetchEventError,
loading: eventLoading, loading: eventLoading,
refetch: refetchEvent, refetch: refetchEvent,
} = useFetchEvent(props.uuid); } = useFetchEvent(propsUUID);
watch(propsUUID, (newUUid) => { watch(propsUUID, (newUUid) => {
refetchEvent({ uuid: newUUid }); refetchEvent({ uuid: newUUid });

View File

@ -188,7 +188,7 @@
<event-participation-card <event-participation-card
v-for="participation in month[1]" v-for="participation in month[1]"
:key="participation.id" :key="participation.id"
:participation="(participation as IParticipant)" :participation="participation as IParticipant"
:options="{ hideDate: false }" :options="{ hideDate: false }"
@event-deleted="eventDeleted" @event-deleted="eventDeleted"
class="participation" class="participation"

View File

@ -83,7 +83,9 @@
detail-key="id" detail-key="id"
v-model:checked-rows="checkedRows" v-model:checked-rows="checkedRows"
checkable checkable
:is-row-checkable="(row: IParticipant) => row.role !== ParticipantRole.CREATOR" :is-row-checkable="
(row: IParticipant) => row.role !== ParticipantRole.CREATOR
"
checkbox-position="left" checkbox-position="left"
:show-detail-icon="false" :show-detail-icon="false"
:loading="participantsLoading" :loading="participantsLoading"

View File

@ -47,7 +47,7 @@
:default-sort-direction="'desc'" :default-sort-direction="'desc'"
:default-sort="['insertedAt', 'desc']" :default-sort="['insertedAt', 'desc']"
@page-change="loadMoreFollowers" @page-change="loadMoreFollowers"
@sort="(field, order) => $emit('sort', field, order)" @sort="(field: any, order: any) => $emit('sort', field, order)"
> >
<o-table-column <o-table-column
field="actor.preferredUsername" field="actor.preferredUsername"
@ -136,6 +136,8 @@ import { Notifier } from "@/plugins/notifier";
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const preferredUsername = computed(() => props.preferredUsername);
const page = useRouteQuery("page", 1, integerTransformer); const page = useRouteQuery("page", 1, integerTransformer);
const pending = useRouteQuery("pending", false, booleanTransformer); const pending = useRouteQuery("pending", false, booleanTransformer);
@ -241,5 +243,5 @@ const personMemberships = computed(
() => person.value?.memberships ?? { total: 0, elements: [] } () => person.value?.memberships ?? { total: 0, elements: [] }
); );
const { person } = usePersonStatusGroup(props.preferredUsername); const { person } = usePersonStatusGroup(preferredUsername.value);
</script> </script>

View File

@ -275,6 +275,7 @@ useHead({
}); });
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const preferredUsername = computed(() => props.preferredUsername);
const emit = defineEmits(["sort"]); const emit = defineEmits(["sort"]);
@ -440,7 +441,7 @@ const {
{ {
query: GROUP_MEMBERS, query: GROUP_MEMBERS,
variables: { variables: {
groupName: props.preferredUsername, groupName: preferredUsername.value,
page: page.value, page: page.value,
limit: MEMBERS_PER_PAGE, limit: MEMBERS_PER_PAGE,
roles: roles.value, roles: roles.value,
@ -547,5 +548,5 @@ const personMemberships = computed(
() => person.value?.memberships ?? { total: 0, elements: [] } () => person.value?.memberships ?? { total: 0, elements: [] }
); );
const { person } = usePersonStatusGroup(props.preferredUsername); const { person } = usePersonStatusGroup(preferredUsername.value);
</script> </script>

View File

@ -189,7 +189,7 @@
import PictureUpload from "@/components/PictureUpload.vue"; import PictureUpload from "@/components/PictureUpload.vue";
import { GroupVisibility, MemberRole, Openness } from "@/types/enums"; import { GroupVisibility, MemberRole, Openness } from "@/types/enums";
import { IGroup, usernameWithDomain, displayName } from "@/types/actor"; import { IGroup, usernameWithDomain, displayName } from "@/types/actor";
import { Address, IAddress } from "@/types/address.model"; import { IAddress } from "@/types/address.model";
import { ServerParseError } from "@apollo/client/link/http"; import { ServerParseError } from "@apollo/client/link/http";
import { ErrorResponse } from "@apollo/client/link/error"; import { ErrorResponse } from "@apollo/client/link/error";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
@ -218,14 +218,11 @@ const FullAddressAutoComplete = defineAsyncComponent(
); );
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const preferredUsername = computed(() => props.preferredUsername);
const { currentActor } = useCurrentActorClient(); const { currentActor } = useCurrentActorClient();
const { const { group, loading, onResult: onGroupResult } = useGroup(preferredUsername);
group,
loading,
onResult: onGroupResult,
} = useGroup(props.preferredUsername);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
@ -395,7 +392,7 @@ const personMemberships = computed(
() => person.value?.memberships ?? { total: 0, elements: [] } () => person.value?.memberships ?? { total: 0, elements: [] }
); );
const { person } = usePersonStatusGroup(props.preferredUsername); const { person } = usePersonStatusGroup(preferredUsername);
const dialog = inject<Dialog>("dialog"); const dialog = inject<Dialog>("dialog");

View File

@ -703,22 +703,22 @@ const props = defineProps<{
preferredUsername: string; preferredUsername: string;
}>(); }>();
const preferredUsername = computed(() => props.preferredUsername);
const { anonymousReportsConfig } = useAnonymousReportsConfig(); const { anonymousReportsConfig } = useAnonymousReportsConfig();
const { currentActor } = useCurrentActorClient(); const { currentActor } = useCurrentActorClient();
const { const {
group, group,
loading: groupLoading, loading: groupLoading,
refetch: refetchGroup, refetch: refetchGroup,
} = useGroup(props.preferredUsername, { afterDateTime: new Date() }); } = useGroup(preferredUsername, { afterDateTime: new Date() });
const router = useRouter(); const router = useRouter();
const { group: discussionGroup } = useGroupDiscussionsList( const { group: discussionGroup } = useGroupDiscussionsList(preferredUsername);
props.preferredUsername const { group: resourcesGroup } = useGroupResourcesList(preferredUsername, {
); resourcesPage: 1,
const { group: resourcesGroup } = useGroupResourcesList( resourcesLimit: 3,
props.preferredUsername, });
{ resourcesPage: 1, resourcesLimit: 3 }
);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -27,10 +27,12 @@
> >
<o-input <o-input
autocapitalize="characters" autocapitalize="characters"
@update:modelValue="(val: string) => inputs[i] = val.toUpperCase()" @update:modelValue="
(val: string) => (inputs[i] = val.toUpperCase())
"
:useHtml5Validation="true" :useHtml5Validation="true"
:id="`user-code-${i}`" :id="`user-code-${i}`"
:ref="(el: Element) => userCodeInputs[i] = el" :ref="(el: Element) => (userCodeInputs[i] = el)"
:modelValue="inputs[i]" :modelValue="inputs[i]"
v-else v-else
size="large" size="large"

View File

@ -169,9 +169,10 @@ const props = withDefaults(
}>(), }>(),
{ isUpdate: false } { isUpdate: false }
); );
const preferredUsername = computed(() => props.preferredUsername);
const { currentActor } = useCurrentActorClient(); const { currentActor } = useCurrentActorClient();
const { group } = useGroup(props.preferredUsername); const { group } = useGroup(preferredUsername);
const { result: postResult, loading: postLoading } = useQuery<{ const { result: postResult, loading: postLoading } = useQuery<{
post: IPost; post: IPost;

View File

@ -36,9 +36,12 @@
:resources="resource.children.elements" :resources="resource.children.elements"
:isRoot="resource.path === '/'" :isRoot="resource.path === '/'"
:group="resource.actor" :group="resource.actor"
@delete="(resourceID: string) => deleteResource({ @delete="
id: resourceID, (resourceID: string) =>
})" deleteResource({
id: resourceID,
})
"
@update="updateResource" @update="updateResource"
@rename="handleRename" @rename="handleRename"
@move="handleMove" @move="handleMove"

View File

@ -852,6 +852,7 @@ const arrayTransformer: RouteQueryTransformer<string[]> = {
const props = defineProps<{ const props = defineProps<{
tag?: string; tag?: string;
}>(); }>();
const tag = computed(() => props.tag);
const page = useRouteQuery("page", 1, integerTransformer); const page = useRouteQuery("page", 1, integerTransformer);
const eventPage = useRouteQuery("eventPage", 1, integerTransformer); const eventPage = useRouteQuery("eventPage", 1, integerTransformer);
@ -864,7 +865,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",
props.tag ? ContentType.EVENTS : ContentType.ALL, tag.value ? ContentType.EVENTS : ContentType.ALL,
enumTransformer(ContentType) enumTransformer(ContentType)
); );
@ -1286,7 +1287,7 @@ const { result: searchElementsResult, loading: searchLoading } = useQuery<{
searchGroups: Paginate<TypeNamed<IGroup>>; searchGroups: Paginate<TypeNamed<IGroup>>;
}>(SEARCH_EVENTS_AND_GROUPS, () => ({ }>(SEARCH_EVENTS_AND_GROUPS, () => ({
term: searchDebounced.value, term: searchDebounced.value,
tags: props.tag, tags: tag.value,
location: geoHashLocation.value, location: geoHashLocation.value,
beginsOn: start.value, beginsOn: start.value,
endsOn: end.value, endsOn: end.value,

View File

@ -248,10 +248,12 @@
tag="a" tag="a"
icon-left="rss" icon-left="rss"
@click=" @click="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom')
" "
@keyup.enter=" @keyup.enter="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'atom'), 'atom')
" "
:href="tokenToURL(feedToken.token, 'atom')" :href="tokenToURL(feedToken.token, 'atom')"
target="_blank" target="_blank"
@ -268,10 +270,12 @@
<o-button <o-button
tag="a" tag="a"
@click=" @click="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics')
" "
@keyup.enter=" @keyup.enter="
(e: Event) => copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics') (e: Event) =>
copyURL(e, tokenToURL(feedToken.token, 'ics'), 'ics')
" "
icon-left="calendar-sync" icon-left="calendar-sync"
:href="tokenToURL(feedToken.token, 'ics')" :href="tokenToURL(feedToken.token, 'ics')"
@ -348,10 +352,11 @@ const { result: loggedUserResult } = useQuery<{ loggedUser: IUser }>(
USER_NOTIFICATIONS USER_NOTIFICATIONS
); );
const loggedUser = computed(() => loggedUserResult.value?.loggedUser); const loggedUser = computed(() => loggedUserResult.value?.loggedUser);
const feedTokens = computed(() => const feedTokens = computed(
loggedUser.value?.feedTokens.filter( () =>
(token: IFeedToken) => token.actor === null loggedUser.value?.feedTokens.filter(
) (token: IFeedToken) => token.actor === null
)
); );
const { result: webPushEnabledResult } = useQuery<{ const { result: webPushEnabledResult } = useQuery<{

View File

@ -75,8 +75,9 @@ import { useI18n } from "vue-i18n";
import { useMutation } from "@vue/apollo-composable"; import { useMutation } from "@vue/apollo-composable";
const props = defineProps<{ preferredUsername: string }>(); const props = defineProps<{ preferredUsername: string }>();
const preferredUsername = computed(() => props.preferredUsername);
const { group } = useGroup(props.preferredUsername); const { group } = useGroup(preferredUsername);
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });

View File

@ -13,7 +13,7 @@
required required
type="email" type="email"
id="emailAddress" id="emailAddress"
v-model="credentials.email" v-model="emailValue"
/> />
</o-field> </o-field>
<p class="flex flex-wrap gap-1 mt-2"> <p class="flex flex-wrap gap-1 mt-2">
@ -34,7 +34,7 @@
{{ {{
$t( $t(
"If an account with this email exists, we just sent another confirmation email to {email}", "If an account with this email exists, we just sent another confirmation email to {email}",
{ email: credentials.email } { email: emailValue }
) )
}} }}
</o-notification> </o-notification>
@ -50,7 +50,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { RESEND_CONFIRMATION_EMAIL } from "@/graphql/auth"; import { RESEND_CONFIRMATION_EMAIL } from "@/graphql/auth";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
import { reactive, ref, computed } from "vue"; import { ref, computed } from "vue";
import { useMutation } from "@vue/apollo-composable"; import { useMutation } from "@vue/apollo-composable";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useHead } from "@vueuse/head"; import { useHead } from "@vueuse/head";
@ -62,10 +62,9 @@ useHead({
}); });
const props = withDefaults(defineProps<{ email: string }>(), { email: "" }); const props = withDefaults(defineProps<{ email: string }>(), { email: "" });
const defaultEmail = computed(() => props.email);
const credentials = reactive({ const emailValue = ref<string>(defaultEmail.value);
email: props.email,
});
const validationSent = ref(false); const validationSent = ref(false);
const error = ref(false); const error = ref(false);
@ -92,7 +91,7 @@ const resendConfirmationAction = async (e: Event): Promise<void> => {
error.value = false; error.value = false;
resendConfirmationEmail({ resendConfirmationEmail({
email: credentials.email, email: emailValue.value,
}); });
}; };
</script> </script>

View File

@ -25,7 +25,7 @@
aria-required="true" aria-required="true"
required required
type="email" type="email"
v-model="credentials.email" v-model="emailValue"
/> />
</o-field> </o-field>
<p class="control"> <p class="control">
@ -41,7 +41,7 @@
<o-notification variant="success" :closable="false" title="Success"> <o-notification variant="success" :closable="false" title="Success">
{{ {{
t("We just sent an email to {email}", { t("We just sent an email to {email}", {
email: credentials.email, email: emailValue,
}) })
}} }}
</o-notification> </o-notification>
@ -57,7 +57,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { SEND_RESET_PASSWORD } from "../../graphql/auth"; import { SEND_RESET_PASSWORD } from "../../graphql/auth";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
import { computed, reactive, ref } from "vue"; import { computed, ref } from "vue";
import { useMutation } from "@vue/apollo-composable"; import { useMutation } from "@vue/apollo-composable";
import { useHead } from "@vueuse/head"; import { useHead } from "@vueuse/head";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
@ -74,9 +74,8 @@ const props = withDefaults(
{ email: "" } { email: "" }
); );
const credentials = reactive<{ email: string }>({ const defaultEmail = computed(() => props.email);
email: props.email, const emailValue = ref<string>(defaultEmail.value);
});
const validationSent = ref(false); const validationSent = ref(false);
@ -110,7 +109,7 @@ const sendResetPasswordTokenAction = async (e: Event): Promise<void> => {
e.preventDefault(); e.preventDefault();
sendResetPasswordMutation({ sendResetPasswordMutation({
email: credentials.email, email: emailValue.value,
}); });
}; };
</script> </script>