Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
e4759c5a7f
5 changed files with 18 additions and 28 deletions
|
@ -14,9 +14,10 @@ const mapStateToProps = state => ({
|
||||||
hashtagWarning: ['public', 'public_unlisted', 'login'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && state.getIn(['compose', 'searchability']) !== 'public' && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
|
hashtagWarning: ['public', 'public_unlisted', 'login'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && state.getIn(['compose', 'searchability']) !== 'public' && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
|
||||||
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
|
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
|
||||||
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited',
|
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited',
|
||||||
|
limitedPostWarning: state.getIn(['compose', 'privacy']) === 'mutual',
|
||||||
});
|
});
|
||||||
|
|
||||||
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning }) => {
|
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning, limitedPostWarning }) => {
|
||||||
if (needsLockWarning) {
|
if (needsLockWarning) {
|
||||||
return <Warning message={<FormattedMessage id='compose_form.lock_disclaimer' defaultMessage='Your account is not {locked}. Anyone can follow you to view your follower-only posts.' values={{ locked: <a href='/settings/profile'><FormattedMessage id='compose_form.lock_disclaimer.lock' defaultMessage='locked' /></a> }} />} />;
|
return <Warning message={<FormattedMessage id='compose_form.lock_disclaimer' defaultMessage='Your account is not {locked}. Anyone can follow you to view your follower-only posts.' values={{ locked: <a href='/settings/profile'><FormattedMessage id='compose_form.lock_disclaimer.lock' defaultMessage='locked' /></a> }} />} />;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +40,10 @@ const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning
|
||||||
return <Warning message={<FormattedMessage id='compose_form.searchability_warning' defaultMessage='Self only searchability is not available other mastodon servers. Others can search your post.' />} />;
|
return <Warning message={<FormattedMessage id='compose_form.searchability_warning' defaultMessage='Self only searchability is not available other mastodon servers. Others can search your post.' />} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (limitedPostWarning) {
|
||||||
|
return <Warning message={<FormattedMessage id='compose_form.limited_post_warning' defaultMessage='Limited posts are NOT reached Misskey, normal Mastodon or so on.' />} />;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +52,7 @@ WarningWrapper.propTypes = {
|
||||||
hashtagWarning: PropTypes.bool,
|
hashtagWarning: PropTypes.bool,
|
||||||
directMessageWarning: PropTypes.bool,
|
directMessageWarning: PropTypes.bool,
|
||||||
searchabilityWarning: PropTypes.bool,
|
searchabilityWarning: PropTypes.bool,
|
||||||
|
limitedPostWarning: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(WarningWrapper);
|
export default connect(mapStateToProps)(WarningWrapper);
|
||||||
|
|
|
@ -146,6 +146,7 @@
|
||||||
"compose_form.direct_message_warning_learn_more": "もっと詳しく",
|
"compose_form.direct_message_warning_learn_more": "もっと詳しく",
|
||||||
"compose_form.encryption_warning": "Mastodonの投稿はエンドツーエンド暗号化に対応していません。安全に送受信されるべき情報をMastodonで共有しないでください。",
|
"compose_form.encryption_warning": "Mastodonの投稿はエンドツーエンド暗号化に対応していません。安全に送受信されるべき情報をMastodonで共有しないでください。",
|
||||||
"compose_form.hashtag_warning": "この投稿は公開設定ではないのでハッシュタグの一覧に表示されません。公開投稿だけがハッシュタグで検索できます。",
|
"compose_form.hashtag_warning": "この投稿は公開設定ではないのでハッシュタグの一覧に表示されません。公開投稿だけがハッシュタグで検索できます。",
|
||||||
|
"compose_form.limited_post_warning": "限定投稿は現状、ごく一部のMastodonサーバーにしか届きませんがいずれ改善されるでしょう(2023年8月時点でFedibirdとkmyblueのみです)",
|
||||||
"compose_form.lock_disclaimer": "あなたのアカウントは{locked}になっていません。誰でもあなたをフォローすることができ、フォロワー限定の投稿を見ることができます。",
|
"compose_form.lock_disclaimer": "あなたのアカウントは{locked}になっていません。誰でもあなたをフォローすることができ、フォロワー限定の投稿を見ることができます。",
|
||||||
"compose_form.lock_disclaimer.lock": "承認制",
|
"compose_form.lock_disclaimer.lock": "承認制",
|
||||||
"compose_form.markdown.marked": "Markdown有効",
|
"compose_form.markdown.marked": "Markdown有効",
|
||||||
|
|
|
@ -119,10 +119,7 @@ class ActivityPub::Activity
|
||||||
|
|
||||||
dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_actor: signed_fetch_actor)
|
dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_actor: signed_fetch_actor)
|
||||||
|
|
||||||
return if dereferencer.object.nil?
|
@object = dereferencer.object unless dereferencer.object.nil?
|
||||||
|
|
||||||
@object = dereferencer.object
|
|
||||||
@json = @object
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def signed_fetch_actor
|
def signed_fetch_actor
|
||||||
|
|
|
@ -118,7 +118,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_status_params
|
def process_status_params
|
||||||
@status_parser = ActivityPub::Parser::StatusParser.new(@json, followers_collection: @account.followers_url)
|
@status_parser = ActivityPub::Parser::StatusParser.new(@json['signature'].present? ? @object : @json, followers_collection: @account.followers_url)
|
||||||
|
|
||||||
@params = {
|
@params = {
|
||||||
uri: @status_parser.uri,
|
uri: @status_parser.uri,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
class SearchService < BaseService
|
class SearchService < BaseService
|
||||||
def call(query, account, limit, options = {})
|
def call(query, account, limit, options = {})
|
||||||
@query = query&.strip
|
@query = query&.strip
|
||||||
pull_query_commands
|
|
||||||
|
|
||||||
@account = account
|
@account = account
|
||||||
@options = options
|
@options = options
|
||||||
|
@ -28,9 +27,6 @@ class SearchService < BaseService
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
MIN_SCORE = 0.7
|
|
||||||
MIN_SCORE_RE = /MINSCORE=(((\d+\.\d+)|(\d+)){1,6})/
|
|
||||||
|
|
||||||
def perform_accounts_search!
|
def perform_accounts_search!
|
||||||
AccountSearchService.new.call(
|
AccountSearchService.new.call(
|
||||||
@query,
|
@query,
|
||||||
|
@ -45,22 +41,22 @@ class SearchService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_statuses_search!
|
def perform_statuses_search!
|
||||||
privacy_definition = parsed_query.apply(StatusesIndex.filter(terms: { searchability: %w(public private direct) }).filter(term: { searchable_by: @account.id }).track_scores(true).min_score(@min_score))
|
privacy_definition = parsed_query.apply(StatusesIndex.filter(terms: { searchability: %w(public private direct) }).filter(term: { searchable_by: @account.id }))
|
||||||
|
|
||||||
# 'direct' searchability posts are NOT in here because it's already added at previous line.
|
# 'direct' searchability posts are NOT in here because it's already added at previous line.
|
||||||
case @searchability
|
case @searchability
|
||||||
when 'public'
|
when 'public'
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' }).track_scores(true).min_score(@min_score))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' }))
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'private' }).filter(terms: { account_id: following_account_ids }).track_scores(true).min_score(@min_score)) unless following_account_ids.empty?
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'private' }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }))
|
||||||
when 'private', 'direct'
|
when 'private', 'direct'
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public private) }).filter(terms: { account_id: following_account_ids }).track_scores(true).min_score(@min_score)) unless following_account_ids.empty?
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public private) }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }))
|
||||||
when 'limited'
|
when 'limited'
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }))
|
||||||
end
|
end
|
||||||
|
|
||||||
definition = parsed_query.apply(StatusesIndex.min_score(@min_score).track_scores(true)).order(id: :desc)
|
definition = parsed_query.apply(StatusesIndex).order(id: :desc)
|
||||||
definition = definition.filter(term: { account_id: @options[:account_id] }) if @options[:account_id].present?
|
definition = definition.filter(term: { account_id: @options[:account_id] }) if @options[:account_id].present?
|
||||||
|
|
||||||
definition = definition.and(privacy_definition)
|
definition = definition.and(privacy_definition)
|
||||||
|
@ -137,16 +133,6 @@ class SearchService < BaseService
|
||||||
@options[:type].blank? || @options[:type] == 'statuses'
|
@options[:type].blank? || @options[:type] == 'statuses'
|
||||||
end
|
end
|
||||||
|
|
||||||
def pull_query_commands
|
|
||||||
@min_score = MIN_SCORE
|
|
||||||
|
|
||||||
min_score_result = @query.scan(MIN_SCORE_RE).first
|
|
||||||
return unless min_score_result
|
|
||||||
|
|
||||||
@min_score = min_score_result[1].to_f
|
|
||||||
@query = @query.gsub(MIN_SCORE_RE, '').strip
|
|
||||||
end
|
|
||||||
|
|
||||||
def parsed_query
|
def parsed_query
|
||||||
SearchQueryTransformer.new.apply(SearchQueryParser.new.parse(@query))
|
SearchQueryTransformer.new.apply(SearchQueryParser.new.parse(@query))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue