Fix vote counting to only count main target notes (not mixed in ones)
This commit is contained in:
parent
3f72af9994
commit
fb0279f311
3 changed files with 15 additions and 16 deletions
|
@ -230,7 +230,7 @@ var NoteList = {
|
||||||
updateVotes:
|
updateVotes:
|
||||||
function() {
|
function() {
|
||||||
var votes = $("#votes .votes");
|
var votes = $("#votes .votes");
|
||||||
var notes = $("#notes-list, #new-notes-list").find(".note.vote");
|
var notes = $("#notes-list, #new-notes-list").find(".note .vote");
|
||||||
|
|
||||||
// only update if there is a vote display
|
// only update if there is a vote display
|
||||||
if (votes.size()) {
|
if (votes.size()) {
|
||||||
|
|
|
@ -12,11 +12,5 @@ module NotesHelper
|
||||||
!@mixed_targets || @main_target_type == note.noteable_type
|
!@mixed_targets || @main_target_type == note.noteable_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def note_vote_class(note)
|
|
||||||
if note.upvote?
|
|
||||||
"vote upvote"
|
|
||||||
elsif note.downvote?
|
|
||||||
"vote downvote"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
%li{id: dom_id(note), class: "note #{note_vote_class(note)}"}
|
%li{id: dom_id(note), class: "note"}
|
||||||
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
||||||
%div.note-author
|
%div.note-author
|
||||||
%strong= note.author_name
|
%strong= note.author_name
|
||||||
|
@ -6,14 +6,19 @@
|
||||||
%cite.cgray
|
%cite.cgray
|
||||||
= time_ago_in_words(note.updated_at)
|
= time_ago_in_words(note.updated_at)
|
||||||
ago
|
ago
|
||||||
- if note.upvote?
|
|
||||||
%span.label.label-success
|
-# only show vote if it's a note for the main target
|
||||||
%i.icon-thumbs-up
|
- if note_for_main_target?(note)
|
||||||
\+1
|
- if note.upvote?
|
||||||
- if note.downvote?
|
%span.vote.upvote.label.label-success
|
||||||
%span.label.label-error
|
%i.icon-thumbs-up
|
||||||
%i.icon-thumbs-down
|
\+1
|
||||||
\-1
|
- if note.downvote?
|
||||||
|
%span.vote.downvote.label.label-error
|
||||||
|
%i.icon-thumbs-down
|
||||||
|
\-1
|
||||||
|
|
||||||
|
-# remove button
|
||||||
- if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
|
- if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
|
||||||
= link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do
|
= link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do
|
||||||
%i.icon-trash
|
%i.icon-trash
|
||||||
|
|
Loading…
Add table
Reference in a new issue