Skip to content

[MBL-19895][Student] Fix announcement unread badge not clearing after viewing#3621

Merged
kristofnemere merged 1 commit intomasterfrom
MBL-19895
Apr 7, 2026
Merged

[MBL-19895][Student] Fix announcement unread badge not clearing after viewing#3621
kristofnemere merged 1 commit intomasterfrom
MBL-19895

Conversation

@kristofnemere
Copy link
Copy Markdown
Contributor

@kristofnemere kristofnemere commented Apr 2, 2026

Test plan:

  1. Log in as a Student
  2. Open a course that has announcements with unread replies (unread badge visible)
  3. Tap an announcement to open it
  4. Navigate back to the announcement list
  5. Verify the unread badge is gone for the viewed announcement
  6. Also verify with a manual pull-to-refresh that the badge stays gone

refs: MBL-19895
affects: Student
release note: Fixed an issue where the unread badge on announcements would remain visible even after reading the announcement and its replies.

What changed

The new WebView-based discussion/announcement detail screen (DiscussionDetailsWebViewFragment) loads the page with embed=true, which prevents Canvas from automatically marking the discussion topic and its entries as read server-side. Added an explicit API call to PUT .../discussion_topics/{topicId}/read_all when the detail screen loads, which marks both the topic header and all reply entries as read.

Checklist

  • Follow-up e2e test ticket created or not needed
  • Tested in dark mode
  • Tested in light mode
  • Test in landscape mode and/or tablet
  • A11y checked
  • Approve from product

… viewing

The new WebView-based discussion/announcement details screen loaded with
embed=true, which prevents Canvas from automatically marking entries as
read server-side. Added an explicit call to PUT read_all after loading
the discussion to mark the topic and all its entries as read.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR adds a markAllDiscussionTopicEntriesRead API endpoint and calls it automatically when a discussion is loaded in the WebView, which is a clean and useful improvement.

Positive aspects:

  • The new Retrofit endpoint in DiscussionAPI follows the existing suspend/DataResult conventions correctly.
  • The API is placed logically next to the related markDiscussionTopicRead and markDiscussionTopicEntryRead endpoints.
  • The test scaffolding was updated to include the new mock dependency.

Issues found:

  • Silent failure: DataResult return value discarded (DiscussionDetailsWebViewViewModel.kt:72) — The result of markAllDiscussionTopicEntriesRead is not checked. A DataResult.Fail response won't throw and won't be caught by the surrounding try/catch, so failures are silently ignored. At minimum, log failures or make the fire-and-forget intent explicit.

  • Pattern inconsistency: raw API interface injected into ViewModel (DiscussionDetailsWebViewViewModel.kt:44) — All other network calls in this ViewModel go through Manager classes (DiscussionManager, OAuthManager). Injecting DiscussionAPI.DiscussionInterface directly bypasses that abstraction layer. Consider adding the method to DiscussionManager instead.

  • Missing test assertion for the new behavior (DiscussionDetailsWebViewViewModelTest.kt:113) — The success test doesn't verify that markAllDiscussionTopicEntriesRead is called. A coVerify should be added to confirm the call happens with the correct arguments, and a test for the failure path would be valuable.

  • Nit: isForceReadFromNetwork = true has no effect on a PUT (DiscussionDetailsWebViewViewModel.kt:71) — This flag is relevant for caching GET responses; it's a no-op for mutating requests. Consider using plain RestParams() to avoid confusion.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

🧪 Unit Test Results

✅ 📦 Submodules

  • Tests: 3347 total, 0 failed, 0 skipped
  • Duration: 57.871s
  • Success Rate: 100%

📊 Summary

  • Total Tests: 3347
  • Failed: 0
  • Skipped: 0
  • Status: ✅ All tests passed!

Last updated: Tue, 07 Apr 2026 09:11:56 GMT

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

📊 Code Coverage Report

✅ Student

  • PR Coverage: 42.65%
  • Master Coverage: 42.65%
  • Delta: +0.00%

✅ Teacher

  • PR Coverage: 25.37%
  • Master Coverage: 25.37%
  • Delta: +0.00%

✅ Pandautils

  • PR Coverage: 23.69%
  • Master Coverage: 23.68%
  • Delta: +0.01%

📈 Overall Average

  • PR Coverage: 30.57%
  • Master Coverage: 30.57%
  • Delta: +0.00%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

Student Install Page

Copy link
Copy Markdown
Contributor

@kdeakinstructure kdeakinstructure left a comment

Choose a reason for hiding this comment

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

QA 👍

Copy link
Copy Markdown
Contributor

@adamNagy56 adamNagy56 left a comment

Choose a reason for hiding this comment

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

QA +1

@kristofnemere kristofnemere merged commit 2410f4c into master Apr 7, 2026
54 of 55 checks passed
@kristofnemere kristofnemere deleted the MBL-19895 branch April 7, 2026 09:26
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.

4 participants