mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-03-01 12:44:28 +00:00
136 lines
3.6 KiB
Vue
136 lines
3.6 KiB
Vue
<template>
|
|
<div>
|
|
<ds-space>
|
|
<base-card>
|
|
<h2 class="title">{{ $t('settings.muted-users.name') }}</h2>
|
|
<ds-text>
|
|
{{ $t('settings.muted-users.explanation.intro') }}
|
|
</ds-text>
|
|
<ds-list>
|
|
<ds-list-item>
|
|
{{ $t('settings.muted-users.explanation.your-perspective') }}
|
|
</ds-list-item>
|
|
<ds-list-item>
|
|
{{ $t('settings.muted-users.explanation.search') }}
|
|
</ds-list-item>
|
|
</ds-list>
|
|
</base-card>
|
|
</ds-space>
|
|
<base-card v-if="mutedUsers && mutedUsers.length">
|
|
<ds-table :data="mutedUsers" :fields="fields" condensed>
|
|
<template #avatar="scope">
|
|
<nuxt-link
|
|
:to="{
|
|
name: 'profile-id-slug',
|
|
params: { id: scope.row.id, slug: scope.row.slug },
|
|
}"
|
|
>
|
|
<profile-avatar :profile="scope.row" size="small" />
|
|
</nuxt-link>
|
|
</template>
|
|
<template #name="scope">
|
|
<nuxt-link
|
|
:to="{
|
|
name: 'profile-id-slug',
|
|
params: { id: scope.row.id, slug: scope.row.slug },
|
|
}"
|
|
>
|
|
<b>{{ scope.row.name | truncate(20) }}</b>
|
|
</nuxt-link>
|
|
</template>
|
|
<template #slug="scope">
|
|
<nuxt-link
|
|
:to="{
|
|
name: 'profile-id-slug',
|
|
params: { id: scope.row.id, slug: scope.row.slug },
|
|
}"
|
|
>
|
|
<b>{{ scope.row.slug | truncate(20) }}</b>
|
|
</nuxt-link>
|
|
</template>
|
|
|
|
<template #unmuteUser="scope">
|
|
<os-button
|
|
data-test="unmute-btn"
|
|
variant="primary"
|
|
appearance="outline"
|
|
circle
|
|
size="sm"
|
|
:aria-label="$t('settings.muted-users.columns.unmute')"
|
|
@click="unmuteUser(scope)"
|
|
>
|
|
<template #icon><os-icon :icon="icons.userPlus" /></template>
|
|
</os-button>
|
|
</template>
|
|
</ds-table>
|
|
</base-card>
|
|
<base-card v-else>
|
|
<ds-space>
|
|
<ds-placeholder>
|
|
{{ $t('settings.muted-users.empty') }}
|
|
</ds-placeholder>
|
|
</ds-space>
|
|
<ds-space>
|
|
<ds-text align="center">
|
|
{{ $t('settings.muted-users.how-to') }}
|
|
</ds-text>
|
|
</ds-space>
|
|
</base-card>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { OsButton, OsIcon } from '@ocelot-social/ui'
|
|
import { iconRegistry } from '~/utils/iconRegistry'
|
|
import { mutedUsers, unmuteUser } from '~/graphql/settings/MutedUsers'
|
|
import ProfileAvatar from '~/components/_new/generic/ProfileAvatar/ProfileAvatar'
|
|
import scrollToContent from './scroll-to-content.js'
|
|
|
|
export default {
|
|
mixins: [scrollToContent],
|
|
components: {
|
|
OsButton,
|
|
OsIcon,
|
|
ProfileAvatar,
|
|
},
|
|
created() {
|
|
this.icons = iconRegistry
|
|
},
|
|
data() {
|
|
return {
|
|
mutedUsers: [],
|
|
}
|
|
},
|
|
computed: {
|
|
fields() {
|
|
return {
|
|
avatar: '',
|
|
name: this.$t('settings.muted-users.columns.name'),
|
|
slug: this.$t('settings.muted-users.columns.slug'),
|
|
unmuteUser: this.$t('settings.muted-users.columns.unmute'),
|
|
}
|
|
},
|
|
},
|
|
apollo: {
|
|
mutedUsers: { query: mutedUsers, fetchPolicy: 'cache-and-network' },
|
|
},
|
|
methods: {
|
|
async unmuteUser(user) {
|
|
await this.$apollo.mutate({
|
|
mutation: unmuteUser(),
|
|
variables: { id: user.row.id },
|
|
})
|
|
this.$apollo.queries.mutedUsers.refetch()
|
|
const { name } = user.row
|
|
this.$toast.success(this.$t('settings.muted-users.unmuted', { name }))
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.ds-table-col {
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|