-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/clh/add standardrb #1136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: supporter_level_goal
Are you sure you want to change the base?
Changes from all commits
da64de8
0d3dd77
91845e6
d3d2ae2
9f67723
2c50490
4338657
8334741
0a4513d
b43686d
d4b0ef8
d36a8b1
88cd90a
e3c6f28
f3bc07f
9203ce9
7ac3eef
c2963cf
aa35d11
82dd5bb
5234251
056babe
093b8a8
16fe3b3
9f86ab6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ def create | |
| json_saved campaign, "Campaign created! Well done." | ||
| else | ||
| profile_id = params[:campaign][:profile_id] | ||
| Profile.find(profile_id).update_attributes params[:profile] | ||
| Profile.find(profile_id).update params[:profile] | ||
| render json: CreatePeerToPeerCampaign.create(params[:campaign], profile_id) | ||
| end | ||
| end | ||
|
|
@@ -76,7 +76,7 @@ def update | |
| Time.use_zone(current_nonprofit.timezone || "UTC") do | ||
| params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present? | ||
| end | ||
| current_campaign.update_attributes params[:campaign] | ||
| current_campaign.update params[:campaign] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Standard wants you to call |
||
|
|
||
| json_saved current_campaign, "Successfully updated!" | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -403,6 +403,12 @@ def leaf? | |
| end | ||
| end | ||
|
|
||
| def self.create_from(root_tree_node) | ||
| er = ExpansionTree.new | ||
| er.root_node = root_tree_node | ||
| er | ||
| end | ||
|
|
||
|
Comment on lines
+406
to
+411
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happened here? Why is this public instead of private? |
||
| private | ||
|
|
||
| # given a set of SPaths, build a tree to describe | ||
|
|
@@ -415,11 +421,5 @@ def parse_paths(paths = []) | |
| end | ||
| end | ||
| end | ||
|
|
||
| def self.create_from(root_tree_node) | ||
| er = ExpansionTree.new | ||
| er.root_node = root_tree_node | ||
| er | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ def create | |
| end | ||
|
|
||
| def remove | ||
| @image = ImageAttachment.select { |img| img.file_url == params[:src] }.first | ||
| @image = ImageAttachment.find { |img| img.file_url == params[:src] } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if @image | ||
| @image.destroy | ||
| render json: @image | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ def modify | |
| end | ||
|
|
||
| supporter_ids = if params[:selecting_all] | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.map { |h| h["id"] } | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.pluck("id") | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Veify pluck works here
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it will. It would be nice if all of these were tested though. |
||
| else | ||
| params[:supporter_ids].map(&:to_i) | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ module Nonprofits | |
| class SupportersController < ApplicationController | ||
| include Controllers::NonprofitHelper | ||
|
|
||
| before_action :authenticate_nonprofit_user!, except: [:new, :create] | ||
| before_action :authenticate_nonprofit_user!, except: [:create] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the change? |
||
|
|
||
| before_action :validate_allowed!, only: [:create] | ||
| rescue_from ::TempBlockError, with: :handle_temp_block_error | ||
|
|
@@ -19,7 +19,7 @@ def index | |
| end | ||
|
|
||
| format.csv do | ||
| file_date = Date.today.strftime("%m-%d-%Y") | ||
| file_date = Time.zone.today.strftime("%m-%d-%Y") | ||
| supporters = QuerySupporters.for_export(params[:nonprofit_id], params) | ||
| send_data(Format::Csv.from_vectors(supporters), filename: "supporters-#{file_date}.csv") | ||
| end | ||
|
|
@@ -82,7 +82,7 @@ def update | |
|
|
||
| def bulk_delete | ||
| supporter_ids = if params[:selecting_all] | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.map { |h| h["id"] } | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.pluck("id") | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pluck?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be ideal if we had a spec to verify this Controller action |
||
| else | ||
| params[:supporter_ids].map(&:to_i) | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ def index | |
| # selected supporters' tags or all supporters' tags | ||
| def modify | ||
| supporter_ids = if params[:selecting_all] | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.map { |h| h["id"] } | ||
| QuerySupporters.full_filter_expr(current_nonprofit.id, params[:query]).select("supporters.id").execute.pluck("id") | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pluck?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be ideal if we had a spec to verify this Controller action |
||
| else | ||
| params[:supporter_ids].map(&:to_i) | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ def create | |
|
|
||
| def update | ||
| flash[:notice] = "Update successful!" | ||
| current_nonprofit.update_attributes params[:nonprofit].except(:verification_status) | ||
| current_nonprofit.update params[:nonprofit].except(:verification_status) | ||
| current_nonprofit.clear_cache | ||
| json_saved current_nonprofit | ||
| end | ||
|
|
@@ -129,7 +129,7 @@ def countries_list(locale) | |
| all_countries = ISO3166::Country.translations(locale) | ||
|
|
||
| if Settings.intntl.all_countries | ||
| countries = all_countries.select { |code, name| Settings.intntl.all_countries.include? code } | ||
| countries = all_countries.slice(*Settings.intntl.all_countries) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. slice over select |
||
| countries = countries.map { |code, name| [code.upcase, name] }.sort_by { |a| a[1] } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sort_by
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about sort_by? |
||
| countries.push([Settings.intntl.other_country.upcase, I18n.t("nonprofits.donate.info.supporter.other_country")]) if Settings.intntl.other_country | ||
| countries | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,27 @@ def terms_and_privacy | |
| end | ||
|
|
||
| def ccs | ||
| ccs_method = (!Settings.ccs) ? "local_tar_gz" : Settings.ccs.ccs_method | ||
| if ccs_method == "local_tar_gz" | ||
| temp_file = "#{Rails.root.join("tmp/#{Time.current.to_i}.tar.gz")}" | ||
| result = Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD") | ||
| if result | ||
| send_file(temp_file, type: "application/gzip") | ||
| else | ||
| head 500 | ||
| end | ||
| elsif ccs_method == "github" | ||
| git_hash = File.read("#{Rails.root.join("CCS_HASH")}") | ||
| if Settings.ccs&.ccs_method.presence == "github" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty significant manual refactor of this method ... deserves close review.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks right |
||
| redirect_to "https://github.com/#{Settings.ccs.options.account}/#{Settings.ccs.options.repo}/tree/#{git_hash}", | ||
| allow_other_host: true | ||
| elsif create_archive | ||
| send_file(temp_file, type: "application/gzip") | ||
| else | ||
| head 500 | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def git_hash | ||
| @git_hash ||= File.read(Rails.root.join("CCS_HASH").to_s) | ||
| end | ||
|
|
||
| def temp_file | ||
| @temp_file ||= Rails.root.join("tmp/#{Time.current.to_i}.tar.gz").to_s | ||
| end | ||
|
|
||
| def create_archive | ||
| Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD") | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later | ||
| module CardHelper | ||
| def expiration_years | ||
| (0..15).map { |n| (Date.today + n.years).year } | ||
| (0..15).map { |n| (Time.zone.today + n.years).year } | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later | ||
| # newer versions of Rails use an ApplicationJob so let's be cool like them | ||
| class InlineJob < ActiveJob::Base | ||
| class InlineJob < ApplicationJob | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inherit ApplicatoinJob ... Should there be a queue_adapter call?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite sure what was going on here. That said, I'm not sure we can safely switch this to ApplicationJob. I think we should switch this back and evaluate at a different time. |
||
| :inline | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.