Skip to content

Commit

Permalink
Merge remote-tracking branch 'mastodon/main' into merge/mastodon-main…
Browse files Browse the repository at this point in the history
…-branch
  • Loading branch information
S-H-GAMELINKS committed Jul 30, 2024
2 parents c82b5c5 + 598ae4f commit 88b54c1
Show file tree
Hide file tree
Showing 169 changed files with 1,568 additions and 651 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/codespaces/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},

"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postCreateCommand": "bin/setup",
"postCreateCommand": "COREPACK_ENABLE_DOWNLOAD_PROMPT=0 bin/setup",
"waitFor": "postCreateCommand",

"customizations": {
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
jobs:
upload-translations:
runs-on: ubuntu-latest
if: github.repository == 'mastodon/mastodon'

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.8
# syntax=docker/dockerfile:1.9

# This file is designed for production server deployment, not local development work
# For a containerized local dev environment, see: https://github.com/mastodon/mastodon/blob/main/README.md#docker
Expand Down
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,14 @@ GEM
aes_key_wrap
bindata
httpclient
json-ld (3.3.1)
json-ld (3.3.2)
htmlentities (~> 4.3)
json-canonicalization (~> 1.0)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.15)
rack (>= 2.2, < 4)
rdf (~> 3.3)
rexml (~> 3.2)
json-ld-preloaded (3.3.0)
json-ld (~> 3.3)
rdf (~> 3.3)
Expand Down Expand Up @@ -483,7 +484,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.6)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nsa (0.3.0)
Expand Down Expand Up @@ -717,8 +718,9 @@ GEM
rbs_rails (0.12.0)
parser
rbs (>= 1)
rdf (3.3.1)
rdf (3.3.2)
bcp47_spec (~> 0.2)
bigdecimal (~> 3.1, >= 3.1.5)
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.7.0)
rdf (~> 3.3)
Expand Down Expand Up @@ -817,7 +819,7 @@ GEM
fugit (~> 1.1, >= 1.1.6)
safety_net_attestation (0.4.0)
jwt (~> 2.0)
sanitize (6.1.1)
sanitize (6.1.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sassc (2.4.0)
Expand Down
18 changes: 17 additions & 1 deletion app/controllers/admin/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

module Admin
class TagsController < BaseController
before_action :set_tag
before_action :set_tag, except: [:index]

PER_PAGE = 20

def index
authorize :tag, :index?

@tags = filtered_tags.page(params[:page]).per(PER_PAGE)
end

def show
authorize @tag, :show?
Expand Down Expand Up @@ -31,5 +39,13 @@ def set_tag
def tag_params
params.require(:tag).permit(:name, :display_name, :trendable, :usable, :listable)
end

def filtered_tags
TagFilter.new(filter_params.with_defaults(order: 'newest')).results
end

def filter_params
params.slice(:page, *TagFilter::KEYS).permit(:page, *TagFilter::KEYS)
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def doorkeeper_forbidden_render_options(*)

protected

def limit_param(default_limit)
def limit_param(default_limit, max_limit = nil)
return default_limit unless params[:limit]

[params[:limit].to_i.abs, default_limit * 2].min
[params[:limit].to_i.abs, max_limit || (default_limit * 2)].min
end

def params_slice(*keys)
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/api/v1/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Api::V1::NotificationsController < Api::BaseController
after_action :insert_pagination_headers, only: :index

DEFAULT_NOTIFICATIONS_LIMIT = 40
DEFAULT_NOTIFICATIONS_COUNT_LIMIT = 100
MAX_NOTIFICATIONS_COUNT_LIMIT = 1_000

def index
with_read_replica do
Expand All @@ -17,6 +19,14 @@ def index
render json: @notifications, each_serializer: REST::NotificationSerializer, relationships: @relationships
end

def unread_count
limit = limit_param(DEFAULT_NOTIFICATIONS_COUNT_LIMIT, MAX_NOTIFICATIONS_COUNT_LIMIT)

with_read_replica do
render json: { count: browserable_account_notifications.paginate_by_min_id(limit, notification_marker&.last_read_id).count }
end
end

def show
@notification = current_account.notifications.without_suspended.find(params[:id])
render json: @notification, serializer: REST::NotificationSerializer
Expand Down Expand Up @@ -54,6 +64,10 @@ def browserable_account_notifications
)
end

