Skip to content

Commit

Permalink
Merge commit 'c91c0175db1cc8b954a977d29472886234ce9586' into glitch-s…
Browse files Browse the repository at this point in the history
…oc/merge-upstream

Conflicts:
- `spec/controllers/api/v1/timelines/tag_controller_spec.rb`:
  Glitch-soc had a few extra lines in this file to account for a different
  default setting. This file got replaced by
  `spec/requests/api/v1/timelines/tag_spec.rb`, into which the glitch-soc
  additions were moved too.

Additional changes:
- `spec/requests/api/v1/statuses/sources_spec.rb`:
  Add glitch-soc-only attribute `content_type`.
  • Loading branch information
ClearlyClaire committed Oct 17, 2023
2 parents 656a41d + c91c017 commit b867d45
Show file tree
Hide file tree
Showing 89 changed files with 1,735 additions and 2,166 deletions.
3 changes: 0 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ RSpec/LetSetup:
- 'spec/controllers/admin/reports/actions_controller_spec.rb'
- 'spec/controllers/admin/statuses_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
- 'spec/controllers/api/v1/admin/accounts_controller_spec.rb'
- 'spec/controllers/api/v1/filters_controller_spec.rb'
- 'spec/controllers/api/v1/followed_tags_controller_spec.rb'
- 'spec/controllers/api/v2/admin/accounts_controller_spec.rb'
- 'spec/controllers/api/v2/filters/keywords_controller_spec.rb'
- 'spec/controllers/api/v2/filters/statuses_controller_spec.rb'
Expand Down Expand Up @@ -418,7 +416,6 @@ Rails/SkipsModelValidations:
- 'lib/mastodon/cli/accounts.rb'
- 'lib/mastodon/cli/main.rb'
- 'lib/mastodon/cli/maintenance.rb'
- 'spec/controllers/api/v1/admin/accounts_controller_spec.rb'
- 'spec/lib/activitypub/activity/follow_spec.rb'
- 'spec/services/follow_service_spec.rb'
- 'spec/services/update_account_service_spec.rb'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GEM
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
better_html (2.0.1)
better_html (2.0.2)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
Expand Down Expand Up @@ -345,14 +345,14 @@ GEM
rainbow (>= 2.0.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.12)
i18n-tasks (1.0.13)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
better_html (>= 1.0, < 3.0)
erubi
highline (>= 2.0.0)
i18n
parser (>= 2.2.3.0)
parser (>= 3.2.2.1)
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
Expand Down Expand Up @@ -561,7 +561,7 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails-i18n (7.0.7)
rails-i18n (7.0.8)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.0.8)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@
"sign_in_banner.create_account": "Sortu kontua",
"sign_in_banner.sign_in": "Hasi saioa",
"sign_in_banner.sso_redirect": "Hasi saioa edo izena eman",
"sign_in_banner.text": "Hasi saioa profilak edo traolak jarraitzeko, bidalketak gogokoetara gehitzeko, partekatzeko edo erantzuteko. Zure kontutik ere komunika zaitezke beste zerbitzari ezberdin vatean.",
"sign_in_banner.text": "Hasi saioa profilak edo traolak jarraitzeko, bidalketak gogokoetara gehitzeko, partekatzeko edo erantzuteko. Zure kontutik ere komunika zaitezke beste zerbitzari ezberdin batean.",
"status.admin_account": "Ireki @{name} erabiltzailearen moderazio interfazea",
"status.admin_domain": "{domain}-(r)en moderazio-interfazea ireki",
"status.admin_status": "Ireki bidalketa hau moderazio interfazean",
Expand Down
16 changes: 8 additions & 8 deletions app/javascript/mastodon/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"account.unmute_notifications_short": "Poista ilmoitusten mykistys",
"account.unmute_short": "Poista mykistys",
"account_note.placeholder": "Lisää muistiinpano napsauttamalla",
"admin.dashboard.daily_retention": "Käyttäjän säilyminen rekisteröitymisen jälkeiseen päivään mennessä",
"admin.dashboard.monthly_retention": "Käyttäjän säilyminen rekisteröitymisen jälkeiseen kuukauteen mennessä",
"admin.dashboard.daily_retention": "Käyttäjän pysyminen rekisteröitymisen jälkeiseen päivään mennessä",
"admin.dashboard.monthly_retention": "Käyttäjän pysyminen rekisteröitymisen jälkeiseen kuukauteen mennessä",
"admin.dashboard.retention.average": "Keskimäärin",
"admin.dashboard.retention.cohort": "Kirjautumiset",
"admin.dashboard.retention.cohort_size": "Uudet käyttäjät",
Expand Down Expand Up @@ -101,7 +101,7 @@
"bundle_modal_error.close": "Sulje",
"bundle_modal_error.message": "Jotain meni pieleen komponenttia ladattaessa.",
"bundle_modal_error.retry": "Yritä uudelleen",
"closed_registrations.other_server_instructions": "Koska Mastodon on hajautettu, voit luoda tilin toiselle palvelimelle ja silti olla vuorovaikutuksessa tämän kanssa.",
"closed_registrations.other_server_instructions": "Koska Mastodon on hajautettu, voit luoda tilin toiselle palvelimelle ja olla silti vuorovaikutuksessa tämän kanssa.",
"closed_registrations_modal.description": "Tilin luonti palveluun {domain} ei tällä hetkellä ole mahdollista, mutta huomioi, ettei Mastodonin käyttö edellytä juuri kyseisen palvelun tiliä.",
"closed_registrations_modal.find_another_server": "Etsi toinen palvelin",
"closed_registrations_modal.preamble": "Mastodon on hajautettu, joten riippumatta siitä, missä luot tilisi, voit seurata ja olla vuorovaikutuksessa kenen tahansa kanssa tällä palvelimella. Voit jopa isännöidä palvelinta!",
Expand Down Expand Up @@ -154,9 +154,9 @@
"compose_form.publish_form": "Uusi julkaisu",
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Tallenna muutokset",
"compose_form.sensitive.hide": "{count, plural, one {Merkitse media arkaluontoiseksi} other {Merkitse mediat arkaluontoiseksi}}",
"compose_form.sensitive.marked": "{count, plural, one {Media on merkitty arkaluontoiseksi} other {Mediat on merkitty arkaluontoiseksi}}",
"compose_form.sensitive.unmarked": "{count, plural, one {Mediaa ei ole merkitty arkaluontoiseksi} other {Medioja ei ole merkitty arkaluontoiseksi}}",
"compose_form.sensitive.hide": "{count, plural, one {Merkitse media arkaluonteiseksi} other {Merkitse mediat arkaluonteisiksi}}",
"compose_form.sensitive.marked": "{count, plural, one {Media on merkitty arkaluonteiseksi} other {Mediat on merkitty arkaluonteisiksi}}",
"compose_form.sensitive.unmarked": "{count, plural, one {Mediaa ei ole merkitty arkaluonteiseksi} other {Medioita ei ole merkitty arkaluonteisiksi}}",
"compose_form.spoiler.marked": "Poista sisältövaroitus",
"compose_form.spoiler.unmarked": "Lisää sisältövaroitus",
"compose_form.spoiler_placeholder": "Kirjoita varoituksesi tähän",
Expand Down Expand Up @@ -592,7 +592,7 @@
"search.search_or_paste": "Hae tai kirjoita URL-osoite",
"search_popout.full_text_search_disabled_message": "Ei saatavilla palvelimella {domain}.",
"search_popout.language_code": "ISO-kielikoodi",
"search_popout.options": "Haun asetukset",
"search_popout.options": "Hakuvalinnat",
"search_popout.quick_actions": "Pikatoiminnot",
"search_popout.recent": "Viimeaikaiset haut",
"search_popout.specific_date": "tietty päivämäärä",
Expand Down Expand Up @@ -686,7 +686,7 @@
"timeline_hint.resources.followers": "Seuraajat",
"timeline_hint.resources.follows": "seurattua",
"timeline_hint.resources.statuses": "Vanhemmat julkaisut",
"trends.counter_by_accounts": "{count, plural, one {{counter} henkilö} other {{counter} henkilöä}} {days, plural, one {viimeisen päivän} other {viimeisten {days} päivän}} aikana",
"trends.counter_by_accounts": "{count, plural, one {{counter} henkilö} other {{counter} henkilöä}} {days, plural, one {viime päivänä} other {viimeisenä {days} päivänä}}",
"trends.trending_now": "Suosittua nyt",
"ui.beforeunload": "Luonnos häviää, jos poistut Mastodonista.",
"units.short.billion": "{count} mrd.",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"account.locked_info": "このアカウントは承認制アカウントです。相手が承認するまでフォローは完了しません。",
"account.media": "メディア",
"account.mention": "@{name}さんにメンション",
"account.moved_to": "{name}さんがアカウントを引っ越しました:",
"account.moved_to": "{name}さんはこちらのアカウントに引っ越しました:",
"account.mute": "@{name}さんをミュート",
"account.mute_notifications_short": "通知をオフにする",
"account.mute_short": "ミュート",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"account.requested_follow": "{name} ti poslal žiadosť na sledovanie",
"account.share": "Zdieľaj @{name} profil",
"account.show_reblogs": "Ukáž vyzdvihnutia od @{name}",
"account.statuses_counter": "{count, plural, one {{counter} Toot} other {{counter} Toots}}",
"account.statuses_counter": "{count, plural, one {{counter} príspevok} other {{counter} príspevkov}}",
"account.unblock": "Odblokuj @{name}",
"account.unblock_domain": "Prestaň skrývať {domain}",
"account.unblock_short": "Odblokuj",
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"dismissable_banner.explore_links": "這些新聞故事正在被此伺服器以及去中心化網路上的人們熱烈討論著。越多不同人所嘟出的新聞排名更高。",
"dismissable_banner.explore_statuses": "這些於此伺服器以及去中心化網路中其他伺服器發出的嘟文正在被此伺服器上的人們熱烈討論著。越多不同人轉嘟及最愛排名更高。",
"dismissable_banner.explore_tags": "這些主題標籤正在被此伺服器以及去中心化網路上的人們熱烈討論著。越多不同人所嘟出的主題標籤排名更高。",
"dismissable_banner.public_timeline": "這些是來自 {domain} 上人們於社群網站中跟隨者所發表之最近公開嘟文",
"dismissable_banner.public_timeline": "這些是來自 {domain} 使用者們跟隨中帳號所發表之最新公開嘟文",
"embed.instructions": "要在您的網站嵌入此嘟文,請複製以下程式碼。",
"embed.preview": "它將顯示成這樣:",
"emoji_button.activity": "活動",
Expand Down Expand Up @@ -271,8 +271,8 @@
"filter_modal.select_filter.title": "過濾此嘟文",
"filter_modal.title.status": "過濾一則嘟文",
"firehose.all": "全部",
"firehose.local": "此伺服器",
"firehose.remote": "其他伺服器",
"firehose.local": "本站",
"firehose.remote": "聯邦宇宙",
"follow_request.authorize": "授權",
"follow_request.reject": "拒絕",
"follow_requests.unlocked_explanation": "即便您的帳號未被鎖定,{domain} 的管理員認為您可能想要自己審核這些帳號的跟隨請求。",
Expand Down
3 changes: 2 additions & 1 deletion app/lib/link_details_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def description
end

