Skip to content

feat(group_profile): add group notification toggles and leave sheet - #735

Open
tentamdin wants to merge 4 commits into
developfrom
feat/group-notification-controls
Open

feat(group_profile): add group notification toggles and leave sheet#735
tentamdin wants to merge 4 commits into
developfrom
feat/group-notification-controls

Conversation

@tentamdin

Copy link
Copy Markdown
Member
  • Joined button opens a sheet with per-group chat and content push toggles and a confirmed Leave group action.
  • Master switch off now unregisters the push device and greys out the toggles.
  • Route EVENT_REMINDER pushes to the event, and skip the foreground banner for the open chat room.

Joined button opens a sheet with per-group chat and content push toggles
and a confirmed Leave group action. Master switch off now unregisters the
push device and greys out the toggles. Route EVENT_REMINDER pushes to the
event, and skip the foreground banner for the open chat room.
Claiming the active room from initState and dispose tripped Riverpod's
lifecycle guard and red-screened the chat screen. Use a plain holder
object instead; push suppression reads it the same way.
@tentamdin
tentamdin marked this pull request as ready for review September 8, 2026 18:32
@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

The PR is not yet safe to merge because a transient unregister failure can leave an opted-out device receiving server push notifications.

Findings

  1. P1 Security Failed opt-out is not retried
Prompt To Fix All With AI
### Issue 1
lib/features/push_notifications/application/push_notification_service.dart:216-218
When device unregistration fails after the signed-in user disables the master notification switch, this branch only logs the failure after the reconciliation loop has cleared its pending-work flag. No automatic retry is scheduled, so the backend registration remains active and background or terminated-state notifications continue until an unrelated event triggers another reconciliation.

**How this was verified:** The failure branch leaves the stored registration intact, and reconciliation restarts only when another request is already pending.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

  • Adds group-level chat and content notification preferences.
  • Unregisters devices when the application-wide notification switch is disabled.
  • Tracks nested active chat rooms to suppress duplicate foreground banners.
  • Routes event-reminder notifications to their corresponding event.
  • A failed master-switch unregistration currently leaves the backend device registration active without an automatic retry.

Comment thread lib/features/group_chat/presentation/providers/group_chat_providers.dart Outdated
Master switch flips during an in-flight register or unregister could leave
the device registered after opt-out, or lose the id of a fresh registration.
Route both through one reconcile loop that re-reads state after each pass.
Track open chat rooms as a stack so popping one chat re-mutes the one under
it.
Comment on lines +216 to +218
final result = await _repository.unregisterDeviceToken(serverId);
await result.fold(
(failure) async =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Failed opt-out is not retried

When device unregistration fails after the signed-in user disables the master notification switch, this branch only logs the failure after the reconciliation loop has cleared its pending-work flag. No automatic retry is scheduled, so the backend registration remains active and background or terminated-state notifications continue until an unrelated event triggers another reconciliation.

How this was verified: The failure branch leaves the stored registration intact, and reconciliation restarts only when another request is already pending.

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/features/push_notifications/application/push_notification_service.dart
Line: 216-218

Comment:
**Failed opt-out is not retried**

When device unregistration fails after the signed-in user disables the master notification switch, this branch only logs the failure after the reconciliation loop has cleared its pending-work flag. No automatic retry is scheduled, so the backend registration remains active and background or terminated-state notifications continue until an unrelated event triggers another reconciliation.

**How this was verified:** The failure branch leaves the stored registration intact, and reconciliation restarts only when another request is already pending.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

A master-switch opt-out whose DELETE failed offline left the device
registered until some unrelated event reconciled again. Retry failed
passes with linear backoff up to five times; an explicit request cancels
a pending retry.
@tentamdin

Copy link
Copy Markdown
Member Author

@greptileai review

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.

1 participant