File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -281,9 +281,12 @@ public function isAckAction()
281
281
$ json = array ();
282
282
$ postId = $ this ->params ()->fromQuery ('postid ' , null );
283
283
$ myReactions = $ this ->mattermost ->getMyReactions ($ postId );
284
- $ ok = array_filter ($ myReactions , function ($ v ){
285
- return strcmp ($ v ['emoji_name ' ], 'ok ' ) == 0 ;
286
- });
284
+ $ ok = array ();
285
+ if ($ myReactions !== null ) {
286
+ $ ok = array_filter ($ myReactions , function ($ v ) {
287
+ return strcmp ($ v ['emoji_name ' ], 'ok ' ) == 0 ;
288
+ });
289
+ }
287
290
$ json ['ack ' ] = count ($ ok ) == 1 ;
288
291
return new JsonModel ($ json );
289
292
}
Original file line number Diff line number Diff line change @@ -317,9 +317,13 @@ public function getMyReactions($postId)
317
317
$ result = $ this ->getClient ()->getPostModel ()->getReactions ($ postId );
318
318
if ($ result ->getStatusCode () == 200 ) {
319
319
$ reactions = json_decode ($ result ->getBody (), true );
320
- $ myReactions = array_filter ($ reactions , function ($ v ){
321
- return strcmp ($ v ['user_id ' ], $ this ->getMyId ()) == 0 ;
322
- });
320
+ if ($ reactions !== null ) {
321
+ $ myReactions = array_filter ($ reactions , function ($ v ){
322
+ return strcmp ($ v ['user_id ' ], $ this ->getMyId ()) == 0 ;
323
+ });
324
+ } else {
325
+ return null ;
326
+ }
323
327
return $ myReactions ;
324
328
} else {
325
329
error_log (print_r (json_decode ($ result ->getBody ()), true ));
You can’t perform that action at this time.
0 commit comments