Skip to content

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjaustin committed Apr 6, 2024
2 parents a5579e2 + 139b76b commit 2411569
Show file tree
Hide file tree
Showing 235 changed files with 4,046 additions and 1,806 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@32686543011497c256009cce0c94b73a8179cbdb
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.idea
stdout
*~
.vscode/
# /
/*.tmproj
/sphinx
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
12 changes: 10 additions & 2 deletions 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 @@ -115,6 +120,9 @@ gem "marcel", "1.0.2"
# 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 All @@ -126,7 +134,7 @@ group :test do
gem 'capybara-screenshot'
gem 'cucumber-rails', require: false
gem 'launchy' # So you can do Then show me the page
gem 'delorean'

# Record and replay data from external URLs
gem 'vcr', '~> 3.0', '>= 3.0.1'
gem "webmock"
Expand Down
26 changes: 21 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,8 +205,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
delorean (2.1.0)
chronic
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 @@ -223,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 @@ -328,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 Down Expand Up @@ -362,10 +366,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.5.0)
net-protocol
net-ssh (6.1.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
Expand Down Expand Up @@ -564,6 +577,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 @@ -616,6 +630,7 @@ DEPENDENCIES
awesome_print
aws-sdk-s3
bcrypt
bcrypt_pbkdf (>= 1.0, < 2.0)
brakeman
bullet (>= 5.7.3)
bundler
Expand All @@ -630,10 +645,10 @@ DEPENDENCIES
cucumber-timecop
dalli
database_cleaner
delorean
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 +668,7 @@ DEPENDENCIES
launchy
listen (~> 3.3)
lograge
mail (>= 2.8)
marcel (= 1.0.2)
mechanize
minitest
Expand Down Expand Up @@ -704,7 +720,7 @@ DEPENDENCIES
will_paginate (>= 3.0.2)

RUBY VERSION
ruby 3.0.5p211
ruby 3.1.4p223

BUNDLED WITH
2.2.33
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ There is currently no API for the OTW-Archive software. While it is something we

License and Acknowledgments
----------
The Archive code is licensed under [GPL](https://www.gnu.org/licenses/gpl-2.0.html) by the [Organization for Transformative Works](https://www.transformativeworks.org/).
The Archive code is licensed under [GPL-2.0-or-later](https://www.gnu.org/licenses/gpl-2.0.html) by the [Organization for Transformative Works](https://www.transformativeworks.org/).

We benefit from software and services that are free to use for Open Source projects, including:

Expand Down
7 changes: 5 additions & 2 deletions app/controllers/admin/spam_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::SpamController < Admin::BaseController

def index
authorize ModeratedWork

Expand All @@ -11,7 +10,11 @@ def index
else
{ reviewed: false, approved: false }
end
@works = ModeratedWork.where(conditions).order(:created_at).page(params[:page])
@works = ModeratedWork.where(conditions)
.joins(:work)
.includes(:work)
.order(:created_at)
.page(params[:page])
end

def bulk_update
Expand Down
11 changes: 0 additions & 11 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ def redirect_to(*args, **kwargs)
end
end

# Migrates session cookies from encrypted to signed format
before_action :migrate_session_cookie_20231230
def migrate_session_cookie_20231230
# If the request contains a valid encrypted session cookie, it means the
# session hasn't yet been migrated to a signed cookie, so we update the
# session with the contents of the encrypted cookie.
if cookies.encrypted[:_otwarchive_session].present?
session.update(cookies.encrypted[:_otwarchive_session])
end
end

after_action :ensure_admin_credentials
def ensure_admin_credentials
if logged_in_as_admin?
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/archive_faqs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ def default_url_options
def set_locale
session[:language_id] = params[:language_id] if Locale.exists?(iso: params[:language_id])

if current_user.present? && $rollout.active?(:set_locale_preference,
current_user)
@i18n_locale = session[:language_id].presence || Locale.find(current_user.preference.preferred_locale).iso
if current_user.present?
@i18n_locale = session[:language_id].presence || current_user.preference.locale.iso
else
@i18n_locale = session[:language_id].presence || I18n.default_locale
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/bookmarks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def search
def index
if @bookmarkable
access_denied unless is_admin? || @bookmarkable.visible?
@bookmarks = @bookmarkable.bookmarks.is_public.paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
@bookmarks = @bookmarkable.bookmarks.is_public.order_by_created_at.paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
else
base_options = {
show_private: (@user.present? && @user == current_user),
Expand Down Expand Up @@ -286,7 +286,7 @@ def fetch_recent
@bookmarkable = @bookmark.bookmarkable
respond_to do |format|
format.js {
@bookmarks = @bookmarkable.bookmarks.visible.order("created_at DESC").offset(1).limit(4)
@bookmarks = @bookmarkable.bookmarks.order_by_created_at.visible.offset(1).limit(4)
set_own_bookmarks
}
format.html do
Expand Down
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
Loading

0 comments on commit 2411569

Please sign in to comment.