Add comment undeletion functionality

Only Developers and Trusted Users can undelete comments.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Marcel Korpel 2016-01-19 14:49:50 +01:00 committed by Lukas Fleischer
parent e9fe1a9eb1
commit bd85441cf6
8 changed files with 75 additions and 7 deletions

View file

@ -101,7 +101,7 @@
color: #999;
}
.delete-comment-form, .pin-comment-form, .edit-comment {
.delete-comment-form, .undelete-comment-form, .pin-comment-form, .edit-comment {
float: right;
margin-left: 8px;
}
@ -112,13 +112,13 @@
top: 1px;
}
.delete-comment, .edit-comment, .pin-comment {
.delete-comment, .undelete-comment, .edit-comment, .pin-comment {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.6;
}
.delete-comment:hover, .edit-comment:hover, .pin-comment:hover {
.delete-comment:hover, .undelete-comment:hover, .edit-comment:hover, .pin-comment:hover {
-webkit-filter: none;
filter: none;
opacity: 1;

View file

@ -0,0 +1,3 @@
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="8" width="8" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 8 8">
<path d="m4.5 0c-1.93 0-3.5 1.57-3.5 3.5v0.5h-1l2 2 2-2h-1v-0.5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5c0-1.93-1.57-3.5-3.5-3.5z" transform="translate(0 1)" fill="#36a"/>
</svg>

After

Width:  |  Height:  |  Size: 415 B

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="svg2"
viewBox="0 0 8 8"
height="8"
width="8">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<path
style="fill:#3366aa;fill-opacity:1"
id="path4"
transform="translate(0 1)"
d="M4.5 0c-1.93 0-3.5 1.57-3.5 3.5v.5h-1l2 2 2-2h-1v-.5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5c0-1.93-1.57-3.5-3.5-3.5z" />
</svg>

After

Width:  |  Height:  |  Size: 924 B

View file

@ -180,6 +180,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
readfile("./$path");
break;
case "/images/x.min.svg":
case "/images/action-undo.min.svg":
case "/images/pencil.min.svg":
case "/images/pin.min.svg":
case "/images/unpin.min.svg":

View file

@ -99,6 +99,11 @@ if (check_token()) {
list($ret, $output) = pkgbase_notify($ids, false);
} elseif (current_action("do_DeleteComment")) {
list($ret, $output) = pkgbase_delete_comment();
} elseif (current_action("do_UndeleteComment")) {
list($ret, $output) = pkgbase_delete_comment(true);
if ($ret && isset($_POST["comment_id"])) {
$fragment = '#comment-' . intval($_POST["comment_id"]);
}
} elseif (current_action("do_PinComment")) {
list($ret, $output) = pkgbase_pin_comment();
} elseif (current_action("do_UnpinComment")) {