aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-22 05:50:15 -0700
committerfriendica <info@friendica.com>2013-08-22 05:50:15 -0700
commit141c8ccb1f94b9ce80466aa6be178d97e3f290bf (patch)
tree80d00f40987ba79f5568bdfd6835bf996e9c4ed7
parent32ff0932bf3b596e68ae7f4100bebbccdc1eae00 (diff)
downloadvolse-hubzilla-141c8ccb1f94b9ce80466aa6be178d97e3f290bf.tar.gz
volse-hubzilla-141c8ccb1f94b9ce80466aa6be178d97e3f290bf.tar.bz2
volse-hubzilla-141c8ccb1f94b9ce80466aa6be178d97e3f290bf.zip
possible fix for mention tags not posting to mentioned forum (when send stream permission is blocked)
-rw-r--r--include/zot.php28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/zot.php b/include/zot.php
index 37d2a03bd..c7049dee6 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -838,6 +838,7 @@ function zot_import($arr) {
// and who are allowed to see them based on the sender's permissions
$deliveries = allowed_public_recips($i);
+
}
if(! $deliveries) {
logger('zot_import: no deliveries on this site');
@@ -910,10 +911,12 @@ function zot_import($arr) {
function public_recips($msg) {
+ $check_mentions = false;
if($msg['message']['type'] === 'activity') {
if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) {
$col = 'channel_w_stream';
$field = PERMS_W_STREAM;
+ $check_mentions = true;
}
else {
$col = 'channel_w_comment';
@@ -928,8 +931,7 @@ function public_recips($msg) {
if(! $col)
return NULL;
- logger('__public_recips');
-dbg(1);
+
if($msg['notify']['sender']['url'] === z_root())
$sql = " where (( " . $col . " & " . PERMS_NETWORK . " ) or ( " . $col . " & " . PERMS_SITE . " )) ";
else
@@ -947,9 +949,29 @@ dbg(1);
if(! $x)
$x = array();
-dbg(0);
$r = array_merge($r,$x);
+
+ // look for any public mentions on this site
+ // They will get filtered by tgroup_check() so we don't need to check permissions now
+
+ if($check_mentions && $msg['message']['tags']) {
+ if(is_array($msg['message']['tags']) && $msg['message']['tags']) {
+ foreach($msg['message']['tags'] as $tag) {
+ if(($tag['type'] === 'mention') && (strpos($tag['url'],z_root()) !== false)) {
+ $address = basename($tag['url']);
+ if($address) {
+ $z = q("select channel_hash as hash from channel where channel_address = '%s' limit 1",
+ dbesc($address)
+ );
+ if($z)
+ $r = array_merge($r,$z);
+ }
+ }
+ }
+ }
+ }
+
logger('public_recips: ' . print_r($r,true), LOGGER_DATA);
return $r;
}