about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r--app/javascript/flavours/glitch/features/status/components/detailed_status.js38
1 files changed, 32 insertions, 6 deletions
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 1633d26ee..e9bbcaa90 100644
--- a/app/javascript/flavours/glitch/features/status/components/detailed_status.js
+++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.js
@@ -15,6 +15,7 @@ import VisibilityIcon from 'flavours/glitch/components/status_visibility_icon';
 import scheduleIdleTask from 'flavours/glitch/util/schedule_idle_task';
 import classNames from 'classnames';
 import PollContainer from 'flavours/glitch/containers/poll_container';
+import { me } from 'flavours/glitch/util/initial_state';
 
 export default class DetailedStatus extends ImmutablePureComponent {
 
@@ -114,10 +115,10 @@ export default class DetailedStatus extends ImmutablePureComponent {
 
     let media           = null;
     let mediaIcon       = null;
-    let applicationLink = '';
     let reblogLink = '';
     let reblogIcon = 'repeat';
     let favouriteLink = '';
+    let sharekeyLinks = '';
 
     if (this.props.measureHeight) {
       outerStyle.height = `${this.state.height}px`;
@@ -168,10 +169,6 @@ export default class DetailedStatus extends ImmutablePureComponent {
       mediaIcon = 'link';
     }
 
-    if (status.get('application')) {
-      applicationLink = <span> · <a className='detailed-status__application' href={status.getIn(['application', 'website'])} target='_blank' rel='noopener'>{status.getIn(['application', 'name'])}</a></span>;
-    }
-
     if (status.get('visibility') === 'direct') {
       reblogIcon = 'envelope';
     } else if (status.get('visibility') === 'private') {
@@ -194,6 +191,34 @@ export default class DetailedStatus extends ImmutablePureComponent {
       );
     }
 
+    if (status.get('sharekey')) {
+      sharekeyLinks = (
+        <span>
+          <a href={`${status.get('url')}?key=${status.get('sharekey')}`} target='_blank' className='detailed-status__link'>
+            <i className='fa fa-key' title='Right-click or long press to copy share link with key' />
+          </a>
+          &nbsp;·&nbsp;
+          <a href={`${status.get('url')}?rekey=1&toweb=1`} className='detailed-status__link'>
+            <i className='fa fa-user-plus' title='Generate a new share key' />
+          </a>
+          &nbsp;·&nbsp;
+          <a href={`${status.get('url')}?rekey=0&toweb=1`} className='detailed-status__link'>
+            <i className='fa fa-user-times' title='Revoke share key' />
+          </a>
+          &nbsp;·
+        </span>
+      );
+    } else if (status.getIn(['account', 'id']) == me) {
+      sharekeyLinks = (
+        <span>
+          <a href={`${status.get('url')}?rekey=1&toweb=1`} className='detailed-status__link'>
+            <i className='fa fa-user-plus' title='Generate a new share key' />
+          </a>
+          &nbsp;·
+        </span>
+      );
+    }
+
     if (this.context.router) {
       favouriteLink = (
         <Link to={`/statuses/${status.get('id')}/favourites`} className='detailed-status__link'>
@@ -229,9 +254,10 @@ export default class DetailedStatus extends ImmutablePureComponent {
           />
 
           <div className='detailed-status__meta'>
+            {sharekeyLinks} {reblogLink} · {favouriteLink} · <VisibilityIcon visibility={status.get('visibility')} />
             <a className='detailed-status__datetime' href={status.get('url')} target='_blank' rel='noopener'>
               <FormattedDate value={new Date(status.get('created_at'))} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' />
-            </a>{applicationLink} · {reblogLink} · {favouriteLink} · <VisibilityIcon visibility={status.get('visibility')} />
+            </a>
           </div>
         </div>
       </div>