def language
json['inLanguage']
lang = json['inLanguage']
lang.is_a?(Hash) ? (lang['alternateName'] || lang['name']) : lang
end

def type
Expand Down
37 changes: 26 additions & 11 deletions app/validators/existing_username_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,40 @@

class ExistingUsernameValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if value.blank?
@value = value
return if @value.blank?

usernames_and_domains = value.split(',').filter_map do |str|
username, domain = str.strip.gsub(/\A@/, '').split('@', 2)
if options[:multiple]
record.errors.add(attribute, not_found_multiple_message) if usernames_with_no_accounts.any?
elsif usernames_with_no_accounts.any? || usernames_and_domains.size > 1
record.errors.add(attribute, not_found_message)
end
end

private

def usernames_and_domains
@value.split(',').filter_map do |string|
username, domain = string.strip.gsub(/\A@/, '').split('@', 2)
domain = nil if TagManager.instance.local_domain?(domain)

next if username.blank?

[str, username, domain]
[string, username, domain]
end
end

usernames_with_no_accounts = usernames_and_domains.filter_map do |(str, username, domain)|
str unless Account.find_remote(username, domain)
def usernames_with_no_accounts
usernames_and_domains.filter_map do |(string, username, domain)|
string unless Account.find_remote(username, domain)
end
end

