fix(client): isEdited missed edits fetched from the message box - #228
Merged
Conversation
Messages returned by getRecentMessagesV2 mark an edit only with contentMetadata.UPDATED_TIME - no EDITED flag and no updatedTime field - so isEdited reported them as unedited while updatedTime returned the edit time. isEdited now defers to updatedTime instead of repeating a narrower lookup.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TalkMessage.isEditedreturnsfalsefor edited messages fetched from themessage box, while
TalkMessage.updatedTimereturns the edit time for the samemessage. The two getters contradict each other.
isEdited(added in #225) only looked atcontentMetadata.EDITEDand theupdatedTimefield. But a message returned bygetRecentMessagesV2carriesneither — only
contentMetadata.UPDATED_TIME:updatedTimealready readsUPDATED_TIMEfirst, so it reports the editcorrectly;
isEditeddoes not. Any chat history walked withgetRecentMessagesV2/getPreviousMessagesV2reports every edited message asunedited.
isEditednow defers toupdatedTimeinstead of repeating a narrower lookup,so the two cannot drift apart again.
This also corrects a comment I got wrong in #225: it claimed
updatedTimeis"only set on messages fetched from the message box". The message box does not
set that field at all.
Testing
getRecentMessagesV2response. It fails before this change and passes after.deno test -A→ 241 passeddeno publish --dry-run→ passesObserved against my own account: a message edited from the LINE iOS app, then
re-fetched with
getRecentMessagesV2.Checklist