-
Notifications
You must be signed in to change notification settings - Fork 436
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(archive): Improve archive preference handling #13404
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,18 +299,36 @@ public function updateNotificationCalls(Participant $participant, int $level): v | |
} | ||
|
||
/** | ||
* @param Participant $participant | ||
* @return Participant::NOTIFY_* | ||
*/ | ||
protected function getDefaultGroupNotification(): int { | ||
$config = (int)$this->serverConfig->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_MENTION); | ||
return max(Participant::NOTIFY_DEFAULT, min($config, Participant::NOTIFY_NEVER)); | ||
} | ||
|
||
public function archiveConversation(Participant $participant): void { | ||
$attendee = $participant->getAttendee(); | ||
$attendee->setArchived(true); | ||
$attendee->setLastAttendeeActivity($this->timeFactory->getTime()); | ||
|
||
$room = $participant->getRoom(); | ||
if ($room->getType() === Room::TYPE_PUBLIC || $room->getType() === Room::TYPE_GROUP) { | ||
// Turn of call notifications by default | ||
if ($attendee->getNotificationCalls() === Participant::NOTIFY_CALLS_ON) { | ||
$attendee->setNotificationCalls(Participant::NOTIFY_CALLS_OFF); | ||
} | ||
|
||
// Reduce notifications when it was "Always" via the default | ||
// Otherwise we respect the attendees selection | ||
if ($attendee->getNotificationLevel() === Participant::NOTIFY_DEFAULT | ||
&& $this->getDefaultGroupNotification() !== Participant::NOTIFY_NEVER) { | ||
$attendee->setNotificationCalls(Participant::NOTIFY_MENTION); | ||
} | ||
Comment on lines
+323
to
+326
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to consider the default group notification level? I thought it's relevant only when creating a new conversation. Also, I think user expects to turn off all notifications automatically (maybe except mention) when archiving a conversation. They could have set "always" for group conversation previously and when archiving, they expect it to be changed to "only mention" and not stay "always" (why would they archive it then). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume DEFAULT is stored in DB per each attendee, unless was redefined by that attendee. Then it makes sense to redefine default behaviour only If they are annoyed by notifications, maybe they shouldn't have set it to ALWAYS?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Even if it was redefined by attendee, it doesn't mean it should be applied in archive (the point of archive it to put the notifications frequency to the lowest (not in sidebar list, no call, no message notif).
Conversation was previously important (a deal) and now it's not (deal closed for a while now). A user can see archiving as a good shortcut to reduce the notifications at once. |
||
} | ||
|
||
$this->attendeeMapper->update($attendee); | ||
} | ||
|
||
/** | ||
* @param Participant $participant | ||
*/ | ||
public function unarchiveConversation(Participant $participant): void { | ||
$attendee = $participant->getAttendee(); | ||
$attendee->setArchived(false); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.