Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Sources/Actions/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,20 @@ protected function setAlertPref(): void
$perfs = self::getNotifyPrefs((int) self::$member_info['id'], [$this->type . '_notify_' . $this->id], true);
$this->alert_pref = ((int) $perfs[(int) self::$member_info['id']][$this->type . '_notify_' . $this->id]) & self::PREF_ALERT;
break;

// And its mirror image: turn off the alerts and keep the emails.
case self::MODE_NO_ALERT:
$perfs = self::getNotifyPrefs((int) self::$member_info['id'], [$this->type . '_notify_' . $this->id], true);
$this->alert_pref = ((int) $perfs[(int) self::$member_info['id']][$this->type . '_notify_' . $this->id]) & self::PREF_EMAIL;
break;

// $this->mode comes straight from the query string, so it can be
// anything at all. Leaving it out here means the typed property
// below is never assigned, and reading it is a fatal error rather
// than a page.
default:
$this->alert_pref = self::PREF_NONE;
break;
}
}

Expand Down
4 changes: 3 additions & 1 deletion Sources/Actions/NotifyBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ protected function setId(): void
protected function saToMode(): void
{
if (!isset($_GET['mode']) && isset($_GET['sa'])) {
$_GET['mode'] = $_GET['sa'] == 'on' ? 3 : -1;
// 'off' is the unsubscribe link in the notification emails, so it
// means stop emailing me - not stop telling me anything at all.
$_GET['mode'] = $_GET['sa'] == 'on' ? parent::MODE_BOTH : parent::MODE_NO_EMAIL;
unset($_GET['sa']);
}
}
Expand Down
6 changes: 4 additions & 2 deletions Sources/Actions/NotifyTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ protected function setId(): void
protected function saToMode(): void
{
if (!isset($_GET['mode']) && isset($_GET['sa'])) {
$_GET['mode'] = $_GET['sa'] == 'on' ? 3 : -1;
// 'off' is the unsubscribe link in the notification emails, so it
// means stop emailing me - not stop telling me anything at all.
$_GET['mode'] = $_GET['sa'] == 'on' ? parent::MODE_BOTH : parent::MODE_NO_EMAIL;
unset($_GET['sa']);
}
}
Expand Down Expand Up @@ -116,7 +118,7 @@ protected function changePref(): void
[
'id_member' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'unwatched' => 'int',
],
$log,
[$log],
['id_member', 'id_topic'],
);

Expand Down