-
-
Notifications
You must be signed in to change notification settings - Fork 859
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 notifications #5959
Fix notifications #5959
Conversation
The notification about wrong login was not working. Noticed while working on FreshRSS#5955 This was due to timing of when the notification is retrieved. Simplified code to make the logic easier and more robust.
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.
Looks good, but I haven't tested it.
$status = $this->notification['type']; | ||
|
||
$notif = Minz_Request::getNotification(); | ||
if (!empty($notif)) { |
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.
if (!empty($notif)) { | |
if ($notif !== null && array_key_exists('content', $notif) && array_key_exists('type', $notif)) { |
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.
The check is already done by type declaration (this code already passes PHPStan Level 9). And if anything, array_key_exists
does not seem like the correct test as it accepts null
, which we do not want.
We could consider using ??
below for providing default values, but I do not think it is necessary for now.
$msg = $this->notification['content']; | ||
$status = $this->notification['type']; | ||
$notif = Minz_Request::getNotification(); | ||
if (!empty($notif)) { |
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.
if (!empty($notif)) { | |
if ($notif !== null && array_key_exists('content', $notif) && array_key_exists('type', $notif)) { |
The notification about wrong login was not working. Noticed while working on #5955
This was due to timing of when the notification is retrieved.
Simplified code to make the logic easier and more robust.