From 5e8c84edb23f9bced462954a7ec12e2a091b0a7b Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Tue, 25 Nov 2014 21:38:00 +0100 Subject: [PATCH] notifications bug --- actions/apiqvitternotifications.php | 25 ++++++++++++++++--------- js/lan.js | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/actions/apiqvitternotifications.php b/actions/apiqvitternotifications.php index bf1aa8c..49143d0 100644 --- a/actions/apiqvitternotifications.php +++ b/actions/apiqvitternotifications.php @@ -103,15 +103,22 @@ class ApiQvitterNotificationsAction extends ApiPrivateAuthAction $notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id)); } } - - $notifications_populated[] = array( - 'id'=> $notification->id, - 'from_profile'=> self::twitterUserArray(Profile::getKV($notification->from_profile_id)), - 'ntype'=> $notification->ntype, - 'notice'=> $notice, - 'created_at'=>self::dateTwitter($notification->created), - 'is_seen'=>$notification->is_seen - ); + + $from_profile = Profile::getKV($notification->from_profile_id); + + // a user might have deleted their profile, don't show these notifications + if($from_profile instanceof Profile) { + + $notifications_populated[] = array( + 'id'=> $notification->id, + 'from_profile'=> self::twitterUserArray($from_profile), + 'ntype'=> $notification->ntype, + 'notice'=> $notice, + 'created_at'=>self::dateTwitter($notification->created), + 'is_seen'=>$notification->is_seen + ); + + } } // mark as seen diff --git a/js/lan.js b/js/lan.js index d33dbc5..0829fdf 100644 --- a/js/lan.js +++ b/js/lan.js @@ -2008,7 +2008,7 @@ window.siteTitle = $('head title').html(); // remember this for later use // replace placeholders in translation $.each(window.sL,function(k,v){ - window.sL[k] = v.replace('{site-title}',window.siteTitle); + window.sL[k] = v.replace(/{site-title}/g,window.siteTitle); }); // set some static string