1
0
Fork 0
forked from gitea/nas

Add public post to unlisted setting

This commit is contained in:
KMY 2023-04-10 14:08:43 +09:00
parent dadd77788d
commit bc48000dce
7 changed files with 17 additions and 3 deletions

View file

@ -36,6 +36,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_default_privacy,
:setting_default_searchability,
:setting_default_sensitive,
:setting_public_post_to_unlisted,
:setting_default_language,
:setting_unfollow_modal,
:setting_boost_modal,

View file

@ -20,6 +20,7 @@ class UserSettingsDecorator
user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy')
user.settings['default_searchability']=default_searchability_preference if change?('setting_default_searchability')
user.settings['default_sensitive'] = default_sensitive_preference if change?('setting_default_sensitive')
user.settings['public_post_to_unlisted']=public_post_to_unlisted_preference if change?('setting_public_post_to_unlisted')
user.settings['default_language'] = default_language_preference if change?('setting_default_language')
user.settings['unfollow_modal'] = unfollow_modal_preference if change?('setting_unfollow_modal')
user.settings['boost_modal'] = boost_modal_preference if change?('setting_boost_modal')
@ -63,6 +64,10 @@ class UserSettingsDecorator
boolean_cast_setting 'setting_default_sensitive'
end
def public_post_to_unlisted_preference
boolean_cast_setting 'setting_public_post_to_unlisted'
end
def unfollow_modal_preference
boolean_cast_setting 'setting_unfollow_modal'
end

View file

@ -137,7 +137,7 @@ class User < ApplicationRecord
:reduce_motion, :system_font_ui, :noindex, :theme, :display_media, :display_media_expand,
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
:disable_swiping, :always_send_emails,
:disable_swiping, :always_send_emails, :public_post_to_unlisted,
to: :settings, prefix: :setting, allow_nil: false
delegate :can?, to: :role

View file

@ -67,6 +67,7 @@ class PostStatusService < BaseService
@text = @options.delete(:spoiler_text) if @text.blank? && @options[:spoiler_text].present?
@visibility = @options[:visibility] || @account.user&.setting_default_privacy
@visibility = :unlisted if (@visibility&.to_sym == :public || @visibility&.to_sym == :public_unlisted) && @account.silenced?
@visibility = :public_unlisted if @visibility&.to_sym == :public && !@options[:application]&.superapp && @account.user&.setting_public_post_to_unlisted
@searchability= searchability
@scheduled_at = @options[:scheduled_at]&.to_datetime
@scheduled_at = nil if scheduled_in_the_past?
@ -81,9 +82,10 @@ class PostStatusService < BaseService
when :unlisted
case @visibility&.to_sym when :public, :public_unlisted, :unlisted then :unlisted when :private then :private else :direct end
when :private
case @visibility&.to_sym when :public, :public_unlisted, :unlisted, :private then :private else :direct end
# direct message also can be searched by receiver
:private
when nil
@account.searchability
@account.user&.setting_default_searchability || @account.searchability
else
:direct
end

View file

@ -25,6 +25,9 @@
.fields-group
= f.input :setting_default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, hint: false
.fields-group
= f.input :setting_public_post_to_unlisted, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label

View file

@ -218,6 +218,7 @@ en:
setting_expand_spoilers: Always expand posts marked with content warnings
setting_hide_network: Hide your social graph
setting_noindex: Opt-out of search engine indexing
setting_public_post_to_unlisted: Convert public post to public unlisted if not using Web app
setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send posts
setting_system_font_ui: Use system's default font

View file

@ -60,6 +60,7 @@ ja:
setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします
setting_display_media_expand: Misskeyなどは4個を超えて投稿可能です。その追加分を最大8個まで表示します。kmyblueからアップロードはできません
setting_noindex: 公開プロフィールおよび各投稿ページに影響します
setting_public_post_to_unlisted: 未対応のサードパーティアプリからもローカル公開で投稿できますが、公開投稿はWeb以外できなくなります
setting_show_application: 投稿するのに使用したアプリが投稿の詳細ビューに表示されるようになります
setting_use_blurhash: ぼかしはメディアの色を元に生成されますが、細部は見えにくくなっています
setting_use_pending_items: 新着があってもタイムラインを自動的にスクロールしないようにします
@ -219,6 +220,7 @@ ja:
setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する
setting_hide_network: 繋がりを隠す
setting_noindex: 検索エンジンによるインデックスを拒否する
setting_public_post_to_unlisted: サードパーティアプリから投稿するとき、公開投稿をローカル公開に変更する
setting_reduce_motion: アニメーションの動きを減らす
setting_show_application: 送信したアプリを開示する
setting_system_font_ui: システムのデフォルトフォントを使う