]> source.dussan.org Git - redmine.git/commitdiff
Fixed that journals are shown multiple times in activity (#19168).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Apr 2015 07:55:30 +0000 (07:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Apr 2015 07:55:30 +0000 (07:55 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14163 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/journal.rb
test/unit/activity_test.rb

index c20aa8d9d4beab6781ba89d57d41eaf3cf2cc226..ec9c9d52e81c3fe68ebd790e9b2e1ded0951e5d8 100644 (file)
@@ -38,7 +38,7 @@ class Journal < ActiveRecord::Base
                             :scope => preload({:issue => :project}, :user).
                                       joins("LEFT OUTER JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id").
                                       where("#{Journal.table_name}.journalized_type = 'Issue' AND" +
-                                            " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')")
+                                            " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')").uniq
 
   before_create :split_private_notes
   after_create :send_notification
index afb5a111cda311614824ce1e2e1e09a7169d270a..5df2699b6ba5d7b021748c5864af5fc71c9d75b7 100644 (file)
@@ -76,6 +76,14 @@ class ActivityTest < ActiveSupport::TestCase
     assert_nil(events.detect {|e| e.event_author != user})
   end
 
+  def test_journal_with_notes_and_changes_should_be_returned_once
+    f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1))
+    f.scope = ['issues']
+    events = f.events
+
+    assert_equal events, events.uniq
+  end
+
   def test_files_activity
     f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1))
     f.scope = ['files']