From 0a3771902940767d3c55de5000f2b94efc7299c5 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 13 Nov 2021 15:58:54 +0100 Subject: [PATCH] Expose content language in HTML Signed-off-by: Thomas Citharel --- js/src/components/Comment/Comment.vue | 7 ++++++- js/src/components/Event/EventCard.vue | 7 ++++++- js/src/components/Event/EventMinimalistCard.vue | 2 +- js/src/components/Event/EventParticipationCard.vue | 4 +++- js/src/components/Post/PostListItem.vue | 4 +++- js/src/graphql/comment.ts | 1 + js/src/graphql/event.ts | 3 +++ js/src/graphql/group.ts | 1 + js/src/graphql/home.ts | 3 +++ js/src/graphql/post.ts | 2 ++ js/src/types/event.model.ts | 4 ++++ js/src/views/Event/Event.vue | 8 +++++++- js/src/views/Posts/Post.vue | 9 +++++++-- .../unit/specs/components/Post/PostListItem.spec.ts | 1 + .../Post/__snapshots__/PostListItem.spec.ts.snap | 12 +++++++++--- js/tests/unit/specs/mocks/event.ts | 3 +++ 16 files changed, 60 insertions(+), 11 deletions(-) diff --git a/js/src/components/Comment/Comment.vue b/js/src/components/Comment/Comment.vue index d450f99e..569134f6 100644 --- a/js/src/components/Comment/Comment.vue +++ b/js/src/components/Comment/Comment.vue @@ -63,7 +63,12 @@
-
+
{{ $t("[This comment has been deleted]") }}

diff --git a/js/src/components/Event/EventCard.vue b/js/src/components/Event/EventCard.vue index 3f8ba21f..541b1c4a 100644 --- a/js/src/components/Event/EventCard.vue +++ b/js/src/components/Event/EventCard.vue @@ -39,7 +39,12 @@ />

-

+

{{ event.title }}

diff --git a/js/src/components/Event/EventMinimalistCard.vue b/js/src/components/Event/EventMinimalistCard.vue index be0e4781..549c63db 100644 --- a/js/src/components/Event/EventMinimalistCard.vue +++ b/js/src/components/Event/EventMinimalistCard.vue @@ -17,7 +17,7 @@
-

+

-

{{ participation.event.title }}

+

+ {{ participation.event.title }} +

-

{{ post.title }}

+

+ {{ post.title }} +

{{ diff --git a/js/src/graphql/comment.ts b/js/src/graphql/comment.ts index 350a9cf3..8fa835b1 100644 --- a/js/src/graphql/comment.ts +++ b/js/src/graphql/comment.ts @@ -18,6 +18,7 @@ export const COMMENT_FIELDS_FRAGMENT = gql` updatedAt deletedAt isAnnouncement + language } ${ACTOR_FRAGMENT} `; diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts index c45fd44d..01de31ba 100644 --- a/js/src/graphql/event.ts +++ b/js/src/graphql/event.ts @@ -22,6 +22,7 @@ const FULL_EVENT_FRAGMENT = gql` visibility joinOptions draft + language picture { id url @@ -60,6 +61,7 @@ const FULL_EVENT_FRAGMENT = gql` uuid title beginsOn + language picture { id url @@ -153,6 +155,7 @@ export const FETCH_EVENTS = gql` status visibility insertedAt + language picture { id url diff --git a/js/src/graphql/group.ts b/js/src/graphql/group.ts index 6ff9ac71..fbc085d1 100644 --- a/js/src/graphql/group.ts +++ b/js/src/graphql/group.ts @@ -105,6 +105,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql` title beginsOn draft + language options { maximumAttendeeCapacity } diff --git a/js/src/graphql/home.ts b/js/src/graphql/home.ts index ae2b6cfc..9fda5024 100644 --- a/js/src/graphql/home.ts +++ b/js/src/graphql/home.ts @@ -37,6 +37,7 @@ export const HOME_USER_QUERIES = gql` } beginsOn visibility + language organizerActor { ...ActorFragment } @@ -79,6 +80,7 @@ export const HOME_USER_QUERIES = gql` picture { url } + language attributedTo { ...ActorFragment } @@ -129,6 +131,7 @@ export const CLOSE_CONTENT = gql` id url } + language tags { ...TagFragment } diff --git a/js/src/graphql/post.ts b/js/src/graphql/post.ts index b7ccc7bd..0b125ccf 100644 --- a/js/src/graphql/post.ts +++ b/js/src/graphql/post.ts @@ -21,6 +21,7 @@ export const POST_FRAGMENT = gql` publishAt draft visibility + language tags { ...TagFragment } @@ -56,6 +57,7 @@ export const POST_BASIC_FIELDS = gql` publishAt draft visibility + language picture { id url diff --git a/js/src/types/event.model.ts b/js/src/types/event.model.ts index 35899be1..e091af11 100644 --- a/js/src/types/event.model.ts +++ b/js/src/types/event.model.ts @@ -90,6 +90,7 @@ export interface IEvent { options: IEventOptions; metadata: IEventMetadata[]; contacts: IActor[]; + language: string; toEditJSON(): IEventEditJSON; } @@ -134,6 +135,8 @@ export class EventModel implements IEvent { publishAt = new Date(); + language = "und"; + participantStats = { notApproved: 0, notConfirmed: 0, @@ -210,6 +213,7 @@ export class EventModel implements IEvent { this.tags = hash.tags; this.metadata = hash.metadata; + this.language = hash.language; if (hash.options) this.options = hash.options; } diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index c4c51fcc..99a77a83 100755 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -10,7 +10,12 @@