This commit is contained in:
redmatrix 2016-02-26 12:49:02 -08:00
commit 6126070a1d
6 changed files with 39 additions and 57 deletions

View File

@ -1313,7 +1313,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
intval($channel_id)
);
file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', $notify=0);
file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', $notify=1);
}
/**
@ -1557,6 +1557,8 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$u_arr_deny_cid = array_unique(array_merge($arr_deny_cid, expand_acl($object['deny_cid'])));
$u_arr_deny_gid = array_unique(array_merge($arr_deny_gid, expand_acl($object['deny_gid'])));
$private = (($u_arr_allow_cid[0] || $u_arr_allow_gid[0] || $u_arr_deny_cid[0] || $u_arr_deny_gid[0]) ? 1 : 0);
$u_mid = item_message_id();
$arr['aid'] = get_account_id();
@ -1566,13 +1568,12 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['author_xchan'] = $poster['xchan_hash'];
$arr['owner_xchan'] = $poster['xchan_hash'];
$arr['title'] = '';
//updates should be visible to everybody -> perms may have changed
$arr['allow_cid'] = '';
$arr['allow_gid'] = '';
$arr['deny_cid'] = '';
$arr['deny_gid'] = '';
$arr['allow_cid'] = perms2str($u_arr_allow_cid);
$arr['allow_gid'] = perms2str($u_arr_allow_gid);
$arr['deny_cid'] = perms2str($u_arr_deny_cid);
$arr['deny_gid'] = perms2str($u_arr_deny_gid);
$arr['item_hidden'] = 1;
$arr['item_private'] = 0;
$arr['item_private'] = $private;
$arr['verb'] = ACTIVITY_UPDATE;
$arr['obj_type'] = $objtype;
$arr['object'] = $u_jsonobject;
@ -1705,7 +1706,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
//turn allow_gid into allow_cid's
foreach($arr_allow_gid as $gid) {
$in_group = in_group($gid);
$in_group = group_get_members($gid);
$arr_allow_cid = array_unique(array_merge($arr_allow_cid, $in_group));
}
@ -1727,7 +1728,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
* */
if($parent_arr['allow_gid']) {
foreach($parent_arr['allow_gid'][$count] as $gid) {
$in_group = in_group($gid);
$in_group = group_get_members($gid);
$parent_arr['allow_cid'][$count] = array_unique(array_merge($parent_arr['allow_cid'][$count], $in_group));
}
}
@ -1808,31 +1809,6 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
return $ret;
}
/**
* @brief Returns members of a group.
*
* @param int $group_id id of the group to look up
*/
function in_group($group_id) {
$group_members = array();
/** @TODO make these two queries one with a join. */
$x = q("SELECT id FROM groups WHERE hash = '%s'",
dbesc($group_id)
);
$r = q("SELECT xchan FROM group_member WHERE gid = %d",
intval($x[0]['id'])
);
foreach($r as $ig) {
$group_members[] = $ig['xchan'];
}
return $group_members;
}
function filepath_macro($s) {
return str_replace(

View File

@ -296,7 +296,7 @@ function photo_upload($channel, $observer, $args) {
$photo_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' . t('a new photo') . '[/zrl]';
$album_link = '[zrl=' . z_root() . '/photos/album/' . bin2hex($album) . ']' . $album . '[/zrl]';
$album_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album) . ']' . $album . '[/zrl]';
$activity_format = sprintf(t('%1$s posted %2$s to %3$s','photo_upload'), $author_link, $photo_link, $album_link);

View File

@ -1444,7 +1444,7 @@ function prepare_body(&$item,$attach = false) {
call_hooks('prepare_body_init', $item);
$s = '';
$photo = '';
$is_photo = ((($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) ? true : false);
@ -1454,7 +1454,7 @@ function prepare_body(&$item,$attach = false) {
// if original photo width is <= 640px prepend it to item body
if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) {
$s = '<div class="inline-photo-item-wrapper"><a href="' . zid(rawurldecode($object['id'])) . '" target="_blank"><img class="inline-photo-item" style="max-width:' . $object['link'][0]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][0]['href'])) . '"></a></div>' . $s;
$s .= '<div class="inline-photo-item-wrapper"><a href="' . zid(rawurldecode($object['id'])) . '" target="_blank"><img class="inline-photo-item" style="max-width:' . $object['link'][0]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][0]['href'])) . '"></a></div>' . $s;
}
// if original photo width is > 640px make it a cover photo
@ -1464,7 +1464,7 @@ function prepare_body(&$item,$attach = false) {
}
}
$s = prepare_text($item['body'],$item['mimetype'], false);
$s .= prepare_text($item['body'],$item['mimetype'], false);
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event($item['object']) : false);

View File

@ -39,4 +39,4 @@ function update_display_content(&$a) {
// logger('update_display: ' . $text);
killme();
}
}

View File

@ -1,4 +1,3 @@
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$id}}" >
<a href="item/drop/{{$id}}" onclick="return confirmDelete();" title="{{$delete}}" ><i class="icon-trash drop-icons"></i></a>
<a class="btn btn-default btn-sm" href="#" onclick="dropItem('item/drop/{{$id}}', '#wall-item-outside-wrapper-{{$id}}'); return false;" title="{{$delete}}" ><i class="icon-trash"></i></a>
</div>
<div class="wall-item-delete-end"></div>

View File

@ -1,27 +1,34 @@
<div class="wall-item-outside-wrapper {{$indent}}" id="wall-item-outside-wrapper-{{$id}}" >
<div class="wall-item-content-wrapper {{$indent}}" id="wall-item-content-wrapper-{{$id}}" style="clear:both;">
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper" id="wall-item-photo-wrapper-{{$id}}" >
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-photo-link" id="wall-item-photo-link-{{$id}}">
<img src="{{$thumb}}" class="wall-item-photo" id="wall-item-photo-{{$id}}" style="height: 80px; width: 80px;" alt="{{$name}}" /></a>
<div class="wall-item-outside-wrapper{{if $indent}} {{$indent}}{{/if}}" id="wall-item-outside-wrapper-{{$id}}" >
<div class="wall-item-content-wrapper{{if $indent}} {{$indent}}{{/if}}" id="wall-item-content-wrapper-{{$id}}" style="clear:both;">
<div class="wall-item-head">
<div class="wall-item-info" id="wall-item-info-{{$id}}" >
<div class="wall-item-photo-wrapper" id="wall-item-photo-wrapper-{{$id}}" >
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-photo-link" id="wall-item-photo-link-{{$id}}">
<img src="{{$thumb}}" class="wall-item-photo" id="wall-item-photo-{{$id}}" style="height: 80px; width: 80px;" alt="{{$name}}" /></a>
</div>
</div>
</div>
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$id}}" >
<div class="wall-item-author">
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-{{$id}}" >{{$name}}</span></a>
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$id}}" >
<div class="wall-item-author">
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-{{$id}}" >{{$name}}</span></a>
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$id}}">{{$ago}}</div>
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$id}}">{{$ago}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$id}}" >
<div class="wall-item-title" id="wall-item-title-{{$id}}">{{$title}}</div>
<div class="wall-item-body" id="wall-item-body-{{$id}}" >{{$body}}</div>
</div>
{{$drop}}
<div class="wall-item-wrapper-end"></div>
{{if $drop}}
<div class="wall-item-tools" id="wall-item-tools-{{$id}}" >
<div class="wall-item-tools-right pull-right">
{{$drop}}
</div>
<div class="clear"></div>
</div>
{{/if}}
<div class="clear"></div>
{{$comment}}
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
</div>