Skip to content

Commit

Permalink
Merge pull request #2833 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to 611533c
  • Loading branch information
ClearlyClaire authored Sep 3, 2024
2 parents ec3b81f + e9adba6 commit c461a6a
Show file tree
Hide file tree
Showing 53 changed files with 436 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ services:
hard: -1

libretranslate:
image: libretranslate/libretranslate:v1.5.7
image: libretranslate/libretranslate:v1.6.0
restart: unless-stopped
volumes:
- lt-data:/home/libretranslate/.local
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ group :test do
gem 'rails-controller-testing', '~> 1.0'

# Validate schemas in specs
gem 'json-schema', '~> 4.0'
gem 'json-schema', '~> 5.0'

# Test harness fo rack components
gem 'rack-test', '~> 2.1'
Expand Down Expand Up @@ -210,7 +210,7 @@ group :development, :test do
gem 'test-prof'

# RSpec runner for rails
gem 'rspec-rails', '~> 6.0'
gem 'rspec-rails', '~> 7.0'
end

group :production do
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
inline_svg (1.9.0)
inline_svg (1.10.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
Expand All @@ -373,8 +373,8 @@ GEM
json-ld-preloaded (3.3.0)
json-ld (~> 3.3)
rdf (~> 3.3)
json-schema (4.3.1)
addressable (>= 2.8)
json-schema (5.0.0)
addressable (~> 2.8)
jsonapi-renderer (0.2.2)
jwt (2.7.1)
kaminari (1.2.2)
Expand Down Expand Up @@ -724,10 +724,10 @@ GEM
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.4)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-rails (7.0.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
Expand Down Expand Up @@ -906,7 +906,7 @@ GEM
xorcist (1.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.17)
zeitwerk (2.6.18)

PLATFORMS
ruby
Expand Down Expand Up @@ -965,7 +965,7 @@ DEPENDENCIES
irb (~> 1.8)
json-ld
json-ld-preloaded (~> 3.2)
json-schema (~> 4.0)
json-schema (~> 5.0)
kaminari (~> 1.2)
kt-paperclip (~> 7.2)
letter_opener (~> 1.8)
Expand Down Expand Up @@ -1024,7 +1024,7 @@ DEPENDENCIES
redis-namespace (~> 1.10)
rqrcode (~> 2.2)
rspec-github (~> 2.4)
rspec-rails (~> 6.0)
rspec-rails (~> 7.0)
rspec-sidekiq (~> 5.0)
rubocop
rubocop-capybara
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/jsonld_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,6 @@ def body_to_json(body, compare_id: nil)
nil
end

def merge_context(context, new_context)
if context.is_a?(Array)
context << new_context
else
[context, new_context]
end
end

def response_successful?(response)
(200...300).cover?(response.code)
end
Expand Down
25 changes: 24 additions & 1 deletion app/javascript/flavours/glitch/reducers/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ function processNewNotification(
}

function trimNotifications(state: NotificationGroupsState) {
if (state.scrolledToTop) {
if (state.scrolledToTop && state.groups.length > NOTIFICATIONS_TRIM_LIMIT) {
state.groups.splice(NOTIFICATIONS_TRIM_LIMIT);
ensureTrailingGap(state.groups);
}
}

Expand Down Expand Up @@ -400,6 +401,28 @@ function ensureLeadingGap(
}
}

// Ensure the groups list ends with a gap suitable for loading more, mutating it to append one if needed
function ensureTrailingGap(
groups: NotificationGroupsState['groups'],
): NotificationGap {
const groupOrGap = groups.at(-1);

if (groupOrGap?.type === 'gap') {
// We're expecting older notifications, so discard sinceId if it's set
groupOrGap.sinceId = undefined;

return groupOrGap;
} else {
const gap: NotificationGap = {
type: 'gap',
maxId: groupOrGap?.page_min_id,
};

groups.push(gap);
return gap;
}
}

export const notificationGroupsReducer = createReducer<NotificationGroupsState>(
initialState,
(builder) => {
Expand Down
89 changes: 89 additions & 0 deletions app/javascript/mastodon/locales/fy.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/ia.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"block_modal.you_wont_see_mentions": "Tu non videra le messages que mentiona iste persona.",
"boost_modal.combo": "Tu pote premer {combo} pro saltar isto le proxime vice",
"boost_modal.reblog": "Impulsar le message?",
"boost_modal.undo_reblog": "Cessar de impulsar le message?",
"bundle_column_error.copy_stacktrace": "Copiar reporto de error",
"bundle_column_error.error.body": "Le pagina requestate non pote esser visualisate. Pote esser a causa de un defecto in nostre codice o de un problema de compatibilitate del navigator.",
"bundle_column_error.error.title": "Oh, no!",
Expand Down
25 changes: 24 additions & 1 deletion app/javascript/mastodon/reducers/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ function processNewNotification(
}

function trimNotifications(state: NotificationGroupsState) {
if (state.scrolledToTop) {
if (state.scrolledToTop && state.groups.length > NOTIFICATIONS_TRIM_LIMIT) {
state.groups.splice(NOTIFICATIONS_TRIM_LIMIT);
ensureTrailingGap(state.groups);
}
}

Expand Down Expand Up @@ -400,6 +401,28 @@ function ensureLeadingGap(
}
}

// Ensure the groups list ends with a gap suitable for loading more, mutating it to append one if needed
function ensureTrailingGap(
groups: NotificationGroupsState['groups'],
): NotificationGap {
const groupOrGap = groups.at(-1);

if (groupOrGap?.type === 'gap') {
// We're expecting older notifications, so discard sinceId if it's set
groupOrGap.sinceId = undefined;

return groupOrGap;
} else {
const gap: NotificationGap = {
type: 'gap',
maxId: groupOrGap?.page_min_id,
};

groups.push(gap);
return gap;
}
}

export const notificationGroupsReducer = createReducer<NotificationGroupsState>(
initialState,
(builder) => {
Expand Down
4 changes: 0 additions & 4 deletions app/models/mention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ class Mention < ApplicationRecord
to: :account,
prefix: true
)

def active?
!silent?
end
end
4 changes: 0 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@ def unconfirmed_or_pending?
unconfirmed? || pending?
end

def inactive_message
approved? ? super : :pending
end

def approve!
return if approved?

Expand Down
2 changes: 1 addition & 1 deletion app/services/post_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def validate_media!

@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(Status::MEDIA_ATTACHMENTS_LIMIT).map(&:to_i))

not_found_ids = @options[:media_ids] - @media.map(&:id)
not_found_ids = @options[:media_ids].map(&:to_i) - @media.map(&:id)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_found', ids: not_found_ids.join(', ')) if not_found_ids.any?

raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:audio_or_video?)
Expand Down
2 changes: 1 addition & 1 deletion app/services/update_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def validate_media!

media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(Status::MEDIA_ATTACHMENTS_LIMIT).map(&:to_i)).to_a

not_found_ids = @options[:media_ids] - media_attachments.map(&:id)
not_found_ids = @options[:media_ids].map(&:to_i) - media_attachments.map(&:id)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_found', ids: not_found_ids.join(', ')) if not_found_ids.any?

raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if media_attachments.size > 1 && media_attachments.find(&:audio_or_video?)
Expand Down
1 change: 1 addition & 0 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ ca:
media_attachments:
validations:
images_and_video: No es pot adjuntar un vídeo a una publicació que ja contingui imatges
not_found: No s'ha trobat el contingut multimèdia %{ids} o ja s'ha adjuntat a una altra publicació
not_ready: No es poden adjuntar fitxers que no s'hagin acabat de processar. Torna-ho a provar en un moment!
too_many: No es poden adjuntar més de 4 fitxers
migrations:
Expand Down
1 change: 1 addition & 0 deletions config/locales/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ da:
media_attachments:
validations:
images_and_video: En video kan ikke vedhæftes et indlæg med billedindhold
not_found: Mediet %{ids} ikke fundet eller allerede vedhæftet andet indlæg
not_ready: Filer under behandling kan ikke vedhæftes. Forsøg igen senere!
too_many: Maks. 4 filer kan vedhæftes
migrations:
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ de:
media_attachments:
validations:
images_and_video: Es kann kein Video an einen Beitrag angehängt werden, der bereits Bilder enthält
not_found: Medien %{ids} nicht verfügbar oder bereits an einen anderen Beitrag angehängt
not_ready: Dateien, die noch nicht verarbeitet wurden, können nicht angehängt werden. Versuche es gleich noch einmal!
too_many: Mehr als vier Dateien können nicht angehängt werden
migrations:
Expand Down
1 change: 1 addition & 0 deletions config/locales/doorkeeper.fy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fy:
access_denied: De boarne-eigener of autorisaasjeserver hat it fersyk wegere.
credential_flow_not_configured: De wachtwurdgegevens-flow fan de boarne-eigener is mislearre, omdat Doorkeeper.configure.resource_owner_from_credentials net ynsteld is.
invalid_client: Clientferifikaasje is mislearre troch in ûnbekende client, ûntbrekkende client-autentikaasje of in net stipe autentikaasjemetoade.
invalid_code_challenge_method: De koadechallengemetoade moat S256 wezen, plain wurdt net stipe.
invalid_grant: De opjûne autorisaasje is ûnjildich, ferrûn, ynlutsen, komt net oerien mei de redirect-URI dy’t opjûn is of útjûn waard oan in oere client.
invalid_redirect_uri: De opjûne redirect-URI is ûnjildich.
invalid_request:
Expand Down
1 change: 1 addition & 0 deletions config/locales/es-AR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ es-AR:
media_attachments:
validations:
images_and_video: No se puede adjuntar un video a un mensaje que ya contenga imágenes
not_found: Medios %{ids} no encontrados o ya adjuntados a otro mensaje
not_ready: No se pueden adjuntar archivos que no se han terminado de procesar. ¡Intentá de nuevo en un rato!
too_many: No se pueden adjuntar más de 4 archivos
migrations:
Expand Down
1 change: 1 addition & 0 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ fi:
media_attachments:
validations:
images_and_video: Videota ei voi liittää tilapäivitykseen, jossa on jo kuvia
not_found: Mediaa %{ids} ei löytynyt, tai se on jo liitetty toiseen julkaisuun
not_ready: Ei voi liittää tiedostoja, joiden käsittely on kesken. Yritä hetken kuluttua uudelleen!
too_many: Tiedostoja voi liittää enintään 4
migrations:
Expand Down
1 change: 1 addition & 0 deletions config/locales/fo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ fo:
media_attachments:
validations:
images_and_video: Kann ikki viðfesta sjónfílu til ein post, sum longu inniheldur myndir
not_found: Miðilin %{ids} ikki funnin ella longu knýttur at øðrum posti
not_ready: Kann ikki viðfesta fílur, sum ikki eru liðugt viðgjørdar. Roynd aftur um eina løtu!
too_many: Kann ikki viðfest fleiri enn 4 fílur
migrations:
Expand Down
Loading

0 comments on commit c461a6a

Please sign in to comment.