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] @auth_redirect = params[:auth_redirect]
@push_url = params[:push_url] @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 rescue Discourse::InvalidAccess
@generic_error = true @generic_error = true
end end
@ -123,7 +116,7 @@ class UserApiKeysController < ApplicationController
].each{|p| params.require(p)} ].each{|p| params.require(p)}
end end
def validate_params(skip_push_check = false) def validate_params
request_read = params[:access].include? 'r' request_read = params[:access].include? 'r'
request_read ||= params[:access].include? 'p' request_read ||= params[:access].include? 'p'
request_write = params[:access].include? 'w' request_write = params[:access].include? 'w'

View file

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