Merge remote-tracking branch 'parent/main' into kb_migration

This commit is contained in:
KMY 2023-08-26 18:32:39 +09:00
commit 3affa4177d
13 changed files with 146 additions and 85 deletions

View file

@ -90,6 +90,7 @@ const messages = defineMessages({
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
open: { id: 'compose.published.open', defaultMessage: 'Open' },
published: { id: 'compose.published.body', defaultMessage: 'Post published.' },
saved: { id: 'compose.saved.body', defaultMessage: 'Post saved.' },
});
export const ensureComposeIsVisible = (getState, routerHistory) => {
@ -253,7 +254,7 @@ export function submitCompose(routerHistory) {
}
dispatch(showAlert({
message: messages.published,
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),

View file

@ -587,7 +587,7 @@ class Status extends ImmutablePureComponent {
return (
<HotKeys handlers={handlers}>
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility_ex')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility_ex')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef} data-nosnippet={status.getIn(['account', 'noindex'], true) || undefined}>
{prepend}
<div className={classNames('status', `status-${status.get('visibility_ex')}`, { 'status-reply': !!status.get('in_reply_to_id'), 'status--in-thread': !!rootId, 'status--first-in-thread': previousId && (!connectUp || connectToRoot), muted: this.props.muted })} data-id={status.get('id')}>

View file

@ -142,6 +142,7 @@
"compose.language.search": "Search languages...",
"compose.published.body": "Post published.",
"compose.published.open": "Open",
"compose.saved.body": "Post saved.",
"compose_form.direct_message_warning_learn_more": "Learn more",
"compose_form.encryption_warning": "Posts on Mastodon are not end-to-end encrypted. Do not share any sensitive information over Mastodon.",
"compose_form.hashtag_warning": "This post won't be listed under any hashtag as it is not public. Only public posts can be searched by hashtag.",

View file

@ -10,7 +10,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
protected
def perform_query
[mastodon_version, ruby_version, postgresql_version, redis_version]
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version].compact
end
def mastodon_version
@ -57,6 +57,22 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
}
end
def elasticsearch_version
return unless Chewy.enabled?
client_info = Chewy.client.info
version = client_info.dig('version', 'number')
{
key: 'elasticsearch',
human_key: client_info.dig('version', 'distribution') == 'opensearch' ? 'OpenSearch' : 'Elasticsearch',
value: version,
human_value: version,
}
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error
nil
end
def redis_info
@redis_info ||= if redis.is_a?(Redis::Namespace)
redis.redis.info

View file

@ -6,6 +6,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
AccountsIndex,
TagsIndex,
StatusesIndex,
PublicStatusesIndex,
].freeze
def skip?
@ -85,7 +86,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
def mismatched_indexes
@mismatched_indexes ||= INDEXES.filter_map do |klass|
klass.index_name if Chewy.client.indices.get_mapping[klass.index_name]&.deep_symbolize_keys != klass.mappings_hash
klass.base_name if Chewy.client.indices.get_mapping[klass.index_name]&.deep_symbolize_keys != klass.mappings_hash
end
end

View file

@ -24,7 +24,7 @@ class StatusesSearchService < BaseService
definition_should << searchability_private if %i(public private).include?(@searchability)
definition = parsed_query.apply(
StatusesIndex.filter(
Chewy::Search::Request.new(StatusesIndex, PublicStatusesIndex).filter(
bool: {
should: definition_should,
minimum_should_match: 1,
@ -32,10 +32,7 @@ class StatusesSearchService < BaseService
)
)
# This is the best way to submit identical queries to multi-indexes though chewy
definition.instance_variable_get(:@parameters)[:indices].value[:indices] << PublicStatusesIndex
results = definition.collapse(field: :id).order(_id: { order: :desc }).limit(@limit).offset(@offset).objects.compact
results = definition.collapse(field: :id).order(id: { order: :desc }).limit(@limit).offset(@offset).objects.compact
account_ids = results.map(&:account_id)
account_domains = results.map(&:account_domain)
preloaded_relations = @account.relations_map(account_ids, account_domains)
@ -47,13 +44,7 @@ class StatusesSearchService < BaseService
def publicly_searchable
{
bool: {
must_not: {
exists: {
field: 'searchable_by',
},
},
},
term: { _index: PublicStatusesIndex.index_name },
}
end
@ -62,9 +53,7 @@ class StatusesSearchService < BaseService
bool: {
must: [
{
exists: {
field: 'searchable_by',
},
term: { _index: StatusesIndex.index_name },
},
{
exists: {