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

@ -205,13 +205,21 @@
</div>
<div class="row no-border round-check">
<input type="checkbox" class="switch" v-model="domains[cd].requireIdentification" id="require-identification">
<label for="require-identification">Allow anonymous comments</label>
<input type="checkbox" class="switch" v-model="domains[cd].allowAnonymous" id="allow-anonymous">
<label for="allow-anonymous">Allow anonymous comments</label>
<div class="pitch">
Enabling this would require all commenters to authenticate themselves (using their Google account, for example). Disabling would allow anonymous comments.
</div>
</div>
<div class="row no-border round-check indent" v-if="domains[cd].allowAnonymous">
<input type="checkbox" class="switch" v-model="domains[cd].moderateAllAnonymous" id="moderate-all-anonymous">
<label for="moderate-all-anonymous">Require anonymous comments to be approved manually</label>
<div class="pitch">
Enabling this would require a moderator to approve anonymous comments. This is recommended as a lot of spam is often from anonymous comments.
</div>
</div>
<div id="new-domain-error" class="modal-error-box"></div>
</div>
<div class="center">

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,

View File

@ -623,6 +623,10 @@ body {
border: none;
}
.indent {
padding-left: 32px;
}
.button {
@extend .shadow;
height: 40px;