Make announcements available to all with privileges

This commit is contained in:
tusooa 2022-12-24 12:17:09 -05:00
parent 25e628efe2
commit b65a89c822
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
5 changed files with 10 additions and 4 deletions

View File

@ -27,6 +27,9 @@ const Announcement = {
...mapState({
currentUser: state => state.users.currentUser
}),
canEditAnnouncement () {
return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements')
},
content () {
return this.announcement.content
},

View File

@ -45,14 +45,14 @@
{{ $t('announcements.mark_as_read_action') }}
</button>
<button
v-if="currentUser && currentUser.role === 'admin'"
v-if="canEditAnnouncement"
class="btn button-default"
@click="enterEditMode"
>
{{ $t('announcements.edit_action') }}
</button>
<button
v-if="currentUser && currentUser.role === 'admin'"
v-if="canEditAnnouncement"
class="btn button-default"
@click="deleteAnnouncement"
>

View File

@ -28,6 +28,9 @@ const AnnouncementsPage = {
}),
announcements () {
return this.$store.state.announcements.announcements
},
canPostAnnouncement () {
return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements')
}
},
methods: {

View File

@ -7,7 +7,7 @@
</div>
<div class="panel-body">
<section
v-if="currentUser && currentUser.role === 'admin'"
v-if="canPostAnnouncement"
>
<div class="post-form">
<div class="heading">

View File

@ -49,7 +49,7 @@ const announcements = {
}
const currentUser = store.rootState.users.currentUser
const isAdmin = currentUser && currentUser.role === 'admin'
const isAdmin = currentUser && currentUser.privileges.includes('announcements_manage_announcements')
const getAnnouncements = async () => {
if (!isAdmin) {