diff --git a/app/javascript/flavours/glitch/actions/search.ts b/app/javascript/flavours/glitch/actions/search.ts index 30a03724b1..d0c3e01c77 100644 --- a/app/javascript/flavours/glitch/actions/search.ts +++ b/app/javascript/flavours/glitch/actions/search.ts @@ -124,10 +124,15 @@ export const clickSearchResult = createAppAsyncThunk( export const forgetSearchResult = createAppAsyncThunk( 'search/forgetResult', - (q: string, { dispatch, getState }) => { + ( + { q, type }: { q: string; type?: RecentSearchType }, + { dispatch, getState }, + ) => { const previous = getState().search.recent; const me = getState().meta.get('me') as string; - const current = previous.filter((result) => result.q !== q); + const current = previous.filter( + (result) => result.q !== q || result.type !== type, + ); searchHistory.set(me, current); dispatch(updateSearchHistory(current)); diff --git a/app/javascript/flavours/glitch/features/compose/components/search.tsx b/app/javascript/flavours/glitch/features/compose/components/search.tsx index ea503fb313..97ab67c6c2 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.tsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.tsx @@ -221,7 +221,7 @@ export const Search: React.FC<{ }, forget: (e) => { e.stopPropagation(); - void dispatch(forgetSearchResult(search.q)); + void dispatch(forgetSearchResult(search)); }, })); @@ -497,8 +497,10 @@ export const Search: React.FC<{
{recentOptions.length > 0 ? ( recentOptions.map(({ label, key, action, forget }, i) => ( - - +
)) ) : (
diff --git a/app/javascript/mastodon/actions/search.ts b/app/javascript/mastodon/actions/search.ts index 13a4ee4432..1e57c30715 100644 --- a/app/javascript/mastodon/actions/search.ts +++ b/app/javascript/mastodon/actions/search.ts @@ -121,10 +121,15 @@ export const clickSearchResult = createAppAsyncThunk( export const forgetSearchResult = createAppAsyncThunk( 'search/forgetResult', - (q: string, { dispatch, getState }) => { + ( + { q, type }: { q: string; type?: RecentSearchType }, + { dispatch, getState }, + ) => { const previous = getState().search.recent; const me = getState().meta.get('me') as string; - const current = previous.filter((result) => result.q !== q); + const current = previous.filter( + (result) => result.q !== q || result.type !== type, + ); searchHistory.set(me, current); dispatch(updateSearchHistory(current)); diff --git a/app/javascript/mastodon/features/compose/components/search.tsx b/app/javascript/mastodon/features/compose/components/search.tsx index 84e11e44b5..2186ff36ab 100644 --- a/app/javascript/mastodon/features/compose/components/search.tsx +++ b/app/javascript/mastodon/features/compose/components/search.tsx @@ -221,7 +221,7 @@ export const Search: React.FC<{ }, forget: (e) => { e.stopPropagation(); - void dispatch(forgetSearchResult(search.q)); + void dispatch(forgetSearchResult(search)); }, })); @@ -497,8 +497,10 @@ export const Search: React.FC<{
{recentOptions.length > 0 ? ( recentOptions.map(({ label, key, action, forget }, i) => ( - - +
)) ) : (
diff --git a/app/models/trends/statuses.rb b/app/models/trends/statuses.rb index 3e41be1b7f..680bae8b28 100644 --- a/app/models/trends/statuses.rb +++ b/app/models/trends/statuses.rb @@ -89,7 +89,15 @@ class Trends::Statuses < Trends::Base private def eligible?(status) - status.created_at.past? && status.public_visibility? && status.account.discoverable? && !status.account.silenced? && !status.account.sensitized? && (status.spoiler_text.blank? || Setting.trending_status_cw) && !status.sensitive? && !status.reply? && valid_locale?(status.language) + status.created_at.past? && + status.public_visibility? && + status.account.discoverable? && + !status.account.silenced? && + !status.account.sensitized? && + (status.spoiler_text.blank? || Setting.trending_status_cw) && + !status.sensitive? && + !status.reply? && + valid_locale?(status.language) end def calculate_scores(statuses, at_time) diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 2de9cd250f..1b9d051b38 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -15,6 +15,7 @@ class SuspendAccountService < BaseService unmerge_from_home_timelines! unmerge_from_list_timelines! privatize_media_attachments! + remove_from_trends! end private @@ -101,6 +102,10 @@ class SuspendAccountService < BaseService end end + def remove_from_trends! + StatusTrend.where(account: @account).delete_all + end + def signed_activity_json @signed_activity_json ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) end diff --git a/config/initializers/cookie_rotator.rb b/config/initializers/cookie_rotator.rb new file mode 100644 index 0000000000..ccc2c6b21f --- /dev/null +++ b/config/initializers/cookie_rotator.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# TODO: remove this file some time after 4.3.0 + +Rails.application.config.after_initialize do + Rails.application.config.action_dispatch.cookies_rotations.tap do |cookies| + authenticated_encrypted_cookie_salt = Rails.application.config.action_dispatch.authenticated_encrypted_cookie_salt + signed_cookie_salt = Rails.application.config.action_dispatch.signed_cookie_salt + + secret_key_base = Rails.application.secret_key_base + + key_generator = ActiveSupport::KeyGenerator.new( + secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1 + ) + key_len = ActiveSupport::MessageEncryptor.key_len + + old_encrypted_secret = key_generator.generate_key(authenticated_encrypted_cookie_salt, key_len) + old_signed_secret = key_generator.generate_key(signed_cookie_salt) + + cookies.rotate :encrypted, old_encrypted_secret + cookies.rotate :signed, old_signed_secret + end +end