Skip to content

Commit 10411d0

Browse files
committed
Merge remote-tracking branch 'origin/master' into AO3-7410
2 parents 75f892c + cf1922e commit 10411d0

84 files changed

Lines changed: 1195 additions & 350 deletions

File tree

Some content is hidden

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

Gemfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ GEM
200200
bigdecimal
201201
rexml
202202
crass (1.0.6)
203-
css_parser (1.16.0)
203+
css_parser (1.22.0)
204204
addressable
205205
csv (3.3.5)
206206
cucumber (9.2.1)
@@ -243,7 +243,7 @@ GEM
243243
activerecord (>= 5.a)
244244
database_cleaner-core (~> 2.0.0)
245245
database_cleaner-core (2.0.1)
246-
date (3.4.1)
246+
date (3.5.1)
247247
departure (8.0.0)
248248
activerecord (>= 7.2.0)
249249
mysql2 (>= 0.4.0, < 0.6.0)
@@ -276,7 +276,7 @@ GEM
276276
email_spec (1.6.0)
277277
launchy (~> 2.1)
278278
mail (~> 2.2)
279-
erb (5.1.1)
279+
erb (6.0.1.1)
280280
erb_lint (0.4.0)
281281
activesupport
282282
better_html (>= 2.0.1)
@@ -406,7 +406,7 @@ GEM
406406
net-http-digest_auth (1.4.1)
407407
net-http-persistent (4.0.2)
408408
connection_pool (~> 2.2)
409-
net-imap (0.5.9)
409+
net-imap (0.5.14)
410410
date
411411
net-protocol
412412
net-pop (0.1.2)
@@ -425,7 +425,7 @@ GEM
425425
netrc (0.11.0)
426426
nio4r (2.7.4)
427427
nkf (0.2.0)
428-
nokogiri (1.19.1)
428+
nokogiri (1.19.3)
429429
mini_portile2 (~> 2.8.2)
430430
racc (~> 1.4)
431431
orm_adapter (0.5.0)
@@ -458,7 +458,7 @@ GEM
458458
psych (5.2.6)
459459
date
460460
stringio
461-
public_suffix (6.0.2)
461+
public_suffix (7.0.5)
462462
puma (6.5.0)
463463
nio4r (~> 2.0)
464464
puma_worker_killer (1.0.0)
@@ -661,7 +661,7 @@ GEM
661661
tilt (2.6.1)
662662
timecop (0.9.10)
663663
timeliness (0.4.5)
664-
timeout (0.4.3)
664+
timeout (0.6.1)
665665
tsort (0.2.0)
666666
tzinfo (2.0.6)
667667
concurrent-ruby (~> 1.0)

app/controllers/challenge/gift_exchange_controller.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def update
4242
# expire the cache on the signup form
4343
ActionController::Base.new.expire_fragment('challenge_signups/new')
4444

45+
# allow regenerating matches if none were found previously
46+
if @challenge.no_potential_matches_found?
47+
@challenge.no_potential_matches_found = false
48+
@challenge.save!
49+
end
50+
4551
# see if we initialized the tag set
4652
redirect_to collection_profile_path(@collection)
4753
else

app/controllers/challenge_assignments_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ def update_multiple
188188
assignment.defaulted_at = nil
189189
assignment.save || (@errors << ts("We couldn't undefault the assignment covering %{request}.", request: assignment.request_byline))
190190
when "approve"
191-
assignment.get_collection_item.approve_by_collection if assignment.get_collection_item
191+
if (item = assignment.get_collection_item)
192+
item.approve_by_collection
193+
item.save || (@errors << t(".approve_error", request: assignment.request_byline))
194+
end
192195
when "cover"
193196
# cover_[assignment_id] = pinch hitter pseud
194197
next if val.blank? || assignment.pinch_hitter.try(:byline) == val

app/controllers/chapters_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
class ChaptersController < ApplicationController
22
include WorksHelper
33

