Skip to content

Commit

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

Merge upstream changes up to 89f89d7
  • Loading branch information
ClearlyClaire authored May 21, 2024
2 parents e853355 + edf6ca5 commit 40a3a3f
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 64 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ GEM
mime-types-data (3.2024.0507)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
minitest (5.23.0)
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.4.0)
Expand Down Expand Up @@ -610,7 +610,7 @@ GEM
pundit (2.3.2)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.7.3)
racc (1.8.0)
rack (2.2.9)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
Expand Down Expand Up @@ -685,7 +685,7 @@ GEM
redis (>= 4)
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.9.0)
regexp_parser (2.9.2)
reline (0.5.7)
io-console (~> 0.5)
request_store (1.6.0)
Expand Down Expand Up @@ -746,7 +746,7 @@ GEM
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.1)
rubocop-rails (2.25.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
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 @@ -128,7 +128,7 @@ def remove_header
def unblock_email
authorize @account, :unblock_email?

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

log_action :unblock_email, @account

Expand Down
14 changes: 14 additions & 0 deletions app/javascript/mastodon/locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"admin.dashboard.retention.cohort_size": "Mga bagong tagagamit",
"alert.rate_limited.message": "Mangyaring subukan muli pagkatapos ng {retry_time, time, medium}.",
"audio.hide": "Itago ang tunog",
"block_modal.show_less": "Magpakita ng mas kaunti",
"block_modal.show_more": "Magpakita ng higit pa",
"block_modal.title": "Harangan ang tagagamit?",
"bundle_column_error.error.title": "Naku!",
"bundle_column_error.network.body": "Nagkaroon ng kamalian habang sinusubukang i-karga ang pahinang ito. Maaaring dahil ito sa pansamantalang problema ng iyong koneksyon sa internet o ang server na ito.",
Expand Down Expand Up @@ -102,6 +104,7 @@
"compose_form.encryption_warning": "Ang mga post sa Mastodon ay hindi naka-encrypt nang dulo-dulo. Huwag magbahagi ng anumang sensitibong impormasyon sa Mastodon.",
"compose_form.hashtag_warning": "Hindi maililista ang post na ito sa anumang hashtag dahil hindi ito nakapubliko. Mga nakapublikong post lamang ang mahahanap ayon sa hashtag.",
"compose_form.placeholder": "Anong nangyari?",
"compose_form.poll.duration": "Tagal ng botohan",
"compose_form.poll.multiple": "Maraming pagpipilian",
"compose_form.poll.single": "Piliin ang isa",
"compose_form.reply": "Tumugon",
Expand Down Expand Up @@ -173,6 +176,7 @@
"empty_column.list": "Wala pang laman ang listahang ito. Kapag naglathala ng mga bagong post ang mga miyembro ng listahang ito, makikita iyon dito.",
"empty_column.lists": "Wala ka pang mga listahan. Kapag gumawa ka ng isa, makikita yun dito.",
"explore.search_results": "Mga resulta ng paghahanap",
"explore.suggested_follows": "Mga tao",
"explore.title": "Tuklasin",
"explore.trending_links": "Mga balita",
"filter_modal.select_filter.search": "Hanapin o gumawa",
Expand All @@ -186,9 +190,13 @@
"follow_suggestions.who_to_follow": "Sinong maaaring sundan",
"footer.about": "Tungkol dito",
"footer.get_app": "Kunin ang app",
"footer.status": "Katayuan",
"generic.saved": "Nakaimbak",
"hashtag.column_header.tag_mode.all": "at {additional}",
"hashtag.column_header.tag_mode.any": "o {additional}",
"hashtag.column_settings.tag_mode.all": "Lahat ng nandito",
"hashtag.column_settings.tag_mode.any": "Ilan sa nandito",
"hashtag.column_settings.tag_mode.none": "Wala dito",
"home.column_settings.show_replies": "Ipakita ang mga tugon",
"home.pending_critical_update.body": "Mangyaring i-update ang iyong serbiro ng Mastodon sa lalong madaling panahon!",
"interaction_modal.login.action": "Iuwi mo ako",
Expand All @@ -199,6 +207,7 @@
"intervals.full.days": "{number, plural, one {# araw} other {# na araw}}",
"intervals.full.hours": "{number, plural, one {# oras} other {# na oras}}",
"intervals.full.minutes": "{number, plural, one {# minuto} other {# na minuto}}",
"keyboard_shortcuts.blocked": "Buksan ang talaan ng mga nakaharang na mga tagagamit",
"keyboard_shortcuts.description": "Paglalarawan",
"keyboard_shortcuts.down": "Ilipat pababa sa talaan",
"keyboard_shortcuts.mention": "Banggitin ang may-akda",
Expand All @@ -218,14 +227,18 @@
"navigation_bar.about": "Tungkol dito",
"navigation_bar.blocks": "Nakaharang na mga tagagamit",
"navigation_bar.direct": "Mga palihim na banggit",
"navigation_bar.discover": "Tuklasin",
"navigation_bar.explore": "Tuklasin",
"navigation_bar.favourites": "Mga paborito",
"navigation_bar.follow_requests": "Mga hiling sa pagsunod",
"navigation_bar.follows_and_followers": "Mga sinusundan at tagasunod",
"navigation_bar.lists": "Mga listahan",
"navigation_bar.search": "Maghanap",
"notification.admin.report": "Iniulat ni {name} si {target}",
"notification.follow": "Sinundan ka ni {name}",
"notification.follow_request": "Hinihiling ni {name} na sundan ka",
"notification.mention": "Binanggit ka ni {name}",
"notification.moderation_warning": "Mayroong kang natanggap na babala sa pagtitimpi",
"notification.relationships_severance_event.learn_more": "Matuto nang higit pa",
"notification_requests.accept": "Tanggapin",
"notification_requests.notifications_from": "Mga abiso mula kay/sa {name}",
Expand All @@ -246,6 +259,7 @@
"onboarding.profile.note_hint": "Maaari mong @bangitin ang ibang mga tao o mga #hashtag…",
"onboarding.profile.save_and_continue": "Iimbak at magpatuloy",
"onboarding.share.next_steps": "Mga posibleng susunod na hakbang:",
"picture_in_picture.restore": "Ilagay ito pabalik",
"poll.closed": "Sarado",
"poll.reveal": "Ipakita ang mga resulta",
"poll.voted": "Binoto mo para sa sagot na ito",
Expand Down
1 change: 0 additions & 1 deletion app/models/canonical_email_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class CanonicalEmailBlock < ApplicationRecord
validates :canonical_email_hash, presence: true, uniqueness: true

scope :matching_email, ->(email) { where(canonical_email_hash: email_to_canonical_email_hash(email)) }
scope :matching_account, ->(account) { matching_email(account&.user_email).or(where(reference_account: account)) }

def to_log_human_identifier
canonical_email_hash
Expand Down
18 changes: 9 additions & 9 deletions app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,33 +344,33 @@ def as_direct_timeline(account, limit = 20, max_id = nil, since_id = nil)

# _from_me part does not require any timeline filters
query_from_me = where(account_id: account.id)
.where(Status.arel_table[:visibility].eq(3))
.direct_visibility
.limit(limit)
.order('statuses.id DESC')
.order(id: :desc)

# _to_me part requires mute and block filter.
# FIXME: may we check mutes.hide_notifications?
query_to_me = Status
.direct_visibility
.joins(:mentions)
.merge(Mention.where(account_id: account.id))
.where(Status.arel_table[:visibility].eq(3))
.where(mentions: { account_id: account.id })
.limit(limit)
.order('mentions.status_id DESC')
.not_excluded_by_account(account)

if max_id.present?
query_from_me = query_from_me.where('statuses.id < ?', max_id)
query_to_me = query_to_me.where('mentions.status_id < ?', max_id)
query_from_me = query_from_me.where(id: ...max_id)
query_to_me = query_to_me.where(mentions: { status_id: ...max_id })
end

if since_id.present?
query_from_me = query_from_me.where('statuses.id > ?', since_id)
query_to_me = query_to_me.where('mentions.status_id > ?', since_id)
end

# returns ActiveRecord.Relation
items = (query_from_me.select(:id).to_a + query_to_me.select(:id).to_a).uniq(&:id).sort_by(&:id).reverse.take(limit)
Status.where(id: items.map(&:id))
# TODO: use a single query?
ids = (query_from_me.pluck(:id) + query_to_me.pluck(:id)).sort.uniq.reverse.take(limit)
Status.where(id: ids)
end

def favourites_map(status_ids, account_id)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/accounts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
= render 'admin/accounts/counters', account: @account

- if @account.local? && @account.user.nil?
= link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.matching_account(@account).exists?
= link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.exists?(reference_account_id: @account.id)
- else
.table-wrapper
%table.table.inline-table
Expand Down
1 change: 1 addition & 0 deletions config/locales/is.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ is:
update_custom_emoji_html: "%{name} uppfærði tjáningartáknið %{target}"
update_domain_block_html: "%{name} uppfærði útilokun lénsins %{target}"
update_ip_block_html: "%{name} breytti reglu fyrir IP-vistfangið %{target}"
update_report_html: "%{name} uppfærði kæru %{target}"
update_status_html: "%{name} uppfærði færslu frá %{target}"
update_user_role_html: "%{name} breytti hlutverki %{target}"
deleted_account: eyddur notandaaðgangur
Expand Down
6 changes: 3 additions & 3 deletions config/locales/lt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ lt:
settings: 'Keisti el. pašto nuostatas: %{link}'
view: 'Peržiūra:'
view_profile: Peržiurėti profilį
view_status: Peržiūrėti statusą
view_status: Peržiūrėti įrašą
applications:
created: Aplikacija sėkmingai sukurta
destroyed: Aplikacija sėkmingai ištrinta
Expand Down Expand Up @@ -777,8 +777,8 @@ lt:
title: Moderacija
notification_mailer:
favourite:
body: 'Jūsų statusą pamėgo %{name}:'
subject: "%{name} pamėgo Jūsų statusą"
body: 'Tavo įrašą pamėgo %{name}:'
subject: "%{name} pamėgo tavo įrašą"
title: Naujas mėgstamas
follow:
body: "%{name} pradėjo jus sekti!"
Expand Down
2 changes: 1 addition & 1 deletion spec/fabricators/canonical_email_block_fabricator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

Fabricator(:canonical_email_block) do
email { |attrs| attrs[:reference_account] ? attrs[:reference_account].user_email : sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
reference_account { Fabricate.build(:account) }
end
Loading

0 comments on commit 40a3a3f

Please sign in to comment.