Commit 8c781718 authored by Doris Tam's avatar Doris Tam 🌷
Browse files

Bug 1940800: Identify comments for moderation

Add additional text beside the 'Make comment public' button
to let page owners differentiate between private comments
made by others and private comments that need moderation.

Change-Id: I4515333b204021c7095ca816e247356711e29cf4
parent 3213a689
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -76,9 +76,10 @@ $string['replyto'] = 'Reply to:';
$string['replytonoaccess'] = 'You are not allowed to post a reply to this comment.';
$string['replytonoprivatereplyallowed'] = 'You are not allowed to post a private reply to this comment.';
$string['replytonopublicreplyallowed'] = 'You are not allowed to post a public reply to this comment.';
$string['thiscommentisprivate'] = 'This comment is private';
$string['thiscommentisprivate1'] = 'This comment is private.';
$string['typefeedback'] = 'Comment';
$string['viewcomment'] = 'View comment';
$string['moderatecomment'] = 'The comment author requested that this comment be made public.';
$string['youhaverequestedpublic'] = 'You have requested that this comment be made public.';
$string['commentsnotincluded'] = 'Comments were not included in this export';

+11 −1
Original line number Diff line number Diff line
@@ -382,12 +382,14 @@ class ArtefactTypeComment extends ArtefactType {
        }
        $userid = $USER->get('id');
        $viewid = $view->get('id');
        // Make an artefact comment
        if (!empty($artefact)) {
            $canedit = $USER->can_edit_artefact($artefact);
            $owner = $artefact->get('owner');
            $isowner = $userid && $userid == $owner;
            $artefactid = $artefact->get('id');
        }
        // Make a page comment
        else {
            if ($group = $view->get('group')) {
                $group_admins = group_get_admin_ids($group);
@@ -788,7 +790,7 @@ class ArtefactTypeComment extends ArtefactType {
                }
            }
            if ($item->private) {
                $item->pubmessage = get_string('thiscommentisprivate', 'artefact.comment');
                $item->pubmessage = get_string('thiscommentisprivate1', 'artefact.comment');
            }

            if (isset($data->showcomment) && $data->showcomment == $item->id) {
@@ -823,13 +825,20 @@ class ArtefactTypeComment extends ArtefactType {
            // private comment be made public
            if (!$item->deletedby && $item->private && $item->author && $data->owner
                && ($item->isauthor || $data->isowner)) {
                // The private comment is made by someone who is not logged in
                // There doesn't need to be a request for the page owner to publicise any private comment
                if ((empty($item->requestpublic) && $data->isowner)
                    || $item->isauthor && $item->requestpublic == 'owner'
                    || $data->isowner && $item->requestpublic == 'author') {
                    if (!$is_export_preview) {
                        $item->makepublicform = pieform(self::make_public_form($item->id));
                    }
                    // If a request was made
                    if ($item->requestpublic) {
                        $item->makepublicrequested = 1;
                    }
                }
                // The request was made by the person who is logged in
                else if ($item->isauthor && $item->requestpublic == 'author'
                         || $data->isowner && $item->requestpublic == 'owner') {
                    $item->makepublicrequested = 1;
@@ -903,6 +912,7 @@ class ArtefactTypeComment extends ArtefactType {

        $smarty = smarty_core();
        $smarty->assign('data', $data->data);
        $smarty->assign('isowner', $data->isowner);
        $smarty->assign('canedit', $data->canedit);
        $smarty->assign('position', $data->position);
        $smarty->assign('viewid', $data->view);
+12 −9
Original line number Diff line number Diff line
@@ -81,23 +81,26 @@
                    {/if}
                {/if}

                {if $item->makepublicform || ($item->makepublicrequested && !$item->deletedmessage)}
                <div class="comment-privacy metadata push-left-for-usericon">
                    {if $item->pubmessage}
                        <em class="privatemessage"> {$item->pubmessage} </em>
                    {/if}

                    {if $item->makepublicform || ($item->makepublicrequested && !$item->deletedmessage)}
                        {if $item->private && $isowner && $item->makepublicrequested && !$item->deletedmessage}
                            <em>{str tag=moderatecomment section=artefact.comment}</em>
                        {/if}

                        {if $item->makepublicform}
                            {$item->makepublicform|safe}
                        {/if}

                    {if $item->makepublicrequested && !$item->deletedmessage}
                        <span class="icon icon-lock text-default left" role="presentation" aria-hidden="true"></span>
                        <span>{str tag=youhaverequestedpublic section=artefact.comment}</span>
                        {if $item->makepublicrequested && $item->isauthor && !$item->deletedmessage}
                            <em>{str tag=youhaverequestedpublic section=artefact.comment}</em>
                        {/if}
                </div>
                    {/if}
                </div>
            </div>

            {if !$item->deletedmessage && $item->attachments}
            <div class="col-md-4 comment-attachment push-left-for-usericon">