task sync

This commit is contained in:
nobody 2022-03-17 19:26:10 -07:00
parent e3c2e39b7a
commit 60e73c01ac
2 changed files with 7 additions and 2 deletions

View file

@ -33,7 +33,7 @@ class Libsync
public static function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) public static function build_sync_packet($uid = 0, $packet = null, $groups_changed = false)
{ {
//logger('build_sync_packet'); // logger('build_sync_packet');
$keychange = (($packet && array_key_exists('keychange', $packet)) ? true : false); $keychange = (($packet && array_key_exists('keychange', $packet)) ? true : false);
if ($keychange) { if ($keychange) {

View file

@ -4,6 +4,7 @@ namespace Code\Module;
use App; use App;
use Code\Web\Controller; use Code\Web\Controller;
use Code\Lib\Libsync;
use Code\Lib\Apps; use Code\Lib\Apps;
use Code\Widget\Tasklist; use Code\Widget\Tasklist;
@ -70,6 +71,7 @@ class Tasks extends Controller
} }
$x = event_store_event($event); $x = event_store_event($event);
if ($x) { if ($x) {
Libsync::build_sync_packet($channel['channel_id'], ['event' => [$x]]);
$ret['success'] = true; $ret['success'] = true;
} }
} }
@ -93,10 +95,13 @@ class Tasks extends Controller
$event['summary'] = escape_tags($_REQUEST['summary']); $event['summary'] = escape_tags($_REQUEST['summary']);
$x = event_store_event($event); $x = event_store_event($event);
if ($x) { if ($x) {
Libsync::build_sync_packet($channel['channel_id'], ['event' => [$x]]);
$x['success'] = true; $x['success'] = true;
} else { }
else {
$x = ['success' => false]; $x = ['success' => false];
} }
json_return_and_die($x); json_return_and_die($x);
} }
} }