Skip to content

Fix #19: Implement public and logged-in notifications#138

Merged
TUPM96 merged 2 commits into
mergeos-bounties:masterfrom
lqkhanh295:fix-issue-19
May 29, 2026
Merged

Fix #19: Implement public and logged-in notifications#138
TUPM96 merged 2 commits into
mergeos-bounties:masterfrom
lqkhanh295:fix-issue-19

Conversation

@lqkhanh295
Copy link
Copy Markdown
Contributor

Resolves #19

Summary

  • Added unread state to dashboard notifications
  • Modified dashboardNotificationCount to display the count of unread notifications
  • Implemented markAllNotificationsRead to call the /api/notifications/read-all endpoint and update UI
  • Updated the .toast CSS for mobile view to display at the bottom instead of the top so it doesn't overlap important CTAs like the navigation bar.

Acceptance Criteria Met

  • Added/fixed notification UI for logged-in dashboard users (including new unread UI styling and mark-all read).
  • Adjusted public toast mobile position for better layout.
  • Handled missing backend data: utilized note.read_at field from existing notifications API.
  • Note: Test commands like npm test or go test were skipped locally as the environment restricts npm/go commands, but relying on CI builds for verification.

Claim Requirement

Claim comment: #1 (comment)

Copilot AI review requested due to automatic review settings May 29, 2026 00:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR enhances the dashboard notification center by adding explicit unread styling, an action to mark all notifications as read, and adjusting toast positioning on small screens.

Changes:

  • Add unread visual treatment for notifications (row highlight + dot emphasis).
  • Add “Mark all read” action and update the header to show unread count.
  • Move mobile toast positioning from top to bottom.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
frontend/src/styles.css Adds styles for unread notifications + actions row; adjusts toast position on narrow viewports.
frontend/src/App.vue Computes unread count, supports unread UI state, and adds “mark all read” API action.
Comments suppressed due to low confidence (1)

frontend/src/App.vue:3423

  • dashboardNotificationCount is derived from dashboardNotificationRows, but dashboardNotificationRows is sliced to 8 items. This will undercount unread notifications when there are more than 8 notifications/unreads. Consider computing the unread count from the full notifications source (pre-slice), or splitting this into (1) an unsliced list for counts and (2) a sliced list for display.
const dashboardNotificationRows = computed(() =>

Comment thread frontend/src/App.vue Outdated
Comment on lines +3427 to +3430
.slice(0, 8)
.map(mapDashboardNotification),
);
const dashboardNotificationCount = computed(() => Math.min(9, dashboardNotificationRows.value.length));
const dashboardNotificationCount = computed(() => dashboardNotificationRows.value.filter((n) => n.isUnread).length);
Comment thread frontend/src/styles.css
Comment on lines 6301 to +6303

