Skip to content
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

Grouped messages #209

Merged
merged 4 commits into from
Oct 29, 2024
Merged

Grouped messages #209

merged 4 commits into from
Oct 29, 2024

Conversation

raphaelrobert
Copy link
Contributor

No description provided.

@raphaelrobert raphaelrobert self-assigned this Oct 27, 2024
Copy link
Member

@kkohbrok kkohbrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a few opportunities where it's possible to return a little earlier.


while let Some(conversation_message) = iter.next() {
let mut timestamp = conversation_message.timestamp();
match conversation_message.message() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a let Message::Content(content_message) = ... else { ... }.

// Keep collecting messages from the same sender
while let Some(next_message) = iter.peek() {
let temp_timestamp = next_message.timestamp();
match next_message.message() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be a let ... else.

let temp_timestamp = next_message.timestamp();
match next_message.message() {
Message::Content(next_content_message) => {
if next_content_message.sender() == current_sender {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all we do is break in the else branch, I'd prefer to check for the negative and break, before the function continues without opening a new code block.

Copy link
Member

@kkohbrok kkohbrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes! Let's get it merged.

@raphaelrobert raphaelrobert enabled auto-merge (squash) October 29, 2024 15:53
@raphaelrobert raphaelrobert merged commit 4b7e94a into main Oct 29, 2024
6 checks passed
@raphaelrobert raphaelrobert deleted the raphael/grouped-messages branch October 29, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants