File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
app/code/Magento/AdminNotification
Controller/Adminhtml/Notification Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ public function getLastCritical()
74
74
{
75
75
$ items = array_values ($ this ->_messages ->getItems ());
76
76
77
- if (isset ($ items[ 0 ] ) && ( int ) $ items[ 0 ] ->getSeverity () === MessageInterface::SEVERITY_CRITICAL ) {
78
- return $ items[ 0 ] ;
77
+ if (! empty ($ items ) && current ( $ items) ->getSeverity () === MessageInterface::SEVERITY_CRITICAL ) {
78
+ return current ( $ items) ;
79
79
}
80
80
return null ;
81
81
}
Original file line number Diff line number Diff line change 9
9
use Magento \AdminNotification \Controller \Adminhtml \Notification ;
10
10
use Magento \AdminNotification \Model \NotificationService ;
11
11
use Magento \Backend \App \Action ;
12
+ use Magento \Framework \Exception \LocalizedException ;
12
13
13
14
class MarkAsRead extends Notification
14
15
{
@@ -40,7 +41,7 @@ public function execute()
40
41
try {
41
42
$ this ->notificationService ->markAsRead ($ notificationId );
42
43
$ this ->messageManager ->addSuccessMessage (__ ('The message has been marked as Read. ' ));
43
- } catch (\ Magento \ Framework \ Exception \ LocalizedException $ e ) {
44
+ } catch (LocalizedException $ e ) {
44
45
$ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
45
46
} catch (\Exception $ e ) {
46
47
$ this ->messageManager ->addExceptionMessage (
You can’t perform that action at this time.
0 commit comments