Skip to content

Commit a5b0863

Browse files
committed
Enable Move if user has group moderation permssion only
1 parent 1c0a706 commit a5b0863

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

class.groups.plugin.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ public function base_discussionOptionsDropdown_handler($sender, $args){
333333

334334
if ($canMove === false) {
335335
$options->removeItem('move');
336+
} else {
337+
// User doesn't have Vanilla Moderation permission but can moderate group discussions
338+
$options->addLink(t('Move'), '/moderation/confirmdiscussionmoves?discussionid='.$Discussion->DiscussionID, 'move', 'MoveDiscussion Popup');
336339
}
337340

338341
if ($canRefetch === false) {

models/class.groupmodel.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,12 +1737,14 @@ public function canMoveDiscussion($discussion) {
17371737
}
17381738

17391739
$groupID = $this->findGroupIDFromDiscussion($discussion);
1740-
$group = $this->getByGroupID($groupID);
1741-
$result = $this->getGroupRoleFor(Gdn::session()->UserID, $groupID);
1742-
$groupRole = val('Role', $result, null);
1743-
if($groupRole === GroupModel::ROLE_LEADER || Gdn::session()->UserID === $group->OwnerID
1744-
|| Gdn::session()->checkPermission(GroupsPlugin::GROUPS_MODERATION_MANAGE_PERMISSION)) {
1745-
return true;
1740+
if($groupID) {
1741+
$group = $this->getByGroupID($groupID);
1742+
$result = $this->getGroupRoleFor(Gdn::session()->UserID, $groupID);
1743+
$groupRole = val('Role', $result, null);
1744+
if ($groupRole === GroupModel::ROLE_LEADER || Gdn::session()->UserID === $group->OwnerID
1745+
|| Gdn::session()->checkPermission(GroupsPlugin::GROUPS_MODERATION_MANAGE_PERMISSION)) {
1746+
return true;
1747+
}
17461748
}
17471749
return false;
17481750
}

0 commit comments

Comments
 (0)