Fix and improve group page edition
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e0acff267b
commit
faa92aebd9
|
@ -967,5 +967,6 @@
|
||||||
"You posted a comment on the event {event}.": "You posted a comment on the event {event}.",
|
"You posted a comment on the event {event}.": "You posted a comment on the event {event}.",
|
||||||
"{profile} posted a comment on the event {event}.": "{profile} posted a comment on the event {event}.",
|
"{profile} posted a comment on the event {event}.": "{profile} posted a comment on the event {event}.",
|
||||||
"You replied to a comment on the event {event}.": "You replied to a comment on the event {event}.",
|
"You replied to a comment on the event {event}.": "You replied to a comment on the event {event}.",
|
||||||
"{profile} replied to a comment on the event {event}.": "{profile} replied to a comment on the event {event}."
|
"{profile} replied to a comment on the event {event}.": "{profile} replied to a comment on the event {event}.",
|
||||||
|
"New post": "New post"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1061,5 +1061,6 @@
|
||||||
"You posted a comment on the event {event}.": "Vous avez posté un commentaire sur l'événement {event}.",
|
"You posted a comment on the event {event}.": "Vous avez posté un commentaire sur l'événement {event}.",
|
||||||
"{profile} posted a comment on the event {event}.": "{profile} a posté un commentaire sur l'événement {event}.",
|
"{profile} posted a comment on the event {event}.": "{profile} a posté un commentaire sur l'événement {event}.",
|
||||||
"You replied to a comment on the event {event}.": "Vous avez répondu à un commentaire sur l'événement {event}.",
|
"You replied to a comment on the event {event}.": "Vous avez répondu à un commentaire sur l'événement {event}.",
|
||||||
"{profile} replied to a comment on the event {event}.": "{profile} a répondu à un commentaire sur l'événement {event}."
|
"{profile} replied to a comment on the event {event}.": "{profile} a répondu à un commentaire sur l'événement {event}.",
|
||||||
|
"New post": "Nouveau billet"
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import { Component, Vue } from "vue-property-decorator";
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
id: this.currentActor.id,
|
id: this.currentActor.id,
|
||||||
group: this.$route.params.preferredUsername,
|
group: this.group.preferredUsername,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
subscribeToMore: {
|
subscribeToMore: {
|
||||||
|
@ -42,14 +42,14 @@ import { Component, Vue } from "vue-property-decorator";
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
actorId: this.currentActor.id,
|
actorId: this.currentActor.id,
|
||||||
group: this.$route.params.preferredUsername,
|
group: this.group.preferredUsername,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
skip() {
|
skip() {
|
||||||
return (
|
return (
|
||||||
!this.currentActor ||
|
!this.currentActor ||
|
||||||
!this.currentActor.id ||
|
!this.currentActor.id ||
|
||||||
!this.$route.params.preferredUsername
|
!this.group.preferredUsername
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,7 @@ import { Component, Vue } from "vue-property-decorator";
|
||||||
return (
|
return (
|
||||||
!this.currentActor ||
|
!this.currentActor ||
|
||||||
!this.currentActor.id ||
|
!this.currentActor.id ||
|
||||||
!this.$route.params.preferredUsername
|
!this.group.preferredUsername
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,43 @@
|
||||||
<div>
|
<div>
|
||||||
<form @submit.prevent="publish(false)" v-if="isCurrentActorAGroupModerator">
|
<form @submit.prevent="publish(false)" v-if="isCurrentActorAGroupModerator">
|
||||||
<div class="container section">
|
<div class="container section">
|
||||||
|
<nav class="breadcrumb" aria-label="breadcrumbs" v-if="actualGroup">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<router-link
|
||||||
|
v-if="actualGroup"
|
||||||
|
:to="{
|
||||||
|
name: RouteName.GROUP,
|
||||||
|
params: {
|
||||||
|
preferredUsername: usernameWithDomain(actualGroup),
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
>{{
|
||||||
|
actualGroup.name || actualGroup.preferredUsername
|
||||||
|
}}</router-link
|
||||||
|
>
|
||||||
|
<b-skeleton v-else :animated="true"></b-skeleton>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<router-link
|
||||||
|
v-if="actualGroup"
|
||||||
|
:to="{
|
||||||
|
name: RouteName.POSTS,
|
||||||
|
params: {
|
||||||
|
preferredUsername: usernameWithDomain(actualGroup),
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
>{{ $t("Posts") }}</router-link
|
||||||
|
>
|
||||||
|
<b-skeleton v-else :animated="true"></b-skeleton>
|
||||||
|
</li>
|
||||||
|
<li class="is-active">
|
||||||
|
<span v-if="preferredUsername">{{ $t("New post") }}</span>
|
||||||
|
<span v-else-if="slug">{{ $t("Edit post") }}</span>
|
||||||
|
<b-skeleton v-else :animated="true"></b-skeleton>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
<h1 class="title" v-if="isUpdate === true">
|
<h1 class="title" v-if="isUpdate === true">
|
||||||
{{ $t("Edit post") }}
|
{{ $t("Edit post") }}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -111,7 +148,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Watch } from "vue-property-decorator";
|
import { Component, Prop, Watch } from "vue-property-decorator";
|
||||||
import { mixins } from "vue-class-component";
|
import { mixins } from "vue-class-component";
|
||||||
import { FETCH_GROUP } from "@/graphql/group";
|
|
||||||
import {
|
import {
|
||||||
buildFileFromIMedia,
|
buildFileFromIMedia,
|
||||||
buildFileVariable,
|
buildFileVariable,
|
||||||
|
@ -135,11 +171,24 @@ import TagInput from "../../components/Event/TagInput.vue";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
import Subtitle from "../../components/Utils/Subtitle.vue";
|
import Subtitle from "../../components/Utils/Subtitle.vue";
|
||||||
import PictureUpload from "../../components/PictureUpload.vue";
|
import PictureUpload from "../../components/PictureUpload.vue";
|
||||||
|
import { PERSON_MEMBERSHIP_GROUP } from "@/graphql/actor";
|
||||||
|
import { FETCH_GROUP } from "@/graphql/group";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
apollo: {
|
apollo: {
|
||||||
tags: TAGS,
|
tags: TAGS,
|
||||||
config: CONFIG,
|
config: CONFIG,
|
||||||
|
group: {
|
||||||
|
query: FETCH_GROUP,
|
||||||
|
variables() {
|
||||||
|
return {
|
||||||
|
name: this.preferredUsername,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
skip() {
|
||||||
|
return !this.preferredUsername;
|
||||||
|
},
|
||||||
|
},
|
||||||
post: {
|
post: {
|
||||||
query: FETCH_POST,
|
query: FETCH_POST,
|
||||||
fetchPolicy: "cache-and-network",
|
fetchPolicy: "cache-and-network",
|
||||||
|
@ -152,15 +201,17 @@ import PictureUpload from "../../components/PictureUpload.vue";
|
||||||
return !this.slug;
|
return !this.slug;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
group: {
|
person: {
|
||||||
query: FETCH_GROUP,
|
query: PERSON_MEMBERSHIP_GROUP,
|
||||||
|
fetchPolicy: "cache-and-network",
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
name: this.preferredUsername,
|
id: this.currentActor.id,
|
||||||
|
group: this.actualGroup.preferredUsername,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
skip() {
|
skip() {
|
||||||
return !this.preferredUsername;
|
return !this.currentActor?.id || !this.actualGroup?.preferredUsername;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -206,6 +257,10 @@ export default class EditPost extends mixins(GroupMixin) {
|
||||||
|
|
||||||
errors: Record<string, unknown> = {};
|
errors: Record<string, unknown> = {};
|
||||||
|
|
||||||
|
RouteName = RouteName;
|
||||||
|
|
||||||
|
usernameWithDomain = usernameWithDomain;
|
||||||
|
|
||||||
async mounted(): Promise<void> {
|
async mounted(): Promise<void> {
|
||||||
this.pictureFile = await buildFileFromIMedia(this.post.picture);
|
this.pictureFile = await buildFileFromIMedia(this.post.picture);
|
||||||
}
|
}
|
||||||
|
@ -331,18 +386,6 @@ export default class EditPost extends mixins(GroupMixin) {
|
||||||
}
|
}
|
||||||
return this.group;
|
return this.group;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasCurrentActorThisRole(givenRole: string | string[]): boolean {
|
|
||||||
const roles = Array.isArray(givenRole) ? givenRole : [givenRole];
|
|
||||||
return (
|
|
||||||
this.person &&
|
|
||||||
this.actualGroup &&
|
|
||||||
this.person.memberships.elements.some(
|
|
||||||
({ parent: { id }, role }) =>
|
|
||||||
id === this.actualGroup.id && roles.includes(role)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -360,4 +403,8 @@ form {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.breadcrumb li.is-active > span {
|
||||||
|
padding: 0 0.75em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue