mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-11 14:30:35 +00:00
Merge pull request #3086 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 8224178e8c
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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<{
|
||||
<div className='search__popout__menu'>
|
||||
{recentOptions.length > 0 ? (
|
||||
recentOptions.map(({ label, key, action, forget }, i) => (
|
||||
<button
|
||||
<div
|
||||
key={key}
|
||||
tabIndex={0}
|
||||
role='button'
|
||||
onMouseDown={action}
|
||||
className={classNames(
|
||||
'search__popout__menu__item search__popout__menu__item--flex',
|
||||
@@ -509,7 +511,7 @@ export const Search: React.FC<{
|
||||
<button className='icon-button' onMouseDown={forget}>
|
||||
<Icon id='times' icon={CloseIcon} />
|
||||
</button>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className='search__popout__menu__message'>
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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<{
|
||||
<div className='search__popout__menu'>
|
||||
{recentOptions.length > 0 ? (
|
||||
recentOptions.map(({ label, key, action, forget }, i) => (
|
||||
<button
|
||||
<div
|
||||
key={key}
|
||||
tabIndex={0}
|
||||
role='button'
|
||||
onMouseDown={action}
|
||||
className={classNames(
|
||||
'search__popout__menu__item search__popout__menu__item--flex',
|
||||
@@ -509,7 +511,7 @@ export const Search: React.FC<{
|
||||
<button className='icon-button' onMouseDown={forget}>
|
||||
<Icon id='times' icon={CloseIcon} />
|
||||
</button>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className='search__popout__menu__message'>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
23
config/initializers/cookie_rotator.rb
Normal file
23
config/initializers/cookie_rotator.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user