aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-25 01:39:45 -0800
committerfriendica <info@friendica.com>2015-02-25 01:39:45 -0800
commit2a2cc309ce2f9a991978d7dda841663825a95370 (patch)
tree94f71f0407a7cf5432b66efb87e987d3f65d208b
parent1434130264836916001fe191dd237e51af5c6e3e (diff)
downloadvolse-hubzilla-2a2cc309ce2f9a991978d7dda841663825a95370.tar.gz
volse-hubzilla-2a2cc309ce2f9a991978d7dda841663825a95370.tar.bz2
volse-hubzilla-2a2cc309ce2f9a991978d7dda841663825a95370.zip
solve some (hopefully most) missing delivery issues
-rw-r--r--include/zot.php68
-rw-r--r--mod/admin.php2
-rw-r--r--version.inc2
3 files changed, 57 insertions, 15 deletions
diff --git a/include/zot.php b/include/zot.php
index b19b1474a..6068c5e8c 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1295,9 +1295,33 @@ function public_recips($msg) {
$check_mentions = true;
}
else {
- $col = 'channel_w_comment';
- $field = PERMS_W_COMMENT;
+ // This doesn't look like it works so I have to explain what happened. These are my
+ // notes (below) from when I got this section of code working.
+
+ // ... so public_recips and allowed_public_recips is working so much better
+ // than before, but was still not quite right. We seem to be getting all the right
+ // results for top-level posts now, but comments aren't getting through on channels
+ // for which we've allowed them to send us their stream, but not comment on our posts.
+ // The reason is we were seeing if they could comment - and we only need to do that if
+ // we own the post. If they own the post, we only need to check if they can send us their stream.
+
+ // if this is a comment and it wasn't sent by the post owner, check to see who is allowing them to comment.
+ // We should have one specific recipient and this step shouldn't be needed unless somebody stuffed up
+ // their software. We may need this step to protect us from bad guys intentionally stuffing up their software.
+ // If it is sent by the post owner, we don't need to do this. We only need to see who is receiving the
+ // owner's stream (which was already set above) - as they control the comment permissions, not us.
+
+ // Note that by doing this we introduce another bug because some public forums have channel_w_stream
+ // permissions set to themselves only. We also need in this function to add these public forums to the
+ // public recipient list based on if they are tagged or not and have tag permissions. This is complicated
+ // by the fact that this activity doesn't have the public forum tag. It's the parent activity that
+ // contains the tag. we'll solve that further below.
+
+ if($msg['notify']['sender']['guid_sig'] != $msg['message']['owner']['guid_sig']) {
+ $col = 'channel_w_comment';
+ $field = PERMS_W_COMMENT;
+ }
}
}
elseif($msg['message']['type'] === 'mail') {
@@ -1359,22 +1383,40 @@ function public_recips($msg) {
// 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);
+ if($check_mentions) {
+ // It's a top level post. Look at the tags. See if any of them are mentions and are on this hub.
+ if($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);
+ }
}
}
}
}
}
+ else {
+ // this is a comment. Find any parent with ITEM_UPLINK set.
+ if($msg['message']['message_top']) {
+ $z = q("select owner_xchan as hash from item where parent_mid = '%s' and ( item_flags & %d ) > 0 ",
+ dbesc($msg['message']['message_top']),
+ intval(ITEM_UPLINK)
+ );
+ if($z)
+ $r = array_merge($r,$z);
+ }
+ }
+
+ // FIXME
+ // There are probably a lot of duplicates in $r at this point. We really need to filter those out.
+ // It's a bit of work since it's a multi-dimensional array
logger('public_recips: ' . print_r($r,true), LOGGER_DATA);
return $r;
diff --git a/mod/admin.php b/mod/admin.php
index e1808fd55..ba52033ec 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -546,7 +546,7 @@ function admin_page_dbsync(&$a) {
$o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
}
elseif($retval === UPDATE_SUCCESS) {
- $o .= sprintf( t('Update %s was successfully applied.', $func));
+ $o .= sprintf( t('Update %s was successfully applied.'), $func);
set_config('database',$func, 'success');
}
else
diff --git a/version.inc b/version.inc
index 2a61decf3..710b61eed 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-02-24.953
+2015-02-25.954