aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Libzot.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-25 20:27:50 +0000
committerMario <mario@mariovavti.com>2021-01-25 20:27:50 +0000
commit0e9d99c603d84b76c4774aa39dc782992bd91cdc (patch)
tree36e20b9a53119b19d1ba8782a1838194d546d768 /Zotlabs/Lib/Libzot.php
parent77793e17c04b1f67c10a83e7877c36a8b11ddbaa (diff)
downloadvolse-hubzilla-0e9d99c603d84b76c4774aa39dc782992bd91cdc.tar.gz
volse-hubzilla-0e9d99c603d84b76c4774aa39dc782992bd91cdc.tar.bz2
volse-hubzilla-0e9d99c603d84b76c4774aa39dc782992bd91cdc.zip
expose manual public item import from searchbar, set commen_policy in Activity::store() to what we get if we get something otherwise default to authenticated, comments by the owner have the relay flag set and therefor $perm will be not be set to post_comments - always check if we own the parent in lib/libzot (not only if $perm = send_stream) if otherwise not allowed
Diffstat (limited to 'Zotlabs/Lib/Libzot.php')
-rw-r--r--Zotlabs/Lib/Libzot.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index ee1f54ec8..13a75bb6c 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1235,8 +1235,14 @@ class Libzot {
if (is_array($AS->obj) && array_key_exists('commentPolicy', $AS->obj)) {
$p = strstr($AS->obj['commentPolicy'], 'until=');
if ($p !== false) {
- $arr['comments_closed'] = datetime_convert('UTC', 'UTC', substr($p, 6));
- $arr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy']));
+ $comments_closed_at = datetime_convert('UTC', 'UTC', substr($p, 6));
+ if ($comments_closed_at === $arr['created']) {
+ $arr['item_nocomment'] = 1;
+ }
+ else {
+ $arr['comments_closed'] = $comments_closed_at;
+ $arr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy']));
+ }
}
else {
$arr['comment_policy'] = $AS->obj['commentPolicy'];
@@ -1545,8 +1551,7 @@ class Libzot {
}
$tag_delivery = tgroup_check($channel['channel_id'], $arr);
-
- $perm = 'send_stream';
+ $perm = 'send_stream';
if (($arr['mid'] !== $arr['parent_mid']) && ($relay))
$perm = 'post_comments';
@@ -1563,7 +1568,7 @@ class Libzot {
if ((!$tag_delivery) && (!$local_public)) {
$allowed = (perm_is_allowed($channel['channel_id'], $sender, $perm));
- if ((!$allowed) && $perm === 'post_comments') {
+ if (!$allowed) {
$parent = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['parent_mid']),
intval($channel['channel_id'])