Merge branch 'tusooa/announcements-priv' into 'develop'
Make announcements available to all with privileges See merge request pleroma/pleroma-fe!1716
This commit is contained in:
commit
b5d4c43bc2
@ -27,6 +27,9 @@ const Announcement = {
|
|||||||
...mapState({
|
...mapState({
|
||||||
currentUser: state => state.users.currentUser
|
currentUser: state => state.users.currentUser
|
||||||
}),
|
}),
|
||||||
|
canEditAnnouncement () {
|
||||||
|
return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements')
|
||||||
|
},
|
||||||
content () {
|
content () {
|
||||||
return this.announcement.content
|
return this.announcement.content
|
||||||
},
|
},
|
||||||
|
@ -45,14 +45,14 @@
|
|||||||
{{ $t('announcements.mark_as_read_action') }}
|
{{ $t('announcements.mark_as_read_action') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="currentUser && currentUser.role === 'admin'"
|
v-if="canEditAnnouncement"
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
@click="enterEditMode"
|
@click="enterEditMode"
|
||||||
>
|
>
|
||||||
{{ $t('announcements.edit_action') }}
|
{{ $t('announcements.edit_action') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="currentUser && currentUser.role === 'admin'"
|
v-if="canEditAnnouncement"
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
@click="deleteAnnouncement"
|
@click="deleteAnnouncement"
|
||||||
>
|
>
|
||||||
|
@ -28,6 +28,9 @@ const AnnouncementsPage = {
|
|||||||
}),
|
}),
|
||||||
announcements () {
|
announcements () {
|
||||||
return this.$store.state.announcements.announcements
|
return this.$store.state.announcements.announcements
|
||||||
|
},
|
||||||
|
canPostAnnouncement () {
|
||||||
|
return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<section
|
<section
|
||||||
v-if="currentUser && currentUser.role === 'admin'"
|
v-if="canPostAnnouncement"
|
||||||
>
|
>
|
||||||
<div class="post-form">
|
<div class="post-form">
|
||||||
<div class="heading">
|
<div class="heading">
|
||||||
|
@ -49,7 +49,7 @@ const announcements = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentUser = store.rootState.users.currentUser
|
const currentUser = store.rootState.users.currentUser
|
||||||
const isAdmin = currentUser && currentUser.role === 'admin'
|
const isAdmin = currentUser && currentUser.privileges.includes('announcements_manage_announcements')
|
||||||
|
|
||||||
const getAnnouncements = async () => {
|
const getAnnouncements = async () => {
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
|
Loading…
Reference in New Issue
Block a user