more local-only options
parent
b5cb68581b
commit
467170f4a0
|
@ -31,6 +31,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
params.require(:user).permit(
|
||||
:setting_default_privacy,
|
||||
:setting_default_local,
|
||||
:setting_alwyas_local,
|
||||
:setting_default_sensitive,
|
||||
:setting_default_language,
|
||||
:setting_unfollow_modal,
|
||||
|
|
|
@ -144,7 +144,7 @@ export function submitCompose(routerHistory) {
|
|||
|
||||
dispatch(submitComposeRequest());
|
||||
if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) {
|
||||
status = status + ' 👁️';
|
||||
status = status + ' #!';
|
||||
}
|
||||
api(getState).post('/api/v1/statuses', {
|
||||
status,
|
||||
|
|
|
@ -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, defaultLocal } from 'flavours/glitch/util/initial_state';
|
||||
import { me, defaultContentType, defaultLocal, alwaysLoal } 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: defaultLocal,
|
||||
do_not_federate: defaultLocal || alwaysLocal,
|
||||
threaded_mode: false,
|
||||
}),
|
||||
sensitive: false,
|
||||
|
@ -82,7 +82,7 @@ const initialState = ImmutableMap({
|
|||
suggestion_token: null,
|
||||
suggestions: ImmutableList(),
|
||||
default_advanced_options: ImmutableMap({
|
||||
do_not_federate: null,
|
||||
do_not_federate: alwaysLocal || null,
|
||||
threaded_mode: null, // Do not reset
|
||||
}),
|
||||
default_privacy: 'public',
|
||||
|
@ -177,7 +177,7 @@ function continueThread (state, status) {
|
|||
map.set('in_reply_to', status.id);
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: /👁\ufe0f?\u200b?(?:<\/p>)?$/.test(status.content) }))
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: /#!\u200b?(?:<\/p>)?$/.test(status.content) }))
|
||||
);
|
||||
map.set('privacy', status.visibility);
|
||||
map.set('sensitive', false);
|
||||
|
@ -331,7 +331,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: /👁\ufe0f?\u200b?(?:<\/p>)?$/.test(action.status.get('content')) }))
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: /#!(?:<\/p>)?$/.test(action.status.get('content')) }))
|
||||
);
|
||||
map.set('focusDate', new Date());
|
||||
map.set('caretPosition', null);
|
||||
|
|
|
@ -21,6 +21,7 @@ export const favouriteModal = getMeta('favourite_modal');
|
|||
export const deleteModal = getMeta('delete_modal');
|
||||
export const me = getMeta('me');
|
||||
export const defaultLocal = getMeta('default_local');
|
||||
export const alwaysLocal = getMeta('always_local');
|
||||
export const searchEnabled = getMeta('search_enabled');
|
||||
export const maxChars = (initialState && initialState.max_toot_chars) || 500;
|
||||
export const pollLimits = (initialState && initialState.poll_limits);
|
||||
|
|
|
@ -19,6 +19,7 @@ class UserSettingsDecorator
|
|||
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['always_local'] = always_local_preference if change?('setting_always_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')
|
||||
|
@ -56,6 +57,10 @@ class UserSettingsDecorator
|
|||
boolean_cast_setting 'setting_default_local'
|
||||
end
|
||||
|
||||
def always_local_preference
|
||||
boolean_cast_setting 'setting_always_local'
|
||||
end
|
||||
|
||||
def default_sensitive_preference
|
||||
boolean_cast_setting 'setting_default_sensitive'
|
||||
end
|
||||
|
|
|
@ -508,11 +508,7 @@ class Status < ApplicationRecord
|
|||
|
||||
def marked_local_only?
|
||||
# match both with and without U+FE0F (the emoji variation selector)
|
||||
/#{local_only_emoji}\ufe0f?\z/.match?(content)
|
||||
end
|
||||
|
||||
def local_only_emoji
|
||||
'👁'
|
||||
/#!\z/.match?(content)
|
||||
end
|
||||
|
||||
def marked_no_replies?
|
||||
|
@ -560,7 +556,7 @@ class Status < ApplicationRecord
|
|||
|
||||
def set_locality
|
||||
if account.domain.nil? && !attribute_changed?(:local_only)
|
||||
self.local_only = marked_local_only?
|
||||
self.local_only = marked_local_only? || account.user.setting_always_local
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class User < ApplicationRecord
|
|||
|
||||
has_many :session_activations, dependent: :destroy
|
||||
|
||||
delegate :auto_play_gif, :default_local, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
|
||||
delegate :auto_play_gif, :default_local, :always_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
|
||||
|
||||
|
@ -192,6 +192,10 @@ class User < ApplicationRecord
|
|||
settings.default_local || false
|
||||
end
|
||||
|
||||
def setting_always_local
|
||||
settings.always_local || false
|
||||
end
|
||||
|
||||
def allows_digest_emails?
|
||||
settings.notification_emails['digest']
|
||||
end
|
||||
|
|
|
@ -39,6 +39,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[:always_local] = object.current_account.user.setting_always_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
|
||||
|
|
|
@ -28,6 +28,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_always_local, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label
|
||||
|
||||
%hr#settings_other/
|
||||
|
|
|
@ -102,7 +102,8 @@ 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_local: Default to Monsterpit-only roars (in Glitch flavour)
|
||||
setting_always_local: Don't send your roars outside Monsterpit
|
||||
setting_default_sensitive: Always mark media as sensitive
|
||||
setting_delete_modal: Show confirmation dialog before deleting a roar
|
||||
setting_display_media: Media display
|
||||
|
@ -110,7 +111,7 @@ en:
|
|||
setting_display_media_hide_all: Hide all
|
||||
setting_display_media_show_all: Show all
|
||||
setting_expand_spoilers: Always expand roars marked with content warnings
|
||||
setting_favourite_modal: Show confirmation dialog before admiring (applies to Glitch flavour only)
|
||||
setting_favourite_modal: Show confirmation dialog before admiring (in Glitch flavour)
|
||||
setting_hide_followers_count: Hide your packmates count
|
||||
setting_hide_network: Hide your packmates
|
||||
setting_noindex: Opt-out of search engine indexing
|
||||
|
|
Loading…
Reference in New Issue