def notification_marker
current_user.markers.find_by(timeline: 'notifications')
end

def target_statuses_from_notifications
@notifications.reject { |notification| notification.target_status.nil? }.map(&:target_status)
end
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/api/v2_alpha/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Api::V2Alpha::NotificationsController < Api::BaseController
after_action :insert_pagination_headers, only: :index

DEFAULT_NOTIFICATIONS_LIMIT = 40
DEFAULT_NOTIFICATIONS_COUNT_LIMIT = 100
MAX_NOTIFICATIONS_COUNT_LIMIT = 1_000

def index
with_read_replica do
Expand Down Expand Up @@ -35,6 +37,14 @@ def index
end
end

def unread_count
limit = limit_param(DEFAULT_NOTIFICATIONS_COUNT_LIMIT, MAX_NOTIFICATIONS_COUNT_LIMIT)

with_read_replica do
render json: { count: browserable_account_notifications.paginate_groups_by_min_id(limit, min_id: notification_marker&.last_read_id).count }
end
end

def show
@notification = current_account.notifications.without_suspended.find_by!(group_key: params[:id])
render json: NotificationGroup.from_notification(@notification), serializer: REST::NotificationGroupSerializer
Expand Down Expand Up @@ -92,6 +102,10 @@ def browserable_account_notifications
)
end

def notification_marker
current_user.markers.find_by(timeline: 'notifications')
end

