diff options
Diffstat (limited to 'app')
5 files changed, 86 insertions, 3 deletions
diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index 1c744ad73..3e0feed7e 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -8,7 +8,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController def index @statuses = load_statuses - render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id) + render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_account&.id) end private diff --git a/app/controllers/api/v1/statuses/bookmarks_controller.rb b/app/controllers/api/v1/statuses/bookmarks_controller.rb index 19963c002..a4c878ed4 100644 --- a/app/controllers/api/v1/statuses/bookmarks_controller.rb +++ b/app/controllers/api/v1/statuses/bookmarks_controller.rb @@ -24,6 +24,7 @@ class Api::V1::Statuses::BookmarksController < Api::BaseController bookmark&.destroy! + render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, bookmarks_map: { @status.id => false }), current_account_id: current_user&.account_id render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, bookmarks_map: { @status.id => false }) rescue Mastodon::NotPermittedError not_found 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%); diff --git a/app/javascript/mastodon/locales/en-MP.json b/app/javascript/mastodon/locales/en-MP.json index 8544a0d1b..41445c538 100644 --- a/app/javascript/mastodon/locales/en-MP.json +++ b/app/javascript/mastodon/locales/en-MP.json @@ -122,6 +122,9 @@ "status.in_reply_to": "This roar is a reply", "status.is_poll": "This roar is a poll", "status.open": "Open this roar", + "status.permissions.title": "Show extended permissions...", + "status.permissions.visibility.status": "{visibility} 🡲 {domain}", + "status.permissions.visibility.account": "{visibility} 🡲 {domain}", "status.pinned": "Pinned", "status.publish": "Publish", "status.reblogs.empty": "No one has boosted this roar yet. When someone does, they will show up here.", @@ -133,7 +136,7 @@ "status.unpublished": "Unpublished", "tabs_bar.federated_timeline": "World", "timeline_hint.resources.statuses": "Older roars", - "trends.counter_by_accounts": "{count, plural, one {{counter} creature} other {{counter} creatures}} talking", + "trends.counter_by_accounts": "{count, plural, one {{counter} creature} other {{counter} creatures}} talking", "ui.beforeunload": "Your draft will be lost if you leave the web page.", "upload_form.edit": "Add description text", "upload_modal.edit_media": "Add description text", @@ -150,4 +153,4 @@ "keyboard_shortcuts.local": "to open Monsterpit timeline", "navigation_bar.community_timeline": "Monsterpit", "tabs_bar.local_timeline": "Monsterpit" -} \ No newline at end of file +} |