aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Like.php15
-rw-r--r--Zotlabs/Module/Pubstream.php5
-rw-r--r--include/channel.php16
3 files changed, 23 insertions, 13 deletions
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index b104a5f5f..0abf111e0 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -12,7 +12,10 @@ class Like extends \Zotlabs\Web\Controller {
function get() {
$o = '';
-
+
+ $sys_channel = get_sys_channel();
+ $sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0);
+
$observer = \App::get_observer();
$interactive = $_REQUEST['interactive'];
if($interactive) {
@@ -253,20 +256,22 @@ class Like extends \Zotlabs\Web\Controller {
logger('like: verb ' . $verb . ' item ' . $item_id, LOGGER_DEBUG);
// get the item. Allow linked photos (which are normally hidden) to be liked
-
+
$r = q("SELECT * FROM item WHERE id = %d
and (item_type = 0 or item_type = 6) and item_deleted = 0 and item_unpublished = 0
and item_delayed = 0 and item_pending_remove = 0 and item_blocked = 0 LIMIT 1",
intval($item_id)
);
-
+
if(! $item_id || (! $r)) {
logger('like: no item ' . $item_id);
killme();
}
+ // Use the $effective_uid option of xchan_query to sort out comment permission
+ // for public stream items
- xchan_query($r,true,(($r[0]['uid'] == local_channel()) ? 0 : local_channel()));
+ xchan_query($r,true,(($r[0]['uid'] == $sys_channel_id) ? local_channel() : 0));
$item = $r[0];
@@ -464,6 +469,8 @@ class Like extends \Zotlabs\Web\Controller {
$arr['mid'] = $mid;
$arr['aid'] = (($extended_like) ? $ch[0]['channel_account_id'] : $owner_aid);
$arr['uid'] = $owner_uid;
+
+
$arr['item_flags'] = $item_flags;
$arr['item_wall'] = $item_wall;
$arr['parent_mid'] = (($extended_like) ? $mid : $item['mid']);
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 4224fa3c8..0e6c2360f 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -240,7 +240,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
dbesc($parents_str)
);
- xchan_query($items,true,(-1));
+ // use effective_uid param of xchan_query to help sort out comment permission
+ // for sys_channel owned items.
+
+ xchan_query($items,true,(($sys) ? local_channel() : 0));
$items = fetch_post_tags($items,true);
$items = conv_sort($items,$ordering);
}
diff --git a/include/channel.php b/include/channel.php
index 4f0e8ec6a..2783dea97 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -101,14 +101,14 @@ function create_sys_channel() {
set_config('system', 'prvkey', $hostkey['prvkey']);
}
- create_identity(array(
- 'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
- 'nickname' => 'sys',
- 'name' => 'System',
- 'pageflags' => 0,
- 'publish' => 0,
- 'system' => 1
- ));
+ create_identity([
+ 'account_id' => 'xxx', // Typecast trickery: account_id is required. This will create an identity with an (integer) account_id of 0
+ 'nickname' => 'sys',
+ 'name' => 'System',
+ 'pageflags' => 0,
+ 'publish' => 0,
+ 'system' => 1
+ ]);
}