#192: updated factory, some refactoring of Issue observer
This commit is contained in:
parent
cb36a6d6da
commit
3f42dfcd35
|
@ -4,8 +4,12 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
|
|
||||||
included do
|
included do
|
||||||
after_commit :new_issue_notifications, :on => :create
|
after_commit :new_issue_notifications, :on => :create
|
||||||
|
|
||||||
after_commit :send_assign_notifications, :on => :create
|
after_commit :send_assign_notifications, :on => :create
|
||||||
after_commit -> { send_assign_notifications(:update) }, :on => :update
|
after_commit -> { send_assign_notifications(:update) }, :on => :update
|
||||||
|
|
||||||
|
after_commit :send_hooks, :on => :create
|
||||||
|
after_commit -> { send_hooks(:update) }, :on => :update, :if => :status_changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -31,7 +35,7 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
project.hooks.each{ |h| h.receive_issues(self, :create) }
|
# dont remove outdated issues link
|
||||||
Comment.create_link_on_issues_from_item(self)
|
Comment.create_link_on_issues_from_item(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,9 +58,12 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
project.hooks.each{ |h| h.receive_issues(self, action) } if status_changed?
|
|
||||||
# dont remove outdated issues link
|
# dont remove outdated issues link
|
||||||
Comment.create_link_on_issues_from_item(self)
|
Comment.create_link_on_issues_from_item(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_hooks(action = :create)
|
||||||
|
project.hooks.each{ |h| h.receive_issues(self, action) }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -7,6 +7,9 @@ FactoryGirl.define do
|
||||||
association :user, :factory => :user
|
association :user, :factory => :user
|
||||||
association :assignee, :factory => :user
|
association :assignee, :factory => :user
|
||||||
status "open"
|
status "open"
|
||||||
|
# Hooks for #after_commit
|
||||||
after(:create) { |i| i.send(:new_issue_notifications) }
|
after(:create) { |i| i.send(:new_issue_notifications) }
|
||||||
|
after(:create) { |i| i.send(:send_assign_notifications) }
|
||||||
|
after(:create) { |i| i.send(:send_hooks) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue