Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f03dc3c
Only allow users with the official role to apply to make skins public
sarken Jun 12, 2025
ed1ba59
Tests
sarken Jun 12, 2025
706907f
Remove skins-approval help text
sarken Jun 13, 2025
41ac735
Add task for clearing unofficial skins
sarken Jun 13, 2025
f3ef025
AO3-7030 Resolve merge conflicts
sarken Sep 20, 2025
82163bb
AO3-7030 Use update_all to clear unofficial skins so we don't update …
sarken Sep 20, 2025
b1fa0ac
Merge branch 'master' into AO3-7030
sarken Oct 13, 2025
c6f1f44
AO3-7030 I forgot what the test failures are when doing it this way
sarken Oct 13, 2025
0244884
AO3-7030 Ah yeah that's what happens
sarken Oct 14, 2025
6fcfa84
AO3-7030 Disallow editing of public attribute in controller instead
sarken Oct 18, 2025
7f6ab77
AO3-7030 Merge with master
sarken Oct 18, 2025
2f9fbdb
AO3-7030 Put blank line back in file I removed other changes from
sarken Oct 18, 2025
20324f1
AO3-7030 Move test
sarken Oct 18, 2025
d5141c0
Merge branch 'master' into AO3-7030
sarken Oct 18, 2025
4977652
AO3-7030 Remove duplicate test from merge
sarken Oct 18, 2025
9527542
AO3-7030 Change order of steps for step definition
sarken Oct 18, 2025
e723062
AO3-7030 How much worse did I make it
sarken Oct 18, 2025
01455c4
AO3-7030 Keep the array
sarken Oct 18, 2025
3b02554
AO3-7030 In case I also need these changes
sarken Oct 18, 2025
b2e9b04
AO3-7030 Humor me for a sec
sarken Oct 19, 2025
90f95c7
Merge with master
sarken Jan 28, 2026
22ba631
Readd test removed to simplyify conflict resolution
sarken Jan 28, 2026
257f96f
Use official user for creating approved skins in tests
sarken Jan 28, 2026
b61a311
Just disable the thing because only volunteers can see it anyway
sarken Feb 3, 2026
8f939c5
Test updates, fix things that got messed up in merge, line lenght tweaks
sarken Feb 4, 2026
c5c6ea9
Don't include apply to make public checkbox for admins
sarken Feb 5, 2026
1620b31
AO3-7030 Cucumber expressions
sarken Feb 5, 2026
7ac58c1
AO3-7030 Code style fixes
sarken Feb 6, 2026
3b5839b
AO3-7030 Try to find some bracket layout that'll appease Reviewdog's …
sarken Feb 6, 2026
c680b56
AO3-7030 Indent
sarken Feb 6, 2026
fd6461e
AO3-7030 C'mon
sarken Feb 6, 2026
e45272a
AO3-7030 Style fixes in specs
sarken Feb 19, 2026
9d19748
AO3-7030 Add a space in the spec
sarken Feb 19, 2026
34078b0
AO3-7030 Change line breaks in skin task spec
sarken Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/controllers/skins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,19 @@ def destroy
private

def skin_params
params.require(:skin).permit(
:title, :description, :public, :css, :role, :ie_condition, :unusable,
:font, :base_em, :margin, :paragraph_margin, :background_color,
allowed_attributes = [
Comment thread
brianjaustin marked this conversation as resolved.
:title, :description, :css, :role, :ie_condition, :unusable, :font,
:base_em, :margin, :paragraph_margin, :background_color,
:foreground_color, :headercolor, :accent_color, :icon,
media: [],
skin_parents_attributes: [
:id, :position, :parent_skin_id, :parent_skin_title, :_destroy
]
)
]

allowed_attributes += [:public] if current_user.is_a?(User) && current_user.official

params.require(:skin).permit(allowed_attributes)
end

def load_skin
Expand Down
6 changes: 4 additions & 2 deletions app/views/skins/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
<dt><%= f.label :icon, t(".icon") %></dt>
<dd><%= f.file_field :icon %></dd>

<dt><%= f.label :public, t(".public") %> <%= link_to_help "skins-approval" %></dt>
<dd><%= f.check_box :public %></dd>
<% if @current_user&.official %>
<dt><%= f.label :public, t(".public") %></dt>
<dd><%= f.check_box :public %></dd>
<% end %>
</dl>
</fieldset>

