diff options
author | Mario <mario@mariovavti.com> | 2023-11-25 17:12:28 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-11-25 17:12:28 +0100 |
commit | 0fd8e02a884a2b040dca62ab5d9674db5f6a070b (patch) | |
tree | 586ee43f32f6f14368c09026f21dcd3244ea24b6 /Zotlabs/Module/Sse_bs.php | |
parent | 82e704ec5b107823c09f1387e9091adee53a4c2d (diff) | |
parent | 55c4bfb67009c598f25b1a8189604bfffa73dfbb (diff) | |
download | volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.gz volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.bz2 volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.zip |
Merge branch '8.8RC'8.8
Diffstat (limited to 'Zotlabs/Module/Sse_bs.php')
-rw-r--r-- | Zotlabs/Module/Sse_bs.php | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index fdaab4ab8..78adf1859 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -7,6 +7,7 @@ use Zotlabs\Lib\Apps; use Zotlabs\Web\Controller; use Zotlabs\Lib\Enotify; use Zotlabs\Lib\XConfig; +use Zotlabs\Lib\Cache; class Sse_bs extends Controller { @@ -117,14 +118,29 @@ class Sse_bs extends Controller { function mark_read($arr) { - if(! self::$uid) - return; - $mids = []; $str = ''; + $mids_all_json = Cache::get('sse_mids_all_' . session_id()); + + if (!$mids_all_json) + $mids_all_json = '[]'; + + $mids_all = json_decode($mids_all_json, true); + foreach($arr as $a) { - $mids[] = '\'' . dbesc(unpack_link_id($a)) . '\''; + $mid_str = '\'' . dbesc(unpack_link_id($a)) . '\''; + $mids[] = $mid_str; + + if (!in_array($mid_str, $mids_all)) { + $mids_all[] = $mid_str; + } + } + + Cache::set('sse_mids_all_' . session_id(), json_encode($mids_all)); + + if(! self::$uid) { + return; } $str = implode(',', $mids); @@ -411,8 +427,9 @@ class Sse_bs extends Controller { } } - if(! isset($_SESSION['static_loadtime'])) + if(!isset($_SESSION['static_loadtime'])) { $_SESSION['static_loadtime'] = datetime_convert(); + } $limit = intval(self::$limit); $offset = self::$offset; @@ -430,6 +447,13 @@ class Sse_bs extends Controller { if(self::$xchans) $sql_extra2 = " AND CASE WHEN verb = '" . ACTIVITY_SHARE . "' THEN owner_xchan ELSE author_xchan END IN (" . self::$xchans . ") "; + $sql_extra3 = ''; + $sse_mids_all_json = Cache::get('sse_mids_all_' . session_id()); + if ($sse_mids_all_json) { + $sse_mids_all = json_decode($sse_mids_all_json, true); + $sql_extra3 = " AND mid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") "; + } + $uids = " AND uid IN ( " . $sys['channel_id'] . " ) "; $site_firehose = get_config('system', 'site_firehose', 0); @@ -452,10 +476,11 @@ class Sse_bs extends Controller { $item_normal $sql_extra $sql_extra2 + $sql_extra3 ORDER BY created DESC LIMIT $limit OFFSET $offset", dbescdate($_SESSION['sse_loadtime']), dbesc(self::$ob_hash), - dbescdate($_SESSION['static_loadtime']) + dbescdate($_SESSION['last_login_date'] ?? $_SESSION['static_loadtime']) ); if($items) { @@ -478,8 +503,9 @@ class Sse_bs extends Controller { AND created > '%s' $item_normal $sql_extra + $sql_extra3 AND author_xchan != '%s' LIMIT 100", - dbescdate($_SESSION['static_loadtime']), + dbescdate($_SESSION['last_login_date'] ?? $_SESSION['static_loadtime']), dbesc(self::$ob_hash) ); |