Skip to content

Commit

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

Conflicts:
- `app/validators/status_pin_validator.rb`:
  Upstream refactored that file, while glitch-soc had configurable limits for
  pinned statuses.
  Updated the code with upstream's refactor, while keeping glitch-soc's
  configurability.
  • Loading branch information
ClearlyClaire committed Dec 19, 2023
2 parents d288a61 + 973597c commit 2e786e1
Show file tree
Hide file tree
Showing 157 changed files with 1,279 additions and 713 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-javascript/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
using: 'composite'
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ gem 'sprockets', '~> 3.7.2'
gem 'thor', '~> 1.2'
gem 'rack', '~> 2.2.7'

# For why irb is in the Gemfile, see: https://ruby.social/@st0012/111444685161478182
gem 'irb', '~> 1.8'

gem 'haml-rails', '~>2.0'
gem 'pg', '~> 1.5'
gem 'pghero'
Expand Down Expand Up @@ -179,6 +182,9 @@ group :development do
end

group :development, :test do
# Interactive Debugging tools
gem 'debug', '~> 1.8'

# Profiling tools
gem 'memory_profiler', require: false
gem 'ruby-prof', require: false
Expand Down
43 changes: 24 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,21 @@ GEM
encryptor (~> 3.0.0)
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.2.0)
aws-partitions (1.828.0)
aws-sdk-core (3.183.1)
aws-eventstream (1.3.0)
aws-partitions (1.855.0)
aws-sdk-core (3.188.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sdk-kms (1.73.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-s3 (1.139.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-sigv4 (1.7.0)
aws-eventstream (~> 1, >= 1.0.2)
azure-storage-blob (2.0.3)
azure-storage-common (~> 2.0)
Expand All @@ -154,7 +154,7 @@ GEM
faraday_middleware (~> 1.0, >= 1.0.0.rc1)
net-http-persistent (~> 4.0)
nokogiri (~> 1, >= 1.10.8)
base64 (0.1.1)
base64 (0.2.0)
bcp47_spec (0.2.1)
bcrypt (3.1.19)
better_errors (2.10.1)
Expand Down Expand Up @@ -220,6 +220,9 @@ GEM
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
debug_inspector (1.1.0)
devise (4.9.3)
bcrypt (~> 3.0)
Expand Down Expand Up @@ -248,7 +251,7 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
drb (2.1.1)
drb (2.2.0)
ruby2_keywords
ed25519 (1.3.0)
elasticsearch (7.13.3)
Expand Down Expand Up @@ -374,7 +377,7 @@ GEM
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
io-console (0.6.0)
irb (1.8.3)
irb (1.9.1)
rdoc
reline (>= 0.3.8)
jmespath (1.6.2)
Expand Down Expand Up @@ -436,7 +439,7 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.21.4)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -462,7 +465,7 @@ GEM
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.3.0)
mutex_m (0.1.2)
mutex_m (0.2.0)
net-http (0.4.0)
uri
net-http-persistent (4.0.2)
Expand All @@ -478,7 +481,7 @@ GEM
net-smtp (0.4.0)
net-protocol
nio4r (2.5.9)
nokogiri (1.15.4)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oj (3.16.1)
Expand Down Expand Up @@ -599,13 +602,13 @@ GEM
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rdf (3.3.1)
bcp47_spec (~> 0.2)
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.6.1)
rdf (~> 3.2)
rdoc (6.5.0)
rdoc (6.6.0)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (4.8.1)
Expand All @@ -614,7 +617,7 @@ GEM
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.8.2)
reline (0.3.9)
reline (0.4.0)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
Expand All @@ -639,7 +642,7 @@ GEM
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.3)
rspec-rails (6.1.0)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand Down Expand Up @@ -757,7 +760,7 @@ GEM
unicode-display_width (>= 1.1.1, < 3)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
test-prof (1.2.3)
test-prof (1.3.0)
thor (1.3.0)
tilt (2.3.0)
timeout (0.4.1)
Expand Down Expand Up @@ -851,6 +854,7 @@ DEPENDENCIES
concurrent-ruby
connection_pool
database_cleaner-active_record
debug (~> 1.8)
devise (~> 4.9)
devise-two-factor (~> 4.1)
devise_pam_authenticatable2 (~> 9.2)
Expand All @@ -876,6 +880,7 @@ DEPENDENCIES
httplog (~> 1.6.2)
i18n-tasks (~> 1.0)
idn-ruby
irb (~> 1.8)
json-ld
json-ld-preloaded (~> 3.2)
json-schema (~> 4.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def batch
private

def batched_ordered_status_edits
@status.edits.reorder(nil).includes(:account, status: [:account]).find_each(order: :asc)
@status.edits.includes(:account, status: [:account]).find_each(order: :asc)
end
helper_method :batched_ordered_status_edits

Expand Down
47 changes: 33 additions & 14 deletions app/controllers/api/v1/instances/activity_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class Api::V1::Instances::ActivityController < Api::V1::Instances::BaseController
before_action :require_enabled_api!

WEEKS_OF_ACTIVITY = 12

def show
cache_even_if_authenticated!
render_with_cache json: :activity, expires_in: 1.day
Expand All @@ -11,23 +13,40 @@ def show
private

def activity
statuses_tracker = ActivityTracker.new('activity:statuses:local', :basic)
logins_tracker = ActivityTracker.new('activity:logins', :unique)
registrations_tracker = ActivityTracker.new('activity:accounts:local', :basic)

(0...12).map do |i|
start_of_week = i.weeks.ago
end_of_week = start_of_week + 6.days

{
week: start_of_week.to_i.to_s,
statuses: statuses_tracker.sum(start_of_week, end_of_week).to_s,
logins: logins_tracker.sum(start_of_week, end_of_week).to_s,
registrations: registrations_tracker.sum(start_of_week, end_of_week).to_s,
}
activity_weeks.map do |weeks_ago|
activity_json(*week_edge_days(weeks_ago))
end
end

def activity_json(start_of_week, end_of_week)
{
week: start_of_week.to_i.to_s,
statuses: statuses_tracker.sum(start_of_week, end_of_week).to_s,
logins: logins_tracker.sum(start_of_week, end_of_week).to_s,
registrations: registrations_tracker.sum(start_of_week, end_of_week).to_s,
}
end

def activity_weeks
0...WEEKS_OF_ACTIVITY
end

def week_edge_days(num)
[num.weeks.ago, num.weeks.ago + 6.days]
end

def statuses_tracker
ActivityTracker.new('activity:statuses:local', :basic)
end

def logins_tracker
ActivityTracker.new('activity:logins', :unique)
end

def registrations_tracker
ActivityTracker.new('activity:accounts:local', :basic)
end

def require_enabled_api!
head 404 unless Setting.activity_api_enabled && !limited_federation_mode?
end
Expand Down
14 changes: 13 additions & 1 deletion app/controllers/api/v1/instances/domain_blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ def index
private

def require_enabled_api!
head 404 unless Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
head 404 unless api_enabled?
end

def api_enabled?
show_domain_blocks_for_all? || show_domain_blocks_to_user?
end

def show_domain_blocks_for_all?
Setting.show_domain_blocks == 'all'
end

def show_domain_blocks_to_user?
Setting.show_domain_blocks == 'users' && user_signed_in?
end

def set_domain_blocks
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/statuses/histories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def show
private

def status_edits
@status.edits.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)]
@status.edits.ordered.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)]
end
end
14 changes: 12 additions & 2 deletions app/controllers/api/v2/media_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

