Skip to content

Commit

Permalink
List Notifications
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Jul 16, 2023
1 parent 09e881b commit 4873f19
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import Vuex, { Store } from 'vuex'

import storeConfig from './storeConfig.js'

// eslint-disable-next-line n/no-missing-import, import/no-unresolved
import announcementsStore from 'apps/announcementcenter/src/store/announcementsStore.js'

Vue.use(Vuex)

export default new Store(storeConfig)
export default new Store({...storeConfig, ...announcementsStore})
5 changes: 1 addition & 4 deletions src/store/storeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// eslint-disable-next-line n/no-missing-import, import/no-unresolved
import announcementsStore from 'apps/announcementcenter/src/store/index.js'

const defaultStore = {
modules: {},

Expand All @@ -30,4 +27,4 @@ const defaultStore = {
strict: process.env.NODE_ENV !== 'production',
}

export default { ...defaultStore, ...announcementsStore }
export default defaultStore
31 changes: 31 additions & 0 deletions src/views/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ export default {
this.$store.dispatch('addAnnouncement', announcement)
})
},
/**
* Load the comments of the announcements
*
* @param {number} id the announcement
*/
async onClickAnnouncement(id) {
if (id === this.activeId) {
return
}
this.activeId = id
if (!this.activateAnnouncementHasComments) {
return
}
if (id === 0) {
// Destroy the comments view as the sidebar is destroyed
this.commentsView = null
return
}
if (!this.commentsView) {
// Create a new comments view when there is none
this.commentsView = new OCA.Comments.View('announcement')
}
await this.commentsView.update(id)
this.commentsView.$mount(this.$refs.sidebar)
},
},
}
</script>

0 comments on commit 4873f19

Please sign in to comment.