forked from signalapp/Signal-Desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f0ed54
commit 28ab6e1
Showing
8 changed files
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2020-2022 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import { assert } from 'chai'; | ||
|
||
import { isConversationMuted } from '../../util/isConversationMuted'; | ||
|
||
describe('isConversationMuted', () => { | ||
it('returns false if passed an undefined expiry time', () => { | ||
assert.isFalse(isConversationMuted({})); | ||
assert.isFalse(isConversationMuted({ muteExpiresAt: undefined })); | ||
}); | ||
|
||
it('returns false if passed a date in the past', () => { | ||
assert.isFalse(isConversationMuted({ muteExpiresAt: 0 })); | ||
assert.isFalse(isConversationMuted({ muteExpiresAt: Date.now() - 123 })); | ||
}); | ||
|
||
it('returns true if passed a date in the future', () => { | ||
assert.isTrue(isConversationMuted({ muteExpiresAt: Date.now() + 123 })); | ||
assert.isTrue(isConversationMuted({ muteExpiresAt: Date.now() + 123456 })); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright 2020-2022 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import type { ConversationAttributesType } from '../model-types.d'; | ||
|
||
export const isConversationMuted = ({ | ||
muteExpiresAt, | ||
}: Readonly<Pick<ConversationAttributesType, 'muteExpiresAt'>>): boolean => | ||
Boolean(muteExpiresAt && Date.now() < muteExpiresAt); |
This file was deleted.
Oops, something went wrong.