-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: group messages sent within a short timeframe (WPB-6237) #16631
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -29,7 +29,6 @@ import {useRelativeTimestamp} from 'src/script/hooks/useRelativeTimestamp'; | |||||
import {StatusType} from 'src/script/message/StatusType'; | ||||||
import {useKoSubscribableChildren} from 'Util/ComponentUtil'; | ||||||
import {getMessageAriaLabel} from 'Util/conversationMessages'; | ||||||
import {fromUnixTime, TIME_IN_MILLIS} from 'Util/TimeUtil'; | ||||||
|
||||||
import {ContentAsset} from './asset'; | ||||||
import {MessageActionsMenu} from './MessageActions/MessageActions'; | ||||||
|
@@ -126,13 +125,13 @@ export const ContentMessageComponent: React.FC<ContentMessageProps> = ({ | |||||
return true; | ||||||
} | ||||||
|
||||||
const currentMessageDate = fromUnixTime(message.timestamp() / TIME_IN_MILLIS.SECOND); | ||||||
const previousMessageDate = fromUnixTime(previousMessage.timestamp() / TIME_IN_MILLIS.SECOND); | ||||||
// Interval in milliseconds, within which messages are grouped together | ||||||
const GROUPED_MESSAGE_INTERVAL = 30000; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh no, magic number warning :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nah it's okay, this magic number warning doesn't really make sense here (we need to fine tuned this one, I find it a little stupid sometimes) |
||||||
|
||||||
const currentMinute = currentMessageDate.getMinutes(); | ||||||
const previousMinute = previousMessageDate.getMinutes(); | ||||||
const currentMessageDate = message.timestamp(); | ||||||
const previousMessageDate = previousMessage.timestamp(); | ||||||
|
||||||
if (currentMinute !== previousMinute) { | ||||||
if (currentMessageDate - previousMessageDate >= GROUPED_MESSAGE_INTERVAL) { | ||||||
return true; | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Let's use
TimeInMillis
from our time util :)