solve some minor group delivery issues

This commit is contained in:
zotlabs 2020-04-29 17:35:55 -07:00
parent 1a2e2f28cd
commit 6349cfeb1f
4 changed files with 29 additions and 17 deletions

View file

@ -443,7 +443,7 @@ class Notifier {
if ($top_level_post) {
// remove clones who will receive the post via sync
self::$recipients = array_diff(self::$recipients, [ $target_item['owner_xchan'] ]);
self::$recipients = array_values(array_diff(self::$recipients, [ $target_item['owner_xchan'] ]));
}
// don't send deletions onward for other people's stuff

View file

@ -800,7 +800,7 @@ class Item extends Controller {
$summary = z_input_filter($summary,$mimetype,$execflag);
$body = z_input_filter($body,$mimetype,$execflag);
}
$arr = [ 'profile_uid' => $profile_uid, 'summary' => $summary, 'content' => $body, 'mimetype' => $mimetype ];
call_hooks('post_content',$arr);
@ -814,7 +814,26 @@ class Item extends Controller {
$str_group_allow = $gacl['allow_gid'];
$str_contact_deny = $gacl['deny_cid'];
$str_group_deny = $gacl['deny_gid'];
$groupww = false;
// if this is a wall-to-wall post to a group, turn it into a direct message
$role = get_pconfig($profile_uid,'system','permissions_role');
$rolesettings = PermissionRoles::role_perms($role);
$channel_type = isset($rolesettings['channel_type']) ? $rolesettings['channel_type'] : 'normal';
$is_group = (($channel_type === 'group') ? true : false);
if (($is_group) && ($walltowall) && (! $walltowall_comment)) {
$groupww = true;
$str_contact_allow = $owner_xchan['xchan_hash'];
$str_group_allow = '';
}
if($mimetype === 'text/bbcode') {
require_once('include/text.php');
@ -909,8 +928,6 @@ class Item extends Controller {
}
}
if(($str_contact_allow) && (! $str_group_allow)) {
// direct message - private between individual channels but not groups
$private = 2;
@ -1462,20 +1479,13 @@ class Item extends Controller {
call_hooks('post_local_end', $datarray);
$role = get_pconfig($profile_uid,'system','permissions_role');
$rolesettings = PermissionRoles::role_perms($role);
$channel_type = isset($rolesettings['channel_type']) ? $rolesettings['channel_type'] : 'normal';
$is_group = (($channel_type === 'group') ? true : false);
if ($is_group && $datarray['mid'] === $datarray['parent_mid'] && $datarray['author_xchan'] !== $datarray['owner_xchan']) {
// W2W group post - will have been delivered already by tag_deliver()
if ($groupww) {
$nopush = false;
}
if(! $nopush)
if(! $nopush) {
\Zotlabs\Daemon\Master::Summon(array('Notifier', $notify_type, $post_id));
}
logger('post_complete');
if($moderated) {

View file

@ -126,7 +126,6 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
}
}
// Add the authors of any posts in this thread, if they are known to us.
// This is specifically designed to forward wall-to-wall posts to the original author,
// in case they aren't a connection but have permission to write on our wall.
@ -168,6 +167,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
// add ourself just in case we have nomadic clones that need to get a copy.
$recipients[] = $item['author_xchan'];
if($item['owner_xchan'] != $item['author_xchan'])
$recipients[] = $item['owner_xchan'];
@ -2888,7 +2888,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $edit = false)
$arr['body'] = $bb;
$arr['author_xchan'] = $channel['channel_hash'];
$arr['owner_xchan'] = $item['author_xchan'];
$arr['owner_xchan'] = $channel['channel_hash'];
// $arr['obj'] = $item['obj'];
$arr['obj_type'] = $item['obj_type'];
$arr['verb'] = 'Create';

View file

@ -1036,6 +1036,8 @@ function sslify($s) {
$clean = strip_zids(strip_query_param($match[2],'f'));
$cached = Img_cache::check($clean,'cache/img');
if ($cached) {
// $file = Img_cache::get_filename($clean,'cache/img');
// @fixme getimagesize and replace height/width/alt in image tag
$s = str_replace($match[2],z_root() . '/ca/' . basename(Img_cache::get_filename($clean,'cache/img')) . '?url=' . urlencode($clean),$s);
}
}