Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -5,3 +5,5 @@ c07a4aa4b61aab90a4e3927fd83574158907be27
77891f15aaff2826a65338edf0448625f3982295
# Flatten multi-level style of module composition
1fed30132333efa675f0c7d800691a225e9c26f8
# Run bin/standardrb --fix
c23ea233adc828e9a8c6d02143279269f551a23f
167 changes: 82 additions & 85 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,170 +1,167 @@
source 'https://rubygems.org'
source "https://rubygems.org"

ruby ENV['CUSTOM_RUBY_VERSION'] || '3.1.7' # heroku needs a specific ruby version in the Gemfile
ruby ENV["CUSTOM_RUBY_VERSION"] || "3.1.7" # heroku needs a specific ruby version in the Gemfile

gem 'rake'
gem 'rails', '~> 7.0.8.7'
gem 'sprockets', '~> 3.7' # Sprockets 4.0 stops allowing us to add a proc to the config.assets.precompile array, which we currently use
gem "rake"
gem "rails", "~> 7.0.8.7"
gem "sprockets", "~> 3.7" # Sprockets 4.0 stops allowing us to add a proc to the config.assets.precompile array, which we currently use

gem 'rack', '~> 2.2.13'
gem "rack", "~> 2.2.13"

# https://stripe.com/docs/api
gem 'stripe', '~> 5.0'
gem "stripe", "~> 5.0"

# json serialization
# https://github.com/nesquena/rabl
gem 'rabl'
gem "rabl"

gem 'jbuilder'
gem "jbuilder"

gem "puma", "~> 5.6"

gem 'kaminari'
gem "kaminari"

gem 'bootsnap', require: false
gem 'rack-timeout'
gem "bootsnap", require: false
gem "rack-timeout"

gem 'test-unit'
gem 'immutable-ruby' # used instead of hamster in a few legacy places
gem "test-unit"
gem "immutable-ruby" # used instead of hamster in a few legacy places

gem 'aws-sdk-s3'
gem 'aws-sdk-rails'
gem "aws-sdk-s3"
gem "aws-sdk-rails"

gem 'json', '>= 2.3.0'
gem "json", ">= 2.3.0"

gem 'yaaf' # form objects
gem "yaaf" # form objects

# for blocking ip addressses
gem 'rack-attack'
gem "rack-attack"

# to find middleware thread safety bugs
gem 'rack-freeze'
gem "rack-freeze"

# Database (postgres)
gem 'pg', '~> 1.1'
gem 'qx', path: 'gems/ruby-qx'
gem 'dalli'
gem "pg", "~> 1.1"
gem "qx", path: "gems/ruby-qx"
gem "dalli"


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

# Print colorized text lol
gem 'colorize'
gem "colorize"

# https://github.com/collectiveidea/delayed_job_active_record
gem 'delayed_job_active_record'
gem "delayed_job_active_record"

# For nat lang parsing of dates
gem 'chronic'
gem "chronic"

# Images
# https://github.com/carrierwaveuploader/carrierwave
gem 'carrierwave', '~> 3.0'
gem 'carrierwave-aws' # for uploading images to amazon s3
gem 'mini_magick'
gem "carrierwave", "~> 3.0"
gem "carrierwave-aws" # for uploading images to amazon s3
gem "mini_magick"

# https://github.com/jnunemaker/httparty
gem 'httparty'
gem "httparty"

# User authentication
# https://github.com/plataformatec/devise
gem 'devise', '~> 4.1'
gem "devise", "~> 4.1"

# https://github.com/airbrake/airbrake
gem 'airbrake'
gem "airbrake"

# http://www.rubygeocoder.com/
gem 'geocoder' # for adding latitude and longitude to location-based tables
gem "geocoder" # for adding latitude and longitude to location-based tables

# https://github.com/buytruckload/nearest_time_zone
gem 'nearest_time_zone' # for detecting timezone from lat/lng
gem "nearest_time_zone" # for detecting timezone from lat/lng

gem 'rest-client' # recommended for fullcontact
gem "rest-client" # recommended for fullcontact

# https://github.com/fphilipe/premailer-rails
# for stylizing emails
gem 'premailer-rails'
gem "premailer-rails"

# Nice table printing of data for the console
gem 'table_print'
gem "table_print"

gem 'rails-i18n' # For 4.0.x
gem 'i18n-js', '~> 3.8' # i18n-js 4 is very different and doesn't work without some big changes
gem 'countries'
gem "rails-i18n" # For 4.0.x
gem "i18n-js", "~> 3.8" # i18n-js 4 is very different and doesn't work without some big changes
gem "countries"

gem 'rexml' # needed on Ruby 3
gem "rexml" # needed on Ruby 3

group :development, :ci, :test do
gem "standard"
gem "standard-rails"
gem 'listen'
gem 'letter_opener'
gem 'timecop'
gem 'pry'
gem 'pry-byebug'
gem 'binding_of_caller'
gem 'rspec', "~> 3"
gem 'rspec-rails', "~> 7"
gem 'database_cleaner'
gem 'dotenv-rails'
gem 'stripe-ruby-mock', '~> 5.0', :require => 'stripe_mock'
gem 'factory_bot'
gem 'factory_bot_rails'
gem 'action_mailer_matchers', '~> 1.2.0'
gem 'simplecov', '~> 0.22.0', require: false
gem 'byebug'
gem 'shoulda-matchers'
gem 'rspec-json_expectations'
gem 'yard'
gem 'faker' # test data generation
gem "listen"
gem "letter_opener"
gem "timecop"
gem "pry"
gem "pry-byebug"
gem "binding_of_caller"
gem "rspec", "~> 3"
gem "rspec-rails", "~> 7"
gem "database_cleaner"
gem "dotenv-rails"
gem "stripe-ruby-mock", "~> 5.0", require: "stripe_mock"
gem "factory_bot"
gem "factory_bot_rails"
gem "action_mailer_matchers", "~> 1.2.0"
gem "simplecov", "~> 0.22.0", require: false
gem "byebug"
gem "shoulda-matchers"
gem "rspec-json_expectations"
gem "yard"
gem "faker" # test data generation
end