class Api::V2::MediaController < Api::V1::MediaController
def create
@media_attachment = current_account.media_attachments.create!({ delay_processing: true }.merge(media_attachment_params))
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: @media_attachment.not_processed? ? 202 : 200
@media_attachment = current_account.media_attachments.create!(media_and_delay_params)
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: status_from_media_processing
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
render json: file_type_error, status: 422
rescue Paperclip::Error => e
Rails.logger.error "#{e.class}: #{e.message}"
render json: processing_error, status: 500
end

private

def media_and_delay_params
{ delay_processing: true }.merge(media_attachment_params)
end

def status_from_media_processing
@media_attachment.not_processed? ? 202 : 200
end
end
5 changes: 5 additions & 0 deletions app/javascript/mastodon/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"account.blocked": "Блокирани",
"account.browse_more_on_origin_server": "Разглеждане на още в оригиналния профил",
"account.cancel_follow_request": "Оттегляне на заявката за последване",
"account.copy": "Копиране на връзка към профила",
"account.direct": "Частно споменаване на @{name}",
"account.disable_notifications": "Сприране на известия при публикуване от @{name}",
"account.domain_blocked": "Блокиран домейн",
Expand Down Expand Up @@ -191,6 +192,7 @@
"conversation.mark_as_read": "Маркиране като прочетено",
"conversation.open": "Преглед на разговора",
"conversation.with": "С {names}",
"copy_icon_button.copied": "Копиранo в буферната памет",
"copypaste.copied": "Копирано",
"copypaste.copy_to_clipboard": "Копиране в буферната памет",
"directory.federated": "От позната федивселена",
Expand Down Expand Up @@ -479,6 +481,8 @@
"onboarding.follows.empty": "За съжаление, в момента не могат да се показват резултати. Може да опитате да употребявате търсене или да прегледате страницата за изследване, за да намерите страница за последване, или да опитате пак по-късно.",
"onboarding.follows.lead": "Може да бъдете куратор на началния си инфоканал. Последвайки повече хора, по-деен и по-интересен ще става. Тези профили може да са добра начална точка, от която винаги по-късно да спрете да следвате!",
"onboarding.follows.title": "Популярно в Mastodon",
"onboarding.profile.discoverable": "Правене на моя профил откриваем",
"onboarding.profile.discoverable_hint": "Включвайки откриваемостта в Mastodon, вашите публикации може да се появят при резултатите от търсене и изгряващи неща, и вашия профил може да бъде предложен на хора с подобни интереси като вашите.",
"onboarding.profile.display_name": "Името на показ",
"onboarding.profile.display_name_hint": "Вашето пълно име или псевдоним…",
"onboarding.profile.lead": "Винаги може да завършите това по-късно в настройките, където дори има повече възможности за настройване.",
Expand Down Expand Up @@ -531,6 +535,7 @@
"privacy.unlisted.short": "Несписъчно",
"privacy_policy.last_updated": "Последно осъвременяване на {date}",
"privacy_policy.title": "Политика за поверителност",
"recommended": "Препоръчано",
"refresh": "Опресняване",
"regeneration_indicator.label": "Зареждане…",
"regeneration_indicator.sublabel": "Подготовка на началния ви инфоканал!",
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/mastodon/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@
"onboarding.follows.empty": "Yn anffodus, nid oes modd dangos unrhyw ganlyniadau ar hyn o bryd. Gallwch geisio defnyddio chwilio neu bori'r dudalen archwilio i ddod o hyd i bobl i'w dilyn, neu ceisio eto yn nes ymlaen.",
"onboarding.follows.lead": "Rydych chi'n curadu eich ffrwd gartref eich hun. Po fwyaf o bobl y byddwch chi'n eu dilyn, y mwyaf egnïol a diddorol fydd hi. Gall y proffiliau hyn fod yn fan cychwyn da - gallwch chi bob amser eu dad-ddilyn yn nes ymlaen:",
"onboarding.follows.title": "Yn boblogaidd ar Mastodon",
"onboarding.profile.discoverable": "Gwnewch fy mhroffil yn un y gellir ei ddarganfod",
"onboarding.profile.discoverable_hint": "Pan fyddwch yn optio i mewn i ddarganfodadwyedd ar Mastodon, gall eich postiadau ymddangos mewn canlyniadau chwilio a thueddiadau, ac efallai y bydd eich proffil yn cael ei awgrymu i bobl sydd â diddordebau tebyg i chi.",
"onboarding.profile.display_name_hint": "Eich enw llawn neu'ch enw hwyl…",
"onboarding.profile.note": "Bywgraffiad",
"onboarding.profile.note_hint": "Gallwch @grybwyll pobl eraill neu #hashnodau…",
Expand Down Expand Up @@ -529,6 +531,7 @@
"privacy.unlisted.short": "Heb ei restru",
"privacy_policy.last_updated": "Diweddarwyd ddiwethaf ar {date}",
"privacy_policy.title": "Polisi Preifatrwydd",
"recommended": "Argymhellwyd",
"refresh": "Adnewyddu",
"regeneration_indicator.label": "Yn llwytho…",
"regeneration_indicator.sublabel": "Mae eich ffrwd cartref yn cael ei baratoi!",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/fr-QC.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
"home.column_settings.basic": "Basique",
"home.column_settings.show_reblogs": "Afficher boosts",
"home.column_settings.show_replies": "Afficher réponses",
"home.explore_prompt.body": "Votre fil d'actualité aura un mélange de messages depuis les hashtags que vous avez choisi de suivre, les personnes que vous avez choisi de suivre, et les messages qu'ils boostent. Si ça vous semble trop calme à votre goût, n’hésitez pas à :",
"home.explore_prompt.body": "Votre fil d'actualité aura un mélange de messages depuis les hashtags que vous avez choisi de suivre, les personnes que vous avez choisi de suivre, et les messages qu'elles boostent. Si ça vous semble trop calme à votre goût, n’hésitez pas à :",
"home.explore_prompt.title": "C'est votre page d'accueil dans Mastodon.",
"home.hide_announcements": "Masquer les annonces",
"home.pending_critical_update.body": "Veuillez mettre à jour votre serveur Mastodon dès que possible !",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
"home.column_settings.basic": "Basique",
"home.column_settings.show_reblogs": "Afficher les partages",
"home.column_settings.show_replies": "Afficher les réponses",
"home.explore_prompt.body": "Votre fil d'actualité aura un mélange de messages depuis les hashtags que vous avez choisi de suivre, les personnes que vous avez choisi de suivre, et les messages qu'ils boostent. Si ça vous semble trop calme à votre goût, n’hésitez pas à :",
"home.explore_prompt.body": "Votre fil d'actualité aura un mélange de messages depuis les hashtags que vous avez choisi de suivre, les personnes que vous avez choisi de suivre, et les messages qu'elles boostent. Si ça vous semble trop calme à votre goût, n’hésitez pas à :",
"home.explore_prompt.title": "C'est votre page d'accueil dans Mastodon.",
"home.hide_announcements": "Masquer les annonces",
"home.pending_critical_update.body": "Veuillez mettre à jour votre serveur Mastodon dès que possible !",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
"onboarding.follows.empty": "Desgraciadamente agora mesmo non hai nada que mostrar. Podes intentalo coa busca ou na páxina descubrir para atopar persoas ás que seguir, ou intentalo máis tarde.",
"onboarding.follows.lead": "Podes facer que a túa cronoloxía de inicio sexa como ti a queres. Canta máis xente sigas máis interesante será. Estes perfís poderían axudarche a comezar —sempre poderás deixar de seguilos despois!",
"onboarding.follows.title": "Popular en Mastodon",
"onboarding.profile.discoverable": "Que o meu perfil sexa atopable",
"onboarding.profile.discoverable": "Que o meu perfil se poida atopar",
"onboarding.profile.discoverable_hint": "Cando elixes que poidan atoparte en Mastodon as túas publicacións aparecerán nos resultados das buscas e nos temas en voga, e o teu perfil podería ser suxerido para seguimento a persoas con intereses semellantes aos teus.",
"onboarding.profile.display_name": "Nome público",
"onboarding.profile.display_name_hint": "O teu nome completo ou un nome divertido…",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/is.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"hashtag.follow": "Fylgjast með myllumerki",
"hashtag.unfollow": "Hætta að fylgjast með myllumerki",
"hashtags.and_other": "…og {count, plural, other {# til viðbótar}}",
"home.actions.go_to_explore": "Sjáðu hvað er í umræðunni",
"home.actions.go_to_explore": "Sjá hvað er í umræðunni",
"home.actions.go_to_suggestions": "Finna fólk til að fylgjast með",
"home.column_settings.basic": "Einfalt",
"home.column_settings.show_reblogs": "Sýna endurbirtingar",
Expand Down
Loading

0 comments on commit 2e786e1

Please sign in to comment.