feat: Add more snooze options (#7344)
This commit is contained in:
@@ -57,7 +57,6 @@ import { hasPressedAltAndOKey } from 'shared/helpers/KeyboardHelpers';
|
||||
import { mapGetters } from 'vuex';
|
||||
import agentMixin from '../../../mixins/agentMixin.js';
|
||||
import BackButton from '../BackButton';
|
||||
import differenceInHours from 'date-fns/differenceInHours';
|
||||
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
|
||||
import inboxMixin from 'shared/mixins/inboxMixin';
|
||||
import InboxName from '../InboxName';
|
||||
@@ -65,6 +64,8 @@ import MoreActions from './MoreActions';
|
||||
import Thumbnail from '../Thumbnail';
|
||||
import wootConstants from 'dashboard/constants/globals';
|
||||
import { conversationListPageURL } from 'dashboard/helper/URLHelper';
|
||||
import { conversationReopenTime } from 'dashboard/helper/snoozeHelpers';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BackButton,
|
||||
@@ -125,17 +126,9 @@ export default {
|
||||
snoozedDisplayText() {
|
||||
const { snoozed_until: snoozedUntil } = this.currentChat;
|
||||
if (snoozedUntil) {
|
||||
// When the snooze is applied, it schedules the unsnooze event to next day/week 9AM.
|
||||
// By that logic if the time difference is less than or equal to 24 + 9 hours we can consider it tomorrow.
|
||||
const MAX_TIME_DIFFERENCE = 33;
|
||||
const isSnoozedUntilTomorrow =
|
||||
differenceInHours(new Date(snoozedUntil), new Date()) <=
|
||||
MAX_TIME_DIFFERENCE;
|
||||
return this.$t(
|
||||
isSnoozedUntilTomorrow
|
||||
? 'CONVERSATION.HEADER.SNOOZED_UNTIL_TOMORROW'
|
||||
: 'CONVERSATION.HEADER.SNOOZED_UNTIL_NEXT_WEEK'
|
||||
);
|
||||
return `${this.$t(
|
||||
'CONVERSATION.HEADER.SNOOZED_UNTIL'
|
||||
)} ${conversationReopenTime(snoozedUntil)}`;
|
||||
}
|
||||
return this.$t('CONVERSATION.HEADER.SNOOZED_UNTIL_NEXT_REPLY');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user