diff --git a/js/src/components/Event/DateTimePicker.vue b/js/src/components/Event/DateTimePicker.vue index d20fac8eb..94cab473b 100644 --- a/js/src/components/Event/DateTimePicker.vue +++ b/js/src/components/Event/DateTimePicker.vue @@ -83,16 +83,16 @@ export default class DateTimePicker extends Vue { localeMonthNamesProxy = localeMonthNames(); @Watch("value") - updateValue() { + updateValue(): void { this.dateWithTime = this.value; } @Watch("dateWithTime") - updateDateWithTimeWatcher() { + updateDateWithTimeWatcher(): void { this.updateDateTime(); } - updateDateTime() { + updateDateTime(): void { /** * Returns the updated date * @@ -115,6 +115,7 @@ export default class DateTimePicker extends Vue { return null; } + // eslint-disable-next-line class-methods-use-this private datesAreOnSameDay(first: Date, second: Date): boolean { return ( first.getFullYear() === second.getFullYear() && diff --git a/js/src/components/Post/PostElementItem.vue b/js/src/components/Post/PostElementItem.vue new file mode 100644 index 000000000..6a76998c7 --- /dev/null +++ b/js/src/components/Post/PostElementItem.vue @@ -0,0 +1,107 @@ + + + diff --git a/js/src/filters/datetime.ts b/js/src/filters/datetime.ts index e470d21ee..b8056b44c 100644 --- a/js/src/filters/datetime.ts +++ b/js/src/filters/datetime.ts @@ -1,3 +1,5 @@ +import { DateTimeFormatOptions } from "vue-i18n"; + function parseDateTime(value: string): Date { return new Date(value); } @@ -16,19 +18,21 @@ function formatTimeString(value: string): string { } function formatDateTimeString(value: string, showTime = true): string { - const options = { - weekday: "long", + const options: DateTimeFormatOptions = { + weekday: undefined, year: "numeric", month: "long", day: "numeric", - hour: "numeric", - minute: "numeric", + hour: undefined, + minute: undefined, }; if (showTime) { + options.weekday = "long"; options.hour = "numeric"; options.minute = "numeric"; } - return parseDateTime(value).toLocaleTimeString(undefined, options); + const format = new Intl.DateTimeFormat(undefined, options); + return format.format(parseDateTime(value)); } export { formatDateString, formatTimeString, formatDateTimeString }; diff --git a/js/src/graphql/post.ts b/js/src/graphql/post.ts index 5f81570ff..5155eb9c8 100644 --- a/js/src/graphql/post.ts +++ b/js/src/graphql/post.ts @@ -34,6 +34,11 @@ export const POST_FRAGMENT = gql` tags { ...TagFragment } + picture { + id + url + name + } } ${TAG_FRAGMENT} `; @@ -48,6 +53,7 @@ export const POST_BASIC_FIELDS = gql` id preferredUsername name + domain avatar { url } @@ -56,6 +62,7 @@ export const POST_BASIC_FIELDS = gql` id preferredUsername name + domain avatar { url } @@ -64,6 +71,12 @@ export const POST_BASIC_FIELDS = gql` updatedAt publishAt draft + visibility + picture { + id + url + name + } } `; @@ -102,6 +115,7 @@ export const CREATE_POST = gql` $visibility: PostVisibility $draft: Boolean $tags: [String] + $picture: PictureInput ) { createPost( title: $title @@ -110,6 +124,7 @@ export const CREATE_POST = gql` visibility: $visibility draft: $draft tags: $tags + picture: $picture ) { ...PostFragment } @@ -126,6 +141,7 @@ export const UPDATE_POST = gql` $visibility: PostVisibility $draft: Boolean $tags: [String] + $picture: PictureInput ) { updatePost( id: $id @@ -135,6 +151,7 @@ export const UPDATE_POST = gql` visibility: $visibility draft: $draft tags: $tags + picture: $picture ) { ...PostFragment } diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index a379b32ee..2d74e9cee 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -779,5 +779,8 @@ "Error while reporting group {groupTitle}": "Error while reporting group {groupTitle}", "Reported group": "Reported group", "You can only get invited to groups right now.": "You can only get invited to groups right now.", - "Join group": "Join group" + "Join group": "Join group", + "Created by {username}": "Created by {username}", + "Accessible through link": "Accessible through link", + "Accessible only to members": "Accessible only to members" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index 3cd54e786..89b27dcf1 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -816,5 +816,8 @@ "Error while reporting group {groupTitle}": "Erreur lors du signalement du groupe {groupTitle}", "Reported group": "Groupe signalé", "You can only get invited to groups right now.": "Vous pouvez uniquement être invité aux groupes pour le moment.", - "Join group": "Rejoindre le groupe" + "Join group": "Rejoindre le groupe", + "Created by {username}": "Créé par {username}", + "Accessible through link": "Accessible uniquement par lien", + "Accessible only to members": "Accessible uniquement aux membres" } diff --git a/js/src/utils/image.ts b/js/src/utils/image.ts index dfbdfdd4d..3bbe5593f 100644 --- a/js/src/utils/image.ts +++ b/js/src/utils/image.ts @@ -1,6 +1,6 @@ import { IPicture } from "@/types/picture.model"; -export async function buildFileFromIPicture(obj: IPicture | null) { +export async function buildFileFromIPicture(obj: IPicture | null | undefined) { if (!obj) return null; const response = await fetch(obj.url); diff --git a/js/src/views/Event/Edit.vue b/js/src/views/Event/Edit.vue index 6dba218da..d55791315 100644 --- a/js/src/views/Event/Edit.vue +++ b/js/src/views/Event/Edit.vue @@ -335,6 +335,7 @@ section { diff --git a/js/src/views/Posts/Post.vue b/js/src/views/Posts/Post.vue index 04221e094..50663a539 100644 --- a/js/src/views/Posts/Post.vue +++ b/js/src/views/Posts/Post.vue @@ -14,6 +14,10 @@ >

{{ post.publishAt | formatDateTimeString }}

+ + + {{ $t("Accessible only to members", { group: post.attributedTo.name }) }} +

{{ $t("Draft") }} {{ $t("Edit") }}

+
@@ -41,12 +46,11 @@