Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ran bin/rubocop -a
5c1a35f51b1eedab065f0403057f9909087d0e7b
112 changes: 56 additions & 56 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'rails', '6.1.7.10'
gem 'jbuilder', '~> 2.13'
gem 'bootsnap', '~> 1.18', require: false # Large rails application booting enhancer
gem 'hamster', '~> 3.0' # Thread-safe collection classes for Ruby
gem 'puma', '~> 5.6'
gem 'rake'
gem 'sassc-rails', '~> 2.1', '>= 2.1.2'
gem 'sassc', '~> 2.0', '>= 2.0.1'
gem 'stripe', '~> 1.58' # January 19, 2017 version of the Stripe API https://stripe.com/docs/api
gem 'webpacker', '~> 5.4.4'
gem 'good_job', '~> 3.99'
source "https://rubygems.org"

gem "rails", "6.1.7.10"
gem "jbuilder", "~> 2.13"
gem "bootsnap", "~> 1.18", require: false # Large rails application booting enhancer
gem "hamster", "~> 3.0" # Thread-safe collection classes for Ruby
gem "puma", "~> 5.6"
gem "rake"
gem "sassc-rails", "~> 2.1", ">= 2.1.2"
gem "sassc", "~> 2.0", ">= 2.0.1"
gem "stripe", "~> 1.58" # January 19, 2017 version of the Stripe API https://stripe.com/docs/api
gem "webpacker", "~> 5.4.4"
gem "good_job", "~> 3.99"

# fix for https://www.ruby-lang.org/en/news/2021/11/15/date-parsing-method-regexp-dos-cve-2021-41817/
gem "date", "~> 3.4.1"

gem 'httparty', '~> 0.22.0' # https://github.com/jnunemaker/httparty
gem 'sprockets', '~> 3.7'
gem "httparty", "~> 0.22.0" # https://github.com/jnunemaker/httparty
gem "sprockets", "~> 3.7"

# Helpers
gem 'chronic', '~> 0.10.2' # For nat lang parsing of dates
gem 'countries', '~> 4.2'
gem 'i18n-js', '~> 3.8', git: 'https://github.com/houdiniproject/i18n-js.git', branch: 'houdini-tweaks'
gem 'rails-i18n', '~> 6.0.0', '~> 6'
gem 'premailer-rails', '~> 1.12' # for styling of email
gem 'money', '~> 6.19'
gem "chronic", "~> 0.10.2" # For nat lang parsing of dates
gem "countries", "~> 4.2"
gem "i18n-js", "~> 3.8", git: "https://github.com/houdiniproject/i18n-js.git", branch: "houdini-tweaks"
gem "rails-i18n", "~> 6.0.0", "~> 6"
gem "premailer-rails", "~> 1.12" # for styling of email
gem "money", "~> 6.19"

# Database and Events
gem 'pg', '~> 1.5'
gem "pg", "~> 1.5"

gem 'param_validation', path: 'gems/ruby-param-validation'
gem 'qx', path: 'gems/ruby-qx'
gem "param_validation", path: "gems/ruby-param-validation"
gem "qx", path: "gems/ruby-qx"

# Optimization
gem 'fast_blank'
gem "fast_blank"

# Images
gem 'image_processing', '~> 1.13.0'
gem "image_processing", "~> 1.13.0"

# URL validation
gem 'validate_url'
gem "validate_url"

# User authentication
# https://github.com/plataformatec/devise
gem 'devise-async', '~> 1.0'
gem 'devise', '~> 4.9'
gem "devise-async", "~> 1.0"
gem "devise", "~> 4.9"

group :development, :ci do
gem 'traceroute', '~> 0.8.0'
gem "traceroute", "~> 0.8.0"
end