if options[:multiple]
record.errors.add(attribute, I18n.t('existing_username_validator.not_found_multiple', usernames: usernames_with_no_accounts.join(', '))) if usernames_with_no_accounts.any?
elsif usernames_with_no_accounts.any? || usernames_and_domains.size > 1
record.errors.add(attribute, I18n.t('existing_username_validator.not_found'))
end
def not_found_multiple_message
I18n.t('existing_username_validator.not_found_multiple', usernames: usernames_with_no_accounts.join(', '))
end

def not_found_message
I18n.t('existing_username_validator.not_found')
end
end
38 changes: 38 additions & 0 deletions app/views/disputes/strikes/_card.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.strike-card
- unless strike.none_action?
%p= t "user_mailer.warning.explanation.#{strike.action}", instance: Rails.configuration.x.local_domain
- if strike.text.present?
= linkify(strike.text)
- if strike.report && !strike.report.other?
%p
%strong= t('user_mailer.warning.reason')
= t("user_mailer.warning.categories.#{strike.report.category}")
- if strike.report.violation? && strike.report.rule_ids.present?
%ul.strike-card__rules
- strike.report.rules.each do |rule|
%li
%span.strike-card__rules__text= rule.text
- if strike.status_ids.present? && !strike.status_ids.empty?
%p
%strong= t('user_mailer.warning.statuses')
.strike-card__statuses-list
- status_map = strike.statuses.includes(:application, :media_attachments).index_by(&:id)
- strike.status_ids.each do |status_id|
.strike-card__statuses-list__item
- if (status = status_map[status_id.to_i])
.one-liner
.emojify= one_line_preview(status)
- status.ordered_media_attachments.each do |media_attachment|
%abbr{ title: media_attachment.description }
= fa_icon 'link'
= media_attachment.file_file_name
.strike-card__statuses-list__item__meta
= link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener noreferrer' do
%time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at)
- unless status.application.nil?
·
= status.application.name
- else
.one-liner= t('disputes.strikes.status', id: status_id)
.strike-card__statuses-list__item__meta
= t('disputes.strikes.status_removed')
46 changes: 1 addition & 45 deletions app/views/disputes/strikes/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,7 @@

.report-header
.report-header__card
.strike-card
- unless @strike.none_action?
%p= t "user_mailer.warning.explanation.#{@strike.action}", instance: Rails.configuration.x.local_domain

- if @strike.text.present?
= linkify(@strike.text)

- if @strike.report && [email protected]?
%p
%strong= t('user_mailer.warning.reason')
= t("user_mailer.warning.categories.#{@strike.report.category}")

- if @strike.report.violation? && @strike.report.rule_ids.present?
%ul.strike-card__rules
- @strike.report.rules.each do |rule|
%li
%span.strike-card__rules__text= rule.text

- if @strike.status_ids.present? && [email protected]_ids.empty?
%p
%strong= t('user_mailer.warning.statuses')

.strike-card__statuses-list
- status_map = @strike.statuses.includes(:application, :media_attachments).index_by(&:id)

- @strike.status_ids.each do |status_id|
.strike-card__statuses-list__item
- if (status = status_map[status_id.to_i])
.one-liner
.emojify= one_line_preview(status)

- status.ordered_media_attachments.each do |media_attachment|
%abbr{ title: media_attachment.description }
= fa_icon 'link'
= media_attachment.file_file_name
.strike-card__statuses-list__item__meta
= link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener noreferrer' do
%time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at)
- unless status.application.nil?
·
= status.application.name
- else
.one-liner= t('disputes.strikes.status', id: status_id)
.strike-card__statuses-list__item__meta
= t('disputes.strikes.status_removed')
= render 'card', strike: @strike

