stop eating up push_urls

This commit is contained in:
Sam 2016-08-26 13:23:06 +10:00
parent fcdf13f52d
commit ca79c4b276
2 changed files with 2 additions and 8 deletions

View file

@ -38,13 +38,6 @@ class UserApiKeysController < ApplicationController
@auth_redirect = params[:auth_redirect]
@push_url = params[:push_url]
if @access.include?("p")
if !SiteSetting.allow_push_user_api_keys ||
!SiteSetting.allowed_user_api_push_urls.split('|').any?{|u| params[:push_url] == u}
@access.gsub!("p","")
@push_url = nil
end
end
rescue Discourse::InvalidAccess
@generic_error = true
end
@ -123,7 +116,7 @@ class UserApiKeysController < ApplicationController
].each{|p| params.require(p)}
end
def validate_params(skip_push_check = false)
def validate_params
request_read = params[:access].include? 'r'
request_read ||= params[:access].include? 'p'
request_write = params[:access].include? 'w'

View file

@ -122,6 +122,7 @@ TXT
expect(parsed["access"].split('').sort).to eq(['r'])
key = user.user_api_keys.first
expect(key.push).to eq(true)
expect(key.push_url).to eq("https://push.it/here")
end