[deploy] Remove unnecessary comment links and clean up logic (#8686)

* Remove unnecessary comment links and clean up logic

* Fix links
This commit is contained in:
Ben Halpern 2020-06-15 17:40:21 -04:00 committed by GitHub
parent 8b9670abd7
commit b51647c59a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View file

@ -67,9 +67,10 @@ function addRelevantButtonsToComments(user) {
for (let i = 0; i < settingsButts.length; i += 1) {
let butt = settingsButts[i];
const { action, commentableUserId, userId } = butt.dataset;
if (parseInt(userId, 10) === user.id) {
if (parseInt(userId, 10) === user.id && action === 'settings-button') {
butt.innerHTML = '<a href="'+butt.dataset.path+'" rel="nofollow" style="color:#0a0a0a;" data-no-instant>Settings</a>'
butt.style.display = 'inline-block';
butt.classList.remove('hidden');
}
if (
@ -85,6 +86,9 @@ function addRelevantButtonsToComments(user) {
var modButts = document.getElementsByClassName('mod-actions');
for (let i = 0; i < modButts.length; i += 1) {
let butt = modButts[i];
if (butt.classList.contains('mod-actions-comment-button')) {
butt.innerHTML = '<a href="'+butt.dataset.path+'" rel="nofollow">Moderate</a>'
}
butt.className = 'mod-actions';
butt.style.display = 'inline-block';
}

View file

@ -45,6 +45,8 @@ function initializeCommentsPage() {
var buttEl = document.getElementById('button-for-comment-' + allNodes[i].dataset.commentId);
if (userActionsEl && buttEl) {
userActionsEl.className = 'current-user-actions';
userActionsEl.innerHTML = '<a data-no-instant href="' + userActionsEl.parentNode.dataset.path + '/delete_confirm" class="edit-butt">DELETE</a>\
<a href="' + userActionsEl.parentNode.dataset.path + '/edit">EDIT</a>'
userActionsEl.style.display = 'inline-block';
document.getElementById('button-for-comment-' + allNodes[i].dataset.commentId).classList.add('reacted');
}

View file

@ -61,8 +61,7 @@
<a href="<%= comment.path %>">
Permalink
</a>
<span class="comment-actions hidden" data-user-id="<%= comment.user_id %>" style="display: none;">
<a href="<%= comment.path %>/settings" rel="nofollow" style="color:#0a0a0a;" data-no-instant>Settings</a>
<span class="comment-actions hidden" data-user-id="<%= comment.user_id %>" style="display: none;" data-action="settings-button" data-path="<%= comment.path %>/settings">
</span>
<% action = comment.hidden_by_commentable_user ? "Unhide" : "Hide" %>
<span class="comment-actions hidden" data-action="hide-button" data-commentable-user-id="<%= commentable.user_id %>" data-user-id="<%= comment.user_id %>" style="display: none; width: 100%;">
@ -70,8 +69,7 @@
<%= action %>
</button>
</span>
<span class="mod-actions hidden" style="display: none;">
<a href="<%= comment.path %>/mod" rel="nofollow" style="color:#0a0a0a">Moderate</a>
<span class="mod-actions hidden mod-actions-comment-button" style="display: none;" data-path="<%= comment.path %>/mod">
</span>
<a href="/report-abuse?url=<%= comment_url(comment) %>">Report Abuse</a>
</div>
@ -86,8 +84,6 @@
</div>
<div class="actions" data-comment-id="<%= comment.id %>" data-path="<%= commentable.path %>/comments/<%= comment.id_code_generated %>">
<span class="current-user-actions hidden" style="display:none">
<a data-no-instant href="<%= commentable.path %>/comments/<%= comment.id_code_generated %>/delete_confirm" class="edit-butt" rel="nofollow">DELETE</a>
<a href="<%= commentable.path %>/comments/<%= comment.id_code_generated %>/edit" class="edit-butt" rel="nofollow">EDIT</a>
</span>
<% if comment.depth < 2 || is_childless %>
<a href="#<%= commentable.path %>/comments/new/<%= comment.id_code_generated %>" class="toggle-reply-form" rel="nofollow">REPLY</a>