Skip to content

Commit

Permalink
AO3-6634 Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
sarken committed Apr 2, 2024
2 parents c9ce111 + cedf5b6 commit 6284209
Show file tree
Hide file tree
Showing 158 changed files with 2,203 additions and 1,080 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-latest
env:
BUNDLE_ONLY: linters
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -21,7 +23,7 @@ jobs:
bundler-cache: true

- name: rubocop
uses: reviewdog/action-rubocop@2f726ae5dd8df72b4faa9d93669cdab96aeb2153
uses: reviewdog/action-rubocop@2c8048e3169487eccc1eed812daaa6e5275a809f
with:
use_bundler: true
reporter: github-pr-check
Expand All @@ -30,6 +32,8 @@ jobs:
erb-lint:
name: ERB Lint runner
runs-on: ubuntu-latest
env:
BUNDLE_ONLY: linters
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
50 changes: 50 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require:
- rubocop-rails
- rubocop-rspec
- ./rubocop/rubocop

inherit_mode:
merge:
Expand All @@ -18,6 +19,10 @@ AllCops:
Bundler/OrderedGems:
Enabled: false

I18n/DeprecatedTranslationKey:
Rules:
name_with_colon: "Prefer `name` with `mailer.general.metadata_label_indicator` over `name_with_colon`"

Layout/DotPosition:
EnforcedStyle: leading

Expand Down Expand Up @@ -72,6 +77,51 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Enabled: false

Migration/LargeTableSchemaUpdate:
Tables:
- abuse_reports
- admin_activities
- audits
- bookmarks
- comments
- common_taggings
- collection_items
- collection_participants
- collection_profiles
- collections
- creatorships
- external_works
- favorite_tags
- feedbacks
- filter_counts
- filter_taggings
- gifts
- inbox_comments
- invitations
- kudos
- log_items
- mutes
- preferences
- profiles
- prompts
- pseuds
- readings
- set_taggings
- serial_works
- series
- skins
- stat_counters
- subscriptions
- tag_nominations
- tag_set_associations
- tags
- taggings
- users
- works

Rails/DefaultScope:
Enabled: true

Rails/DynamicFindBy:
AllowedMethods:
# Exception for Tag.find_by_name
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.5
ruby-3.1.4
10 changes: 9 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
source 'https://rubygems.org'

ruby "3.0.5"
ruby "3.1.4"

gem 'test-unit', '~> 3.2'

gem 'bundler'

gem "rails", "~> 6.1.7"

gem "rails-i18n"
gem "rack", "~> 2.2"
gem "sprockets", "< 4"
Expand Down Expand Up @@ -66,6 +67,10 @@ gem 'devise'
gem 'devise-async' # To mails through queues
gem 'bcrypt'

# Needed for modern ssh
gem "ed25519", ">= 1.2", "< 2.0"
gem "bcrypt_pbkdf", ">= 1.0", "< 2.0"

# A highly updated version of the authorization plugin
gem 'permit_yo'
gem "pundit"
Expand Down Expand Up @@ -116,6 +121,9 @@ gem "mimemagic", "0.3.10"
# Library for helping run pt-online-schema-change commands:
gem "departure", "~> 6.5"

# Ruby 3.1 means we need to specify a version of mail until we get to rails 7.x
gem "mail", ">= 2.8"

