make sure enough info in edited photos is changed to actually update on the other end

This commit is contained in:
zotlabs 2019-03-30 15:56:37 -07:00
parent 42dcc86e3e
commit ad021811d8
2 changed files with 24 additions and 6 deletions

View file

@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use Zotlabs\Lib\Libsync;
use Zotlabs\Daemon\Master;
require_once('include/security.php');
require_once('include/bbcode.php');
@ -9,8 +10,6 @@ require_once('include/event.php');
class Like extends \Zotlabs\Web\Controller {
private function reaction_to_activity($reaction) {
$acts = [
@ -309,7 +308,7 @@ class Like extends \Zotlabs\Web\Controller {
// drop_item was not done interactively, so we need to invoke the notifier
// in order to push the changes to connections
\Zotlabs\Daemon\Master::Summon(array('Notifier','drop',$rr['id']));
Master::Summon(array('Notifier','drop',$rr['id']));
}
@ -353,12 +352,13 @@ class Like extends \Zotlabs\Web\Controller {
if(intval($item['item_wall']))
$arr['item_wall'] = 1;
// if this was a linked photo and was hidden, unhide it.
// if this was a linked photo and was hidden, unhide it and distribute it.
if(intval($item['item_hidden'])) {
$r = q("update item set item_hidden = 0 where id = %d",
intval($item['id'])
);
Master::Summon(array('Notifier','wall-new',$item['id']));
}
}

View file

@ -5,6 +5,7 @@ use App;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Access\AccessControl;
use Zotlabs\Daemon\Master;
require_once('include/photo/photo_driver.php');
require_once('include/photos.php');
@ -263,7 +264,9 @@ class Photos extends \Zotlabs\Web\Controller {
$item_id = photos_create_item(App::$data['channel'],get_observer_hash(),$p[0],$visibility);
}
$obj = EMPTY_STR;
if($item_id) {
$r = q("SELECT * FROM item WHERE id = %d AND uid = %d LIMIT 1",
intval($item_id),
@ -274,17 +277,28 @@ class Photos extends \Zotlabs\Web\Controller {
$old_tag = $r[0]['tag'];
$old_inform = $r[0]['inform'];
}
if($r[0]['obj']) {
$obj = json_decode($r[0]['obj'],true);
$obj['name'] = (($desc) ? $desc : $p[0]['filename']);
$obj['updated'] = datetime_convert('UTC','UTC','now',ATOM_TIME);
$obj = json_encode($obj);
}
}
// make sure the linked item has the same permissions as the photo regardless of any other changes
$x = q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', title = '%s', item_private = %d
$x = q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', title = '%s', obj = '%s', edited = '%s', item_private = %d
where id = %d",
dbesc($perm['allow_cid']),
dbesc($perm['allow_gid']),
dbesc($perm['deny_cid']),
dbesc($perm['deny_gid']),
dbesc(($desc) ? $desc : $p[0]['filename']),
dbesc($obj),
dbesc(datetime_convert()),
intval($acl->is_private()),
intval($item_id)
);
@ -350,6 +364,10 @@ class Photos extends \Zotlabs\Web\Controller {
}
if($visibility) {
Master::Summon(array('Notifier','edit_post',$item_id));
}
$sync = attach_export_data(App::$data['channel'],$resource_id);
if($sync)