Remove strip-formatting patch

This commit is contained in:
asonix 2023-09-21 12:48:05 -05:00
parent 53b9790142
commit 1c6d88fc31
17 changed files with 4 additions and 227 deletions

View file

@ -65,17 +65,6 @@ module StatusesHelper
embedded_view? ? '_blank' : nil
end
def text_formatting_classes
case current_user&.setting_strip_formatting
when 'none', nil
'rich-text rich-blocks'
when 'blocks'
'rich-text'
when 'all'
nil
end
end
def fa_visibility_icon(status)
case status.visibility
when 'public'

View file

@ -835,9 +835,7 @@ body > [data-popper-placement] {
margin: -3px 0 0;
}
p,
pre,
blockquote {
p {
margin-bottom: 22px;
white-space: pre-wrap;
unicode-bidi: plaintext;
@ -847,175 +845,6 @@ body > [data-popper-placement] {
}
}
h1,
h2,
h3,
h4,
h5 {
margin-bottom: 20px;
}
blockquote {
white-space: normal;
p:last-child {
margin-bottom: 0;
}
}
ul,
ol {
p {
margin-bottom: 0;
}
}
&:not(.rich-text) {
del {
text-decoration: none;
&::before,
&::after {
content: '~~';
}
}
code {
font-family: inherit;
}
u {
text-decoration: none;
&::before,
&::after {
content: '__';
}
}
h1::before {
content: '# ';
}
h2::before {
content: '## ';
}
h3::before {
content: '### ';
}
h4::before {
content: '#### ';
}
h5::before {
content: '##### ';
}
b,
strong {
&::before,
&::after {
content: '**';
}
}
em,
i {
&::before,
&::after {
content: '*';
}
}
}
&:not(.rich-blocks) {
blockquote {
position: relative;
padding-left: 1em;
overflow: hidden;
}
blockquote::before {
position: absolute;
content: '>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a>\a';
white-space: pre-wrap;
left: 0;
top: 0;
}
li::before {
position: absolute;
content: '*';
left: 0;
top: 0;
}
li {
position: relative;
padding-left: 1em;
}
}
&.rich-text {
h1,
h2 {
font-weight: 700;
}
h3,
h4,
h5 {
font-weight: 500;
}
b,
strong {
font-weight: 700;
}
em,
i {
font-style: italic;
}
sub {
font-size: smaller;
text-align: sub;
}
}
&.rich-blocks {
h1,
h2 {
font-size: 18px;
}
h2 {
font-size: 16px;
}
blockquote {
padding-left: 10px;
border-left: 3px solid $darker-text-color;
color: $darker-text-color;
}
ul,
ol {
margin-left: 1em;
}
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}
}
a {
color: $secondary-text-color;
text-decoration: none;

View file

@ -23,10 +23,6 @@ module HasUserSettings
settings['web.auto_play']
end
def setting_strip_formatting
settings['strip_formatting']
end
def setting_default_sensitive
settings['default_sensitive']
end

View file

@ -51,13 +51,11 @@ class InitialStateSerializer < ActiveModel::Serializer
store[:use_blurhash] = object.current_account.user.setting_use_blurhash
store[:use_pending_items] = object.current_account.user.setting_use_pending_items
store[:show_trends] = Setting.trends && object.current_account.user.setting_trends
store[:strip_formatting] = object.current_account.user.setting_strip_formatting
else
store[:auto_play_gif] = Setting.auto_play_gif
store[:display_media] = Setting.display_media
store[:reduce_motion] = Setting.reduce_motion
store[:use_blurhash] = Setting.use_blurhash
store[:strip_formatting] = Setting.strip_formatting
end
store[:disabled_account_id] = object.disabled_account.id.to_s if object.disabled_account

View file

@ -8,7 +8,6 @@ class REST::PreferencesSerializer < ActiveModel::Serializer
attribute :reading_default_sensitive_media, key: 'reading:expand:media'
attribute :reading_default_sensitive_text, key: 'reading:expand:spoilers'
attribute :reading_autoplay_gifs, key: 'reading:autoplay:gifs'
attribute :reading_strip_formatting, key: 'reading:formatting:strip'
def posting_default_privacy
object.user.setting_default_privacy
@ -33,8 +32,4 @@ class REST::PreferencesSerializer < ActiveModel::Serializer
def reading_autoplay_gifs
object.user.setting_auto_play_gif
end
def reading_strip_formatting
object.user.setting_strip_formatting
end
end

View file

@ -36,7 +36,6 @@
= ff.input :'web.reduce_motion', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_reduce_motion')
= ff.input :'web.disable_swiping', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_disable_swiping')
= ff.input :'web.use_system_font', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_system_font_ui')
= ff.input :strip_formatting, collection: ['none', 'blocks', 'all'], wrapper: :with_floating_label, include_blank: false, label_method: lambda { |value| safe_join([I18n.t("statuses.strip_formatting.#{value}"), content_tag(:span, I18n.t("statuses.strip_formatting.#{value}_long"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', hint: false
%h4= t 'appearance.discovery'

View file

@ -15,7 +15,7 @@
= account_action_button(status.account)
.status__content.emojify{ class: text_formatting_classes, data: ({ spoiler: current_account&.user&.setting_expand_spoilers ? 'expanded' : 'folded' } if status.spoiler_text?) }<
.status__content.emojify{ data: ({ spoiler: current_account&.user&.setting_expand_spoilers ? 'expanded' : 'folded' } if status.spoiler_text?) }<
- if status.spoiler_text?
%p<
%span.p-summary> #{prerender_custom_emojis(h(status.spoiler_text), status.emojis)}&nbsp;

View file

@ -27,7 +27,7 @@
%span.display-name__account
= acct(status.account)
= fa_icon('lock') if status.account.locked?
.status__content.emojify{ class: text_formatting_classes, data: ({ spoiler: current_account&.user&.setting_expand_spoilers ? 'expanded' : 'folded' } if status.spoiler_text?) }<
.status__content.emojify{ data: ({ spoiler: current_account&.user&.setting_expand_spoilers ? 'expanded' : 'folded' } if status.spoiler_text?) }<
- if status.spoiler_text?
%p<
%span.p-summary> #{prerender_custom_emojis(h(status.spoiler_text), status.emojis)}&nbsp;

View file

@ -1541,13 +1541,6 @@ en-DG:
show_older: Show older
show_thread: Show thread
sign_in_to_participate: Sign in to participate in the conversation
strip_formatting:
all: All
all_long: Strip all advanced formatting
blocks: Block elements
blocks_long: Strip formatting for title headers and block quotes
none: None
none_long: Do not strip any formatting supported by Mastodon
title: '%{name}: "%{quote}"'
visibilities:
direct: Direct

View file

@ -1541,13 +1541,6 @@ en-LN:
show_older: Show older
show_thread: Show thread
sign_in_to_participate: Sign in to participate in the conversation
strip_formatting:
all: All
all_long: Strip all advanced formatting
blocks: Block elements
blocks_long: Strip formatting for title headers and block quotes
none: None
none_long: Do not strip any formatting supported by Mastodon
title: '%{name}: "%{quote}"'
visibilities:
direct: Direct

View file

@ -1541,13 +1541,6 @@ en-SQ:
show_older: Show older
show_thread: Show thread
sign_in_to_participate: Sign in to participate in the conversation
strip_formatting:
all: All
all_long: Strip all advanced formatting
blocks: Block elements
blocks_long: Strip formatting for title headers and block quotes
none: None
none_long: Do not strip any formatting supported by Mastodon
title: '%{name}: "%{quote}"'
visibilities:
direct: Direct

View file

@ -211,7 +211,6 @@ en-DG:
setting_noindex: Opt-out of search engine indexing
setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send toots
setting_strip_formatting: Strip formatting
setting_system_font_ui: Use system's default font
setting_theme: Site theme
setting_trends: Show today's trends

View file

@ -211,7 +211,6 @@ en-LN:
setting_noindex: Opt-out of search engine indexing
setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send toots
setting_strip_formatting: Strip formatting
setting_system_font_ui: Use system's default font
setting_theme: Site theme
setting_trends: Show today's trends

View file

@ -211,7 +211,6 @@ en-SQ:
setting_noindex: Opt-out of search engine indexing
setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send toots
setting_strip_formatting: Strip formatting
setting_system_font_ui: Use system's default font
setting_theme: Site theme
setting_trends: Show today's trends

View file

@ -20,7 +20,6 @@ defaults: &defaults
trends: true
trends_as_landing_page: true
trendable_by_default: false
strip_formatting: 'none'
reserved_usernames:
- admin
- support

View file

@ -22,7 +22,6 @@ class MoveUserSettings < ActiveRecord::Migration[6.1]
disable_swiping: 'web.disable_swiping',
show_application: 'show_application',
system_font_ui: 'web.use_system_font',
strip_formatting: 'strip_formatting',
aggregate_reblogs: 'aggregate_reblogs',
advanced_layout: 'web.advanced_layout',
use_blurhash: 'web.use_blurhash',

View file

@ -81,10 +81,7 @@ class Sanitize
},
},
protocols: {
'a' => { 'href' => HTTP_PROTOCOLS },
'blockquote' => { 'cite' => HTTP_PROTOCOLS },
},
protocols: {},
transformers: [
CLASS_WHITELIST_TRANSFORMER,