diff --git a/app/javascript/dashboard/api/notifications.js b/app/javascript/dashboard/api/notifications.js
index 183642742..65fc937b7 100644
--- a/app/javascript/dashboard/api/notifications.js
+++ b/app/javascript/dashboard/api/notifications.js
@@ -6,8 +6,15 @@ class NotificationsAPI extends ApiClient {
super('notifications', { accountScoped: true });
}
- get(page) {
- return axios.get(`${this.url}?page=${page}`);
+ get({ page, status, type, sortOrder }) {
+ return axios.get(this.url, {
+ params: {
+ page,
+ status,
+ type,
+ sort_order: sortOrder,
+ },
+ });
}
getNotifications(contactId) {
diff --git a/app/javascript/dashboard/api/specs/notifications.spec.js b/app/javascript/dashboard/api/specs/notifications.spec.js
index 5bdf88d7f..bc06eaa2b 100644
--- a/app/javascript/dashboard/api/specs/notifications.spec.js
+++ b/app/javascript/dashboard/api/specs/notifications.spec.js
@@ -28,10 +28,20 @@ describe('#NotificationAPI', () => {
});
it('#get', () => {
- notificationsAPI.get(1);
- expect(axiosMock.get).toHaveBeenCalledWith(
- '/api/v1/notifications?page=1'
- );
+ notificationsAPI.get({
+ page: 1,
+ status: 'read',
+ type: 'Conversation',
+ sortOrder: 'desc',
+ });
+ expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/notifications', {
+ params: {
+ page: 1,
+ status: 'read',
+ type: 'Conversation',
+ sort_order: 'desc',
+ },
+ });
});
it('#getNotifications', () => {
@@ -65,5 +75,30 @@ describe('#NotificationAPI', () => {
'/api/v1/notifications/read_all'
);
});
+
+ it('#snooze', () => {
+ notificationsAPI.snooze({ id: 1, snoozedUntil: 12332211 });
+ expect(axiosMock.post).toHaveBeenCalledWith(
+ '/api/v1/notifications/1/snooze',
+ {
+ snoozed_until: 12332211,
+ }
+ );
+ });
+
+ it('#delete', () => {
+ notificationsAPI.delete(1);
+ expect(axiosMock.delete).toHaveBeenCalledWith('/api/v1/notifications/1');
+ });
+
+ it('#deleteAll', () => {
+ notificationsAPI.deleteAll({ type: 'all' });
+ expect(axiosMock.post).toHaveBeenCalledWith(
+ '/api/v1/notifications/destroy_all',
+ {
+ type: 'all',
+ }
+ );
+ });
});
});
diff --git a/app/javascript/dashboard/constants/globals.js b/app/javascript/dashboard/constants/globals.js
index 303f828cd..b8014ce6c 100644
--- a/app/javascript/dashboard/constants/globals.js
+++ b/app/javascript/dashboard/constants/globals.js
@@ -46,5 +46,18 @@ export default {
},
EXAMPLE_URL: 'https://example.com',
EXAMPLE_WEBHOOK_URL: 'https://example/api/webhook',
+ INBOX_SORT_BY: {
+ NEWEST: 'desc',
+ OLDEST: 'asc',
+ },
+ INBOX_DISPLAY_BY: {
+ SNOOZED: 'snoozed',
+ READ: 'read',
+ },
+ INBOX_FILTER_TYPE: {
+ STATUS: 'status',
+ TYPE: 'type',
+ SORT_ORDER: 'sort_order',
+ },
};
export const DEFAULT_REDIRECT_URL = '/app/';
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue
index eb2bc2bb4..ad2ea5d25 100644
--- a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue
+++ b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfo.vue
@@ -306,7 +306,7 @@ export default {
});
} else if (isAInboxViewRoute(this.$route.name)) {
this.$router.push({
- name: 'inbox-view',
+ name: 'inbox_view',
});
} else if (this.$route.name !== 'contacts_dashboard') {
this.$router.push({
diff --git a/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue b/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue
index e0924b9c0..bb0f2e7df 100644
--- a/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue
+++ b/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue
@@ -3,13 +3,13 @@
class="flex flex-col h-full w-full ltr:border-r border-slate-50 dark:border-slate-800/50"
:class="isOnExpandedLayout ? '' : 'min-w-[360px] max-w-[360px]'"
>
-