Add keep_privacy setting
This commit is contained in:
parent
197f0b8ea3
commit
5daf9cdf6e
9 changed files with 31 additions and 3 deletions
|
@ -90,6 +90,7 @@ const initialState = ImmutableMap({
|
|||
suggestion_token: null,
|
||||
suggestions: ImmutableList(),
|
||||
default_privacy: 'public',
|
||||
stay_privacy: false,
|
||||
default_searchability: 'private',
|
||||
default_sensitive: false,
|
||||
default_language: 'en',
|
||||
|
@ -103,6 +104,7 @@ const initialState = ImmutableMap({
|
|||
focusY: 0,
|
||||
dirty: false,
|
||||
}),
|
||||
posted_on_this_session: false,
|
||||
});
|
||||
|
||||
const initialPoll = ImmutableMap({
|
||||
|
@ -130,15 +132,23 @@ function clearAll(state) {
|
|||
map.set('markdown', false);
|
||||
map.set('is_submitting', false);
|
||||
map.set('is_changing_upload', false);
|
||||
if (!state.get('stay_privacy') || state.get('in_reply_to') || !state.get('posted_on_this_session')) {
|
||||
map.set('privacy', state.get('default_privacy'));
|
||||
map.set('circle_id', null);
|
||||
}
|
||||
if (state.get('stay_privacy') && !state.get('in_reply_to')) {
|
||||
map.set('default_privacy', state.get('privacy'));
|
||||
}
|
||||
if (!state.get('in_reply_to')) {
|
||||
map.set('posted_on_this_session', true);
|
||||
}
|
||||
map.set('in_reply_to', null);
|
||||
map.set('privacy', state.get('default_privacy'));
|
||||
map.set('searchability', state.get('default_searchability'));
|
||||
map.set('sensitive', state.get('default_sensitive'));
|
||||
map.set('language', state.get('default_language'));
|
||||
map.update('media_attachments', list => list.clear());
|
||||
map.set('poll', null);
|
||||
map.set('idempotencyKey', uuid());
|
||||
map.set('circle_id', null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,10 @@ module HasUserSettings
|
|||
settings['default_privacy'] || (account.locked? ? 'private' : 'public')
|
||||
end
|
||||
|
||||
def setting_stay_privacy
|
||||
settings['stay_privacy']
|
||||
end
|
||||
|
||||
def setting_default_reblog_privacy
|
||||
settings['default_reblog_privacy'] || 'unset'
|
||||
end
|
||||
|
|
|
@ -21,6 +21,7 @@ class UserSettings
|
|||
setting :default_language, default: nil
|
||||
setting :default_sensitive, default: false
|
||||
setting :default_privacy, default: nil, in: %w(public public_unlisted login unlisted private)
|
||||
setting :stay_privacy, default: false
|
||||
setting :default_reblog_privacy, default: nil
|
||||
setting :default_searchability, default: :direct, in: %w(public private direct limited)
|
||||
setting :disallow_unlisted_public_searchability, default: false
|
||||
|
|
|
@ -73,6 +73,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
if object.current_account
|
||||
store[:me] = object.current_account.id.to_s
|
||||
store[:default_privacy] = object.visibility || object.current_account.user.setting_default_privacy
|
||||
store[:stay_privacy] = object.current_account.user.setting_stay_privacy
|
||||
store[:default_searchability] = object.searchability || object.current_account.user.setting_default_searchability
|
||||
store[:default_sensitive] = object.current_account.user.setting_default_sensitive
|
||||
store[:default_language] = object.current_account.user.preferred_posting_language
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class REST::PreferencesSerializer < ActiveModel::Serializer
|
||||
attribute :posting_default_privacy, key: 'posting:default:visibility'
|
||||
attribute :posting_stay_privacy, key: 'posting:keep:visibility'
|
||||
attribute :posting_default_searchability, key: 'posting:default:searchability'
|
||||
attribute :posting_default_sensitive, key: 'posting:default:sensitive'
|
||||
attribute :posting_default_language, key: 'posting:default:language'
|
||||
|
@ -14,6 +15,10 @@ class REST::PreferencesSerializer < ActiveModel::Serializer
|
|||
object.user.setting_default_privacy
|
||||
end
|
||||
|
||||
def posting_stay_privacy
|
||||
object.user.setting_stay_privacy
|
||||
end
|
||||
|
||||
def posting_default_searchability
|
||||
object.user.setting_default_searchability
|
||||
end
|
||||
|
|
|
@ -169,6 +169,8 @@ class PostStatusService < BaseService
|
|||
end
|
||||
|
||||
def postprocess_status!
|
||||
@account.user.update!(settings_attributes: { default_privacy: @options[:visibility] }) if @account.user&.setting_stay_privacy && !@status.reply? && %i(public public_unlisted login unlisted private).include?(@status.visibility.to_sym)
|
||||
|
||||
process_hashtags_service.call(@status)
|
||||
ProcessReferencesWorker.perform_async(@status.id, @reference_ids, [])
|
||||
Trends.tags.register(@status)
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
.fields-group.fields-row__column.fields-row__column-6
|
||||
= ff.input :default_language, collection: [nil] + filterable_languages, wrapper: :with_label, label_method: ->(locale) { locale.nil? ? I18n.t('statuses.default_language') : native_locale_name(locale) }, required: false, include_blank: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_language')
|
||||
|
||||
.fields-group
|
||||
= ff.input :stay_privacy, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stay_privacy')
|
||||
|
||||
.fields-group
|
||||
= ff.input :'web.enable_login_privacy', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_login_privacy'), hint: false
|
||||
|
||||
|
|
|
@ -245,6 +245,7 @@ en:
|
|||
setting_reject_unlisted_subscription: Reject sending unlisted posts to Misskey, Calckey
|
||||
setting_send_without_domain_blocks: Send your post to all server with administrator set as rejecting-post-server for protect you [DEPRECATED]
|
||||
setting_show_application: Disclose application used to send posts
|
||||
setting_stay_privacy: Not change privacy after post
|
||||
setting_stop_emoji_reaction_streaming: Disable stamp streamings
|
||||
setting_system_font_ui: Use system's default font
|
||||
setting_theme: Site theme
|
||||
|
|
|
@ -247,13 +247,14 @@ ja:
|
|||
setting_hide_network: 繋がりを隠す
|
||||
setting_hide_recent_emojis: 絵文字ピッカーで最近使用した絵文字を隠す(リアクションデッキのみを表示する)
|
||||
setting_hide_statuses_count: 投稿数を隠す
|
||||
setting_stay_privacy: 投稿時に公開範囲を保存する
|
||||
setting_noai: 自分のコンテンツのAI学習利用に対して不快感を表明する
|
||||
setting_public_post_to_unlisted: サードパーティアプリから投稿するとき、公開投稿をローカル公開に変更する
|
||||
setting_reduce_motion: アニメーションの動きを減らす
|
||||
setting_reject_public_unlisted_subscription: Misskey系サーバーに「ローカル公開」投稿を「フォロワーのみ」に変換して配送する
|
||||
setting_reject_unlisted_subscription: Misskey系サーバーに「未収載」投稿を「フォロワーのみ」に変換して配送する
|
||||
setting_send_without_domain_blocks: 管理人の設定した配送停止設定を拒否する (非推奨)
|
||||
setting_show_application: 送信したアプリを開示する
|
||||
setting_stay_privacy: 投稿時に公開範囲を保存する
|
||||
setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する
|
||||
setting_system_font_ui: システムのデフォルトフォントを使う
|
||||
setting_theme: サイトテーマ
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue