feat: Inbox header actions (Snooze/Delete) (#8858)

* feat: Inbox header actions (Snooze/Delete)

* chore: Minor fix

* chore: Fix eslint

* Update inboxHotKeys.js

* feat: custom snooze

* Update actions.spec.js

* chore: Clean up

* chore: add snoozed_until to notification end point

* chore: Minor fix

* chore: Minor style fix

* chore:Clean up

* chore: review fixes

* chore: Minor fix

* chore: Adds alert

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Sivin Varghese
2024-02-06 08:54:15 +05:30
committed by GitHub
parent 65e9cee019
commit 9e0468cd73
26 changed files with 345 additions and 44 deletions

View File

@@ -86,3 +86,6 @@ export const getConversationDashboardRoute = routeName => {
return null;
}
};
export const isAInboxViewRoute = routeName =>
['inbox_view_conversation'].includes(routeName);

View File

@@ -55,7 +55,7 @@ export const findSnoozeTime = (snoozeType, currentDate = new Date()) => {
return parsedDate ? getUnixTime(parsedDate) : null;
};
export const conversationReopenTime = snoozedUntil => {
export const snoozedReopenTime = snoozedUntil => {
if (!snoozedUntil) {
return null;
}

View File

@@ -5,6 +5,7 @@ import {
isAConversationRoute,
routeIsAccessibleFor,
validateLoggedInRoutes,
isAInboxViewRoute,
} from '../routeHelpers';
describe('#getCurrentAccount', () => {
@@ -134,3 +135,10 @@ describe('getConversationDashboardRoute', () => {
expect(getConversationDashboardRoute('non_existent_route')).toBeNull();
});
});
describe('isAInboxViewRoute', () => {
it('returns true if inbox view route name is provided', () => {
expect(isAInboxViewRoute('inbox_view_conversation')).toBe(true);
expect(isAInboxViewRoute('inbox_conversation')).toBe(false);
});
});

View File

@@ -1,6 +1,6 @@
import {
findSnoozeTime,
conversationReopenTime,
snoozedReopenTime,
findStartOfNextWeek,
findStartOfNextMonth,
findNextDay,
@@ -88,13 +88,13 @@ describe('#Snooze Helpers', () => {
});
});
describe('conversationReopenTime', () => {
describe('snoozedReopenTime', () => {
it('should return nil if snoozedUntil is nil', () => {
expect(conversationReopenTime(null)).toEqual(null);
expect(snoozedReopenTime(null)).toEqual(null);
});
it('should return formatted date if snoozedUntil is not nil', () => {
expect(conversationReopenTime('2023-06-07T09:00:00.000Z')).toEqual(
expect(snoozedReopenTime('2023-06-07T09:00:00.000Z')).toEqual(
'7 Jun, 9.00am'
);
});