group :test do
gem "rspec-rails", "~> 4.0.1"
gem 'pickle'
Expand Down
30 changes: 25 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ GEM
backports (3.23.0)
base64 (0.2.0)
bcrypt (3.1.16)
bcrypt_pbkdf (1.1.0)
better_html (2.0.1)
actionview (>= 6.0)
activesupport (>= 6.0)
Expand Down Expand Up @@ -204,6 +205,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
departure (6.5.0)
activerecord (>= 5.2.0, < 7.1, != 7.0.0)
mysql2 (>= 0.4.0, <= 0.5.5)
Expand All @@ -221,6 +223,7 @@ GEM
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
ed25519 (1.3.0)
elasticsearch (7.17.1)
elasticsearch-api (= 7.17.1)
elasticsearch-transport (= 7.17.1)
Expand Down Expand Up @@ -326,8 +329,11 @@ GEM
loofah (2.19.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
mechanize (2.8.5)
Expand All @@ -348,7 +354,7 @@ GEM
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.1.2)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.17.0)
mono_logger (1.1.2)
Expand All @@ -363,10 +369,19 @@ GEM
net-http-digest_auth (1.4.1)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-sftp (3.0.0)
net-ssh (>= 5.0.0, < 7.0.0)
net-smtp (0.4.0)
net-protocol
net-ssh (6.1.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
Expand All @@ -378,8 +393,9 @@ GEM
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.23.0)
parser (3.1.0.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
permit_yo (2.1.3)
phraseapp-in-context-editor-ruby (1.4.0)
i18n (>= 0.6)
Expand Down Expand Up @@ -565,6 +581,7 @@ GEM
tilt (2.3.0)
timecop (0.9.4)
timeliness (0.4.4)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
Expand Down Expand Up @@ -617,6 +634,7 @@ DEPENDENCIES
awesome_print
aws-sdk-s3
bcrypt
bcrypt_pbkdf (>= 1.0, < 2.0)
brakeman
bullet (>= 5.7.3)
bundler
Expand All @@ -634,6 +652,7 @@ DEPENDENCIES
departure (~> 6.5)
devise
devise-async
ed25519 (>= 1.2, < 2.0)
elasticsearch (= 7.17.1)
email_spec (= 1.6.0)
erb_lint (= 0.4.0)
Expand All @@ -653,6 +672,7 @@ DEPENDENCIES
launchy
listen (~> 3.3)
lograge
mail (>= 2.8)
mechanize
mimemagic (= 0.3.10)
minitest
Expand Down Expand Up @@ -704,7 +724,7 @@ DEPENDENCIES
will_paginate (>= 3.0.2)

RUBY VERSION
ruby 3.0.5p211
ruby 3.1.4p223

BUNDLED WITH
2.2.33
2.3.26
23 changes: 12 additions & 11 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class HomeController < ApplicationController

before_action :users_only, only: [:first_login_help]
skip_before_action :store_location, only: [:first_login_help, :token_dispenser]

# unicorn_test
def unicorn_test
end
Expand All @@ -10,14 +11,14 @@ def unicorn_test
def tos
render action: "tos", layout: "application"
end

# terms of service faq
def tos_faq
def tos_faq
render action: "tos_faq", layout: "application"
end

# dmca policy
def dmca
def dmca
render action: "dmca", layout: "application"
end

Expand All @@ -32,28 +33,28 @@ def token_dispenser
format.json { render json: { token: form_authenticity_token } }
end
end

# diversity statement
def diversity
def diversity
render action: "diversity_statement", layout: "application"
end

# site map
def site_map
def site_map
render action: "site_map", layout: "application"
end

# donate
def donate
@page_subtitle = t(".page_title")
render action: "donate", layout: "application"
end

# about
def about
render action: "about", layout: "application"
end

def first_login_help
render action: "first_login_help", layout: false
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/related_works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def destroy
end
end
@related_work.destroy
redirect_back_or_default(user_related_works_path(current_user))
redirect_back(fallback_location: user_related_works_path(current_user))
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/series_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def index
# GET /series/1
# GET /series/1.xml
def show
@works = @series.works_in_order.posted.select(&:visible?)
@works = @series.works_in_order.posted.select(&:visible?).paginate(page: params[:page])

# sets the page title with the data for the series
@page_title = @series.unrevealed? ? ts("Mystery Series") : get_page_title(@series.allfandoms.collect(&:name).join(', '), @series.anonymous? ? ts("Anonymous") : @series.allpseuds.collect(&:byline).join(', '), @series.title)
Expand Down
8 changes: 5 additions & 3 deletions app/helpers/validation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ def error_messages_for(object)
end

def error_messages_formatted(errors, intro = "")
return unless errors && !errors.empty?
error_messages = errors.map { |msg| content_tag(:li, msg.gsub(/^(.*)\^/, '').html_safe) }.join("\n").html_safe
content_tag(:div, intro.html_safe + content_tag(:ul, error_messages), id:"error", class:"error")
return unless errors.present?

error_messages = errors.map { |msg| content_tag(:li, msg.gsub(/^(.*?)\^/, "").html_safe) }
.join("\n").html_safe
content_tag(:div, intro.html_safe + content_tag(:ul, error_messages), id: "error", class: "error")
end

# use to make sure we have consistent name throughout
Expand Down
2 changes: 1 addition & 1 deletion app/models/admin.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Admin < ApplicationRecord
VALID_ROLES = %w[superadmin board board_assistants_team communications elections translation tag_wrangling docs support policy_and_abuse open_doors].freeze
VALID_ROLES = %w[superadmin board board_assistants_team communications development_and_membership docs elections translation tag_wrangling support policy_and_abuse open_doors].freeze

serialize :roles, Array

Expand Down
2 changes: 0 additions & 2 deletions app/models/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class Collection < ApplicationRecord
path: %w(staging production).include?(Rails.env) ? ":class/:attachment/:id/:style.:extension" : ":rails_root/public:url",
storage: %w(staging production).include?(Rails.env) ? :s3 : :filesystem,
s3_protocol: "https",
s3_credentials: "#{Rails.root}/config/s3.yml",
bucket: %w(staging production).include?(Rails.env) ? YAML.load_file("#{Rails.root}/config/s3.yml")['bucket'] : "",
default_url: "/images/skins/iconsets/default/icon_collection.png"

validates_attachment_content_type :icon, content_type: /image\/\S+/, allow_nil: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def mark_unhidden!
end

def sanitized_content
sanitize_field self, :comment_content
sanitize_field(self, :comment_content, strip_images: ultimate_parent.is_a?(AdminPost))
end
include Responder
end
4 changes: 3 additions & 1 deletion app/models/feedback_reporters/abuse_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def subject
end

def ticket_description
description.present? ? description.html_safe : "No comment submitted."
return "No comment submitted." if description.blank?

strip_images(description.html_safe)
end
end
4 changes: 3 additions & 1 deletion app/models/feedback_reporters/support_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def subject
end

def ticket_description
description.present? ? description.html_safe : "No description submitted."
return "No description submitted." if description.blank?

strip_images(description.html_safe)
end
end
Loading

0 comments on commit 6284209

Please sign in to comment.