Ocelot-Social/webapp/mixins/pinnedPosts.js
Moriz Wahl b736a2a2e3
feat(backend): pin more than one post (#8598)
* feat(backend): pin more than one post

* add postPinnedCount query, better names for env variable

* add store and mixin for pinned posts counts

* test pinned post store

* context menu for pin posts

* fix typos

* unpin posts is always possible

---------

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
2025-05-28 19:12:27 +02:00

20 lines
467 B
JavaScript

import { mapGetters, mapActions } from 'vuex'
export default {
computed: {
...mapGetters({
maxPinnedPosts: 'pinnedPosts/maxPinnedPosts',
currentlyPinnedPosts: 'pinnedPosts/currentlyPinnedPosts',
isAdmin: 'auth/isAdmin',
}),
},
methods: {
...mapActions({
fetchPinnedPostsCount: 'pinnedPosts/fetch',
}),
},
async created() {
if (this.isAdmin && this.maxPinnedPosts === 0) await this.fetchPinnedPostsCount()
},
}