Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
f89c595e
Unverified
Commit
f89c595e
authored
6 years ago
by
Eugen Rochko
Committed by
GitHub
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add admin setting to enable OG previews for sensitive media (#7962)
parent
404c7702
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
app/controllers/admin/settings_controller.rb
+2
-0
app/controllers/admin/settings_controller.rb
app/models/form/admin_settings.rb
+2
-0
app/models/form/admin_settings.rb
app/views/admin/settings/edit.html.haml
+6
-0
app/views/admin/settings/edit.html.haml
app/views/stream_entries/_og_image.html.haml
+1
-1
app/views/stream_entries/_og_image.html.haml
config/locales/en.yml
+3
-0
config/locales/en.yml
config/settings.yml
+1
-0
config/settings.yml
with
15 additions
and
1 deletion
+15
-1
app/controllers/admin/settings_controller.rb
+
2
-
0
View file @
f89c595e
...
...
@@ -21,6 +21,7 @@ module Admin
activity_api_enabled
peers_api_enabled
show_known_fediverse_at_about_page
preview_sensitive_media
)
.
freeze
BOOLEAN_SETTINGS
=
%w(
...
...
@@ -31,6 +32,7 @@ module Admin
activity_api_enabled
peers_api_enabled
show_known_fediverse_at_about_page
preview_sensitive_media
)
.
freeze
UPLOAD_SETTINGS
=
%w(
...
...
This diff is collapsed.
Click to expand it.
app/models/form/admin_settings.rb
+
2
-
0
View file @
f89c595e
...
...
@@ -36,6 +36,8 @@ class Form::AdminSettings
:peers_api_enabled
=
,
:show_known_fediverse_at_about_page
,
:show_known_fediverse_at_about_page
=
,
:preview_sensitive_media
,
:preview_sensitive_media
=
,
to:
Setting
)
end
This diff is collapsed.
Click to expand it.
app/views/admin/settings/edit.html.haml
+
6
-
0
View file @
f89c595e
...
...
@@ -2,6 +2,9 @@
=
t
(
'admin.settings.title'
)
=
simple_form_for
@admin_settings
,
url:
admin_settings_path
,
html:
{
method: :patch
}
do
|
f
|
.actions.actions--top
=
f
.
button
:button
,
t
(
'generic.save_changes'
),
type: :submit
.fields-group
=
f
.
input
:site_title
,
placeholder:
t
(
'admin.settings.site_title'
)
=
f
.
input
:site_description
,
wrapper: :with_block_label
,
as: :text
,
label:
t
(
'admin.settings.site_description.title'
),
hint:
t
(
'admin.settings.site_description.desc_html'
),
input_html:
{
rows:
8
}
...
...
@@ -58,5 +61,8 @@
.fields-group
=
f
.
input
:peers_api_enabled
,
as: :boolean
,
wrapper: :with_label
,
label:
t
(
'admin.settings.peers_api_enabled.title'
),
hint:
t
(
'admin.settings.peers_api_enabled.desc_html'
)
.fields-group
=
f
.
input
:preview_sensitive_media
,
as: :boolean
,
wrapper: :with_label
,
label:
t
(
'admin.settings.preview_sensitive_media.title'
),
hint:
t
(
'admin.settings.preview_sensitive_media.desc_html'
)
.actions
=
f
.
button
:button
,
t
(
'generic.save_changes'
),
type: :submit
This diff is collapsed.
Click to expand it.
app/views/stream_entries/_og_image.html.haml
+
1
-
1
View file @
f89c595e
-
if
activity
.
is_a?
(
Status
)
&&
activity
.
non_sensitive_with_media?
-
if
activity
.
is_a?
(
Status
)
&&
(
activity
.
non_sensitive_with_media?
||
(
activity
.
with_media?
&&
Setting
.
preview_sensitive_media
))
-
player_card
=
false
-
activity
.
media_attachments
.
each
do
|
media
|
-
if
media
.
image?
...
...
This diff is collapsed.
Click to expand it.
config/locales/en.yml
+
3
-
0
View file @
f89c595e
...
...
@@ -316,6 +316,9 @@ en:
peers_api_enabled
:
desc_html
:
Domain names this instance has encountered in the fediverse
title
:
Publish list of discovered instances
preview_sensitive_media
:
desc_html
:
Link previews on other websites will display a thumbnail even if the media is marked as sensitive
title
:
Show sensitive media in OpenGraph previews
registrations
:
closed_message
:
desc_html
:
Displayed on frontpage when registrations are closed. You can use HTML tags
...
...
This diff is collapsed.
Click to expand it.
config/settings.yml
+
1
-
0
View file @
f89c595e
...
...
@@ -26,6 +26,7 @@ defaults: &defaults
delete_modal
:
true
auto_play_gif
:
false
display_sensitive_media
:
false
preview_sensitive_media
:
false
reduce_motion
:
false
system_font_ui
:
false
noindex
:
false
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment