Skip to content

Commit

Permalink
Merge remote-tracking branch 'parent/main' into upstream-20240326
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Mar 26, 2024
2 parents 95ab1f7 + 0cea7a6 commit 6c9b221
Show file tree
Hide file tree
Showing 263 changed files with 4,637 additions and 1,527 deletions.
4 changes: 3 additions & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[production]
defaults
not IE 11
> 0.2%
ios >= 15.6
not dead
not OperaMini all

[development]
supports es6-module
16 changes: 16 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@
],
groupName: null, // We dont want them to belong to any group
},
{
// Group all RuboCop packages with `rubocop` in the same PR
matchManagers: ['bundler'],
matchPackageNames: ['rubocop'],
matchPackagePrefixes: ['rubocop-'],
matchUpdateTypes: ['patch', 'minor'],
groupName: 'RuboCop (non-major)',
},
{
// Group all RSpec packages with `rspec` in the same PR
matchManagers: ['bundler'],
matchPackageNames: ['rspec'],
matchPackagePrefixes: ['rspec-'],
matchUpdateTypes: ['patch', 'minor'],
groupName: 'RSpec (non-major)',
},
// Add labels depending on package manager
{ matchManagers: ['npm', 'nvm'], addLabels: ['javascript'] },
{ matchManagers: ['bundler', 'ruby-version'], addLabels: ['ruby'] },
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
- '3.0'
- '3.1'
- '.ruby-version'
- '3.3'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -191,6 +192,7 @@ jobs:
- '3.0'
- '3.1'
- '.ruby-version'
- '3.3'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -277,6 +279,7 @@ jobs:
- '3.0'
- '3.1'
- '.ruby-version'
- '3.3'
search-image:
- docker.elastic.co/elasticsearch/elasticsearch:7.17.13
include:
Expand Down
4 changes: 2 additions & 2 deletions .haml-lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
inherits_from: .haml-lint_todo.yml

exclude:
- 'vendor/**/*'
- lib/templates/haml/scaffold/_form.html.haml
Expand All @@ -14,3 +12,5 @@ linters:
enabled: true
LineLength:
max: 320
ViewLength:
max: 200 # Override default value of 100 inherited from rubocop
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ gem 'htmlentities', '~> 4.3'
gem 'http', '~> 5.1'
gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 1.6.2'
gem 'i18n', '1.14.1' # TODO: Remove version when resolved: https://github.com/glebm/i18n-tasks/issues/552 / https://github.com/ruby-i18n/i18n/pull/688
gem 'idn-ruby', require: 'idn'
gem 'inline_svg'
gem 'kaminari', '~> 1.2'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.5.0', require: 'mime/types/columnar'
Expand Down Expand Up @@ -88,7 +90,7 @@ gem 'sidekiq-bulk', '~> 0.2.0'
gem 'simple-navigation', '~> 4.4'
gem 'simple_form', '~> 5.2'
gem 'stoplight', '~> 3.0.1'
gem 'strong_migrations', '1.7.0'
gem 'strong_migrations', '1.8.0'
gem 'tty-prompt', '~> 0.23', require: false
gem 'twitter-text', '~> 3.1.0'
gem 'tzinfo-data', '~> 1.2023'
Expand Down
54 changes: 29 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.6)
bigdecimal (3.1.7)
bindata (2.4.15)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -213,7 +213,7 @@ GEM
devise_pam_authenticatable2 (9.2.0)
devise (>= 4.0.0)
rpam2 (~> 4.0)
diff-lcs (1.5.0)
diff-lcs (1.5.1)
discard (1.3.0)
activerecord (>= 4.2, < 8)
docile (1.4.0)
Expand All @@ -225,8 +225,7 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
ed25519 (1.3.0)
elasticsearch (7.13.3)
elasticsearch-api (= 7.13.3)
Expand Down Expand Up @@ -350,6 +349,9 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
inline_svg (1.9.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
irb (1.12.0)
rdoc
Expand Down Expand Up @@ -435,7 +437,7 @@ GEM
mime-types-data (3.2023.1205)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.21.2)
minitest (5.22.3)
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.3.0)
Expand Down Expand Up @@ -497,7 +499,7 @@ GEM
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
orm_adapter (0.5.0)
ox (2.14.17)
ox (2.14.18)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -532,7 +534,7 @@ GEM
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-cors (2.0.2)
Expand Down Expand Up @@ -580,7 +582,7 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails-i18n (7.0.8)
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.3.2)
Expand All @@ -598,7 +600,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.7.0)
rdf (~> 3.3)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (4.8.1)
Expand Down Expand Up @@ -632,14 +634,14 @@ GEM
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.1)
rspec-rails (6.1.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-sidekiq (4.1.0)
Expand All @@ -648,32 +650,32 @@ GEM
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.13.1)
rubocop (1.60.2)
rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.0)
rubocop (~> 1.33)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
rubocop-rails (2.24.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.26.1)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.27.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
Expand Down Expand Up @@ -734,7 +736,7 @@ GEM
stoplight (3.0.2)
redlock (~> 1.0)
stringio (3.1.0)
strong_migrations (1.7.0)
strong_migrations (1.8.0)
activerecord (>= 5.2)
swd (1.3.0)
activesupport (>= 3)
Expand Down Expand Up @@ -865,8 +867,10 @@ DEPENDENCIES
http (~> 5.1)
http_accept_language (~> 2.1)
httplog (~> 1.6.2)
i18n (= 1.14.1)
i18n-tasks (~> 1.0)
idn-ruby
inline_svg
irb (~> 1.8)
json-ld
json-ld-preloaded (~> 3.2)
Expand Down Expand Up @@ -939,7 +943,7 @@ DEPENDENCIES
simplecov-lcov (~> 0.8)
stackprof
stoplight (~> 3.0.1)
strong_migrations (= 1.7.0)
strong_migrations (= 1.8.0)
test-prof
thor (~> 1.2)
tty-prompt (~> 0.23)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def remove_header
def unblock_email
authorize @account, :unblock_email?

CanonicalEmailBlock.where(reference_account: @account).delete_all
CanonicalEmailBlock.matching_account(@account).delete_all

log_action :unblock_email, @account

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def index
private

def set_recently_used_tags
@recently_used_tags = Tag.recently_used(current_account).where.not(id: current_account.featured_tags).limit(10)
@recently_used_tags = Tag.recently_used(current_account).where.not(id: featured_tag_ids).limit(10)
end

def featured_tag_ids
current_account.featured_tags.pluck(:tag_id)
end
end
61 changes: 61 additions & 0 deletions app/controllers/severed_relationships_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true

class SeveredRelationshipsController < ApplicationController
layout 'admin'

before_action :authenticate_user!
before_action :set_body_classes
before_action :set_cache_headers

before_action :set_event, only: [:following, :followers]

def index
@events = AccountRelationshipSeveranceEvent.where(account: current_account)
end

def following
respond_to do |format|
format.csv { send_data following_data, filename: "following-#{@event.target_name}-#{@event.created_at.to_date.iso8601}.csv" }
end
end

def followers
respond_to do |format|
format.csv { send_data followers_data, filename: "followers-#{@event.target_name}-#{@event.created_at.to_date.iso8601}.csv" }
end
end

private

def set_event
@event = AccountRelationshipSeveranceEvent.find(params[:id])
end

def following_data
CSV.generate(headers: ['Account address', 'Show boosts', 'Notify on new posts', 'Languages'], write_headers: true) do |csv|
@event.severed_relationships.active.about_local_account(current_account).includes(:remote_account).reorder(id: :desc).each do |follow|
csv << [acct(follow.target_account), follow.show_reblogs, follow.notify, follow.languages&.join(', ')]
end
end
end

def followers_data
CSV.generate(headers: ['Account address'], write_headers: true) do |csv|
@event.severed_relationships.passive.about_local_account(current_account).includes(:remote_account).reorder(id: :desc).each do |follow|
csv << [acct(follow.account)]
end
end
end

def acct(account)
account.local? ? account.local_username_and_domain : account.acct
end

def set_body_classes
@body_classes = 'admin'
end

def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fa_icon(icon, attributes = {})
end

def check_icon
content_tag(:svg, tag.path('fill-rule': 'evenodd', 'clip-rule': 'evenodd', d: 'M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z'), xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 20 20', fill: 'currentColor')
inline_svg_tag 'check.svg'
end

def visibility_icon(status)
Expand Down
11 changes: 0 additions & 11 deletions app/helpers/branding_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,4 @@ def _logo_as_symbol_icon
def render_logo
image_pack_tag('logo.svg', alt: 'Mastodon', class: 'logo logo--icon')
end

def render_symbol(version = :icon)
path = case version
when :icon
'logo-symbol-icon.svg'
when :wordmark
'logo-symbol-wordmark.svg'
end

render(file: Rails.root.join('app', 'javascript', 'images', path)).html_safe # rubocop:disable Rails/OutputSafety
end
end
13 changes: 11 additions & 2 deletions app/helpers/context_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ module ContextHelper
keywords: { 'schema' => 'http://schema.org#', 'keywords' => 'schema:keywords' },
license: { 'schema' => 'http://schema.org#', 'license' => 'schema:license' },
olm: {
'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId',
'toot' => 'http://joinmastodon.org/ns#',
'Device' => 'toot:Device',
'Ed25519Signature' => 'toot:Ed25519Signature',
'Ed25519Key' => 'toot:Ed25519Key',
'Curve25519Key' => 'toot:Curve25519Key',
'EncryptedMessage' => 'toot:EncryptedMessage',
'publicKeyBase64' => 'toot:publicKeyBase64',
'deviceId' => 'toot:deviceId',
'claim' => { '@type' => '@id', '@id' => 'toot:claim' },
'fingerprintKey' => { '@type' => '@id', '@id' => 'toot:fingerprintKey' },
'identityKey' => { '@type' => '@id', '@id' => 'toot:identityKey' },
'devices' => { '@type' => '@id', '@id' => 'toot:devices' },
'messageFranking' => 'toot:messageFranking', 'messageType' => 'toot:messageType', 'cipherText' => 'toot:cipherText'
'messageFranking' => 'toot:messageFranking',
'messageType' => 'toot:messageType',
'cipherText' => 'toot:cipherText',
},
suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' },
}.freeze
Expand Down
Loading

0 comments on commit 6c9b221

Please sign in to comment.