Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Remove suffix from page name (slug)
Browse files Browse the repository at this point in the history
  • Loading branch information
osahyoun committed Apr 4, 2016
1 parent 006353c commit b961633
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 30 deletions.
5 changes: 2 additions & 3 deletions app/controllers/api/actions_controller.rb
Expand Up @@ -10,7 +10,7 @@ def create
write_member_cookie(action.member_id)
render json: {}, status: 200
else
render json: {errors: validator.errors}, status: 422
render json: { errors: validator.errors }, status: 422
end
end

Expand All @@ -19,7 +19,7 @@ def validate
if validator.valid?
render json: {}, status: 200
else
render json: {errors: validator.errors}, status: 422
render json: { errors: validator.errors }, status: 422
end
end

Expand All @@ -38,4 +38,3 @@ def fields
Form.find(params[:form_id]).form_elements.map(&:name)
end
end

4 changes: 2 additions & 2 deletions app/services/action_queue.rb
Expand Up @@ -44,7 +44,7 @@ def payload
{
type: 'action',
params: {
page: "#{@action.page.slug}-petition"
page: page.slug,
}.merge(@action.form_data).
merge( UserLanguageISO.for(page.language) ).tap do |params|
params[:country] = country(member.country) if member.country.present?
Expand All @@ -61,7 +61,7 @@ def payload
type: 'donation',
params: {
donationpage: {
name: "#{@action.page.slug}-donation",
name: page.slug,
payment_account: get_payment_account
},
order: {
Expand Down
12 changes: 0 additions & 12 deletions app/services/manage_action.rb
Expand Up @@ -13,16 +13,4 @@ def create
return previous_action if previous_action.present?
build_action
end

private

def queue_message
{
type: 'action',
params: {
page: "#{page.slug}-petition"
}.merge(@params)
}
end
end

17 changes: 8 additions & 9 deletions spec/requests/api/actions_spec.rb
Expand Up @@ -19,7 +19,6 @@
let(:form) { create(:form_with_email) }

describe "POST#create" do
let(:page) { create(:page) }
let(:form) { create(:form_with_email_and_optional_country) }

let(:params) do
Expand All @@ -37,8 +36,8 @@
type: "action",

params: {
page: "#{page.slug}-petition",
email: "hello@example.com",
page: page.slug,
email: 'hello@example.com',
page_id: page.id.to_s,
form_id: form.id.to_s,
source: 'fb',
Expand Down Expand Up @@ -170,12 +169,12 @@
message_body: {
type: 'action',
params: {
page: "#{page.slug}-petition",
email: 'hello@example.com',
page_id: page.id.to_s,
form_id: form.id.to_s,
akid: invalid_akid,
user_en: 1
page: page.slug,
email: 'hello@example.com',
page_id: page.id.to_s,
form_id: form.id.to_s,
akid: invalid_akid,
user_en: 1
}
}.to_json
}
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api/braintree_spec.rb
Expand Up @@ -24,7 +24,7 @@
type: "donation",
params: {
donationpage: {
name: "cash-rules-everything-around-me-donation",
name: "cash-rules-everything-around-me",
payment_account: "Braintree EUR"
},
order: {
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/braintree_webhook_spec.rb
Expand Up @@ -93,7 +93,7 @@
type: "donation",
params: {
donationpage: {
name: "cash-rules-everything-around-me-donation",
name: "cash-rules-everything-around-me",
payment_account: "Braintree EUR"
},
order: {
Expand Down Expand Up @@ -153,7 +153,7 @@
type: "donation",
params: {
donationpage: {
name: "cash-rules-everything-around-me-donation",
name: "cash-rules-everything-around-me",
payment_account: "PayPal EUR"
},
order: {
Expand Down
2 changes: 1 addition & 1 deletion spec/services/manage_action_spec.rb
Expand Up @@ -26,7 +26,7 @@
expected = {
type: "action",
params: {
page: "#{page.slug}-petition",
page: page.slug,
email: "bob@example.com",
page_id: page.id,
referring_akid: '123.456.xyz',
Expand Down

0 comments on commit b961633

Please sign in to comment.