def target_statuses_from_notifications
@notifications.filter_map(&:target_status)
end
Expand Down
15 changes: 15 additions & 0 deletions app/helpers/admin/tags_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Admin::TagsHelper
def admin_tags_moderation_options
[
[t('admin.tags.moderation.reviewed'), 'reviewed'],
[t('admin.tags.moderation.review_requested'), 'review_requested'],
[t('admin.tags.moderation.unreviewed'), 'unreviewed'],
[t('admin.tags.moderation.trendable'), 'trendable'],
[t('admin.tags.moderation.not_trendable'), 'not_trendable'],
[t('admin.tags.moderation.usable'), 'usable'],
[t('admin.tags.moderation.not_usable'), 'not_usable'],
]
end
end
8 changes: 8 additions & 0 deletions app/javascript/mastodon/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,28 @@
"confirmations.block.confirm": "Блокиране",
"confirmations.delete.confirm": "Изтриване",
"confirmations.delete.message": "Наистина ли искате да изтриете публикацията?",
"confirmations.delete.title": "Изтривате ли публикацията?",
"confirmations.delete_list.confirm": "Изтриване",
"confirmations.delete_list.message": "Наистина ли искате да изтриете завинаги списъка?",
"confirmations.delete_list.title": "Изтривате ли списъка?",
"confirmations.discard_edit_media.confirm": "Отхвърляне",
"confirmations.discard_edit_media.message": "Не сте запазили промени на описанието или огледа на мултимедията, отхвърляте ли ги?",
"confirmations.edit.confirm": "Редактиране",
"confirmations.edit.message": "Редактирането сега ще замени съобщението, което в момента съставяте. Сигурни ли сте, че искате да продължите?",
"confirmations.edit.title": "Презаписвате ли публикацията?",
"confirmations.logout.confirm": "Излизане",
"confirmations.logout.message": "Наистина ли искате да излезете?",
"confirmations.logout.title": "Излизате ли от системата?",
"confirmations.mute.confirm": "Заглушаване",
"confirmations.redraft.confirm": "Изтриване и преработване",
"confirmations.redraft.message": "Наистина ли искате да изтриете тази публикация и да я направите чернова? Означаванията като любими и подсилванията ще се изгубят, а и отговорите към първоначалната публикация ще осиротеят.",
"confirmations.redraft.title": "Изтривате и преработвате ли публикацията?",
"confirmations.reply.confirm": "Отговор",
"confirmations.reply.message": "Отговарянето сега ще замени съобщението, което в момента съставяте. Сигурни ли сте, че искате да продължите?",
"confirmations.reply.title": "Презаписвате ли публикацията?",
"confirmations.unfollow.confirm": "Без следване",
"confirmations.unfollow.message": "Наистина ли искате да не следвате {name}?",
"confirmations.unfollow.title": "Спирате ли да следвате потребителя?",
"conversation.delete": "Изтриване на разговора",
"conversation.mark_as_read": "Маркиране като прочетено",
"conversation.open": "Преглед на разговора",
Expand Down Expand Up @@ -503,6 +510,7 @@
"notification_requests.title": "Филтрирани известия",
"notifications.clear": "Изчистване на известията",
"notifications.clear_confirmation": "Наистина ли искате да изчистите завинаги всичките си известия?",
"notifications.clear_title": "Изчиствате ли известията?",
"notifications.column_settings.admin.report": "Нови доклади:",
"notifications.column_settings.admin.sign_up": "Нови регистрации:",
"notifications.column_settings.alert": "Известия на работния плот",
Expand Down
16 changes: 8 additions & 8 deletions app/javascript/mastodon/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,28 +171,28 @@
"confirmations.block.confirm": "Bloca",
"confirmations.delete.confirm": "Elimina",
"confirmations.delete.message": "Segur que vols eliminar aquest tut?",
"confirmations.delete.title": "Elimina la publicació?",
"confirmations.delete.title": "Eliminar la publicació?",
"confirmations.delete_list.confirm": "Elimina",
"confirmations.delete_list.message": "Segur que vols suprimir permanentment aquesta llista?",
"confirmations.delete_list.title": "Elimina la llista?",
"confirmations.delete_list.title": "Eliminar la llista?",
"confirmations.discard_edit_media.confirm": "Descarta",
"confirmations.discard_edit_media.message": "Tens canvis no desats en la descripció del contingut o en la previsualització, els vols descartar?",
"confirmations.edit.confirm": "Edita",
"confirmations.edit.message": "Editant ara sobreescriuràs el missatge que estàs editant. Segur que vols continuar?",
"confirmations.edit.title": "Sobreescriu la publicació?",
"confirmations.edit.title": "Sobreescriure la publicació?",
"confirmations.logout.confirm": "Tanca la sessió",
"confirmations.logout.message": "Segur que vols tancar la sessió?",
"confirmations.logout.title": "Tanca la sessió?",
"confirmations.logout.title": "Tancar la sessió?",
"confirmations.mute.confirm": "Silencia",
"confirmations.redraft.confirm": "Esborra i reescriu",
"confirmations.redraft.message": "Segur que vols eliminar aquest tut i tornar a escriure'l? Es perdran tots els impulsos i els favorits, i les respostes al tut original quedaran aïllades.",
"confirmations.redraft.title": "Esborra i reescriu la publicació?",
"confirmations.redraft.title": "Esborrar i reescriure la publicació?",
"confirmations.reply.confirm": "Respon",
"confirmations.reply.message": "Si respons ara, sobreescriuràs el missatge que estàs editant. Segur que vols continuar?",
"confirmations.reply.title": "Sobreescriu la publicació?",
"confirmations.reply.title": "Sobreescriure la publicació?",
"confirmations.unfollow.confirm": "Deixa de seguir",
"confirmations.unfollow.message": "Segur que vols deixar de seguir {name}?",
"confirmations.unfollow.title": "Deixa de seguir l'usuari?",
"confirmations.unfollow.title": "Deixar de seguir l'usuari?",
"conversation.delete": "Elimina la conversa",
"conversation.mark_as_read": "Marca com a llegida",
"conversation.open": "Mostra la conversa",
Expand Down Expand Up @@ -510,7 +510,7 @@
"notification_requests.title": "Notificacions filtrades",
"notifications.clear": "Esborra les notificacions",
"notifications.clear_confirmation": "Segur que vols esborrar permanentment totes les teves notificacions?",
"notifications.clear_title": "Esborra les notificacions?",
"notifications.clear_title": "Esborrar les notificacions?",
"notifications.column_settings.admin.report": "Nous informes:",
"notifications.column_settings.admin.sign_up": "Registres nous:",
"notifications.column_settings.alert": "Notificacions d'escriptori",
Expand Down
Loading

0 comments on commit 88b54c1

Please sign in to comment.