Skip to content

Commit bfe66b1

Browse files
authored
Merge pull request #586 from topcoder-platform/issues-559_1
Issues-559:Fixed Deleting comment popup, Issues-587
2 parents 63849e4 + 0ce65b0 commit bfe66b1

File tree

4 files changed

+496
-5
lines changed

4 files changed

+496
-5
lines changed

vanilla/applications/vanilla/controllers/class.discussioncontroller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ public function getNew($discussionID, $lastCommentID = 0) {
391391
*/
392392
public function initialize() {
393393
parent::initialize();
394-
$this->addDefinition('ConfirmDeleteCommentHeading', t('ConfirmDeleteCommentHeading', 'Delete Comment'));
395-
$this->addDefinition('ConfirmDeleteCommentText', t('ConfirmDeleteCommentText', 'Are you sure you want to delete this comment?'));
394+
$this->addDefinition('ConfirmDeleteCommentHeading', t('ConfirmDeleteCommentHeading', 'Delete'));
395+
$this->addDefinition('ConfirmDeleteCommentText', t('ConfirmDeleteCommentText', 'Are you sure you want to delete this item?'));
396396
$this->Menu->highlightRoute('/discussions');
397397
}
398398

vanilla/applications/vanilla/js/discussion.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,42 @@ jQuery(document).ready(function($) {
401401
return false;
402402
});
403403

404+
var currentCommentView = gdn.urlQueryParam(window.location.href, 'view');
405+
var deliveryType = 'VIEW';
406+
if (currentCommentView) {
407+
deliveryType = currentCommentView == 'flat'?'BOOL':'VIEW';
408+
}
404409
// Delete comment
405410
$('a.DeleteComment').popup({
411+
okButtonText:'Delete',
412+
cancelButtonText: 'Cancel',
406413
confirm: true,
407-
confirmHeading: gdn.definition('ConfirmDeleteCommentHeading', 'Delete Comment'),
408-
confirmText: gdn.definition('ConfirmDeleteCommentText', 'Are you sure you want to delete this comment?'),
414+
confirmHtml: '\
415+
<div class="Overlay"> \
416+
<div id="{popup.id}" class="Popup"> \
417+
<div class="Border"> \
418+
<div class="Body"> \
419+
<div class="Content">\
420+
<h1>Delete</h1>\
421+
<form>\
422+
<div>\
423+
<p class="P Message">Are you sure you want to delete this item?</p>\
424+
<div class="Buttons Buttons-Confirm"> \
425+
<input type="button" class="Button Cancel Close" value="Cancel" id="Form_Cancel"/> \
426+
<input type="button" class="Button Primary Okay Delete" value="Delete" /> \
427+
</div> \
428+
</div> \
429+
</form> \
430+
</div> \
431+
</div> \
432+
</div> \
433+
</div> \
434+
</div>',
435+
confirmHeading: gdn.definition('ConfirmDeleteCommentHeading', 'Delete'),
436+
confirmText: gdn.definition('ConfirmDeleteCommentText', 'Are you sure you want to delete this item?'),
409437
followConfirm: false,
410-
deliveryType: gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType'), //'VIEW' - threaded, 'BOOL' - flat
438+
deliveryType: gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType')?
439+
gdn.urlQueryParam( $('a.DeleteComment').attr('href'), 'deliveryType'): deliveryType, //'VIEW' - threaded, 'BOOL' - flat
411440
afterConfirm: function(json, sender) {
412441
var row = $(sender).parents('li.ItemComment');
413442
if (json.ErrorMessage) {

vanilla/applications/vanilla/models/class.categorymodel.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,10 @@ public static function checkPermission($category, $permission, $fullMatch = true
931931
}
932932

933933
if($groupID && $groupID > 0) {
934+
// FIX: https://github.com/topcoder-platform/forums/issues/587
935+
if ($userID == 0) {
936+
return false;
937+
}
934938
$result = checkGroupPermission($userID, $groupID, $categoryID, $permissionCategoryID, $permission, $fullMatch);
935939
} else {
936940
$result = PermissionModel::checkPermission($userPermissions,$permission, $fullMatch, 'Category', $permissionCategoryID)

0 commit comments

Comments
 (0)