.notification-dot.unread-pulse {
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
Comment thread frontend/src/App.vue
<div v-if="dashboardNotificationRows.length" class="notification-center-list">
<article v-for="note in dashboardNotificationRows" :key="note.id">
<span :class="['notification-dot', note.tone]" />
<article v-for="note in dashboardNotificationRows" :key="note.id" :class="{ 'is-unread': note.isUnread }">
Copy link
Copy Markdown
Contributor

@eliasx45 eliasx45 left a comment

Choose a reason for hiding this comment

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

Reviewed current head 6a7aecea77a1ba7b58feb98265df0eca990a8cce. Verdict: request changes.

The build is healthy, but the unread-count implementation has a behavioral bug. dashboardNotificationRows sorts and slices the API result to the first 8 rows before mapping, and dashboardNotificationCount is then computed from that sliced display list:

const dashboardNotificationRows = computed(() =>
  dashboardNotifications.value
    .slice()
    .sort(...)
    .slice(0, 8)
    .map(mapDashboardNotification),
);
const dashboardNotificationCount = computed(() => dashboardNotificationRows.value.filter((n) => n.isUnread).length);

That means the dashboard badge and Mark all read button only count unread notifications inside the visible 8 rows. If a user has 9+ notifications and unread items are below the display slice, the badge can undercount or show 0 new, and the mark-all action can disappear even though unread notifications still exist. Please compute the unread count from the full dashboardNotifications source, then keep the sliced computed value only for rendering.

There is also a whitespace blocker:

git diff --check origin/master...HEAD
# frontend/src/App.vue:5038: new blank line at EOF.

Other validation on this checkout:

git merge-tree --write-tree origin/master HEAD
# df5d684e57128e87564f682ede4540b34a190b2b

npm.cmd --prefix frontend test
# 9 tests passed

npm.cmd --prefix frontend ci
# 36 packages installed, 0 vulnerabilities

npm.cmd --prefix frontend run build:local
# client and SSR builds completed successfully

Suggested fix: introduce an unsliced unread-count computed over dashboardNotifications.value directly, for example by filtering !note.read_at, and remove the trailing blank line at EOF.

@TUPM96 TUPM96 added enhancement New feature or request bounty Eligible work for the MergeOS bounty program bounty: feature Feature or enhancement bounty work. reward:3000-mrg Bounty reward is 3000 MRG tokens. frontend Frontend UI and interaction work. responsive Responsive layout and viewport QA. auth Authentication, login, logout, and account session flows. qa Quality assurance, regression testing, and verification work. dashboard Dashboard layout, authenticated workspace, and post-login UI work. notifications Notification UI, notification center, realtime alerts, and user-facing status messages. evidence: missing PR needs screenshot, GIF, video, or other visual evidence. star: verified PR author has starred this repository. labels May 29, 2026
@lqkhanh295
Copy link
Copy Markdown
Contributor Author

Hi @eliasx45 and @TUPM96, I have updated the implementation to address your review feedback: (1) calculated the unread notification count directly from the full notifications source rather than the sliced list, and (2) removed the trailing blank line at EOF. The tests and builds are passing successfully. Please take a look when you have time! Thank you!

TUPM96 pushed a commit that referenced this pull request May 29, 2026
Maintainer merge: verified the frontend WebSocket visibility/stat update diff against current master. Local merged preview with #138/#143 passed frontend tests and build; no security issue found in #140. Claimant/payout dispute remains separate from accepting this safe code change.
@TUPM96 TUPM96 merged commit e9fc614 into mergeos-bounties:master May 29, 2026
5 checks passed
TUPM96 pushed a commit that referenced this pull request May 29, 2026
Maintainer merge: reviewed the CSS-only dashboard layout fix after the author follow-up. Local merged preview with #140/#138 passed frontend tests and build; no security-sensitive code path or unrelated workflow deletion found. Note: local diff-check still reported a trailing blank line at EOF, but it is non-functional whitespace and does not affect runtime behavior.
@TUPM96
Copy link
Copy Markdown
Contributor

TUPM96 commented May 29, 2026

Maintainer follow-up: merged after rechecking the author update.

Validation:

Bounty/evidence review can remain separate from accepting this safe UI change.

@TUPM96
Copy link
Copy Markdown
Contributor

TUPM96 commented May 29, 2026

MRG credit issued after maintainer merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication, login, logout, and account session flows. bounty: feature Feature or enhancement bounty work. bounty Eligible work for the MergeOS bounty program dashboard Dashboard layout, authenticated workspace, and post-login UI work. enhancement New feature or request evidence: missing PR needs screenshot, GIF, video, or other visual evidence. frontend Frontend UI and interaction work. notifications Notification UI, notification center, realtime alerts, and user-facing status messages. qa Quality assurance, regression testing, and verification work. responsive Responsive layout and viewport QA. reward:3000-mrg Bounty reward is 3000 MRG tokens. star: verified PR author has starred this repository.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[3000 MRG] Implement public and logged-in notifications

4 participants