Skip to content

Commit 91f0ec5

Browse files
authored
Merge branch 'main' into 5150-switch-pagination-order
2 parents 00e8373 + 347529e commit 91f0ec5

42 files changed

Lines changed: 44 additions & 124 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/controllers/admin/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def destroy
8686

8787
def organization_params
8888
params.require(:organization)
89-
.permit(:name, :short_name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day,
89+
.permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day,
9090
users_attributes: %i(name email organization_admin), account_request_attributes: %i(ndbn_member_id id))
9191
end
9292

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def current_organization
3030
elsif current_role.resource.is_a?(Organization)
3131
current_role.resource
3232
else
33-
Organization.find_by(short_name: params[:organization_name])
33+
Organization.find_by(id: params[:organization_id])
3434
end
3535
end
3636
helper_method :current_organization
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class HistoricalTrends::BaseController < ApplicationController
22
def cached_series(type)
3-
Rails.cache.fetch("#{current_organization.short_name}-historical-#{type}-data") { HistoricalTrendService.new(current_organization.id, type).series }
3+
Rails.cache.fetch("#{current_organization.id}-historical-#{type}-data") { HistoricalTrendService.new(current_organization.id, type).series }
44
end
55
end

app/controllers/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def organization_params
9292
request_type_formatter(params)
9393

9494
params.require(:organization).permit(
95-
:name, :short_name, :street, :city, :state,
95+
:name, :street, :city, :state,
9696
:zipcode, :email, :url, :logo, :intake_location,
9797
:default_storage_location, :default_email_text, :reminder_email_text,
9898
:invitation_text, :reminder_day, :deadline_day,

app/jobs/historical_data_cache_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class HistoricalDataCacheJob < ApplicationJob
22
def perform(org_id:, type:)
33
organization = Organization.find_by(id: org_id)
44

5-
Rails.cache.write("#{organization.short_name}-historical-#{type}-data", HistoricalTrendService.new(organization.id, type).series)
5+
Rails.cache.write("#{organization.id}-historical-#{type}-data", HistoricalTrendService.new(organization.id, type).series)
66
end
77

88
def queue_name = "low_priority"

app/models/organization.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ class Organization < ApplicationRecord
4444

4545
include Deadlinable
4646

47+
# TODO: remove once migration "20250504183911_remove_short_name_from_organizations" has run in production
48+
self.ignored_columns += ["short_name"]
49+
4750
validates :name, presence: true
48-
validates :short_name, presence: true, format: /\A[a-z0-9_]+\z/i, uniqueness: true
4951
validates :url, format: { with: URI::DEFAULT_PARSER.make_regexp, message: "it should look like 'http://www.example.com'" }, allow_blank: true
5052
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }, allow_blank: true
5153
validate :correct_logo_mime_type
@@ -149,11 +151,6 @@ def assign_attributes_from_account_request(account_request)
149151
self
150152
end
151153

152-
# NOTE: when finding Organizations, use Organization.find_by(short_name: params[:organization_name])
153-
def to_param
154-
short_name
155-
end
156-
157154
def ordered_requests
158155
requests.order(status: :asc, updated_at: :desc)
159156
end

app/services/distribution_service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ def perform_distribution_service(&block)
1010
set_error(e)
1111
rescue Errors::InsufficientAllotment => e
1212
distribution.line_items.assign_insufficiency_errors(e.insufficient_items)
13-
Rails.logger.error "[!] #{self.class.name} failed because of Insufficient Allotment #{distribution_organization.short_name}: #{distribution.errors.full_messages} [#{e.message}]"
13+
Rails.logger.error "[!] #{self.class.name} failed because of Insufficient Allotment #{distribution_organization.name}: #{distribution.errors.full_messages} [#{e.message}]"
1414
set_error(e)
1515
rescue StandardError => e
16-
Rails.logger.error "[!] #{self.class.name} failed for #{distribution_organization.short_name}: #{distribution.errors.full_messages} [#{e.inspect}]"
16+
Rails.logger.error "[!] #{self.class.name} failed for #{distribution_organization.name}: #{distribution.errors.full_messages} [#{e.inspect}]"
1717
set_error(e)
1818
ensure
1919
return self

app/views/admin/organizations/_list.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<tbody>
1414
<% @organizations.each do |organization| %>
15-
<tr class="<%= organization.short_name %>">
15+
<tr>
1616
<td><%= organization.name %></td>
1717
<td><%= link_to organization.email, "mailto:#{organization.email}" %></td>
1818
<td class="date"><%= organization.created_at.strftime("%F") %></td>

app/views/admin/organizations/_organization_row.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<tr class="<%= organization_row.short_name %>">
1+
<tr>
22
<td><%= organization_row.name %></td>
33
<td><%= link_to organization_row.email, "mailto:#{organization_row.email}" %></td>
44
<td class="date"><%= organization_row.created_at.strftime("%F") %></td>

app/views/admin/organizations/edit.html.erb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@
4242
<span class="input-group-text"><i class="fa fa-user"></i></span>
4343
<%= f.input_field :name, class: "form-control" %>
4444
<% end %>
45-
<%= f.input :short_name, required: true, autofocus: true, wrapper: :input_group do %>
46-
<span class="input-group-text"><i class="fa fa-desktop"></i></span>
47-
<%= f.input_field :short_name, class: "form-control" %>
48-
<% end %>
49-
<div>
50-
APPROACH with EXTREME CAUTION! Editing the short name will break bookmarked links and calendar notices! If a
51-
bank has asked you to do this, explain this to them first.
52-
</div>
5345
<%= f.input :url, as: :url, placeholder: "http://www.example.com", wrapper: :input_group do %>
5446
<span class="input-group-text"><i class="fa fa-link"></i></span>
5547
<%= f.input_field :url, class: "form-control" %>

0 commit comments

Comments
 (0)