Expand Down
4 changes: 2 additions & 2 deletions app/views/skins/_skin_module.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<% if skin.official? %>
<p class="status approved">(<%= ts('Approved') %>)</p>
<% elsif skin.rejected? %>
<p class="status declined">(<%= ts('Declined:')%> <%= link_to_help 'skins-approval' %> <%= skin.admin_note %>)</p>
<p class="status declined">(<%= ts("Declined:") %> <%= skin.admin_note %>)</p>

Check failure on line 11 in app/views/skins/_skin_module.html.erb

View workflow job for this annotation

GitHub Actions / ERB Lint runner

[] reported by reviewdog 🐶 I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards Raw Output: app/views/skins/_skin_module.html.erb:11:38: I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards
<% elsif skin.public? %>
<p class="status unread">(<%= ts('Not yet reviewed') %>) <%= link_to_help 'skins-approval' %></p>
<p class="status unread">(<%= ts("Not yet reviewed") %>)</p>

Check failure on line 13 in app/views/skins/_skin_module.html.erb

View workflow job for this annotation

GitHub Actions / ERB Lint runner

[] reported by reviewdog 🐶 I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards Raw Output: app/views/skins/_skin_module.html.erb:13:36: I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards
<% end %>
<% end %>

Expand Down
4 changes: 2 additions & 2 deletions features/admins/admin_skins.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Feature: Admin manage skins
And I am logged in as a "superadmin" admin
When I follow "Approved Skins"
And I check "Cache"
Then I press "Update"
And I should see "The following skins were updated: public skin"
And I press "Update"
Then I should see "The following skins were updated: public skin"
When I follow "Approved Skins"
And I check "Uncache"
And I press "Update"
Expand Down
20 changes: 20 additions & 0 deletions features/other_b/skin_public.feature
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,23 @@ Feature: Public skins
And I press "unique skin"
Then the page should have the cached skin "unique skin"
And I should be on the works page

Scenario: A regular user can't apply to make a skin public
Given I am logged in
When I go to the new skin page
Then I should not see "Apply to make public"

Scenario: A user with the official role can apply to make a skin public
Given the user "SkinTeam" exists and has the role "official"
And I am logged in as "SkinTeam"
When I set up the skin "Skin We're Gonna Add"
And I attach a preview for the skin
And I check "Apply to make public"
And I submit
Then I should see "Skin was successfully created"

Scenario: Admins can't see the "Apply to make public" checkbox
Given the approved public skin "Usable Skin"
And I am logged in as a "superadmin" admin
When I edit the skin "Usable Skin"
Then I should not see "Apply to make public"
5 changes: 5 additions & 0 deletions features/step_definitions/skin_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
# creation dates, so that they will be listed in the right order:
step "it is currently 1 second from now"

step %{the user "skinner" exists and has the role "official"}
step %{I am logged in as "skinner"}
step %{I set up the skin "#{skin_name}" with css "#{css}"}
attach_file("skin_icon", "features/fixtures/skin_test_preview.png")
Expand Down Expand Up @@ -192,6 +193,10 @@
visit preview_skin_path(skin)
end

When "I attach a preview for the skin" do
attach_file("skin_icon", "features/fixtures/skin_test_preview.png")
end

### THEN

Then "I should see a parent skin text field" do
Expand Down
5 changes: 5 additions & 0 deletions features/step_definitions/user_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@
user.roles = [Role.find_or_create_by(name: "no_resets")]
end

Given "the user {string} has the official role" do |login|
user = User.find_by(login: login)
user.roles = [Role.find_or_create_by(name: "official")]
end

Given "the user {string} with the email {string} exists" do |login, email|
FactoryBot.create(:user, login: login, email: email)
end
Expand Down
7 changes: 7 additions & 0 deletions lib/tasks/skin_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,11 @@ namespace :skins do
Skin.where("id != ?", default_id).update_all(:official => false)
end

desc "Clear unofficial public skins"
task(clear_unofficial_public_skins: :environment) do
Skin.where(public: true, official: false).update_all(rejected: false, public: false)

puts "Finished clearing unofficial public skins."
$stdout.flush
end
end
11 changes: 0 additions & 11 deletions public/help/skins-approval.html

This file was deleted.

Loading
Loading