Skip to content

Issues-559:Fixed Deleting comment popup, Issues-587 #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ public function getNew($discussionID, $lastCommentID = 0) {
*/
public function initialize() {
parent::initialize();
$this->addDefinition('ConfirmDeleteCommentHeading', t('ConfirmDeleteCommentHeading', 'Delete Comment'));
$this->addDefinition('ConfirmDeleteCommentText', t('ConfirmDeleteCommentText', 'Are you sure you want to delete this comment?'));
$this->addDefinition('ConfirmDeleteCommentHeading', t('ConfirmDeleteCommentHeading', 'Delete'));
$this->addDefinition('ConfirmDeleteCommentText', t('ConfirmDeleteCommentText', 'Are you sure you want to delete this item?'));
$this->Menu->highlightRoute('/discussions');
}

Expand Down
35 changes: 32 additions & 3 deletions vanilla/applications/vanilla/js/discussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,42 @@ jQuery(document).ready(function($) {
return false;
});

var currentCommentView = gdn.urlQueryParam(window.location.href, 'view');
var deliveryType = 'VIEW';
if (currentCommentView) {
deliveryType = currentCommentView == 'flat'?'BOOL':'VIEW';
}
// Delete comment
$('a.DeleteComment').popup({
okButtonText:'Delete',
cancelButtonText: 'Cancel',
confirm: true,
confirmHeading: gdn.definition('ConfirmDeleteCommentHeading', 'Delete Comment'),
confirmText: gdn.definition('ConfirmDeleteCommentText', 'Are you sure you want to delete this comment?'),
confirmHtml: '\
<div class="Overlay"> \
<div id="{popup.id}" class="Popup"> \
<div class="Border"> \
<div class="Body"> \
<div class="Content">\
<h1>Delete</h1>\
<form>\
<div>\
<p class="P Message">Are you sure you want to delete this item?</p>\
<div class="Buttons Buttons-Confirm"> \
<input type="button" class="Button Cancel Close" value="Cancel" id="Form_Cancel"/> \
<input type="button" class="Button Primary Okay Delete" value="Delete" /> \
</div> \
</div> \
</form> \
</div> \
</div> \
</div> \
</div> \
</div>',
confirmHeading: gdn.definition('ConfirmDeleteCommentHeading', 'Delete'),
confirmText: gdn.definition('ConfirmDeleteCommentText', 'Are you sure you want to delete this item?'),
followConfirm: false,
deliveryType: gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType'), //'VIEW' - threaded, 'BOOL' - flat
deliveryType: gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType')?
gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType'): deliveryType, //'VIEW' - threaded, 'BOOL' - flat
afterConfirm: function(json, sender) {
var row = $(sender).parents('li.ItemComment');
if (json.ErrorMessage) {
Expand Down
4 changes: 4 additions & 0 deletions vanilla/applications/vanilla/models/class.categorymodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,10 @@ public static function checkPermission($category, $permission, $fullMatch = true
}

if($groupID && $groupID > 0) {
// FIX: https://github.com/topcoder-platform/forums/issues/587
if ($userID == 0) {
return false;
}
$result = checkGroupPermission($userID, $groupID, $categoryID, $permissionCategoryID, $permission, $fullMatch);
} else {
$result = PermissionModel::checkPermission($userPermissions,$permission, $fullMatch, 'Category', $permissionCategoryID)
Expand Down
Loading