aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-18 22:25:41 -0700
committerMario Vavti <mario@mariovavti.com>2017-06-19 16:09:07 +0200
commit1472f85b162ea6f1ab9e19e94b86fc4a8ef074be (patch)
tree5bcfc4803bb4305790d7cce894cc96a072e86840 /Zotlabs/Lib
parent3d6255ae24310a935caf4e74729aa7165f94aeda (diff)
downloadvolse-hubzilla-1472f85b162ea6f1ab9e19e94b86fc4a8ef074be.tar.gz
volse-hubzilla-1472f85b162ea6f1ab9e19e94b86fc4a8ef074be.tar.bz2
volse-hubzilla-1472f85b162ea6f1ab9e19e94b86fc4a8ef074be.zip
allow moderated comments like wordpress if permissions are compatible
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Enotify.php11
-rw-r--r--Zotlabs/Lib/ThreadItem.php8
-rw-r--r--Zotlabs/Lib/ThreadStream.php2
3 files changed, 17 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index a10675a87..114021568 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -170,6 +170,7 @@ class Enotify {
xchan_query($p);
+ $moderated = (($p[0]['item_blocked'] = ITEM_MODERATED) ? true : false);
$item_post_type = item_post_type($p[0]);
// $private = $p[0]['item_private'];
@@ -208,13 +209,21 @@ class Enotify {
// Before this we have the name of the replier on the subject rendering
// differents subjects for messages on the same thread.
- $subject = sprintf( t('[$Projectname:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
+ if($moderated)
+ $subject = sprintf( t('[$Projectname:Notify] Moderated Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
+ else
+ $subject = sprintf( t('[$Projectname:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']);
$preamble = sprintf( t('%1$s, %2$s commented on an item/conversation you have been following.'), $recip['channel_name'], $sender['xchan_name']);
$epreamble = $dest_str;
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
+ if($moderated) {
+ $tsitelink .= "\n\n" . sprintf( t('Please visit %s to approve or reject this comment.'), z_root() . '/moderate' );
+ $hsitelink .= "\n\n" . sprintf( t('Please visit %s to approve or reject this comment.'), z_root() . '/moderate' );
+ }
+
}
if ($params['type'] == NOTIFY_LIKE) {
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 5910ea672..5bb5982f8 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -743,8 +743,12 @@ class ThreadItem {
'$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false),
'$encrypt' => t('Encrypt text'),
'$cipher' => $conv->get_cipher(),
- '$sourceapp' => \App::$sourcename
-
+ '$sourceapp' => \App::$sourcename,
+ '$observer' => get_observer_hash(),
+ '$anoncomments' => perm_is_allowed($conv->get_profile_owner(),'','post_comments'),
+ '$anonname' => [ 'anonname', t('Your full name (required)'),'','' ],
+ '$anonmail' => [ 'anonmail', t('Your email address (required)'),'','' ],
+ '$anonurl' => [ 'anonurl', t('Your website URL (optional)'),'','' ]
));
return $comment_box;
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index beb626f31..1fd746c38 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -158,7 +158,7 @@ class ThreadStream {
if(intval($item->get_data_value('item_nocomment'))) {
$item->set_commentable(false);
}
- elseif(($this->observer) && (! $item->is_commentable())) {
+ elseif(! $item->is_commentable()) {
if((array_key_exists('owner',$item->data)) && intval($item->data['owner']['abook_self']))
$item->set_commentable(perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'));
else