-
Notifications
You must be signed in to change notification settings - Fork 438
[NEW] Sync deleted messages #2617
base: develop
Are you sure you want to change the base?
[NEW] Sync deleted messages #2617
Conversation
let roomId: String? | ||
let since: Date? | ||
|
||
// How to improve this default date? We only want deleted messages as far as the older message we have on cache! (older ones won't be returned) |
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.
Line Length Violation: Line should be 120 characters or less: currently 147 characters (line_length)
|
||
private func loadDeletedMessages(subscription: Subscription, completion: (([String]) -> Void)? = nil) { | ||
|
||
// TODO: Save latest date? Older messages may have been deleted so we probably should always check up to the oldest |
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.
Line Length Violation: Line should be 120 characters or less: currently 123 characters (line_length)
Todo Violation: TODOs should be resolved (Save latest date? Older messag...). (todo)
|
Codecov Report
@@ Coverage Diff @@
## develop #2617 +/- ##
===========================================
+ Coverage 26.15% 26.32% +0.16%
===========================================
Files 463 464 +1
Lines 17216 17252 +36
===========================================
+ Hits 4503 4541 +38
+ Misses 12713 12711 -2
Continue to review full report at Codecov.
|
@luismachado Amazing, thanks for the PR! Gonna review it for release 3.5, we're wrapping up 3.4 right now. 👏 |
@luismachado This PR is missing your signature of CLA, could you do that please? |
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.
Thanks for the PR @luismachado, most of it looks very good, but the way you're doing the request is not the way it should be based on the API. Here's how it should work:
Every time the user opens a subscription, we need to request the latest deleted messages based on the last time we requested them, so for example: if we requested them on time 1000, next time we'll pass 1000 as since parameter. If now the time is 2000, we will update the 1000 value to 2000 for the next request (next time user opens the subscription). Got it?
- We don't need to request it every time we request the history of messages;
- It needs to have a
since
parameter valid, not 0. This will prevent us from downloading very old data from the server.
Let me know if that makes sense to you please.
Thank you!
Hello @rafaelks, I do understand what you're saying (and the fix definitely needs some improvements) but I'm not sure I would 100% agree with you (or maybe I didn't understand you fully :P).
|
AFAIK the date you pass as a parameter is not the date of the message, but the date that the "updates" happen, so if a message from 5 days ago was deleted today and you fetch the API with the "since" from today, you will get the deleted message information, you know? |
Ah that makes much more sense :) I'm going to go over it then but I'll
probably only have news next week.
…On Wed, Apr 3, 2019 at 1:09 PM Rafael Kellermann Streit < ***@***.***> wrote:
What I was thinking would be to grab the oldest message timestamp (I think
this is already done) and then use that timestamp to fetch the deleted list.
I'm not sure that we can avoid fetching deleted info that was already
fetched because the users can delete any message, old or new, so we have to
make sure that we always have the most recent info on deleted messages for
the our current scope (i.e. the messages we have on cache).
AFAIK the date you pass as a parameter is not the date of the message, but
the date that the "updates" happen, so if a message from 5 days ago was
deleted today and you fetch the API with the "since" from today, you will
get the deleted message information, you know?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2617 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHtxo4AWWK1PRd5jWBhFIv6m-cxkp1gCks5vdJndgaJpZM4cSIC7>
.
--
*Luís Machado*
*Software Engineer / iOS Developer - Website <http://lfmdevelopment.com>*
|
Checks for deleted messages every time messages are fetched (direct messages)
For now I've only implemented it for direct messages (and it's lacking optimisation), but would this be a viable way to sync (i.e. remove from the device) deleted messages?
@RocketChat/ios
Closes #2208