4-
# only registered users and NOT admin should be able to create new chapters
5-
before_action :users_only, except: [:index, :show, :destroy, :confirm_delete]
6-
before_action :check_user_status, only: [:new, :create, :update, :update_positions]
4+
# only registered users and NOT admin should be able to create and delete chapters
5+
before_action :users_only, except: [:index, :show]
6+
before_action :check_user_status, only: [:new, :create, :update, :update_positions, :post]
77
before_action :check_user_not_suspended, only: [:edit, :remove_user_creatorship, :confirm_delete, :destroy]
88
before_action :load_work
99
# only authors of a work should be able to edit its chapters

app/controllers/collection_participants_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ def index
7373

7474
def update
7575
if @participant.update(collection_participant_params)
76-
flash[:notice] = t('collection_participants.update_success', default: "Updated %{participant}.", participant: @participant.pseud.name)
76+
flash[:notice] = t(".success", participant: @participant.pseud.byline)
7777
else
78-
flash[:error] = t(".failure", participant: @participant.pseud.name)
78+
flash[:error] = t(".failure", participant: @participant.pseud.byline)
7979
end
8080
redirect_to collection_participants_path(@collection)
8181
end
8282

8383
def destroy
8484
@participant.destroy
85-
flash[:notice] = t('collection_participants.destroy', default: "Removed %{participant} from collection.", participant: @participant.pseud.name)
85+
flash[:notice] = t(".success", participant: @participant.pseud.byline)
8686
redirect_back_or_to root_path
8787
end
8888

app/controllers/gifts_controller.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ def index
1313
end
1414

1515
if @user
16-
@works = if @can_access_refused_gifts && params[:refused]
17-
@user.rejected_gift_works.visible_to_registered_user
18-
elsif current_user.nil?
19-
@user.gift_works.visible_to_all
20-
else
21-
@user.gift_works.visible_to_registered_user
22-
end
16+
@works = @can_access_refused_gifts && params[:refused] ? @user.rejected_gift_works : @user.gift_works
2317
else
2418
pseud = Pseud.parse_byline(@recipient_name)
2519
@works = pseud ? pseud.gift_works : Work.giftworks_for_recipient_name(@recipient_name)
26-
@works = current_user.nil? ? @works.visible_to_all : @works.visible_to_registered_user
2720
end
21+
@works = if guest?
22+
@works.visible_to_all
23+
else
24+
@works.visible_to_registered_user
25+
end
2826
@works = @works.in_collection(@collection) if @collection
2927
@works = @works.order("revised_at DESC").paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
3028
end

app/controllers/help_controller.rb

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,35 @@
11
class HelpController < ApplicationController
2+
HELP_ACTIONS = %i[
3+
first_login
4+
html
5+
preferences_collection
6+
preferences_comment
7+
preferences_display
8+
preferences_locale
9+
preferences_misc
10+
preferences_privacy
11+
preferences_work_title_format
12+
rte
13+
skins_basics
14+
skins_creating
15+
skins_parents
16+
symbols_key
17+
tags_fandoms
18+
tags_ratings
19+
tags_warnings
20+
works_languages
21+
works_parents
22+
works_recipients
23+
works_series
24+
works_translation_link
25+
].freeze
26+
227
before_action :users_only, only: [:first_login]
328
layout proc { |controller| controller.request.xhr? ? false : "application" } # rubocop:disable Lint/AmbiguousBlockAssociation
429

5-
def first_login
6-
end
7-
8-
def html
9-
end
10-
11-
def preferences_collection
12-
end
13-
14-
def preferences_comment
15-
end
16-
17-
def preferences_display
18-
end
19-
20-
def preferences_locale
21-
end
22-
23-
def preferences_misc
24-
end
25-
26-
def preferences_privacy
27-
end
28-
29-
def preferences_work_title_format
30-
end
31-
32-
def rte
33-
end
34-
35-
def skins_basics
36-
end
37-
38-
def skins_creating
39-
end
40-
41-
def skins_parents
42-
end
43-
44-
def symbols_key
45-
end
46-
47-
def tags_fandoms
48-
end
49-
50-
def tags_ratings
51-
end
52-
53-
def tags_warnings
30+
HELP_ACTIONS.each do |action|
31+
define_method(action) do
32+
# Intentionally empty block for help actions
33+
end
5434
end
5535
end

