hiding a channel from the directory also hides them from the cloud rootdir

This commit is contained in:
zotlabs 2018-06-18 22:57:38 -07:00
parent 6cf040d3ee
commit 3716f4e809

View File

@ -722,14 +722,13 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
function ChannelList(&$auth) { function ChannelList(&$auth) {
$ret = array(); $ret = array();
$r = q("SELECT channel_id, channel_address FROM channel WHERE channel_removed = 0 $r = q("SELECT channel_id, channel_address, profile.publish FROM channel left join profile on profile.uid = channel.channel_id WHERE channel_removed = 0 AND channel_system = 0 AND (channel_pageflags & %d) = 0",
AND channel_system = 0 AND (channel_pageflags & %d) = 0",
intval(PAGE_HIDDEN) intval(PAGE_HIDDEN)
); );
if ($r) { if ($r) {
foreach ($r as $rr) { foreach ($r as $rr) {
if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage')) { if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage') && $rr['publish']) {
logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA); logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA);
// @todo can't we drop '/cloud'? It gets stripped off anyway in RedDirectory // @todo can't we drop '/cloud'? It gets stripped off anyway in RedDirectory
$ret[] = new Directory('/cloud/' . $rr['channel_address'], $auth); $ret[] = new Directory('/cloud/' . $rr['channel_address'], $auth);