feat: Tag agents in a private note (#1688)

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2021-01-27 00:04:11 +05:30
committed by GitHub
parent b894b13e14
commit b93388b330
20 changed files with 424 additions and 93 deletions

View File

@@ -23,7 +23,7 @@ export const mutations = {
Vue.set($state.meta, 'unreadCount', unreadCount);
},
[types.SET_NOTIFICATIONS_UNREAD_COUNT]: ($state, count) => {
Vue.set($state.meta, 'unreadCount', count);
Vue.set($state.meta, 'unreadCount', count < 0 ? 0 : count);
},
[types.SET_NOTIFICATIONS]: ($state, data) => {
data.forEach(notification => {

View File

@@ -40,6 +40,12 @@ describe('#mutations', () => {
mutations[types.SET_NOTIFICATIONS_UNREAD_COUNT](state, 3);
expect(state.meta).toEqual({ unreadCount: 3 });
});
it('set notifications unread count to 0 if invalid', () => {
const state = { meta: { unreadCount: 4 } };
mutations[types.SET_NOTIFICATIONS_UNREAD_COUNT](state, -1);
expect(state.meta).toEqual({ unreadCount: 0 });
});
});
describe('#SET_NOTIFICATIONS', () => {