about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-28 22:28:56 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:16 -0500
commitf1575bfffd5df77b68e60f36abc3bbdc6245d91f (patch)
treeaeeeecc32d3d7bfa7dea96ec0f4383a4bb153687 /app/javascript/flavours
parent054e15e4f03eecb174374466581b9662a6b38e24 (diff)
[UI, API, Rebase] Clean up original domain permissions API
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/components/status_content.js37
-rw-r--r--app/javascript/flavours/glitch/styles/monsterfork/components/status.scss42
2 files changed, 79 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js
index 171aff097..d3e7b8718 100644
--- a/app/javascript/flavours/glitch/components/status_content.js
+++ b/app/javascript/flavours/glitch/components/status_content.js
@@ -302,6 +302,39 @@ export default class StatusContent extends React.PureComponent {
       </div>
     );
 
+    const permissions_present = status.get('domain_permissions') && status.get('domain_permissions').size > 0;
+
+    const status_permission_items = permissions_present && status.get('domain_permissions').map((permission) => (
+      <li className='permission-status'>
+        <Icon id='eye-slash' />
+        <FormattedMessage
+          id='status.permissions.visibility.status'
+          defaultMessage='{visibility} 🡲 {domain}'
+          key={`permissions-visibility-${status.get('id')}`}
+          values={{
+            domain: <span>{permission.get('domain')}</span>,
+            visibility: <span>{permission.get('visibility')}</span>,
+          }}
+        />
+      </li>
+    ));
+
+    const permissions = status_permission_items && (
+      <details className='status__permissions' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
+        <summary>
+          <Icon id='unlock-alt' />
+          <FormattedMessage
+            id='status.permissions.title'
+            defaultMessage='Show extended permissions...'
+            key={`permissions-${status.get('id')}`}
+          />
+        </summary>
+        <ul>
+          {status_permission_items}
+        </ul>
+      </details>
+    );
+
     const content = { __html: status.get('contentHtml') };
     const spoilerContent = { __html: status.get('spoilerHtml') };
     const directionStyle = { direction: 'ltr' };
@@ -383,6 +416,8 @@ export default class StatusContent extends React.PureComponent {
             {media}
           </div>
 
+          {permissions}
+
         </div>
       );
     } else if (parseClick) {
@@ -405,6 +440,7 @@ export default class StatusContent extends React.PureComponent {
             tabIndex='0'
           />
           {media}
+          {permissions}
         </div>
       );
     } else {
@@ -419,6 +455,7 @@ export default class StatusContent extends React.PureComponent {
           {edited}
           <div ref={this.setContentsRef} key={`contents-${tagLinks}`} className='status__content__text' dangerouslySetInnerHTML={content} tabIndex='0' />
           {media}
+          {permissions}
         </div>
       );
     }
diff --git a/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss b/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss
index d950fdbb5..2759945a7 100644
--- a/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss
+++ b/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss
@@ -16,6 +16,48 @@
   }
 }
 
+.status__permissions {
+  font-size: 12px;
+  margin-top: 1em;
+
+  & > summary {
+    font-size: 12px;
+
+    &:focus, &:active {
+      outline: none;
+    }
+  }
+
+  & > summary > span,
+  & > ul > li > span {
+    color: lighten($dark-text-color, 4%);
+    padding-left: 8px;
+  }
+
+  & > ul > li > span > span:first-child {
+    display: inline-block;
+    text-transform: capitalize;
+    min-width: 5em;
+  }
+
+  & > summary > i {
+    color: #999966;
+  }
+
+  & > ul > li.permission-status > i {
+    color: #99cccc;
+  }
+
+  & > ul > li.permission-account > i {
+    color: #cc99cc;
+  }
+
+  & > ul > li > span > span,
+  & > ul > li > span > code {
+    color: lighten($dark-text-color, 30%);
+  }
+}
+
 .status, .detailed-status {
   &.unpublished {
     background: darken($ui-base-color, 4%);