mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
get rid of commentPolicy in photos
This commit is contained in:
parent
b4436499f9
commit
e627dd165b
1 changed files with 10 additions and 13 deletions
|
@ -467,20 +467,17 @@ function photo_upload($channel, $observer, $args)
|
|||
$item = get_item_elements($i);
|
||||
$force = false;
|
||||
|
||||
if (intval($item['item_wall']) && $item['mid'] === $item['parent_mid']) {
|
||||
$object['commentPolicy'] = $item['comment_policy'];
|
||||
if ($item['comments_closed'] && Time::convert(datetime: $item['comments_closed']) > NULL_DATE) {
|
||||
$object['endTime'] = Time::convert(datetime: $item['comments_closed'], format: ISO8601);
|
||||
}
|
||||
|
||||
if (intval($item['item_nocomment'])) {
|
||||
if ($object['commentPolicy']) {
|
||||
$object['commentPolicy'] .= ' ';
|
||||
if ($item['mid'] === $item['parent_mid']) {
|
||||
if (in_array($item['comment_policy'], ['self', 'none']) || $item['item_nocomment'] || ($item['comments_closed'] > NULL_DATE && Time::convert('UTC', 'UTC', $item['comments_closed']) <= Time::convert())) {
|
||||
$object['canReply'] = [];
|
||||
} elseif (in_array($item['comment_policy'], ['public', 'authenticated'])) {
|
||||
$object['canReply'] = [ACTIVITY_PUBLIC_INBOX];
|
||||
} elseif (in_array($item['comment_policy'], ['contacts', 'specific'])) {
|
||||
$object['canReply'] = [z_root() . '/followers/' . $channel['channel_address']];
|
||||
}
|
||||
$object['commentPolicy'] .= 'until=' . Time::convert('UTC', 'UTC', $item['created'], ISO8601);
|
||||
} elseif (array_key_exists('comments_closed', $item) && $item['comments_closed'] !== EMPTY_STR && $item['comments_closed'] > NULL_DATE) {
|
||||
if ($object['commentPolicy']) {
|
||||
$object['commentPolicy'] .= ' ';
|
||||
}
|
||||
$object['commentPolicy'] .= 'until=' . Time::convert('UTC', 'UTC', $item['comments_closed'], ISO8601);
|
||||
}
|
||||
|
||||
if ($item['mid'] === $item['parent_mid']) {
|
||||
|
@ -552,7 +549,7 @@ function photo_upload($channel, $observer, $args)
|
|||
];
|
||||
|
||||
if (intval($arr['item_wall']) && $arr['mid'] === $arr['parent_mid']) {
|
||||
$object['commentPolicy'] = $arr['comment_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'], 'post_comments'));
|
||||
$arr['comment_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'], 'post_comments'));
|
||||
}
|
||||
|
||||
$arr['obj'] = json_encode($object);
|
||||
|
|
Loading…
Reference in a new issue