diff --git a/js/src/components/Event/EventCard.vue b/js/src/components/Event/EventCard.vue index 127adddf3..80ab6e0d3 100644 --- a/js/src/components/Event/EventCard.vue +++ b/js/src/components/Event/EventCard.vue @@ -40,6 +40,22 @@

{{ event.title }}

+
+
+ +
+ + + {{ organizerDisplayName(event) }} + +
- + {{ event.physicalAddress.description }}, {{ event.physicalAddress.locality }} @@ -58,6 +74,13 @@ {{ event.physicalAddress.description }}
+
+ + {{ $t("Online") }} +
@@ -100,7 +123,12 @@ + diff --git a/js/src/components/Image/LazyImage.vue b/js/src/components/Image/LazyImage.vue index c5d95b7f5..22674bd2b 100644 --- a/js/src/components/Image/LazyImage.vue +++ b/js/src/components/Image/LazyImage.vue @@ -63,12 +63,14 @@ export default class LazyImage extends Vue { onEnter(): void { // Image is visible (means: has entered the viewport), // so start loading by setting the src attribute - this.image.src = this.src; + if (this.image) { + this.image.src = this.src; - this.image.onload = () => { - // Image is loaded, so start fading in - this.isLoaded = true; - }; + this.image.onload = () => { + // Image is loaded, so start fading in + this.isLoaded = true; + }; + } } @Watch("src") diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index b23f93d13..3c636ed34 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -208,12 +208,8 @@ import RouteName from "../router/name"; @Component({ apollo: { - currentUser: { - query: CURRENT_USER_CLIENT, - }, - currentActor: { - query: CURRENT_ACTOR_CLIENT, - }, + currentUser: CURRENT_USER_CLIENT, + currentActor: CURRENT_ACTOR_CLIENT, identities: { query: IDENTITIES, update: ({ identities }) => diff --git a/js/src/graphql/actor.ts b/js/src/graphql/actor.ts index eaf444e8c..427690f01 100644 --- a/js/src/graphql/actor.ts +++ b/js/src/graphql/actor.ts @@ -1,14 +1,25 @@ import gql from "graphql-tag"; +export const ACTOR_FRAGMENT = gql` + fragment ActorFragment on Actor { + id + avatar { + id + url + } + type + preferredUsername + name + domain + summary + url + } +`; + export const FETCH_PERSON = gql` query ($username: String!) { fetchPerson(preferredUsername: $username) { - id - url - name - domain - summary - preferredUsername + ...ActorFragment suspended mediaSize avatar { @@ -34,6 +45,7 @@ export const FETCH_PERSON = gql` } } } + ${ACTOR_FRAGMENT} `; export const GET_PERSON = gql` @@ -47,12 +59,7 @@ export const GET_PERSON = gql` $membershipsLimit: Int ) { person(id: $actorId) { - id - url - name - domain - summary - preferredUsername + ...ActorFragment suspended mediaSize avatar { @@ -98,14 +105,7 @@ export const GET_PERSON = gql` role insertedAt parent { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } } } @@ -115,6 +115,7 @@ export const GET_PERSON = gql` } } } + ${ACTOR_FRAGMENT} `; export const PERSON_FRAGMENT = gql` @@ -126,6 +127,7 @@ export const PERSON_FRAGMENT = gql` } type preferredUsername + domain name } `; @@ -151,17 +153,11 @@ export const LIST_PROFILES = gql` ) { total elements { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; export const UPDATE_DEFAULT_ACTOR = gql` @@ -179,12 +175,9 @@ export const CURRENT_ACTOR_CLIENT = gql` query currentActor { currentActor @client { id - avatar { - id - url - } preferredUsername name + avatar } } `; @@ -234,27 +227,10 @@ export const LOGGED_USER_PARTICIPATIONS = gql` beginsOn visibility organizerActor { - id - preferredUsername - name - domain - summary - avatar { - id - url - } + ...ActorFragment } attributedTo { - avatar { - id - url - } - preferredUsername - name - summary - domain - url - id + ...ActorFragment } participantStats { going @@ -274,20 +250,13 @@ export const LOGGED_USER_PARTICIPATIONS = gql` id role actor { - id - preferredUsername - name - domain - summary - avatar { - id - url - } + ...ActorFragment } } } } } + ${ACTOR_FRAGMENT} `; export const LOGGED_USER_DRAFTS = gql` @@ -306,14 +275,7 @@ export const LOGGED_USER_DRAFTS = gql` beginsOn visibility organizerActor { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } participantStats { going @@ -326,6 +288,7 @@ export const LOGGED_USER_DRAFTS = gql` } } } + ${ACTOR_FRAGMENT} `; export const LOGGED_USER_MEMBERSHIPS = gql` @@ -338,25 +301,10 @@ export const LOGGED_USER_MEMBERSHIPS = gql` id role actor { - id - avatar { - id - url - } - preferredUsername - name - domain + ...ActorFragment } parent { - id - preferredUsername - domain - name - type - avatar { - id - url - } + ...ActorFragment organizedEvents { elements { id @@ -370,34 +318,22 @@ export const LOGGED_USER_MEMBERSHIPS = gql` } } invitedBy { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } } } } } + ${ACTOR_FRAGMENT} `; export const IDENTITIES = gql` query Identities { identities { - id - avatar { - id - url - } - type - preferredUsername - name + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const PERSON_MEMBERSHIPS = gql` @@ -410,20 +346,10 @@ export const PERSON_MEMBERSHIPS = gql` id role parent { - id - preferredUsername - name - domain - type - avatar { - id - url - } + ...ActorFragment } invitedBy { - id - preferredUsername - name + ...ActorFragment } insertedAt updatedAt @@ -431,6 +357,7 @@ export const PERSON_MEMBERSHIPS = gql` } } } + ${ACTOR_FRAGMENT} `; export const PERSON_STATUS_GROUP = gql` @@ -443,19 +370,10 @@ export const PERSON_STATUS_GROUP = gql` id role parent { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } invitedBy { - id - preferredUsername - name + ...ActorFragment } insertedAt updatedAt @@ -468,24 +386,10 @@ export const PERSON_STATUS_GROUP = gql` notify approved target_actor { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } actor { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } insertedAt updatedAt @@ -493,6 +397,7 @@ export const PERSON_STATUS_GROUP = gql` } } } + ${ACTOR_FRAGMENT} `; export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql` @@ -508,19 +413,10 @@ export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql` id role parent { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } invitedBy { - id - preferredUsername - name + ...ActorFragment } insertedAt updatedAt @@ -528,6 +424,7 @@ export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql` } } } + ${ACTOR_FRAGMENT} `; export const CREATE_PERSON = gql` @@ -543,16 +440,10 @@ export const CREATE_PERSON = gql` summary: $summary avatar: $avatar ) { - id - preferredUsername - name - summary - avatar { - id - url - } + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const UPDATE_PERSON = gql` @@ -563,16 +454,10 @@ export const UPDATE_PERSON = gql` $avatar: MediaInput ) { updatePerson(id: $id, name: $name, summary: $summary, avatar: $avatar) { - id - preferredUsername - name - summary - avatar { - id - url - } + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const DELETE_PERSON = gql` @@ -600,16 +485,10 @@ export const REGISTER_PERSON = gql` summary: $summary email: $email ) { - id - preferredUsername - name - summary - avatar { - id - url - } + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const SUSPEND_PROFILE = gql` diff --git a/js/src/graphql/admin.ts b/js/src/graphql/admin.ts index 5dac4ea00..acb3f73b1 100644 --- a/js/src/graphql/admin.ts +++ b/js/src/graphql/admin.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const DASHBOARD = gql` query { @@ -14,14 +15,7 @@ export const DASHBOARD = gql` } } lastGroupCreated { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } numberOfUsers numberOfEvents @@ -33,31 +27,23 @@ export const DASHBOARD = gql` numberOfConfirmedParticipationsToLocalEvents } } + ${ACTOR_FRAGMENT} `; export const RELAY_FRAGMENT = gql` fragment relayFragment on Follower { id actor { - id - preferredUsername - name - domain - type - summary + ...ActorFragment } targetActor { - id - preferredUsername - name - domain - type - summary + ...ActorFragment } approved insertedAt updatedAt } + ${ACTOR_FRAGMENT} `; export const RELAY_FOLLOWERS = gql` diff --git a/js/src/graphql/comment.ts b/js/src/graphql/comment.ts index dd6b6df4c..350a9cf38 100644 --- a/js/src/graphql/comment.ts +++ b/js/src/graphql/comment.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const COMMENT_FIELDS_FRAGMENT_NAME = "CommentFields"; export const COMMENT_FIELDS_FRAGMENT = gql` @@ -10,15 +11,7 @@ export const COMMENT_FIELDS_FRAGMENT = gql` visibility local actor { - avatar { - id - url - } - id - domain - preferredUsername - name - summary + ...ActorFragment } totalReplies insertedAt @@ -26,6 +19,7 @@ export const COMMENT_FIELDS_FRAGMENT = gql` deletedAt isAnnouncement } + ${ACTOR_FRAGMENT} `; export const COMMENT_RECURSIVE_FRAGMENT = gql` diff --git a/js/src/graphql/discussion.ts b/js/src/graphql/discussion.ts index ef66d22c6..1d14933b7 100644 --- a/js/src/graphql/discussion.ts +++ b/js/src/graphql/discussion.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const DISCUSSION_BASIC_FIELDS_FRAGMENT = gql` fragment DiscussionBasicFields on Discussion { @@ -11,18 +12,13 @@ export const DISCUSSION_BASIC_FIELDS_FRAGMENT = gql` id text actor { - id - preferredUsername - domain - avatar { - id - url - } + ...ActorFragment } publishedAt deletedAt } } + ${ACTOR_FRAGMENT} `; export const DISCUSSION_FIELDS_FOR_REPLY_FRAGMENT = gql` @@ -35,26 +31,17 @@ export const DISCUSSION_FIELDS_FOR_REPLY_FRAGMENT = gql` text updatedAt actor { - id - preferredUsername - domain - avatar { - id - url - } + ...ActorFragment } } actor { - id - preferredUsername - domain + ...ActorFragment } creator { - id - preferredUsername - domain + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const DISCUSSION_FIELDS_FRAGMENT = gql` @@ -70,28 +57,17 @@ export const DISCUSSION_FIELDS_FRAGMENT = gql` deletedAt publishedAt actor { - id - domain - name - preferredUsername - avatar { - url - } + ...ActorFragment } } actor { - id - domain - name - preferredUsername + ...ActorFragment } creator { - id - domain - name - preferredUsername + ...ActorFragment } } + ${ACTOR_FRAGMENT} `; export const CREATE_DISCUSSION = gql` @@ -121,14 +97,7 @@ export const GET_DISCUSSION = gql` id text actor { - id - avatar { - id - url - } - name - domain - preferredUsername + ...ActorFragment } insertedAt updatedAt @@ -140,6 +109,7 @@ export const GET_DISCUSSION = gql` } } ${DISCUSSION_FIELDS_FRAGMENT} + ${ACTOR_FRAGMENT} `; export const UPDATE_DISCUSSION = gql` @@ -171,16 +141,10 @@ export const DISCUSSION_COMMENT_CHANGED = gql` deletedAt publishedAt actor { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } } } } + ${ACTOR_FRAGMENT} `; diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts index 7f3e52ad4..10d8aefba 100644 --- a/js/src/graphql/event.ts +++ b/js/src/graphql/event.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; import { ADDRESS_FRAGMENT } from "./address"; import { TAG_FRAGMENT } from "./tags"; @@ -7,14 +8,7 @@ const PARTICIPANT_QUERY_FRAGMENT = gql` role id actor { - preferredUsername - avatar { - id - url - } - name - id - domain + ...ActorFragment } event { id @@ -26,6 +20,7 @@ const PARTICIPANT_QUERY_FRAGMENT = gql` } insertedAt } + ${ACTOR_FRAGMENT} `; const PARTICIPANTS_QUERY_FRAGMENT = gql` @@ -38,7 +33,7 @@ const PARTICIPANTS_QUERY_FRAGMENT = gql` ${PARTICIPANT_QUERY_FRAGMENT} `; -const EVENT_OPTIONS_FRAGMENT = gql` +export const EVENT_OPTIONS_FRAGMENT = gql` fragment EventOptions on EventOptions { maximumAttendeeCapacity remainingAttendeeCapacity @@ -97,40 +92,13 @@ const FULL_EVENT_FRAGMENT = gql` ...AdressFragment } organizerActor { - avatar { - id - url - } - preferredUsername - domain - name - url - id - summary + ...ActorFragment } contacts { - avatar { - id - url - } - preferredUsername - name - summary - domain - url - id + ...ActorFragment } attributedTo { - avatar { - id - url - } - preferredUsername - name - summary - domain - url - id + ...ActorFragment } participantStats { going @@ -156,18 +124,19 @@ const FULL_EVENT_FRAGMENT = gql` } } physicalAddress { - id - description + ...AdressFragment } organizerActor { - id - avatar { - id - url - } - preferredUsername - domain - name + ...ActorFragment + } + attributedTo { + ...ActorFragment + } + options { + ...EventOptions + } + tags { + ...TagFragment } } options { @@ -183,6 +152,7 @@ const FULL_EVENT_FRAGMENT = gql` ${ADDRESS_FRAGMENT} ${TAG_FRAGMENT} ${EVENT_OPTIONS_FRAGMENT} + ${ACTOR_FRAGMENT} `; export const FETCH_EVENT = gql` @@ -244,36 +214,28 @@ export const FETCH_EVENTS = gql` # online_address, # phone_address, physicalAddress { - id - description - locality + ...AdressFragment } organizerActor { - id - avatar { - id - url - } - preferredUsername - domain - name + ...ActorFragment } attributedTo { - avatar { - id - url - } - preferredUsername - name + ...ActorFragment } category tags { ...TagFragment } + options { + ...EventOptions + } } } } + ${ADDRESS_FRAGMENT} ${TAG_FRAGMENT} + ${EVENT_OPTIONS_FRAGMENT} + ${ACTOR_FRAGMENT} `; export const CREATE_EVENT = gql` @@ -514,10 +476,7 @@ export const FETCH_GROUP_EVENTS = gql` $organisedEventslimit: Int ) { group(preferredUsername: $name) { - id - preferredUsername - domain - name + ...ActorFragment organizedEvents( afterDatetime: $afterDateTime beforeDatetime: $beforeDateTime @@ -538,22 +497,17 @@ export const FETCH_GROUP_EVENTS = gql` notApproved } attributedTo { - id - preferredUsername - name - domain + ...ActorFragment } organizerActor { - id - preferredUsername - name - domain + ...ActorFragment } } total } } } + ${ACTOR_FRAGMENT} `; export const CLOSE_EVENTS = gql` @@ -570,13 +524,28 @@ export const CLOSE_EVENTS = gql` url } tags { - slug - title + ...TagFragment + } + options { + ...EventOptions + } + physicalAddress { + ...AdressFragment + } + attributedTo { + ...ActorFragment + } + organizerActor { + ...ActorFragment } __typename } } } + ${ADDRESS_FRAGMENT} + ${TAG_FRAGMENT} + ${EVENT_OPTIONS_FRAGMENT} + ${ACTOR_FRAGMENT} `; export const EXPORT_EVENT_PARTICIPATIONS = gql` diff --git a/js/src/graphql/followers.ts b/js/src/graphql/followers.ts index cc43afe09..c72f67e06 100644 --- a/js/src/graphql/followers.ts +++ b/js/src/graphql/followers.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const GROUP_FOLLOWERS = gql` query ( @@ -8,10 +9,7 @@ export const GROUP_FOLLOWERS = gql` $approved: Boolean ) { group(preferredUsername: $name) { - id - preferredUsername - name - domain + ...ActorFragment followers( page: $followersPage limit: $followersLimit @@ -21,14 +19,7 @@ export const GROUP_FOLLOWERS = gql` elements { id actor { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } approved insertedAt @@ -37,6 +28,7 @@ export const GROUP_FOLLOWERS = gql` } } } + ${ACTOR_FRAGMENT} `; export const UPDATE_FOLLOWER = gql` diff --git a/js/src/graphql/group.ts b/js/src/graphql/group.ts index eea47ede7..09a702326 100644 --- a/js/src/graphql/group.ts +++ b/js/src/graphql/group.ts @@ -2,6 +2,7 @@ import gql from "graphql-tag"; import { DISCUSSION_BASIC_FIELDS_FRAGMENT } from "./discussion"; import { RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT } from "./resources"; import { POST_BASIC_FIELDS } from "./post"; +import { ACTOR_FRAGMENT } from "./actor"; export const LIST_GROUPS = gql` query ListGroups( @@ -23,12 +24,7 @@ export const LIST_GROUPS = gql` limit: $limit ) { elements { - id - url - name - domain - summary - preferredUsername + ...ActorFragment suspended avatar { id @@ -51,16 +47,12 @@ export const LIST_GROUPS = gql` total } } + ${ACTOR_FRAGMENT} `; export const GROUP_FIELDS_FRAGMENTS = gql` fragment GroupFullFields on Group { - id - url - name - domain - summary - preferredUsername + ...ActorFragment suspended visibility openness @@ -117,16 +109,10 @@ export const GROUP_FIELDS_FRAGMENTS = gql` notApproved } attributedTo { - id - preferredUsername - name - domain + ...ActorFragment } organizerActor { - id - preferredUsername - name - domain + ...ActorFragment } } total @@ -148,14 +134,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql` id role actor { - id - name - domain - preferredUsername - avatar { - id - url - } + ...ActorFragment } insertedAt } @@ -197,6 +176,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql` total } } + ${ACTOR_FRAGMENT} `; export const FETCH_GROUP = gql` @@ -263,21 +243,14 @@ export const CREATE_GROUP = gql` banner: $banner avatar: $avatar ) { - id - preferredUsername - name - domain - summary - avatar { - id - url - } + ...ActorFragment banner { id url } } } + ${ACTOR_FRAGMENT} `; export const UPDATE_GROUP = gql` @@ -303,23 +276,17 @@ export const UPDATE_GROUP = gql` physicalAddress: $physicalAddress manuallyApprovesFollowers: $manuallyApprovesFollowers ) { - id - preferredUsername - name - summary + ...ActorFragment visibility openness manuallyApprovesFollowers - avatar { - id - url - } banner { id url } } } + ${ACTOR_FRAGMENT} `; export const DELETE_GROUP = gql` @@ -355,10 +322,7 @@ export const GROUP_TIMELINE = gql` $limit: Int ) { group(preferredUsername: $preferredUsername) { - id - preferredUsername - domain - name + ...ActorFragment activity(type: $type, author: $author, page: $page, limit: $limit) { total elements { @@ -371,18 +335,10 @@ export const GROUP_TIMELINE = gql` } type author { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } group { - id - preferredUsername + ...ActorFragment } object { ... on Event { @@ -396,14 +352,7 @@ export const GROUP_TIMELINE = gql` ... on Member { id actor { - id - name - preferredUsername - domain - avatar { - id - url - } + ...ActorFragment } } ... on Resource { @@ -421,11 +370,7 @@ export const GROUP_TIMELINE = gql` id } ... on Group { - id - preferredUsername - domain - name - summary + ...ActorFragment visibility openness physicalAddress { @@ -433,9 +378,7 @@ export const GROUP_TIMELINE = gql` } banner { id - } - avatar { - id + url } } } @@ -443,4 +386,5 @@ export const GROUP_TIMELINE = gql` } } } + ${ACTOR_FRAGMENT} `; diff --git a/js/src/graphql/home.ts b/js/src/graphql/home.ts index 93cbdcfa4..e5a059ec0 100644 --- a/js/src/graphql/home.ts +++ b/js/src/graphql/home.ts @@ -62,7 +62,7 @@ export const HOME_USER_QUERIES = gql` } } } - followGroupEvents { + followedGroupEvents { total elements { profile { diff --git a/js/src/graphql/member.ts b/js/src/graphql/member.ts index 305ae7239..bf6bda441 100644 --- a/js/src/graphql/member.ts +++ b/js/src/graphql/member.ts @@ -1,31 +1,19 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const MEMBER_FRAGMENT = gql` fragment MemberFragment on Member { id role parent { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } actor { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } insertedAt } + ${ACTOR_FRAGMENT} `; export const INVITE_MEMBER = gql` @@ -57,24 +45,13 @@ export const REJECT_INVITATION = gql` export const GROUP_MEMBERS = gql` query ($name: String!, $roles: String, $page: Int, $limit: Int) { group(preferredUsername: $name) { - id - url - name - domain - preferredUsername + ...ActorFragment members(page: $page, limit: $limit, roles: $roles) { elements { id role actor { - id - name - domain - preferredUsername - avatar { - id - url - } + ...ActorFragment } insertedAt } @@ -82,6 +59,7 @@ export const GROUP_MEMBERS = gql` } } } + ${ACTOR_FRAGMENT} `; export const UPDATE_MEMBER = gql` diff --git a/js/src/graphql/post.ts b/js/src/graphql/post.ts index 556fe01f2..54ec058b0 100644 --- a/js/src/graphql/post.ts +++ b/js/src/graphql/post.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; import { TAG_FRAGMENT } from "./tags"; export const POST_FRAGMENT = gql` @@ -10,24 +11,10 @@ export const POST_FRAGMENT = gql` body draft author { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } attributedTo { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } insertedAt updatedAt @@ -49,6 +36,7 @@ export const POST_FRAGMENT = gql` } } ${TAG_FRAGMENT} + ${ACTOR_FRAGMENT} `; export const POST_BASIC_FIELDS = gql` @@ -58,24 +46,10 @@ export const POST_BASIC_FIELDS = gql` slug url author { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } attributedTo { - id - preferredUsername - name - domain - avatar { - id - url - } + ...ActorFragment } insertedAt updatedAt @@ -88,15 +62,13 @@ export const POST_BASIC_FIELDS = gql` name } } + ${ACTOR_FRAGMENT} `; export const FETCH_GROUP_POSTS = gql` query GroupPosts($preferredUsername: String!, $page: Int, $limit: Int) { group(preferredUsername: $preferredUsername) { - id - preferredUsername - domain - name + ...ActorFragment posts(page: $page, limit: $limit) { total elements { diff --git a/js/src/graphql/report.ts b/js/src/graphql/report.ts index bc842070c..3fcffe8e8 100644 --- a/js/src/graphql/report.ts +++ b/js/src/graphql/report.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const REPORTS = gql` query Reports($status: ReportStatus, $page: Int, $limit: Int) { @@ -7,25 +8,10 @@ export const REPORTS = gql` elements { id reported { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } reporter { - id - preferredUsername - name - avatar { - id - url - } - domain - type + ...ActorFragment } event { id @@ -41,31 +27,17 @@ export const REPORTS = gql` } } } + ${ACTOR_FRAGMENT} `; const REPORT_FRAGMENT = gql` fragment ReportFragment on Report { id reported { - id - preferredUsername - name - avatar { - id - url - } - domain + ...ActorFragment } reporter { - id - preferredUsername - name - avatar { - id - url - } - domain - type + ...ActorFragment } event { id @@ -81,27 +53,14 @@ const REPORT_FRAGMENT = gql` id text actor { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } } notes { id content moderator { - id - preferredUsername - name - avatar { - id - url - } + ...ActorFragment } insertedAt } @@ -110,6 +69,7 @@ const REPORT_FRAGMENT = gql` status content } + ${ACTOR_FRAGMENT} `; export const REPORT = gql` @@ -167,13 +127,7 @@ export const LOGS = gql` id action actor { - id - preferredUsername - domain - avatar { - id - url - } + ...ActorFragment } object { ... on Report { @@ -197,23 +151,14 @@ export const LOGS = gql` uuid } actor { - id - preferredUsername - domain - name + ...ActorFragment } } ... on Person { - id - preferredUsername - domain - name + ...ActorFragment } ... on Group { - id - preferredUsername - domain - name + ...ActorFragment } ... on User { id @@ -226,4 +171,5 @@ export const LOGS = gql` total } } + ${ACTOR_FRAGMENT} `; diff --git a/js/src/graphql/resources.ts b/js/src/graphql/resources.ts index 44d1168f0..ecc5523eb 100644 --- a/js/src/graphql/resources.ts +++ b/js/src/graphql/resources.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT = gql` fragment ResourceMetadataBasicFields on ResourceMetadata { @@ -38,10 +39,7 @@ export const GET_RESOURCE = gql` type } actor { - id - preferredUsername - name - domain + ...ActorFragment } children(page: $page, limit: $limit) { total @@ -68,6 +66,7 @@ export const GET_RESOURCE = gql` } } } + ${ACTOR_FRAGMENT} ${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT} `; diff --git a/js/src/graphql/search.ts b/js/src/graphql/search.ts index 042fdf92e..b2f18ec6c 100644 --- a/js/src/graphql/search.ts +++ b/js/src/graphql/search.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const SEARCH_EVENTS = gql` query SearchEvents( @@ -58,18 +59,11 @@ export const SEARCH_GROUPS = gql` ) { total elements { - id - avatar { - id - url - } - domain - preferredUsername - name - __typename + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; export const SEARCH_PERSONS = gql` @@ -77,18 +71,11 @@ export const SEARCH_PERSONS = gql` searchPersons(term: $searchText, page: $page, limit: $limit) { total elements { - id - avatar { - id - url - } - domain - preferredUsername - name - __typename + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; export const INTERACT = gql` @@ -110,16 +97,9 @@ export const INTERACT = gql` __typename } ... on Group { - id - avatar { - id - url - } - domain - preferredUsername - name - __typename + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; diff --git a/js/src/graphql/todos.ts b/js/src/graphql/todos.ts index dd3502ad3..cc704339c 100644 --- a/js/src/graphql/todos.ts +++ b/js/src/graphql/todos.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const GET_TODO = gql` query GetTodo($id: ID!) { @@ -9,26 +10,17 @@ export const GET_TODO = gql` dueDate todoList { actor { - id - preferredUsername - domain - name + ...ActorFragment } title id } assignedTo { - id - preferredUsername - domain - name - avatar { - id - url - } + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; export const FETCH_TODO_LIST = gql` @@ -43,21 +35,17 @@ export const FETCH_TODO_LIST = gql` title status assignedTo { - id - preferredUsername - domain + ...ActorFragment } dueDate } } actor { - id - preferredUsername - domain - name + ...ActorFragment } } } + ${ACTOR_FRAGMENT} `; export const CREATE_TODO_LIST = gql` diff --git a/js/src/graphql/user.ts b/js/src/graphql/user.ts index 0f0e7e373..8d0a8bce9 100644 --- a/js/src/graphql/user.ts +++ b/js/src/graphql/user.ts @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { ACTOR_FRAGMENT } from "./actor"; export const CREATE_USER = gql` mutation CreateUser($email: String!, $password: String!, $locale: String) { @@ -18,17 +19,12 @@ export const VALIDATE_USER = gql` id email defaultActor { - id - preferredUsername - name - avatar { - id - url - } + ...ActorFragment } } } } + ${ACTOR_FRAGMENT} `; export const LOGGED_USER = gql` @@ -37,17 +33,12 @@ export const LOGGED_USER = gql` id email defaultActor { - id - preferredUsername - name - avatar { - id - url - } + ...ActorFragment } provider } } + ${ACTOR_FRAGMENT} `; export const CHANGE_PASSWORD = gql` @@ -228,14 +219,7 @@ export const LIST_USERS = gql` confirmedAt disabled actors { - id - preferredUsername - avatar { - id - url - } - name - summary + ...ActorFragment } settings { timezone @@ -243,6 +227,7 @@ export const LIST_USERS = gql` } } } + ${ACTOR_FRAGMENT} `; export const GET_USER = gql` @@ -263,13 +248,7 @@ export const GET_USER = gql` id } actors { - id - preferredUsername - name - avatar { - id - url - } + ...ActorFragment } participations { total @@ -277,6 +256,7 @@ export const GET_USER = gql` role } } + ${ACTOR_FRAGMENT} `; export const UPDATE_USER_LOCALE = gql` diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index d7027ea80..29d566f6a 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -1202,6 +1202,13 @@ "{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})", "Back to top": "Back to top", "Powered by Mobilizon": "Powered by Mobilizon", - "Instance follows": "Instance follows", - "The event is fully online": "The event is fully online" + "The event is fully online": "The event is fully online", + "Follow": "Follow", + "Cancel follow request": "Cancel follow request", + "Unfollow": "Unfollow", + "your notification settings": "your notification settings", + "You will receive notifications about this group's public activity depending on %{notification_settings}.": "You will receive notifications about this group's public activity depending on %{notification_settings}.", + "Recent events from your groups": "Recent events from your groups", + "Online": "Online", + "That you follow or of which you are a member": "That you follow or of which you are a member" } diff --git a/js/src/i18n/es.json b/js/src/i18n/es.json index c1e97c9a0..9eba48260 100644 --- a/js/src/i18n/es.json +++ b/js/src/i18n/es.json @@ -488,7 +488,6 @@ "Instance administrator": "Administrador de instancia", "Instance configuration": "Configuración de instancia", "Instance feeds": "Flujos de instancias", - "Instance follows": "La instancia sigue", "Instance languages": "Idiomas de instancia", "Instance rules": "Reglas de instancia", "Instance settings": "Configuraciones de instancia", diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index d29910fc4..fb97c197c 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -1308,6 +1308,13 @@ "{timezoneLongName} ({timezoneShortName})": "{timezoneLongName} ({timezoneShortName})", "Back to top": "Retour en haut", "Powered by Mobilizon": "Propulsé par Mobilizon", - "Instance follows": "Abonnements de l'instance", - "The event is fully online": "L'événement est entièrement en ligne" + "The event is fully online": "L'événement est entièrement en ligne", + "Follow": "Suivre", + "Cancel follow request": "Annuler la demande de suivi", + "Unfollow": "Ne plus suivre", + "your notification settings": "vos paramètres de notification", + "You will receive notifications about this group's public activity depending on %{notification_settings}.": "Vous recevrez des notifications à propos de l'activité publique de ce groupe en fonction de %{notification_settings}.", + "Recent events from your groups": "Événements récents de vos groupes", + "Online": "En ligne", + "That you follow or of which you are a member": "Que vous suivez ou dont vous êtes membre" } diff --git a/js/src/types/event.model.ts b/js/src/types/event.model.ts index 4574e2d3e..e96c2601a 100644 --- a/js/src/types/event.model.ts +++ b/js/src/types/event.model.ts @@ -4,7 +4,7 @@ import type { ITag } from "@/types/tag.model"; import type { IMedia } from "@/types/media.model"; import type { IComment } from "@/types/comment.model"; import type { Paginate } from "@/types/paginate"; -import { Actor, Group } from "./actor"; +import { Actor, displayName, Group } from "./actor"; import type { IActor, IGroup, IPerson } from "./actor"; import type { IParticipant } from "./participant.model"; import { EventOptions } from "./event-options.model"; @@ -257,3 +257,21 @@ export function toEditJSON(event: IEditableEvent): IEventEditJSON { })), }; } + +export function organizer(event: IEvent): IActor | null { + if (event.attributedTo) { + return event.attributedTo; + } + if (event.organizerActor) { + return event.organizerActor; + } + return null; +} + +export function organizerDisplayName(event: IEvent): string | null { + const organizerActor = organizer(event); + if (organizerActor) { + return displayName(organizerActor); + } + return null; +} diff --git a/js/src/views/Admin/Follows.vue b/js/src/views/Admin/Follows.vue index 50ce67eba..aae1acecd 100644 --- a/js/src/views/Admin/Follows.vue +++ b/js/src/views/Admin/Follows.vue @@ -89,7 +89,7 @@ import RouteName from "../../router/name"; }, metaInfo() { return { - title: this.$t("Instance follows") as string, + title: this.$t("Federation") as string, }; }, }) diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 609223fbe..3756830e3 100755 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -345,15 +345,7 @@

{{ $t("These events may interest you") }}

-
-
- -
-
+