diff options
-rw-r--r-- | app/models/concerns/issuable.rb | 8 | ||||
-rw-r--r-- | app/models/note.rb | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index b8bee0d0ec0..fb038a3cc3f 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -124,10 +124,12 @@ module Issuable users << assignee if is_assigned? mentions = [] mentions << self.mentioned_users + notes.each do |note| users << note.author mentions << note.mentioned_users end + users.concat(mentions.reduce([], :|)).uniq end @@ -149,8 +151,8 @@ module Issuable def add_labels_by_names(label_names) label_names.each do |label_name| - label = project.labels.create_with( - color: Label::DEFAULT_COLOR).find_or_create_by(title: label_name.strip) + label = project.labels.create_with(color: Label::DEFAULT_COLOR). + find_or_create_by(title: label_name.strip) self.labels << label end end @@ -159,11 +161,13 @@ module Issuable def filter_superceded_votes(votes, notes) filteredvotes = [] + votes + votes.each do |vote| if vote.superceded?(notes) filteredvotes.delete(vote) end end + filteredvotes end end diff --git a/app/models/note.rb b/app/models/note.rb index cb879dc2ce3..0b988cc3e0f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -461,14 +461,17 @@ class Note < ActiveRecord::Base def superceded?(notes) return false unless vote? + notes.each do |note| next if note == self + if note.vote? && - self[:author_id] == note[:author_id] && - self[:created_at] <= note[:created_at] + self[:author_id] == note[:author_id] && + self[:created_at] <= note[:created_at] return true end end + false end |