aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Cron.php9
-rw-r--r--Zotlabs/Module/Sse.php26
-rw-r--r--Zotlabs/Module/Sse_bs.php7
-rw-r--r--view/js/main.js4
4 files changed, 23 insertions, 23 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index 8fa31e6ce..bd4e0b294 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -40,6 +40,15 @@ class Cron {
require_once('include/sharedwithme.php');
apply_updates();
+
+ /**
+ * Chatpresence: if somebody hasn't pinged recently, they've most likely left the page
+ * and shouldn't count as online anymore. We allow an expection for bots.
+ */
+ q("delete from chatpresence where cp_last < %s - INTERVAL %s and cp_client != 'auto' ",
+ db_utcnow(),
+ db_quoteinterval('3 MINUTE')
+ );
// expire any expired mail
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index b227a396d..b68fe6705 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -6,6 +6,7 @@ use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Enotify;
+use Zotlabs\Lib\XConfig;
class Sse extends Controller {
@@ -83,30 +84,17 @@ class Sse extends Controller {
}
}
- /**
- * Chatpresence continued... if somebody hasn't pinged recently, they've most likely left the page
- * and shouldn't count as online anymore. We allow an expection for bots.
- */
- q("delete from chatpresence where cp_last < %s - INTERVAL %s and cp_client != 'auto' ",
- db_utcnow(),
- db_quoteinterval('3 MINUTE')
- );
+ XConfig::Load(self::$ob_hash);
- $x = q("SELECT v FROM xconfig WHERE xchan = '%s' AND cat = 'sse' AND k = 'notifications'",
- dbesc(self::$ob_hash)
- );
-
- if($x) {
- $result = unserialize($x[0]['v']);
- }
+ $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ $lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
- if($result) {
+ if($result && !$lock) {
echo "event: notifications\n";
echo 'data: ' . json_encode($result);
echo "\n\n";
- set_xconfig(self::$ob_hash, 'sse', 'notifications', []);
- set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert());
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
unset($result);
}
@@ -120,7 +108,7 @@ class Sse extends Controller {
if(connection_status() != CONNECTION_NORMAL || connection_aborted()) {
//TODO: this does not seem to be triggered
- set_xconfig(self::$ob_hash, 'sse', 'timestamp', NULL_DATE);
+ XConfig::Set(self::$ob_hash, 'sse', 'timestamp', NULL_DATE);
break;
}
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index 270e8b9b9..5e00593ef 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -40,9 +40,6 @@ class Sse_bs extends Controller {
self::$offset = 0;
self::$xchans = '';
- set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert());
- set_xconfig(self::$ob_hash, 'sse', 'language', App::$language);
-
if(!empty($_GET['nquery']) && $_GET['nquery'] !== '%') {
$nquery = $_GET['nquery'];
@@ -80,6 +77,10 @@ class Sse_bs extends Controller {
default:
}
+ set_xconfig(self::$ob_hash, 'sse', 'timestamp', datetime_convert());
+ set_xconfig(self::$ob_hash, 'sse', 'notifications', []); // reset the cache
+ set_xconfig(self::$ob_hash, 'sse', 'language', App::$language);
+
if(self::$offset && $f) {
$result = self::$f(true);
json_return_and_die($result);
diff --git a/view/js/main.js b/view/js/main.js
index eac9bf6ef..a528658e1 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1774,7 +1774,9 @@ function sse_updateNotifications(type, mid, interactive) {
if(! interactive)
return true;
- $('#nav-' + type + '-menu .notification[data-b64mid=\'' + mid + '\']').fadeOut();
+ $('#nav-' + type + '-menu .notification[data-b64mid=\'' + mid + '\']').fadeOut(function() {
+ this.remove();
+ });
}