group :development, :ci, :test do
gem 'debug'
gem 'dotenv-rails', '~> 2.8', require: 'dotenv/rails-now'
gem 'rspec-rails', '~> 4.1.2'
gem 'rspec', '~> 3.13.0'
gem 'rspec-json_expectations', '~> 2'
gem 'factory_bot_rails', '~> 6.4'
gem 'factory_bot', '~> 6.5'
gem 'listen'
gem 'table_print', '~> 1.5', '>= 1.5.6' # giuNice table printing of data for the console
gem 'colorize', '~> 0.8.1' # Print colorized text in debugger/console
gem 'shoulda-matchers', '~> 5.3.0'
gem 'turbo_test'
gem 'erb_lint', require: false
eval_gemfile './gemfiles/rubocop.gemfile'
gem "debug"
gem "dotenv-rails", "~> 2.8", require: "dotenv/rails-now"
gem "rspec-rails", "~> 4.1.2"
gem "rspec", "~> 3.13.0"
gem "rspec-json_expectations", "~> 2"
gem "factory_bot_rails", "~> 6.4"
gem "factory_bot", "~> 6.5"
gem "listen"
gem "table_print", "~> 1.5", ">= 1.5.6" # giuNice table printing of data for the console
gem "colorize", "~> 0.8.1" # Print colorized text in debugger/console
gem "shoulda-matchers", "~> 5.3.0"
gem "turbo_test"
gem "erb_lint", require: false
eval_gemfile "./gemfiles/rubocop.gemfile"
end

group :ci, :test do
gem 'action_mailer_matchers', '~> 1.2'
gem 'database_cleaner-active_record'
gem 'stripe-ruby-mock', '~> 2.4.1', require: 'stripe_mock', git: 'https://github.com/commitchange/stripe-ruby-mock.git', branch: '2.4.1'
gem 'test-unit', '~> 3.6'
gem 'timecop', '~> 0.9.10'
gem 'webmock', '~> 3.24'
gem 'wisper-rspec', '~> 1.1.0'
gem "action_mailer_matchers", "~> 1.2"
gem "database_cleaner-active_record"
gem "stripe-ruby-mock", "~> 2.4.1", require: "stripe_mock", git: "https://github.com/commitchange/stripe-ruby-mock.git", branch: "2.4.1"
gem "test-unit", "~> 3.6"
gem "timecop", "~> 0.9.10"
gem "webmock", "~> 3.24"
gem "wisper-rspec", "~> 1.1.0"
end

group :production do
Expand All @@ -87,18 +87,18 @@ group :production do
# like heroku, uncomment the `heroku-deflater` line.
#
# gem 'heroku-deflater', '~> 0.6.3' # https://github.com/romanbsd/heroku-deflater
gem 'rack-timeout', '~> 0.7.0'
gem "rack-timeout", "~> 0.7.0"
end

gem 'bess', path: 'gems/bess'
gem "bess", path: "gems/bess"

gem 'houdini_full_contact', path: 'gems/houdini_full_contact'
gem "houdini_full_contact", path: "gems/houdini_full_contact"

gem "react_on_rails", "12.6.0"

gem 'kaminari'
gem "kaminari"

gem 'http_accept_language'
gem "http_accept_language"

gem "js-routes"

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('config/application', __dir__)
require File.expand_path("config/application", __dir__)

Commitchange::Application.load_tasks
26 changes: 13 additions & 13 deletions app/controllers/api/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE
class Api::ApiController < ActionController::Base # rubocop:disable Rails/ApplicationController
# We disable Rails/ApplicationController bec
include Controllers::Locale
include Controllers::Nonprofit::Authorization
# We disable Rails/ApplicationController bec
include Controllers::Locale
include Controllers::Nonprofit::Authorization

rescue_from ActiveRecord::RecordInvalid, with: :record_invalid_rescue
rescue_from AuthenticationError, with: :unauthorized_rescue
rescue_from ActiveRecord::RecordInvalid, with: :record_invalid_rescue
rescue_from AuthenticationError, with: :unauthorized_rescue

protected
protected

def record_invalid_rescue(error)
render json: { errors: error.record.errors.messages }, status: :unprocessable_entity
end
def record_invalid_rescue(error)
render json: {errors: error.record.errors.messages}, status: :unprocessable_entity
end

def unauthorized_rescue(error)
@error = error
render 'api/errors/unauthorized', status: :unauthorized
end
def unauthorized_rescue(error)
@error = error
render "api/errors/unauthorized", status: :unauthorized
end
end
30 changes: 15 additions & 15 deletions app/controllers/api/campaign_gift_options_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

