Skip to content

Conversation

@kristofnemere
Copy link
Contributor

@kristofnemere kristofnemere commented Nov 27, 2025

Test Plan

IMPORTANT: Please smoke test bookmarking functionality since we modified the bookmark URL generation logic.

Primary Test Cases

  1. From Notifications List:

    • Navigate to a course
    • Go to Notifications tab
    • Click on an assignment notification
    • Tap the bookmark icon to create a bookmark
    • Navigate to Dashboard → Bookmarks
    • Tap the bookmarked assignment
    • ✅ Verify: Assignment details opens correctly (should NOT show error or fail to route)
  2. From ToDo List:

    • Navigate to ToDo list
    • Click on an assignment todo item
    • Tap the bookmark icon to create a bookmark
    • Navigate to Dashboard → Bookmarks
    • Tap the bookmarked assignment
    • ✅ Verify: Assignment details opens correctly
  3. From Assignments List (baseline):

    • Navigate to a course
    • Go to Assignments tab
    • Click on an assignment
    • Tap the bookmark icon to create a bookmark
    • Navigate to Dashboard → Bookmarks
    • Tap the bookmarked assignment
    • ✅ Verify: Assignment details opens correctly (should continue to work as before)
  4. From Calendar:

    • Navigate to Calendar
    • Tap on an assignment event
    • Tap the bookmark icon to create a bookmark
    • Navigate to Dashboard → Bookmarks
    • Tap the bookmarked assignment
    • ✅ Verify: Assignment details opens correctly

Additional Smoke Tests for Bookmarking

Since this PR modifies bookmark URL generation:

  • Test bookmarking discussions from different entry points
  • Test bookmarking pages from modules
  • Test bookmarking quiz assignments
  • Verify bookmark URLs in the database don't contain placeholder segments like :sliding_tab_type or :submission_id

Expected Behavior

  • All bookmarks should generate clean URLs without placeholder segments
  • Example of CORRECT bookmark URL: https://domain.com/courses/123/assignments/456
  • Example of INCORRECT (old bug) URL: https://domain.com/courses/123/assignments/456/:sliding_tab_type/:submission_id

refs: MBL-19497
affects: Student
release note: Fixed an issue where bookmarks created from notifications or the ToDo list would fail to open

  • I have performed dark/light mode testing
  • I have performed landscape/tablet testing
  • I have tested with the most common accessibility tools
  • I have received product owner approval (if applicable)

Fixed issue where bookmarking assignments opened from notifications
or ToDo list generated URLs with placeholder segments like
:sliding_tab_type and :submission_id, making the bookmarks unusable.

The fix adds regex-based placeholder stripping in BookmarkCreationDialog
after URL generation, ensuring clean URLs without affecting route matching
or existing routing logic.

Changes:
- Added placeholder stripping logic to BookmarkCreationDialog
- Strips segments matching /:[^/?#]+ pattern from generated URLs
- Applied to both single fragment and dual fragment bookmark flows

Test plan:
- Navigate from notifications to assignment details and bookmark
- Verify bookmark URL is clean without placeholders
- Test bookmarking from assignments list, calendar, and ToDo list
- Verify all bookmark URLs are properly formed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@kristofnemere kristofnemere changed the title [MBL-19497] Fix bookmark URL placeholders from notifications [MBL-19497][Student] Fix bookmark URL placeholders from notifications Nov 27, 2025
Copy link

@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 URL cleanup logic to strip unreplaced placeholder segments from bookmark URLs. The fix addresses a valid issue where RouteMatcher.generateUrl() may leave placeholder segments (like /:sliding_tab_type/:submission_id) in URLs when replacement parameters aren't provided.

Positive Feedback

Good problem identification: The fix addresses a real issue where URL generation can leave placeholder segments unreplaced
Strategic placement: The cleanup is applied after URL generation attempts, which is the right approach
Clear comments: The inline comments explain why this cleanup is needed

Issues Found

  • Code duplication (lines 166-168 and 185-187): The placeholder stripping logic is duplicated. Extract to a private helper function to follow DRY principles and improve maintainability - BookmarkCreationDialog.kt:166
  • Regex pattern could be more precise: The pattern /:[^/?#]+ might match edge cases beyond typical placeholders. Consider using /:([a-z_]+) to match only lowercase placeholder-style segments - BookmarkCreationDialog.kt:168

Additional Considerations

Missing test coverage: This file has no unit tests. Consider adding tests to verify:

  • Placeholder segments are properly stripped
  • Valid URL segments are preserved
  • Edge cases (empty URLs, URLs with query params, etc.)

Root cause: While this fix works as a bandaid, the underlying issue is that RouteMatcher.generateUrl() returns URLs with unreplaced placeholders. Consider whether the root cause should be addressed in Route.createUrl() (at Route.kt:279) to either throw an error or strip placeholders when replacement params are missing.

Code Quality

The implementation follows the project's Kotlin conventions and integrates well with the existing code structure. The inline comments are helpful and the fix is minimally invasive.

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

📊 Code Coverage Report

✅ Student

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

✅ Teacher

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

⚠️ Pandautils

  • PR Coverage: 22.63%
  • Master Coverage: 22.63%
  • Delta: -0.00%

📈 Overall Average

  • PR Coverage: 30.29%
  • Master Coverage: 30.29%
  • Delta: -0.00%

@github-actions
Copy link

Student Install Page

Copy link
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.

  • In the Files menu, when I try to bookmark a folder, the button doesn’t do anything, it’s not possible to bookmark it.
  • When I open a New Quiz type from the Quizzes menu, I also can’t bookmark it because the button doesn’t respond there either.

See attached video.

Screen_Recording_20251128_130018_Canvas.mp4

Copy link
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 👍

The found issues (subfolder bookmark, new quiz bookmark) are existing production issues, not exactly related to this bugfix. However, decide if you fix them in the scope of this PR, I can accept if not, but then please make separate bug ticket(s) for them.

Copy link
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
As we discussed, we won’t fix this finding now. I’ll create a separate bug ticket for it, so it’s approved from my side as well.

@kristofnemere kristofnemere merged commit b2aa88b into master Nov 28, 2025
69 of 71 checks passed
@kristofnemere kristofnemere deleted the MBL-19497/fix-bookmark-url-placeholders branch November 28, 2025 13:08
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.

5 participants