Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream changes up to 3205a654caf903002c2db872f802a3332201678b #2585

Merged
merged 29 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b19ae52
Add confirmation when redirecting logged-out requests to permalink (#…
Gargron Jan 24, 2024
41c2af2
chore(deps): update dependency rubocop to v1.60.1 (#28731)
renovate[bot] Jan 24, 2024
1290fed
Fix `Rails/WhereExists` cop in app/lib (#28862)
mjankowski Jan 24, 2024
5a838ce
Use active variants for boost icons and increase icon size (#27924)
ClearlyClaire Jan 24, 2024
64993d3
chore(deps): update dependency haml_lint to v0.55.0 (#28856)
renovate[bot] Jan 24, 2024
ea5397c
chore(deps): update dependency selenium-webdriver to v4.17.0 (#28858)
renovate[bot] Jan 24, 2024
559bbf0
chore(deps): update artifact actions (major) to v4 (major) (#28415)
renovate[bot] Jan 24, 2024
7019af4
fix(deps): update dependency dotenv to v16.4.0 (#28872)
renovate[bot] Jan 24, 2024
9c5be13
chore(deps): update dependency chewy to v7.5.0 (#28730)
renovate[bot] Jan 24, 2024
38f7f8b
Tidy up association declaration in `Instance` model (#28880)
mjankowski Jan 24, 2024
9a8293f
Fix process of receiving posts with bearcaps is not working (#26527)
kmycode Jan 25, 2024
c50274a
Fix redirect confirmation for accounts (#28902)
ClearlyClaire Jan 25, 2024
0471a78
Add tests for redirect confirmations (#28903)
ClearlyClaire Jan 25, 2024
087415d
Add tests for processing statuses using bearcap URIs (#28904)
ClearlyClaire Jan 25, 2024
d158f7e
chore(deps): update dependency rspec-rails to v6.1.1 (#28905)
renovate[bot] Jan 25, 2024
1a565e4
fix(deps): update dependency axios to v1.6.6 (#28895)
renovate[bot] Jan 25, 2024
7c9c6c7
Fix remaining `Rails/WhereExists` cop violations, regenerate todo (#2…
mjankowski Jan 25, 2024
a69506a
fix(deps): update dependency dotenv to v16.4.1 (#28889)
renovate[bot] Jan 25, 2024
6b6586f
Add `CustomFilterKeyword#to_regex` method (#28893)
mjankowski Jan 25, 2024
59d2ea0
New Crowdin Translations (automated) (#28899)
github-actions[bot] Jan 25, 2024
ca7053f
Consolidate db test prep steps to rake task (#28886)
mjankowski Jan 25, 2024
c8f59d2
Fix `Style/TernaryParentheses` cop (#28387)
mjankowski Jan 25, 2024
2866106
Reduce factory creation in `spec/models/account_statuses_cleanup_poli…
mjankowski Jan 25, 2024
274a48a
Extract helper methods for db connection and table existence check in…
mjankowski Jan 25, 2024
3205a65
Refactor conversations components in web UI (#28833)
Gargron Jan 25, 2024
5fa2821
Merge commit '3205a654caf903002c2db872f802a3332201678b' into glitch-s…
ClearlyClaire Jan 26, 2024
e5f5047
[Glitch] Add confirmation when redirecting logged-out requests to per…
Gargron Jan 24, 2024
54ece50
[Glitch] Use active variants for boost icons and increase icon size
ClearlyClaire Jan 24, 2024
dd7a669
Fix CSS loading in redirect controller
ClearlyClaire Jan 26, 2024
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
19 changes: 2 additions & 17 deletions .github/workflows/test-migrations-one-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,8 @@ jobs:
- name: Create database
run: './bin/rails db:create'

- name: Run migrations up to v2.0.0
run: './bin/rails db:migrate VERSION=20171010025614'

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2'

- name: Run migrations up to v2.4.0
run: './bin/rails db:migrate VERSION=20180514140000'

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2_4'

- name: Run migrations up to v2.4.3
run: './bin/rails db:migrate VERSION=20180707154237'

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2_4_3'
- name: Run historical migrations with data population
run: './bin/rails tests:migrations:prepare_database'

- name: Run all remaining migrations
run: './bin/rails db:migrate'
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/test-migrations-two-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
--health-retries 5
ports:
- 5432:5432

redis:
image: redis:7-alpine
options: >-
Expand Down Expand Up @@ -77,28 +78,11 @@ jobs:
- name: Create database
run: './bin/rails db:create'

- name: Run migrations up to v2.0.0
run: './bin/rails db:migrate VERSION=20171010025614'

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2'

- name: Run pre-deployment migrations up to v2.4.0
run: './bin/rails db:migrate VERSION=20180514140000'
env:
SKIP_POST_DEPLOYMENT_MIGRATIONS: true

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2_4'

- name: Run migrations up to v2.4.3
run: './bin/rails db:migrate VERSION=20180707154237'
- name: Run historical migrations with data population
run: './bin/rails tests:migrations:prepare_database'
env:
SKIP_POST_DEPLOYMENT_MIGRATIONS: true

- name: Populate database with test data
run: './bin/rails tests:migrations:populate_v2_4_3'

- name: Run all remaining pre-deployment migrations
run: './bin/rails db:migrate'
env:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
tar --exclude={"*.br","*.gz"} -zcf artifacts.tar.gz public/assets public/packs*

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: matrix.mode == 'test'
with:
path: |-
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: './'
name: ${{ github.sha }}
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: './public'
name: ${{ github.sha }}
Expand All @@ -213,14 +213,14 @@ jobs:
- run: bundle exec rake spec:system

- name: Archive logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-logs-${{ matrix.ruby-version }}
path: log/

- name: Archive test screenshots
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-screenshots
Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: './public'
name: ${{ github.sha }}
Expand All @@ -317,14 +317,14 @@ jobs:
- run: bin/rspec --tag search

- name: Archive logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-search-logs-${{ matrix.ruby-version }}
path: log/

- name: Archive test screenshots
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-search-screenshots
Expand Down
28 changes: 1 addition & 27 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.59.0.
# using RuboCop version 1.60.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -70,25 +70,6 @@ Rails/UniqueValidationWithoutIndex:
- 'app/models/identity.rb'
- 'app/models/webauthn_credential.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: exists, where
Rails/WhereExists:
Exclude:
- 'app/controllers/activitypub/inboxes_controller.rb'
- 'app/controllers/admin/email_domain_blocks_controller.rb'
- 'app/lib/activitypub/activity/create.rb'
- 'app/lib/delivery_failure_tracker.rb'
- 'app/lib/feed_manager.rb'
- 'app/lib/suspicious_sign_in_detector.rb'
- 'app/policies/status_policy.rb'
- 'app/serializers/rest/announcement_serializer.rb'
- 'app/workers/move_worker.rb'
- 'spec/models/account_spec.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/services/purge_domain_service_spec.rb'
- 'spec/services/unallow_domain_service_spec.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods, AllowedPatterns.
# AllowedMethods: ==, equal?, eql?
Expand Down Expand Up @@ -298,13 +279,6 @@ Style/StringLiterals:
- 'config/initializers/webauthn.rb'
- 'config/routes.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'config/environments/development.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Expand Down
21 changes: 11 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ GEM
activesupport
cbor (0.5.9.6)
charlock_holmes (0.7.7)
chewy (7.4.0)
chewy (7.5.0)
activesupport (>= 5.2)
elasticsearch (>= 7.12.0, < 7.14.0)
elasticsearch-dsl
Expand Down Expand Up @@ -319,7 +319,7 @@ GEM
activesupport (>= 5.1)
haml (>= 4.0.6)
railties (>= 5.1)
haml_lint (0.53.0)
haml_lint (0.55.0)
haml (>= 5.0)
parallel (~> 1.10)
rainbow
Expand Down Expand Up @@ -360,7 +360,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
io-console (0.7.1)
io-console (0.7.2)
irb (1.11.1)
rdoc
reline (>= 0.4.2)
Expand Down Expand Up @@ -445,7 +445,7 @@ GEM
mime-types-data (3.2023.1205)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
minitest (5.21.2)
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.3.0)
Expand Down Expand Up @@ -504,7 +504,7 @@ GEM
orm_adapter (0.5.0)
ox (2.14.17)
parallel (1.24.0)
parser (3.2.2.4)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
parslet (2.0.0)
Expand Down Expand Up @@ -610,7 +610,7 @@ GEM
redis (>= 4)
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.8.3)
regexp_parser (2.9.0)
reline (0.4.2)
io-console (~> 0.5)
request_store (1.5.1)
Expand All @@ -636,7 +636,7 @@ GEM
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.1.0)
rspec-rails (6.1.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand All @@ -650,11 +650,11 @@ GEM
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.12.1)
rubocop (1.59.0)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
Expand Down Expand Up @@ -696,7 +696,8 @@ GEM
scenic (1.7.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
selenium-webdriver (4.16.0)
selenium-webdriver (4.17.0)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activitypub/inboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def skip_unknown_actor_activity

def unknown_affected_account?
json = Oj.load(body, mode: :strict)
json.is_a?(Hash) && %w(Delete Update).include?(json['type']) && json['actor'].present? && json['actor'] == value_or_id(json['object']) && !Account.where(uri: json['actor']).exists?
json.is_a?(Hash) && %w(Delete Update).include?(json['type']) && json['actor'].present? && json['actor'] == value_or_id(json['object']) && !Account.exists?(uri: json['actor'])
rescue Oj::ParseError
false
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/email_domain_blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create
log_action :create, @email_domain_block

(@email_domain_block.other_domains || []).uniq.each do |domain|
next if EmailDomainBlock.where(domain: domain).exists?
next if EmailDomainBlock.exists?(domain: domain)

other_email_domain_block = EmailDomainBlock.create!(domain: domain, allow_with_approval: @email_domain_block.allow_with_approval, parent: @email_domain_block)
log_action :create, other_email_domain_block
Expand Down
15 changes: 12 additions & 3 deletions app/controllers/concerns/web_app_controller_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@
def redirect_unauthenticated_to_permalinks!
return if user_signed_in? # NOTE: Different from upstream because we allow moved users to log in

redirect_path = PermalinkRedirector.new(request.path).redirect_path
return if redirect_path.blank?
permalink_redirector = PermalinkRedirector.new(request.path)
return if permalink_redirector.redirect_path.blank?

expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
redirect_to(redirect_path)

respond_to do |format|
format.html do
redirect_to(permalink_redirector.redirect_confirmation_path, allow_other_host: false)
end

format.json do
redirect_to(permalink_redirector.redirect_uri, allow_other_host: true)
Dismissed Show dismissed Hide dismissed
end
end
end

def set_pack
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/redirect/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

class Redirect::AccountsController < Redirect::BaseController
private

def set_resource
@resource = Account.find(params[:id])
not_found if @resource.local?
end
end
29 changes: 29 additions & 0 deletions app/controllers/redirect/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

class Redirect::BaseController < ApplicationController
vary_by 'Accept-Language'

before_action :set_pack
before_action :set_resource
before_action :set_app_body_class

def show
@redirect_path = ActivityPub::TagManager.instance.url_for(@resource)

render 'redirects/show', layout: 'application'
end

private

def set_app_body_class
@body_classes = 'app-body'
end

def set_resource
raise NotImplementedError
end

def set_pack
use_pack 'public'
end
end
10 changes: 10 additions & 0 deletions app/controllers/redirect/statuses_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

class Redirect::StatusesController < Redirect::BaseController
private

def set_resource
@resource = Status.find(params[:id])
not_found if @resource.local? || !@resource.distributable?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import ReplyAllIcon from '@/material-icons/400-24px/reply_all.svg?react';
import StarIcon from '@/material-icons/400-24px/star-fill.svg?react';
import StarBorderIcon from '@/material-icons/400-24px/star.svg?react';
import VisibilityIcon from '@/material-icons/400-24px/visibility.svg?react';
import RepeatActiveIcon from '@/svg-icons/repeat_active.svg?react';
import RepeatDisabledIcon from '@/svg-icons/repeat_disabled.svg';
import RepeatPrivateIcon from '@/svg-icons/repeat_private.svg';
import RepeatPrivateActiveIcon from '@/svg-icons/repeat_private_active.svg?react';
import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions';
import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links';
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
Expand Down Expand Up @@ -303,7 +305,7 @@ class StatusActionBar extends ImmutablePureComponent {

if (status.get('reblogged')) {
reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
reblogIconComponent = publicStatus ? RepeatIcon : RepeatPrivateIcon;
reblogIconComponent = publicStatus ? RepeatActiveIcon : RepeatPrivateActiveIcon;
} else if (publicStatus) {
reblogTitle = intl.formatMessage(messages.reblog);
reblogIconComponent = RepeatIcon;
Expand Down
Loading
Loading