app/controllers/potential_matches_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def index
6565
@assignment_in_progress = true
6666
elsif @collection.potential_matches.count > 0 && @collection.assignments.count == 0
6767
flash[:error] = ts("There has been an error in the potential matching. Please first try regenerating assignments, and if that doesn't work, all potential matches. If the problem persists, please contact Support.")
68+
elsif @collection.challenge.no_potential_matches_found?
69+
@no_potential_matches_found = true
6870
elsif @collection.potential_matches.count > 0
6971
# we have potential_matches and assignments
7072

app/controllers/preferences_controller.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def index
1212
@page_subtitle = t(".page_title", username: @user.login)
1313
@preference = @user.preference
1414
authorize @preference if logged_in_as_admin?
15-
@available_skins = (@user.skins.site_skins + Skin.approved_skins.site_skins).uniq
15+
@available_skins = available_skins
1616
@available_locales = Locale.where(email_enabled: true)
1717
end
1818

1919
def update
2020
@preference = @user.preference
2121
authorize @preference if logged_in_as_admin?
22-
@available_skins = (@user.skins.site_skins + Skin.approved_skins.site_skins).uniq
22+
@available_skins = available_skins
2323
@available_locales = Locale.where(email_enabled: true)
2424

2525
@user.preference.attributes = preference_params
@@ -40,6 +40,11 @@ def update
4040

4141
private
4242

43+
def available_skins
44+
(@user.skins.site_skins.usable +
45+
Skin.approved_skins.site_skins.usable).uniq
46+
end
47+
4348
def preference_params
4449
params.require(:preference).permit(
4550
:minimize_search_engines,

app/controllers/series_controller.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class SeriesController < ApplicationController
22
before_action :check_user_status, only: [:new, :create, :edit, :update]
3-
before_action :load_series, only: [:show, :edit, :remove_user_creatorship, :update, :manage, :destroy, :confirm_delete]
4-
before_action :check_ownership, only: [:edit, :update, :manage, :destroy, :confirm_delete]
3+
before_action :load_series, only: [:show, :edit, :remove_user_creatorship, :update, :manage, :update_positions, :confirm_delete, :destroy]
4+
before_action :check_ownership, except: [:index, :show, :new, :create]
55
before_action :check_visibility, only: [:show]
66

77
def load_series
@@ -42,14 +42,14 @@ def index
4242
# GET /series/1
4343
# GET /series/1.xml
4444
def show
45-
@works = @series.works_in_order.posted.select(&:visible?).paginate(page: params[:page])
45+
@works = @series.works_in_order.posted.includes(:pseuds).select(&:visible?).paginate(page: params[:page])
4646

4747
# sets the page title with the data for the series
4848
if @series.unrevealed?
4949
@page_subtitle = t(".unrevealed_series")
5050
else
5151
@page_subtitle = get_page_subtitle(@series.fandoms.pluck(:name).join(t("support.array.words_connector")),
52-
@series.anonymous? ? t(".anonymous") : @series.allpseuds.collect(&:byline).join(t("support.array.words_connector")),
52+
helpers.text_byline(@series),
5353
@series.title)
5454
end
5555

@@ -116,7 +116,6 @@ def update
116116

117117
def update_positions
118118
if params[:serial_works]
119-
@series = Series.find(params[:id])
120119
@series.reorder_list(params[:serial_works])
121120
flash[:notice] = ts("Series order has been successfully updated.")
122121
elsif params[:serial]

0 commit comments

Comments
 (0)