about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-08-01 15:01:09 +0200
committerThibG <thib@sitedethib.com>2019-08-04 22:25:56 +0200
commitdf866a464d43ad718602a18b86c57b716f7bcf27 (patch)
tree19a592b0dda728c2779c51a0756db69b70d6ed7d /app/javascript/flavours/glitch/features
parent49a28e69a520d5994352e231e9879a5093af5916 (diff)
Add options to highlight misleading links in statuses
Fixes #1162
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r--app/javascript/flavours/glitch/features/local_settings/page/index.js16
-rw-r--r--app/javascript/flavours/glitch/features/status/components/detailed_status.js1
2 files changed, 17 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.js b/app/javascript/flavours/glitch/features/local_settings/page/index.js
index 910cb5346..3f11dc5e9 100644
--- a/app/javascript/flavours/glitch/features/local_settings/page/index.js
+++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js
@@ -25,6 +25,9 @@ const messages = defineMessages({
   filters_upstream: { id: 'settings.filtering_behavior.upstream', defaultMessage: 'Show "filtered" like vanilla Mastodon' },
   filters_hide: { id: 'settings.filtering_behavior.hide', defaultMessage: 'Show "filtered" and add a button to display why' },
   filters_cw: { id: 'settings.filtering_behavior.cw', defaultMessage: 'Still display the post, and add filtered words to content warning' },
+  link_rewriting_none: { id: 'settings.link_rewriting.none', defaultMessage: 'Do not rewrite links' },
+  link_rewriting_rewrite: { id: 'settings.link_rewriting.rewrite', defaultMessage: 'Rewrite links that may be misleading' },
+  link_rewriting_tag: { id: 'settings.link_rewriting.tag', defaultMessage: 'Tag links with their target host unless it is already explicit' },
 });
 
 @injectIntl
@@ -66,6 +69,19 @@ export default class LocalSettingsPage extends React.PureComponent {
         >
           <FormattedMessage id='settings.confirm_boost_missing_media_description' defaultMessage='Show confirmation dialog before boosting toots lacking media descriptions' />
         </LocalSettingsPageItem>
+        <LocalSettingsPageItem
+          settings={settings}
+          item={['link_rewriting']}
+          id='mastodon-settings--link_rewriting'
+          options={[
+            { value: 'none', message: intl.formatMessage(messages.link_rewriting_none) },
+            { value: 'rewrite', message: intl.formatMessage(messages.link_rewriting_rewrite) },
+            { value: 'tag', message: intl.formatMessage(messages.link_rewriting_tag) },
+          ]}
+          onChange={onChange}
+        >
+          <FormattedMessage id='settings.link_rewriting' defaultMessage='Link rewriting' />
+        </LocalSettingsPageItem>
         <section>
           <h2><FormattedMessage id='settings.notifications_opts' defaultMessage='Notifications options' /></h2>
           <LocalSettingsPageItem
diff --git a/app/javascript/flavours/glitch/features/status/components/detailed_status.js b/app/javascript/flavours/glitch/features/status/components/detailed_status.js
index 1c2258256..29272c0ad 100644
--- a/app/javascript/flavours/glitch/features/status/components/detailed_status.js
+++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.js
@@ -241,6 +241,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
             onExpandedToggle={onToggleHidden}
             parseClick={this.parseClick}
             onUpdate={this.handleChildUpdate}
+            linkRewriting={settings.get('link_rewriting')}
             disabled
           />