mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
api,frontend: add Akismet spam flagging integration
This commit is contained in:
@ -51,6 +51,7 @@
|
||||
var ID_REMOVE = "commento-comment-remove-";
|
||||
var ID_STICKY = "commento-comment-sticky-";
|
||||
var ID_CONTENTS = "commento-comment-contents-";
|
||||
var ID_NAME = "commento-comment-name-";
|
||||
var ID_SUBMIT_BUTTON = "commento-submit-button-";
|
||||
var ID_FOOTER = "commento-footer";
|
||||
|
||||
@ -519,14 +520,17 @@
|
||||
$(ID_COMMENTS_AREA).innerHTML = "";
|
||||
commentsRender();
|
||||
|
||||
if (!resp.approved) {
|
||||
if (id == "root") {
|
||||
var body = $(ID_SUPER_CONTAINER + id);
|
||||
prepend(body, messageCreate("Your comment is under moderation."));
|
||||
} else {
|
||||
var body = $(ID_BODY + id);
|
||||
append(body, messageCreate("Your comment is under moderation."));
|
||||
}
|
||||
var message = "";
|
||||
if (resp.state == "unapproved")
|
||||
message = "Your comment is under moderation.";
|
||||
else if (resp.state == "flagged")
|
||||
message = "Your comment was flagged as spam and is under moderation.";
|
||||
|
||||
if (message != "") {
|
||||
if (id == "root")
|
||||
prepend($(ID_SUPER_CONTAINER + id), messageCreate(message));
|
||||
else
|
||||
append($(ID_BODY + id), messageCreate(message));
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -652,6 +656,7 @@
|
||||
remove.id = ID_REMOVE + comment.commentHex;
|
||||
sticky.id = ID_STICKY + comment.commentHex;
|
||||
contents.id = ID_CONTENTS + comment.commentHex;
|
||||
name.id = ID_NAME + comment.commentHex;
|
||||
|
||||
collapse.title = "Collapse";
|
||||
upvote.title = "Upvote";
|
||||
@ -692,8 +697,10 @@
|
||||
}
|
||||
|
||||
classAdd(card, "card");
|
||||
if (isModerator && comment.state == "unapproved")
|
||||
if (isModerator && comment.state != "approved")
|
||||
classAdd(card, "dark-card");
|
||||
if (comment.state == "flagged")
|
||||
classAdd(name, "flagged");
|
||||
classAdd(header, "header");
|
||||
classAdd(name, "name");
|
||||
classAdd(subtitle, "subtitle");
|
||||
@ -773,7 +780,7 @@
|
||||
if (parentHex == "root")
|
||||
append(options, sticky);
|
||||
append(options, remove);
|
||||
if (comment.state == "unapproved")
|
||||
if (comment.state != "approved")
|
||||
append(options, approve);
|
||||
}
|
||||
else {
|
||||
@ -823,10 +830,12 @@
|
||||
}
|
||||
|
||||
var card = $(ID_CARD + commentHex);
|
||||
var name = $(ID_NAME + commentHex);
|
||||
var options = $(ID_OPTIONS + commentHex);
|
||||
var tick = $(ID_APPROVE + commentHex);
|
||||
|
||||
classRemove(card, "dark-card");
|
||||
classRemove(name, "flagged");
|
||||
remove(tick);
|
||||
});
|
||||
}
|
||||
|
@ -124,6 +124,17 @@
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.commento-flagged::after {
|
||||
content: "Flagged";
|
||||
text-transform: uppercase;
|
||||
font-size: 10px;
|
||||
background: $red-7;
|
||||
color: white;
|
||||
margin-left: 8px;
|
||||
padding: 2px 6px 2px 6px;
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
.commento-subtitle {
|
||||
display: block;
|
||||
color: #999;
|
||||
|
Reference in New Issue
Block a user