-
Notifications
You must be signed in to change notification settings - Fork 212
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
[CIS-780] Update channel's lastMessageAt when saving Message #949
[CIS-780] Update channel's lastMessageAt when saving Message #949
Conversation
@@ -273,8 +273,6 @@ extension NSManagedObjectContext: MessageDatabaseSession { | |||
message.user = currentUserDTO.user | |||
message.channel = channelDTO | |||
|
|||
// We should update the channel dates so the list of channels ordering is updated. |
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.
This TODO looked like related to this issue
@@ -66,6 +66,11 @@ class ChannelDTO: NSManagedObject { | |||
$0.didChangeValue(for: \.id) | |||
} | |||
} | |||
|
|||
let newAt = lastMessageAt ?? createdAt |
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.
The task says to move the calculation, but removing the calculation from saveChannel(payload:)
was not possible as the parameter is required.
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.
Feel free to add some description of why is this here + some better naming for the variables would be cool, too
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.
Yep 👍 Let's add tests and see if everything is ok
@@ -66,6 +66,11 @@ class ChannelDTO: NSManagedObject { | |||
$0.didChangeValue(for: \.id) | |||
} | |||
} | |||
|
|||
let newAt = lastMessageAt ?? createdAt |
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.
Feel free to add some description of why is this here + some better naming for the variables would be cool, too
f41a3b4
to
4f41acc
Compare
Codecov Report
@@ Coverage Diff @@
## main #949 +/- ##
=======================================
Coverage 89.44% 89.44%
=======================================
Files 203 203
Lines 8326 8330 +4
=======================================
+ Hits 7447 7451 +4
Misses 879 879
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
c846065
to
a9c9cf0
Compare
a9c9cf0
to
74b4f2d
Compare
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.
Great 👍 Please also add a change log with a user-facing description of the change.
static var unique: Date { Date(timeIntervalSince1970: .random(in: 1...1_500_000_000)) } | ||
static var unique: Date { Date(timeIntervalSince1970: .random(in: 1_000_000...1_500_000_000)) } | ||
|
||
static func unique(before date: Date) -> Date { | ||
Date(timeIntervalSince1970: .random(in: 1..<date.timeIntervalSince1970)) | ||
} | ||
|
||
static func unique(after date: Date) -> Date { | ||
Date(timeIntervalSince1970: .random(in: (date.timeIntervalSince1970 + 1)...1_500_000_000)) | ||
} |
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.
This should ideally go into a standalone commit
Description of the pull request
update the
channelDTO.lastMessageAt
based on this recommendation https://getstream.slack.com/archives/CE5N802GP/p1617215048066400?thread_ts=1617214945.066200&cid=CE5N802GPAdd calculation of
channelDTO.defaultSortingAt
tochannelDTO.willSave
to update this walue every time the messages are updated.Links
https://stream-io.atlassian.net/browse/CIS-780