group :test do
gem 'webmock'
gem "webmock"
end

# Gems used for asset compilation
gem 'sassc'
gem 'sassc-rails'
gem 'uglifier'
gem "sassc"
gem "sassc-rails"
gem "uglifier"

# make logging less terrible in rails
gem 'lograge'
gem "lograge"

gem 'config', '~> 2.0'
gem 'dry-validation' # used only for config validation
gem "config", "~> 2.0"
gem "dry-validation" # used only for config validation

group :production do
gem 'rails_autoscale_agent', '>= 0.9.1'
gem 'tunemygc'
gem "rails_autoscale_agent", ">= 0.9.1"
gem "tunemygc"
end


group :production, :staging do
gem "hiredis", "~> 0.6.0"
gem "redis", ">= 3.2.0"
gem 'redis-actionpack'
gem "redis-actionpack"
end

gem 'recaptcha', '~> 5.8.1'
gem "recaptcha", "~> 5.8.1"

gem 'hashie'
gem "hashie"

gem 'connection_pool'
gem "connection_pool"

gem "barnes"

gem 'protected_attributes_continued' # because we upgraded from 3 and then 4
gem "protected_attributes_continued" # because we upgraded from 3 and then 4

gem 'rack-cors'
gem "rack-cors"

gem 'fx'
gem "fx"

gem 'has_scope'
gem "has_scope"

gem 'globalid', ">= 1.0.1"
gem "globalid", ">= 1.0.1"

gem 'js-routes'
gem "js-routes"

gem 'concurrent-ruby', '1.3.4' # there's a regression in 1.3.5 that can be removed at Rails 7.1
gem "concurrent-ruby", "1.3.4" # there's a regression in 1.3.5 that can be removed at Rails 7.1
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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', __FILE__)
require File.expand_path("../config/application", __FILE__)

Rails.application.load_tasks
36 changes: 18 additions & 18 deletions app/controllers/api_new/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +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
module ApiNew
class ApiController < ActionController::Base # rubocop:disable Rails/ApplicationController
# We disable Rails/ApplicationController because we don't want all the stuff in ApplicationController included since
# the Api is simpler
include Controllers::Locale
include Controllers::Nonprofit::Authorization
include Controllers::ApiNew::JbuilderExpansions
rescue_from ActiveRecord::RecordInvalid, with: :record_invalid_rescue
rescue_from AuthenticationError, with: :unauthorized_rescue
class ApiController < ActionController::Base # rubocop:disable Rails/ApplicationController
# We disable Rails/ApplicationController because we don't want all the stuff in ApplicationController included since
# the Api is simpler
include Controllers::Locale
include Controllers::Nonprofit::Authorization
include Controllers::ApiNew::JbuilderExpansions
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_new/errors/unauthorized', status: :unauthorized
end
end
end
def unauthorized_rescue(error)
@error = error
render "api_new/errors/unauthorized", status: :unauthorized
end
end
end
28 changes: 14 additions & 14 deletions app/controllers/api_new/object_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE

module ApiNew
class ObjectEventsController < ApiNew::ApiController
include Controllers::ApiNew::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!
class ObjectEventsController < ApiNew::ApiController
include Controllers::ApiNew::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!

has_scope :event_entity
has_scope :event_types, type: :array
has_scope :event_entity
has_scope :event_types, type: :array

# Gets the nonprofits object events
# If not logged in, causes a 401 error
def index
@object_events = apply_scopes(current_nonprofit
.associated_object_events)
.order('created_at DESC').page(params[:page]).per(params[:per])
end
end
# Gets the nonprofits object events
# If not logged in, causes a 401 error
def index
@object_events = apply_scopes(current_nonprofit
.associated_object_events)
.order("created_at DESC").page(params[:page]).per(params[:per])
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Rails 6 requires a matching controller for the `spec/views/api_new/offline_transaction_charges/show.json.jbuilder_spec.rb` spec
# This controller isn't currently used for anything else.
class ApiNew::OfflineTransactionChargesController < ApiNew::ApiController
end
end
2 changes: 1 addition & 1 deletion app/controllers/api_new/payouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Rails 6 requires a matching controller for the `spec/views/api_new/payouts/show.json.jbuilder_spec.rb` spec
# This controller isn't currently used for anything else.
class ApiNew::PayoutsController < ApiNew::ApiController
end
end
32 changes: 16 additions & 16 deletions app/controllers/api_new/supporters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
# Full license explanation at https://github.com/houdiniproject/houdini/blob/main/LICENSE

module ApiNew
# A controller for interacting with a nonprofit's supporters
class SupportersController < ApiNew::ApiController
include Controllers::ApiNew::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!
# A controller for interacting with a nonprofit's supporters
class SupportersController < ApiNew::ApiController
include Controllers::ApiNew::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_nonprofit_user!

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

# Gets the a single nonprofit supporter
# If not logged in, causes a 401 error
def show
@supporter = current_nonprofit.supporters.find_by(houid:params[:id])
end
end
# Gets the a single nonprofit supporter
# If not logged in, causes a 401 error
def show
@supporter = current_nonprofit.supporters.find_by(houid: params[:id])
end
end
end
Loading