Skip to content

Commit

Permalink
Merge pull request #937 from kmycode/kb-draft-16.1
Browse files Browse the repository at this point in the history
Release: 16.1
  • Loading branch information
kmycode authored Dec 4, 2024
2 parents d1e6027 + 0c3fab4 commit 4a0bd8a
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 9 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

All notable changes to this project will be documented in this file.

## [4.3.2] - 2024-12-03

### Added

- Add `tootctl feeds vacuum` (#33065 by @ClearlyClaire)
- Add error message when user tries to follow their own account (#31910 by @lenikadali)
- Add client_secret_expires_at to OAuth Applications (#30317 by @ThisIsMissEm)

### Changed

- Change design of Content Warnings and filters (#32543 by @ClearlyClaire)

### Fixed

- Fix processing incoming post edits with mentions to unresolvable accounts (#33129 by @ClearlyClaire)
- Fix error when including multiple instances of `embed.js` (#33107 by @YKWeyer)
- Fix inactive users' timelines being backfilled on follow and unsuspend (#33094 by @ClearlyClaire)
- Fix direct inbox delivery pushing posts into inactive followers' timelines (#33067 by @ClearlyClaire)
- Fix `TagFollow` records not being correctly handled in account operations (#33063 by @ClearlyClaire)
- Fix pushing hashtag-followed posts to feeds of inactive users (#33018 by @Gargron)
- Fix duplicate notifications in notification groups when using slow mode (#33014 by @ClearlyClaire)
- Fix posts made in the future being allowed to trend (#32996 by @ClearlyClaire)
- Fix uploading higher-than-wide GIF profile picture with libvips enabled (#32911 by @ClearlyClaire)
- Fix domain attribution field having autocorrect and autocapitalize enabled (#32903 by @ClearlyClaire)
- Fix titles being escaped twice (#32889 by @ClearlyClaire)
- Fix list creation limit check (#32869 by @ClearlyClaire)
- Fix error in `tootctl email_domain_blocks` when supplying `--with-dns-records` (#32863 by @mjankowski)
- Fix `min_id` and `max_id` causing error in search API (#32857 by @Gargron)
- Fix inefficiencies when processing removal of posts that use featured tags (#32787 by @ClearlyClaire)
- Fix alt-text pop-in not using the translated description (#32766 by @ClearlyClaire)
- Fix preview cards with long titles erroneously causing layout changes (#32678 by @ClearlyClaire)
- Fix embed modal layout on mobile (#32641 by @DismalShadowX)
- Fix and improve batch attachment deletion handling when using OpenStack Swift (#32637 by @hugogameiro)
- Fix blocks not being applied on link timeline (#32625 by @tribela)
- Fix follow counters being incorrectly changed (#32622 by @oneiros)
- Fix 'unknown' media attachment type rendering (#32613 and #32713 by @ThisIsMissEm and @renatolond)
- Fix tl language native name (#32606 by @seav)

### Security

- Update dependencies

## [4.3.1] - 2024-10-21

### Added
Expand Down
4 changes: 4 additions & 0 deletions app/lib/feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def unpush_from_antenna(antenna, status, update: false)
# @param [Account] into_account
# @return [void]
def merge_into_home(from_account, into_account)
return unless into_account.user&.signed_in_recently?

timeline_key = key(:home, into_account.id)
aggregate = into_account.user&.aggregates_reblogs?
query = from_account.statuses.list_eligible_visibility.includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
Expand All @@ -151,6 +153,8 @@ def merge_into_home(from_account, into_account)
# @param [List] list
# @return [void]
def merge_into_list(from_account, list)
return unless list.account.user&.signed_in_recently?

timeline_key = key(:list, list.id)
aggregate = list.account.user&.aggregates_reblogs?
query = from_account.statuses.list_eligible_visibility.includes(:preloadable_poll, :media_attachments, reblog: :account).limit(FeedManager::MAX_ITEMS / 4)
Expand Down
12 changes: 12 additions & 0 deletions app/services/activitypub/process_status_update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def update_tags!
def update_mentions!
previous_mentions = @status.active_mentions.includes(:account).to_a
current_mentions = []
unresolved_mentions = []

@raw_mentions.each do |href|
next if href.blank?
Expand All @@ -274,6 +275,12 @@ def update_mentions!
mention ||= account.mentions.new(status: @status)

current_mentions << mention
rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS
# Since previous mentions are about already-known accounts,
# they don't try to resolve again and won't fall into this case.
# In other words, this failure case is only for new mentions and won't
# affect `removed_mentions` so they can safely be retried asynchronously
unresolved_mentions << href
end

current_mentions.each do |mention|
Expand All @@ -286,6 +293,11 @@ def update_mentions!
removed_mentions = previous_mentions - current_mentions

Mention.where(id: removed_mentions.map(&:id)).update_all(silent: true) unless removed_mentions.empty?

# Queue unresolved mentions for later
unresolved_mentions.uniq.each do |uri|
MentionResolveWorker.perform_in(rand(30...600).seconds, @status.id, uri, { 'request_id' => @request_id })
end
end

def update_emojis!
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
web:
# You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes
build: .
image: kmyblue:16.0
image: kmyblue:16.1
restart: always
env_file: .env.production
command: bundle exec puma -C config/puma.rb
Expand All @@ -83,7 +83,7 @@ services:
build:
dockerfile: ./streaming/Dockerfile
context: .
image: kmyblue-streaming:16.0
image: kmyblue-streaming:16.1
restart: always
env_file: .env.production
command: node ./streaming/index.js
Expand All @@ -101,7 +101,7 @@ services:

sidekiq:
build: .
image: kmyblue:16.0
image: kmyblue:16.1
restart: always
env_file: .env.production
command: bundle exec sidekiq
Expand Down
33 changes: 33 additions & 0 deletions lib/mastodon/cli/feeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Mastodon::CLI
class Feeds < Base
include Redisable
include DatabaseHelper

option :all, type: :boolean, default: false
option :concurrency, type: :numeric, default: 5, aliases: [:c]
Expand Down Expand Up @@ -59,6 +60,38 @@ def remove_legacy
say('OK', :green)
end

desc 'vacuum', 'Remove home feeds of inactive users from Redis'
long_desc <<-LONG_DESC
Running this task should not be needed in most cases, as Mastodon will
automatically clean up feeds from inactive accounts every day.
However, this task is more aggressive in order to clean up feeds that
may have been missed because of bugs or database mishaps.
LONG_DESC
def vacuum
with_read_replica do
say('Deleting orphaned home feeds…')
redis.scan_each(match: 'feed:home:*').each_slice(1000) do |keys|
ids = keys.map { |key| key.split(':')[2] }.compact_blank

known_ids = User.confirmed.signed_in_recently.where(account_id: ids).pluck(:account_id)

keys_to_delete = keys.filter { |key| known_ids.exclude?(key.split(':')[2]&.to_i) }
redis.del(keys_to_delete)
end

say('Deleting orphaned list feeds…')
redis.scan_each(match: 'feed:list:*').each_slice(1000) do |keys|
ids = keys.map { |key| key.split(':')[2] }.compact_blank

known_ids = List.where(account_id: User.confirmed.signed_in_recently.select(:account_id)).where(id: ids).pluck(:id)

keys_to_delete = keys.filter { |key| known_ids.exclude?(key.split(':')[2]&.to_i) }
redis.del(keys_to_delete)
end
end
end

private

def active_user_accounts
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def kmyblue_major
end

def kmyblue_minor
0
1
end

def kmyblue_flag
Expand Down
7 changes: 2 additions & 5 deletions public/embed.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// @ts-check

const allowedPrefixes = (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.dataset.allowedPrefixes) ? document.currentScript.dataset.allowedPrefixes.split(' ') : [];

(function () {
(function (allowedPrefixes) {
'use strict';

/**
Expand Down Expand Up @@ -127,4 +124,4 @@ const allowedPrefixes = (document.currentScript && document.currentScript.tagNam
container.appendChild(iframe);
});
});
})();
})((document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.dataset.allowedPrefixes) ? document.currentScript.dataset.allowedPrefixes.split(' ') : []);

0 comments on commit 4a0bd8a

Please # to comment.