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

fix: start ephemeral timer when chat is archived #6367

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented Dec 24, 2024

Follow-up to #6365

@link2xt
Copy link
Collaborator Author

link2xt commented Dec 24, 2024

I wonder when do UIs call dc_marknoticed_chat with DC_CHAT_ID_ARCHIVED_LINK. If this never happens we should instead return an error when someone marks archived chatlist item as noticed.

On Android I see "Mark All as Read" in 3-dot menu in Archived chatlist, does it actually mark chat as noticed instead?
EDIT: turns out this is what it does:
https://github.com/deltachat/deltachat-android/blob/4833a44542fa3921ebd94563c115dfe82f2297cb/src/main/java/org/thoughtcrime/securesms/ConversationListArchiveActivity.java#L68-L70

src/chat.rs Show resolved Hide resolved
@link2xt link2xt force-pushed the link2xt/marknoticed-archive-start-ephemeral branch 3 times, most recently from e2064f7 to dab792e Compare December 24, 2024 17:20
@link2xt link2xt changed the title fix: start ephemeral timer for all archived chats if archived chat is noticed fix: start ephemeral timer when chat is archived Dec 24, 2024
@link2xt link2xt force-pushed the link2xt/marknoticed-archive-start-ephemeral branch from dab792e to c547b7a Compare December 24, 2024 17:21
@link2xt link2xt marked this pull request as draft December 24, 2024 17:21
@link2xt link2xt force-pushed the link2xt/marknoticed-archive-start-ephemeral branch from c547b7a to f8e5b03 Compare December 24, 2024 17:34
@link2xt link2xt marked this pull request as ready for review December 24, 2024 17:35
@@ -3242,7 +3246,7 @@ pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()>
.query_map(
"SELECT DISTINCT(m.chat_id) FROM msgs m
LEFT JOIN chats c ON m.chat_id=c.id
WHERE m.state=10 AND m.hidden=0 AND m.chat_id>9 AND c.blocked=0 AND c.archived=1",
WHERE m.state=10 AND m.hidden=0 AND m.chat_id>9 AND c.archived=1",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was not marking as noticed messages in contact request chats. But even in blocked chats it does not make sense not to mark them as noticed, so I removed c.blocked check completely.

@link2xt
Copy link
Collaborator Author

link2xt commented Dec 24, 2024

This turned out more complicated when I wrote tests, because messages are already marked as noticed when you archive the chat and then we also need to start timers.

@link2xt link2xt force-pushed the link2xt/marknoticed-archive-start-ephemeral branch from f8e5b03 to f5533c5 Compare December 24, 2024 17:37
@link2xt link2xt force-pushed the link2xt/marknoticed-archive-start-ephemeral branch from f5533c5 to 9b507f2 Compare December 24, 2024 17:51
@link2xt link2xt enabled auto-merge (rebase) December 24, 2024 18:01
@link2xt link2xt merged commit 0cc8026 into main Dec 24, 2024
37 checks passed
@link2xt link2xt deleted the link2xt/marknoticed-archive-start-ephemeral branch December 24, 2024 18:04
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