Skip to content

Commit

Permalink
Merge pull request glitch-soc#2446 from ClearlyClaire/glitch-soc/merg…
Browse files Browse the repository at this point in the history
…e-upstream

Merge upstream changes up to 9f218c9
  • Loading branch information
ClearlyClaire authored Oct 19, 2023
2 parents 918137b + 1a3248d commit 1c53aec
Show file tree
Hide file tree
Showing 45 changed files with 480 additions and 173 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
CAS_ENABLED: true
BUNDLE_WITH: 'pam_authentication test'
CI_JOBS: ${{ matrix.ci_job }}/4
GITHUB_RSPEC: ${{ matrix.ruby-version == '.ruby-version' && github.event.pull_request && 'true' }}

strategy:
fail-fast: false
Expand Down
41 changes: 0 additions & 41 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,6 @@ Lint/UnusedBlockArgument:
- 'config/initializers/paperclip.rb'
- 'config/initializers/simple_form.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/UselessAssignment:
Exclude:
- 'app/services/activitypub/process_status_update_service.rb'
- 'config/initializers/3_omniauth.rb'
- 'db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb'
- 'db/post_migrate/20190511152737_remove_suspended_silenced_account_fields.rb'
- 'spec/controllers/api/v1/favourites_controller_spec.rb'
- 'spec/controllers/concerns/account_controller_concern_spec.rb'
- 'spec/helpers/jsonld_helper_spec.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/domain_block_spec.rb'
- 'spec/models/status_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/models/webauthn_credentials_spec.rb'
- 'spec/services/account_search_service_spec.rb'
- 'spec/services/post_status_service_spec.rb'
- 'spec/services/precompute_feed_service_spec.rb'
- 'spec/services/resolve_url_service_spec.rb'
- 'spec/views/statuses/show.html.haml_spec.rb'

# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 144
Expand All @@ -88,26 +67,6 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Max: 27

# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb'
- 'db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb'
- 'db/migrate/20190820003045_update_statuses_index.rb'
- 'db/migrate/20190823221802_add_local_index_to_statuses.rb'
- 'db/migrate/20200119112504_add_public_index_to_statuses.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/domain_block_spec.rb'
- 'spec/models/user_spec.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SafeMultiline.
Performance/DeletePrefix:
Exclude:
- 'app/models/featured_tag.rb'

Performance/MapMethodChain:
Exclude:
- 'app/models/feed.rb'
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/apps/credentials_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

class Api::V1::Apps::CredentialsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }

def show
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key)
return doorkeeper_render_error unless valid_doorkeeper_token?

render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key client_id scopes)
end
end
19 changes: 19 additions & 0 deletions app/helpers/admin/disputes_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module Admin
module DisputesHelper
def strike_action_label(appeal)
t(key_for_action(appeal),
scope: 'admin.strikes.actions',
name: content_tag(:span, appeal.strike.account.username, class: 'username'),
target: content_tag(:span, appeal.account.username, class: 'target'))
.html_safe
end

private

def key_for_action(appeal)
AccountWarning.actions.slice(appeal.strike.action).keys.first
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getHomeFeedSpeed = createSelector([
state => state.getIn(['timelines', 'home', 'pendingItems'], ImmutableList()),
state => state.get('statuses'),
], (statusIds, pendingStatusIds, statusMap) => {
const recentStatusIds = pendingStatusIds.size > 0 ? pendingStatusIds : statusIds;
const recentStatusIds = pendingStatusIds.concat(statusIds);
const statuses = recentStatusIds.filter(id => id !== null).map(id => statusMap.get(id)).filter(status => status?.get('account') !== me).take(20);

if (statuses.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LinkFooter extends PureComponent {
{DividingCircle}
<a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a>
{DividingCircle}
<span class='version'>v{version}</span>
<span className='version'>v{version}</span>
</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class NavigationPanel extends Component {
<div className='navigation-panel'>
{transientSingleColumn && (
<div className='navigation-panel__logo'>
<div class='switch-to-advanced'>
<div className='switch-to-advanced'>
{intl.formatMessage(messages.openedInClassicInterface)}
{" "}
<a href={`/deck${location.pathname}`} class='switch-to-advanced__toggle'>
<a href={`/deck${location.pathname}`} className='switch-to-advanced__toggle'>
{intl.formatMessage(messages.advancedInterface)}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/home_timeline/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getHomeFeedSpeed = createSelector([
state => state.getIn(['timelines', 'home', 'pendingItems'], ImmutableList()),
state => state.get('statuses'),
], (statusIds, pendingStatusIds, statusMap) => {
const recentStatusIds = pendingStatusIds.size > 0 ? pendingStatusIds : statusIds;
const recentStatusIds = pendingStatusIds.concat(statusIds);
const statuses = recentStatusIds.filter(id => id !== null).map(id => statusMap.get(id)).filter(status => status?.get('account') !== me).take(20);

if (statuses.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LinkFooter extends PureComponent {
{DividingCircle}
<a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a>
{DividingCircle}
<span class='version'>v{version}</span>
<span className='version'>v{version}</span>
</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class NavigationPanel extends Component {
<Link to='/' className='column-link column-link--logo'><WordmarkLogo /></Link>

{transientSingleColumn ? (
<div class='switch-to-advanced'>
<div className='switch-to-advanced'>
{intl.formatMessage(messages.openedInClassicInterface)}
{" "}
<a href={`/deck${location.pathname}`} class='switch-to-advanced__toggle'>
<a href={`/deck${location.pathname}`} className='switch-to-advanced__toggle'>
{intl.formatMessage(messages.advancedInterface)}
</a>
</div>
Expand Down
22 changes: 11 additions & 11 deletions app/javascript/mastodon/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
"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 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.daily_retention": "Käyttäjien pysyvyys rekisteröitymisen jälkeen päivittäin",
"admin.dashboard.monthly_retention": "Käyttäjien pysyvyys rekisteröitymisen jälkeen kuukausittain",
"admin.dashboard.retention.average": "Keskimäärin",
"admin.dashboard.retention.cohort": "Kirjautumiset",
"admin.dashboard.retention.cohort_size": "Uudet käyttäjät",
"admin.dashboard.retention.cohort": "Rekisteröitymis-kk.",
"admin.dashboard.retention.cohort_size": "Uusia käyttäjiä",
"admin.impact_report.instance_accounts": "Tilien profiilit, jotka tämä poistaisi",
"admin.impact_report.instance_followers": "Seuraajat, jotka käyttäjämme menettäisivät",
"admin.impact_report.instance_follows": "Seuraajat, jotka heidän käyttäjänsä menettäisivät",
Expand Down Expand Up @@ -114,7 +114,7 @@
"column.directory": "Selaa profiileja",
"column.domain_blocks": "Estetyt verkkotunnukset",
"column.favourites": "Suosikit",
"column.firehose": "Live-syötteet",
"column.firehose": "Livesyötteet",
"column.follow_requests": "Seuraamispyynnöt",
"column.home": "Koti",
"column.lists": "Listat",
Expand All @@ -135,7 +135,7 @@
"community.column_settings.remote_only": "Vain etätilit",
"compose.language.change": "Vaihda kieli",
"compose.language.search": "Hae kieliä...",
"compose.published.body": "Julkaisusi julkaistiin.",
"compose.published.body": "Julkaisu lähetetty.",
"compose.published.open": "Avaa",
"compose.saved.body": "Julkaisu tallennettu.",
"compose_form.direct_message_warning_learn_more": "Lisätietoja",
Expand Down Expand Up @@ -436,10 +436,10 @@
"notifications.clear": "Tyhjennä ilmoitukset",
"notifications.clear_confirmation": "Haluatko varmasti poistaa kaikki ilmoitukset pysyvästi?",
"notifications.column_settings.admin.report": "Uudet ilmoitukset:",
"notifications.column_settings.admin.sign_up": "Uudet kirjautumiset:",
"notifications.column_settings.admin.sign_up": "Uudet rekisteröitymiset:",
"notifications.column_settings.alert": "Työpöytäilmoitukset",
"notifications.column_settings.favourite": "Suosikit:",
"notifications.column_settings.filter_bar.advanced": "Näytä kaikki kategoriat",
"notifications.column_settings.filter_bar.advanced": "Näytä kaikki luokat",
"notifications.column_settings.filter_bar.category": "Pikasuodatuspalkki",
"notifications.column_settings.filter_bar.show_bar": "Näytä suodatinpalkki",
"notifications.column_settings.follow": "Uudet seuraajat:",
Expand Down Expand Up @@ -517,7 +517,7 @@
"privacy.private.short": "Vain seuraajat",
"privacy.public.long": "Näkyy kaikille",
"privacy.public.short": "Julkinen",
"privacy.unlisted.long": "Näkyy kaikille, mutta jää pois löytämisominaisuuksista",
"privacy.unlisted.long": "Näkyy kaikille mutta jää pois löytämisominaisuuksista",
"privacy.unlisted.short": "Listaamaton",
"privacy_policy.last_updated": "Viimeksi päivitetty {date}",
"privacy_policy.title": "Tietosuojakäytäntö",
Expand Down Expand Up @@ -589,13 +589,13 @@
"search.quick_action.go_to_hashtag": "Siirry aihetunnisteeseen {x}",
"search.quick_action.open_url": "Avaa URL-osoite Mastodonissa",
"search.quick_action.status_search": "Julkaisut haulla {x}",
"search.search_or_paste": "Hae tai kirjoita URL-osoite",
"search.search_or_paste": "Hae tai liitä URL-osoite",
"search_popout.full_text_search_disabled_message": "Ei saatavilla palvelimella {domain}.",
"search_popout.language_code": "ISO-kielikoodi",
"search_popout.options": "Hakuvalinnat",
"search_popout.quick_actions": "Pikatoiminnot",
"search_popout.recent": "Viimeaikaiset haut",
"search_popout.specific_date": "tietty päivämäärä",
"search_popout.specific_date": "tarkka päiväys",
"search_popout.user": "käyttäjä",
"search_results.accounts": "Profiilit",
"search_results.all": "Kaikki",
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 @@ -137,7 +137,7 @@
"compose.language.search": "言語を検索...",
"compose.published.body": "投稿されました!",
"compose.published.open": "開く",
"compose.saved.body": "投稿が保存されました",
"compose.saved.body": "変更を保存しました。",
"compose_form.direct_message_warning_learn_more": "もっと詳しく",
"compose_form.encryption_warning": "Mastodonの投稿はエンドツーエンド暗号化に対応していません。安全に送受信されるべき情報をMastodonで共有しないでください。",
"compose_form.hashtag_warning": "この投稿は公開設定ではないのでハッシュタグの一覧に表示されません。公開投稿だけがハッシュタグで検索できます。",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"column.directory": "瀏覽個人檔案",
"column.domain_blocks": "已封鎖網域",
"column.favourites": "最愛",
"column.firehose": "即時內容",
"column.firehose": "即時河道",
"column.follow_requests": "跟隨請求",
"column.home": "首頁",
"column.lists": "列表",
Expand Down
2 changes: 1 addition & 1 deletion app/models/featured_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def decrement(deleted_status_id)
private

def strip_name
self.name = name&.strip&.gsub(/\A#/, '')
self.name = name&.strip&.delete_prefix('#')
end

def set_tag
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/rest/application_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class REST::ApplicationSerializer < ActiveModel::Serializer
attributes :id, :name, :website, :redirect_uri,
attributes :id, :name, :website, :scopes, :redirect_uri,
:client_id, :client_secret, :vapid_key

def id
Expand Down
2 changes: 0 additions & 2 deletions app/services/activitypub/process_status_update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ def update_media_attachments!
end
end

added_media_attachments = @next_media_attachments - previous_media_attachments

@status.ordered_media_attachment_ids = @next_media_attachments.map(&:id)

@media_attachments_changed = true if @status.ordered_media_attachment_ids != previous_media_attachments_ids
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/disputes/appeals/_appeal.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
= image_tag appeal.account.avatar.url(:original), alt: '', width: 40, height: 40, class: 'avatar'
.log-entry__content
.log-entry__title
= t(appeal.strike.action, scope: 'admin.strikes.actions', name: content_tag(:span, appeal.strike.account.username, class: 'username'), target: content_tag(:span, appeal.account.username, class: 'target')).html_safe
= strike_action_label(appeal)
.log-entry__timestamp
%time.formatted{ datetime: appeal.strike.created_at.iso8601 }
= l(appeal.strike.created_at)
Expand Down
33 changes: 0 additions & 33 deletions config/brakeman.ignore
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
{
"ignored_warnings": [
{
"warning_type": "Cross-Site Scripting",
"warning_code": 2,
"fingerprint": "71cf98c8235b5cfa9946b5db8fdc1a2f3a862566abb34e4542be6f3acae78233",
"check_name": "CrossSiteScripting",
"message": "Unescaped model attribute",
"file": "app/views/admin/disputes/appeals/_appeal.html.haml",
"line": 7,
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
"code": "t((Unresolved Model).new.strike.action, :scope => \"admin.strikes.actions\", :name => content_tag(:span, (Unresolved Model).new.strike.account.username, :class => \"username\"), :target => content_tag(:span, (Unresolved Model).new.account.username, :class => \"target\"))",
"render_path": [
{
"type": "template",
"name": "admin/disputes/appeals/index",
"line": 20,
"file": "app/views/admin/disputes/appeals/index.html.haml",
"rendered": {
"name": "admin/disputes/appeals/_appeal",
"file": "app/views/admin/disputes/appeals/_appeal.html.haml"
}
}
],
"location": {
"type": "template",
"template": "admin/disputes/appeals/_appeal"
},
"user_input": "(Unresolved Model).new.strike",
"confidence": "Weak",
"cwe_id": [
79
],
"note": ""
},
{
"warning_type": "Cross-Site Scripting",
"warning_code": 4,
Expand Down
3 changes: 0 additions & 3 deletions config/initializers/3_omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
end

Devise.setup do |config|
# Devise omniauth strategies
options = {}

# CAS strategy
if ENV['CAS_ENABLED'] == 'true'
cas_options = {}
Expand Down
4 changes: 4 additions & 0 deletions config/locales/activerecord.sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ sk:
position:
elevated: nemôže byť vyššia ako vaša súčasná rola
own_role: nie je možné zmeniť s vašou aktuálnou rolou
webhook:
attributes:
events:
invalid_permissions: nemožno zahrnúť udalosti, ku ktorým nemáte práva
12 changes: 12 additions & 0 deletions config/locales/doorkeeper.sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ sk:
crypto: Šifrovanie End-to-end
favourites: Obľúbené
filters: Filtre
follow: Sledovanie, stlmenie a blokovanie
follows: Sledovania
lists: Zoznamy
media: Mediálne prílohy
Expand All @@ -148,9 +149,19 @@ sk:
scopes:
admin:read: prezeraj všetky dáta na serveri
admin:read:accounts: prezeraj chúlostivé informácie na všetkých účtoch
admin:read:canonical_email_blocks: čítať citlivé informácie všetkých kanonických e-mailových blokov
admin:read:domain_allows: čítať citlivé informácie zo všetkých povolených domén
admin:read:domain_blocks: čítať citlivé informácie zo všetkých blokov domén
admin:read:email_domain_blocks: čítať citlivé informácie zo všetkých blokov emailových domén
admin:read:ip_blocks: čítať citlivé informácie zo všetkých blokov IP
admin:read:reports: čítaj chulostivé informácie o všetkých hláseniach a nahlásených účtoch
admin:write: uprav všetky dáta na serveri
admin:write:accounts: urob moderovacie úkony na účtoch
admin:write:canonical_email_blocks: vykonať akcie moderácie na kanonických emailových blokoch
admin:write:domain_allows: vykonať akcie moderácie na povolených doménach
admin:write:domain_blocks: vykonať akcie moderácie na doménových blokoch
admin:write:email_domain_blocks: vykonať akcie moderácie na blokoch emailových domén
admin:write:ip_blocks: vykonať akcie moderácie na blokoch IP
admin:write:reports: urob moderovacie úkony voči hláseniam
crypto: používať end-to-end šifrovanie
follow: uprav vzťahy svojho účtu
Expand All @@ -159,6 +170,7 @@ sk:
read:accounts: prezri si informácie o účte
read:blocks: prezri svoje bloky
read:bookmarks: pozri svoje záložky
read:favourites: zobraziť vaše obľúbené
read:filters: prezri svoje filtrovanie
read:follows: prezri si svoje sledovania
read:lists: prezri si svoje zoznamy
Expand Down
Loading

0 comments on commit 1c53aec

Please sign in to comment.