Merge branch 'add-missing-comment-deletion-action-log-type' into 'master'

Fix missing deleted comment moderation logaction

See merge request framasoft/mobilizon!915
This commit is contained in:
Thomas Citharel 2021-04-28 10:31:38 +00:00
commit 1b1022f33f
5 changed files with 101 additions and 3 deletions

View file

@ -185,6 +185,21 @@ export const LOGS = gql`
id id
title title
} }
... on Comment {
id
text
event {
id
title
uuid
}
actor {
id
preferredUsername
domain
name
}
}
... on Person { ... on Person {
id id
preferredUsername preferredUsername

View file

@ -987,5 +987,8 @@
"Error while loading the preview": "Error while loading the preview", "Error while loading the preview": "Error while loading the preview",
"Instance feeds": "Instance feeds", "Instance feeds": "Instance feeds",
"{moderator} suspended group {profile}": "{moderator} suspended group {profile}", "{moderator} suspended group {profile}": "{moderator} suspended group {profile}",
"{moderator} has unsuspended group {profile}": "{moderator} has unsuspended group {profile}" "{moderator} has unsuspended group {profile}": "{moderator} has unsuspended group {profile}",
"{moderator} has done an unknown action": "{moderator} has done an unknown action",
"{moderator} has deleted a comment from {author} under the event {event}": "{moderator} has deleted a comment from {author} under the event {event}",
"{moderator} has deleted a comment from {author}": "{moderator} has deleted a comment from {author}"
} }

View file

@ -1081,5 +1081,8 @@
"Error while loading the preview": "Erreur lors du chargement de l'aperçu", "Error while loading the preview": "Erreur lors du chargement de l'aperçu",
"Instance feeds": "Flux de l'instance", "Instance feeds": "Flux de l'instance",
"{moderator} suspended group {profile}": "{moderator} a suspendu le groupe {profile}", "{moderator} suspended group {profile}": "{moderator} a suspendu le groupe {profile}",
"{moderator} has unsuspended group {profile}": "{moderator} a annulé la suspension du groupe {profile}" "{moderator} has unsuspended group {profile}": "{moderator} a annulé la suspension du groupe {profile}",
"{moderator} has done an unknown action": "{moderator} a effectué une action inconnue",
"{moderator} has deleted a comment from {author} under the event {event}": "{moderator} a supprimé un commentaire de {author} sous l'événement {event}",
"{moderator} has deleted a comment from {author}": "{moderator} a supprimé un commentaire de {author}"
} }

View file

@ -270,6 +270,83 @@
</router-link> </router-link>
<b v-else slot="user">{{ log.object.email }}</b> <b v-else slot="user">{{ log.object.email }}</b>
</i18n> </i18n>
<span
v-else-if="
log.action === ActionLogAction.COMMENT_DELETION &&
log.object.event
"
>
<i18n
tag="span"
path="{moderator} has deleted a comment from {author} under the event {event}"
>
<router-link
slot="moderator"
:to="{
name: RouteName.ADMIN_PROFILE,
params: { id: log.actor.id },
}"
>@{{ log.actor.preferredUsername }}</router-link
>
<router-link
v-if="log.object.event && log.object.event.uuid"
slot="event"
:to="{
name: RouteName.EVENT,
params: { uuid: log.object.event.uuid },
}"
>{{ log.object.event.title }}
</router-link>
<b v-else slot="event">{{ log.object.event.title }}</b>
<router-link
slot="author"
:to="{
name: RouteName.ADMIN_PROFILE,
params: { id: log.object.actor.id },
}"
>{{ displayNameAndUsername(log.object.actor) }}
</router-link>
</i18n>
<pre v-html="log.object.text" />
</span>
<span v-else-if="log.action === ActionLogAction.COMMENT_DELETION">
<i18n
tag="span"
path="{moderator} has deleted a comment from {author}"
>
<router-link
slot="moderator"
:to="{
name: RouteName.ADMIN_PROFILE,
params: { id: log.actor.id },
}"
>@{{ log.actor.preferredUsername }}</router-link
>
<router-link
slot="author"
:to="{
name: RouteName.ADMIN_PROFILE,
params: { id: log.object.actor.id },
}"
>{{ displayNameAndUsername(log.object.actor) }}
</router-link>
</i18n>
<pre v-html="log.object.text" />
</span>
<i18n
v-else
tag="span"
path="{moderator} has done an unknown action"
>
<router-link
slot="moderator"
:to="{
name: RouteName.ADMIN_PROFILE,
params: { id: log.actor.id },
}"
>@{{ log.actor.preferredUsername }}</router-link
>
</i18n>
<br /> <br />
<small>{{ log.insertedAt | formatDateTimeString }}</small> <small>{{ log.insertedAt | formatDateTimeString }}</small>
</div> </div>

View file

@ -6,7 +6,7 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
import Absinthe.Resolution.Helpers, only: [dataloader: 1] import Absinthe.Resolution.Helpers, only: [dataloader: 1]
alias Mobilizon.{Actors, Discussions} alias Mobilizon.{Actors, Discussions, Events}
alias Mobilizon.GraphQL.Resolvers.Comment alias Mobilizon.GraphQL.Resolvers.Comment
@desc "A comment" @desc "A comment"