From ca79c4b2768e05fcfd61aff7174fcd44aa6a75c1 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 26 Aug 2016 13:23:06 +1000 Subject: [PATCH] stop eating up push_urls --- app/controllers/user_api_keys_controller.rb | 9 +-------- spec/controllers/user_api_keys_controller_spec.rb | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/controllers/user_api_keys_controller.rb b/app/controllers/user_api_keys_controller.rb index 5ab817980f1..1756237510a 100644 --- a/app/controllers/user_api_keys_controller.rb +++ b/app/controllers/user_api_keys_controller.rb @@ -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' diff --git a/spec/controllers/user_api_keys_controller_spec.rb b/spec/controllers/user_api_keys_controller_spec.rb index a2acc61e6f8..9884eff07ad 100644 --- a/spec/controllers/user_api_keys_controller_spec.rb +++ b/spec/controllers/user_api_keys_controller_spec.rb @@ -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