Merge branch 'master' into 211-display-only-platforms-for-which-user-has-access-on-read
This commit is contained in:
commit
ffc15689d1
|
@ -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,6 +35,8 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
# dont remove outdated issues link
|
||||||
|
Comment.create_link_on_issues_from_item(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_assign_notifications(action = :create)
|
def send_assign_notifications(action = :create)
|
||||||
|
@ -52,9 +58,12 @@ module Modules::Observers::ActivityFeed::Issue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
project.hooks.each{ |h| h.receive_issues(self, action) } if action == :create || 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
|
||||||
|
|
|
@ -119,4 +119,18 @@ describe ApiDefender do
|
||||||
response.status.should == 200
|
response.status.should == 200
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'for allowed addresses' do
|
||||||
|
let(:remote_addr) { APP_CONFIG['allowed_addresses'].first }
|
||||||
|
it 'should not return the limit usage for allowed address' do
|
||||||
|
get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr }
|
||||||
|
response.headers['X-RateLimit-Limit'].should_not == @rate_limit.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not forbidden allowed address' do
|
||||||
|
(@rate_limit+1).times { get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr } }
|
||||||
|
response.status.should == 200
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue