1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

everywhere: improve anonymous comments logic

This commit is contained in:
Adhityaa Chandrasekar
2019-01-23 00:26:22 -05:00
parent 61bc73e705
commit 022fc06257
10 changed files with 52 additions and 35 deletions

View File

@ -465,7 +465,7 @@
commentsArea.innerHTML = "";
if (isLocked || isFrozen) {
if (isAuthenticated) {
if (isAuthenticated || chosenAnonymous) {
append(mainArea, messageCreate("This thread is locked. You cannot add new comments."));
} else {
append(mainArea, textareaCreate("root"));
@ -1408,15 +1408,9 @@
isLocked = !isLocked;
lock.disabled = true;
pageUpdate(function(success) {
if (success) {
lock.disabled = false;
if (isLocked) {
lock.innerHTML = "Unlock Thread";
} else {
lock.innerHTML = "Lock Thread";
}
}
pageUpdate(function() {
lock.disabled = false;
refreshAll();
});
}
@ -1434,16 +1428,14 @@
stickyCommentHex = commentHex;
}
pageUpdate(function(success) {
if (success) {
var sticky = $(ID_STICKY + commentHex);
if (stickyCommentHex === commentHex) {
classRemove(sticky, "option-sticky");
classAdd(sticky, "option-unsticky");
} else {
classRemove(sticky, "option-unsticky");
classAdd(sticky, "option-sticky");
}
pageUpdate(function() {
var sticky = $(ID_STICKY + commentHex);
if (stickyCommentHex === commentHex) {
classRemove(sticky, "option-sticky");
classAdd(sticky, "option-unsticky");
} else {
classRemove(sticky, "option-unsticky");
classAdd(sticky, "option-sticky");
}
});
}

View File

@ -91,6 +91,8 @@
resp.domains[i].viewsLast30Days = global.numberify(0);
resp.domains[i].commentsLast30Days = global.numberify(0);
resp.domains[i].allowAnonymous = !resp.domains[i].requireIdentification;
for (var j = 0; j < resp.domains[i].moderators.length; j++) {
resp.domains[i].moderators[j].timeAgo = global.timeSince(
@ -109,6 +111,7 @@
// Updates a domain with the backend.
global.domainUpdate = function(domain, callback) {
domain.requireIdentification = !domain.allowAnonymous;
var json = {
"ownerToken": global.cookieGet("commentoOwnerToken"),
"domain": domain,