# A controller for interacting with a nonprofit's supporters
class Api::CampaignGiftOptionsController < Api::ApiController
include Controllers::Campaign::Current
include Controllers::Campaign::Authorization
include Controllers::Campaign::Current
include Controllers::Campaign::Authorization

before_action :authenticate_campaign_editor!
before_action :authenticate_campaign_editor!

def index
@campaign_gift_options =
current_campaign
.campaign_gift_options
.order('id DESC')
.page(params[:page])
.per(params[:per])
end
def index
@campaign_gift_options =
current_campaign
.campaign_gift_options
.order("id DESC")
.page(params[:page])
.per(params[:per])
end

# If not logged in, causes a 401 error
def show
@campaign_gift_option = current_campaign.campaign_gift_options.find(params[:id])
end
# If not logged in, causes a 401 error
def show
@campaign_gift_option = current_campaign.campaign_gift_options.find(params[:id])
end
end
16 changes: 8 additions & 8 deletions app/controllers/api/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

# A controller for interacting with a nonprofit's supporters
class Api::CampaignsController < Api::ApiController
include Controllers::Campaign::Current
include Controllers::Campaign::Authorization
include Controllers::Campaign::Current
include Controllers::Campaign::Authorization

before_action :authenticate_campaign_editor!, only: :show
before_action :authenticate_campaign_editor!, only: :show

# Gets the a single nonprofit campaign
# If not logged in, causes a 401 error
def show
@campaign = current_campaign
end
# Gets the a single nonprofit campaign
# If not logged in, causes a 401 error
def show
@campaign = current_campaign
end
end
36 changes: 18 additions & 18 deletions app/controllers/api/custom_field_definitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

# A controller for interacting with a nonprofit's custom field definition
class Api::CustomFieldDefinitionsController < Api::ApiController
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!

# Gets the nonprofits custom field definitions
# If not logged in, causes a 401 error
def index
@custom_field_definitions =
current_nonprofit
.custom_field_definitions
.order('id DESC')
.page(params[:page])
.per(params[:per])
end
# Gets the nonprofits custom field definitions
# If not logged in, causes a 401 error
def index
@custom_field_definitions =
current_nonprofit
.custom_field_definitions
.order("id DESC")
.page(params[:page])
.per(params[:per])
end

# Gets a single custom field definition
# If not logged in, causes a 401 error
def show
@custom_field_definition = current_nonprofit.custom_field_definitions.find(params[:id])
end
# Gets a single custom field definition
# If not logged in, causes a 401 error
def show
@custom_field_definition = current_nonprofit.custom_field_definitions.find(params[:id])
end
end
16 changes: 8 additions & 8 deletions app/controllers/api/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

# A controller for interacting with a nonprofit's supporters
class Api::EventsController < Api::ApiController
include Controllers::Event::Current
include Controllers::Event::Authorization
include Controllers::Event::Current
include Controllers::Event::Authorization

before_action :authenticate_event_editor!, only: :show
before_action :authenticate_event_editor!, only: :show

# Gets the a single nonprofit campaign
# If not logged in, causes a 401 error
def show
@event = current_event
end
# Gets the a single nonprofit campaign
# If not logged in, causes a 401 error
def show
@event = current_event
end
end
35 changes: 16 additions & 19 deletions app/controllers/api/nonprofits_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE
class Api::NonprofitsController < Api::ApiController
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization

before_action :authenticate_nonprofit_user!, only: %i[show]
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization

def create
@nonprofit = Nonprofit.new(clean_params.merge({user_id: current_user_id}))
@nonprofit.save!
render status: :created
end
before_action :authenticate_nonprofit_user!, only: %i[show]

def show
@nonprofit = current_nonprofit
end
def create
@nonprofit = Nonprofit.new(clean_params.merge({user_id: current_user_id}))
@nonprofit.save!
render status: :created
end

private

def clean_params
params.permit(:name, :zip_code, :state_code, :city, :phone, :email, :website)
end

end
def show
@nonprofit = current_nonprofit
end

private

def clean_params
params.permit(:name, :zip_code, :state_code, :city, :phone, :email, :website)
end
end
Loading
Loading