add option to default to local only
parent
9d559d790b
commit
1affcf73fb
|
@ -30,6 +30,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
def user_settings_params
|
||||
params.require(:user).permit(
|
||||
:setting_default_privacy,
|
||||
:setting_default_local,
|
||||
:setting_default_sensitive,
|
||||
:setting_default_language,
|
||||
:setting_unfollow_modal,
|
||||
|
|
|
@ -45,7 +45,7 @@ import { REDRAFT } from 'flavours/glitch/actions/statuses';
|
|||
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
|
||||
import uuid from 'flavours/glitch/util/uuid';
|
||||
import { privacyPreference } from 'flavours/glitch/util/privacy_preference';
|
||||
import { me, defaultContentType } from 'flavours/glitch/util/initial_state';
|
||||
import { me, defaultContentType, defaultLocal } from 'flavours/glitch/util/initial_state';
|
||||
import { overwrite } from 'flavours/glitch/util/js_helpers';
|
||||
import { unescapeHTML } from 'flavours/glitch/util/html';
|
||||
import { recoverHashtags } from 'flavours/glitch/util/hashtag';
|
||||
|
@ -59,7 +59,7 @@ const glitchProbability = 1 - 0.0420215528;
|
|||
const initialState = ImmutableMap({
|
||||
mounted: false,
|
||||
advanced_options: ImmutableMap({
|
||||
do_not_federate: false,
|
||||
do_not_federate: defaultLocal,
|
||||
threaded_mode: false,
|
||||
}),
|
||||
sensitive: false,
|
||||
|
|
|
@ -11,6 +11,7 @@ export const unfollowModal = getMeta('unfollow_modal');
|
|||
export const boostModal = getMeta('boost_modal');
|
||||
export const deleteModal = getMeta('delete_modal');
|
||||
export const me = getMeta('me');
|
||||
export const defaultLocal = getMeta('default_local');
|
||||
export const searchEnabled = getMeta('search_enabled');
|
||||
export const maxChars = (initialState && initialState.max_toot_chars) || 500;
|
||||
export const invitesEnabled = getMeta('invites_enabled');
|
||||
|
|
|
@ -18,6 +18,7 @@ class UserSettingsDecorator
|
|||
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
|
||||
user.settings['interactions'] = merged_interactions if change?('interactions')
|
||||
user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy')
|
||||
user.settings['default_local'] = default_local_preference if change?('setting_default_local')
|
||||
user.settings['default_sensitive'] = default_sensitive_preference if change?('setting_default_sensitive')
|
||||
user.settings['default_language'] = default_language_preference if change?('setting_default_language')
|
||||
user.settings['unfollow_modal'] = unfollow_modal_preference if change?('setting_unfollow_modal')
|
||||
|
@ -51,6 +52,10 @@ class UserSettingsDecorator
|
|||
settings['setting_default_privacy']
|
||||
end
|
||||
|
||||
def default_local_preference
|
||||
boolean_cast_setting 'setting_default_local'
|
||||
end
|
||||
|
||||
def default_sensitive_preference
|
||||
boolean_cast_setting 'setting_default_sensitive'
|
||||
end
|
||||
|
|
|
@ -102,7 +102,7 @@ class User < ApplicationRecord
|
|||
|
||||
has_many :session_activations, dependent: :destroy
|
||||
|
||||
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
|
||||
delegate :auto_play_gif, :default_local, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
|
||||
:reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_network, :hide_followers_count,
|
||||
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application, :default_content_type, to: :settings, prefix: :setting, allow_nil: false
|
||||
|
||||
|
@ -188,6 +188,10 @@ class User < ApplicationRecord
|
|||
settings.default_privacy || 'public'
|
||||
end
|
||||
|
||||
def setting_default_local
|
||||
settings.default_local || false
|
||||
end
|
||||
|
||||
def allows_digest_emails?
|
||||
settings.notification_emails['digest']
|
||||
end
|
||||
|
|
|
@ -38,6 +38,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
|
||||
if object.current_account
|
||||
store[:me] = object.current_account.id.to_s
|
||||
store[:default_local] = object.current_account.user.setting_default_local
|
||||
store[:unfollow_modal] = object.current_account.user.setting_unfollow_modal
|
||||
store[:boost_modal] = object.current_account.user.setting_boost_modal
|
||||
store[:favourite_modal] = object.current_account.user.setting_favourite_modal
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
= f.input :setting_default_content_type, collection: ['text/plain', 'text/markdown', 'text/html'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_default_content_type_#{item.split('/')[1]}"), content_tag(:span, t("simple_form.hints.defaults.setting_default_content_type_#{item.split('/')[1]}"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
|
||||
|
||||
= f.input :setting_default_local, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label
|
||||
|
||||
%hr#settings_other/
|
||||
|
|
|
@ -102,6 +102,7 @@ en:
|
|||
setting_default_content_type_plain: Plain text
|
||||
setting_default_language: Posting language
|
||||
setting_default_privacy: Post privacy
|
||||
setting_default_local: Default to local only
|
||||
setting_default_sensitive: Always mark media as sensitive
|
||||
setting_delete_modal: Show confirmation dialog before deleting a roar
|
||||
setting_display_media: Media display
|
||||
|
|
Loading…
Reference in New Issue