.report-header__details
.report-header__details__item
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/chewy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
enabled = ENV['ES_ENABLED'] == 'true'
host = ENV.fetch('ES_HOST') { 'localhost' }
port = ENV.fetch('ES_PORT') { 9200 }
user = ENV.fetch('ES_USER') { nil }
password = ENV.fetch('ES_PASS') { nil }
fallback_prefix = ENV.fetch('REDIS_NAMESPACE') { nil }
user = ENV.fetch('ES_USER', nil).presence
password = ENV.fetch('ES_PASS', nil).presence
fallback_prefix = ENV.fetch('REDIS_NAMESPACE', nil).presence
prefix = ENV.fetch('ES_PREFIX') { fallback_prefix }

Chewy.settings = {
Expand Down
1 change: 1 addition & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
with_options headers: :any, credentials: false do
with_options methods: [:get] do
resource '/.well-known/*'
resource '/nodeinfo/*'
resource '/@:username'
resource '/users/:username'
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def session_cookie
config.check_at_sign = true
config.pam_default_suffix = ENV.fetch('PAM_EMAIL_DOMAIN') { ENV['LOCAL_DOMAIN'] }
config.pam_default_service = ENV.fetch('PAM_DEFAULT_SERVICE') { 'rpam' }
config.pam_controlled_service = ENV.fetch('PAM_CONTROLLED_SERVICE') { nil }
config.pam_controlled_service = ENV.fetch('PAM_CONTROLLED_SERVICE', nil).presence
end

if ENV['LDAP_ENABLED'] == 'true'
Expand Down
4 changes: 2 additions & 2 deletions config/locales/devise.zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ zh-TW:
confirmations:
confirmed: 您的電子郵件地址已確認成功。
send_instructions: 幾分鐘後您將收到確認信件。若未收到此信件,請檢查垃圾郵件資料夾。
send_paranoid_instructions: 如果您的電子郵件存在於我們的資料庫,您將會在幾分鐘內收到確認信。若未收到請檢查垃圾郵件資料夾。
send_paranoid_instructions: 如果您的電子郵件存在於我們的資料庫,您將於幾分鐘內收到確認信。若未收到請檢查垃圾郵件資料夾。
failure:
already_authenticated: 您已登入。
inactive: 您的帳號尚未啟用。
Expand Down Expand Up @@ -43,7 +43,7 @@ zh-TW:
reset_password_instructions:
action: 變更密碼
explanation: 您已請求帳號的新密碼。
extra: 若您並未請求,請忽略此信件。您的密碼在存取上方連結並建立新密碼前不會變更
extra: 若您並未請求,請忽略此信件。您的密碼於存取上方連結並建立新密碼前不會變更
subject: Mastodon:重設密碼指引
title: 重設密碼
two_factor_disabled:
Expand Down
Loading

0 comments on commit b867d45

Please sign in to comment.