Skip to content

Commit

Permalink
ENG-5093 Improve Visibility of Embargoed Registrations on Registratio…
Browse files Browse the repository at this point in the history
…n Card (#2166)

* ENG-4944 adding withdrawn to indexed preprint titles

* ENG-4944 made requested changes to the head tag and title bar

* ENG-4944 Integrate intl for dynamic title localization

* Fix title logic in head tags and update yarn.lock

* ENG-5093 Improve Visibility of Embargoed Registrations on Registration Card

* ENG-5093 Improve Visibility of Embargoed Registrations on Registration Card

* ENG-5093 remove commented code

* ENG-5093 exclude status for withdrawn registrations

* ENG-5093 exclude status for rejected registrations

* ENG-5093 added getter, fix linitng errors

---------

Co-authored-by: Uditi Mehta <uditimehta@COSs-MacBook-Pro.local>
  • Loading branch information
uditijmehta and Uditi Mehta committed Mar 19, 2024
1 parent 2308f63 commit 94a69a5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import RegistrationModel, { RegistrationReviewStates } from 'ember-osf-web/model
import SchemaResponseModel, { RevisionReviewStates } from 'ember-osf-web/models/schema-response';
import captureException, { getApiErrorMessage } from 'ember-osf-web/utils/capture-exception';


const iconMap: Partial<Record<RegistrationReviewStates | RevisionReviewStates.RevisionPendingModeration, string>> = {
[RegistrationReviewStates.Pending]: 'hourglass',
[RegistrationReviewStates.Withdrawn]: 'ban',
Expand All @@ -33,6 +34,19 @@ export default class RegistrationListCard extends Component<Args> {
return this.args.registration.revisionState === RevisionReviewStates.RevisionPendingModeration;
}

get showPublic() {
const reviewsState = this.args.registration.reviewsState;
return ![RegistrationReviewStates.Rejected,RegistrationReviewStates.Withdrawn].includes(reviewsState);
}

get showEmbargo() {
const reviewsState = this.args.registration.reviewsState;
if (this.args.registration.embargoEndDate) {
return ![RegistrationReviewStates.Rejected,RegistrationReviewStates.Withdrawn].includes(reviewsState);
}
return false;
}

get icon(): string {
const { state } = this.args;
return iconMap[state] || '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,22 @@
</OsfLink>
{{/if}}
</h3>
{{#if this.showEmbargo}}
<div local-class='embargoStatus'>
<span>{{t 'registries.registrationList.embargoEndDate'}}</span>
<span>
{{t 'registries.registrationList.EmbargoEndPrefix'}}
{{format-date @registration.embargoEndDate}}
</span>
</div>
{{else if this.showPublic}}
<span>{{t 'registries.registrationList.public'}}</span>
{{/if}}
{{#if (eq @state 'pending_moderation')}}
<ReviewActionsList @revision={{this.latestRevision}} />
{{else}}
<ReviewActionsList @registration={{@registration}}/>
{{/if}}
</div>
</div>
{{/if}}
{{/if}}
8 changes: 6 additions & 2 deletions mirage/scenarios/registrations.full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,15 @@ function createEgapRegistrationProvider(server: Server, currentUser: ModelInstan
server.create('moderator', { id: currentUser.id, user: currentUser, provider: egap }, 'asAdmin');
server.createList('moderator', 5, { provider: egap });

server.createList('registration', 12, {
server.create('registration', { id: 'embargo-test', title: 'Embargo Tests', provider: egap }, 'isEmbargo');
server.create('registration', {
id: 'pending-embargo',
title: 'Pending Embargo',
reviewsState: RegistrationReviewStates.Pending,
revisionState: RevisionReviewStates.Approved,
embargoEndDate: new Date(2024,0,0),
provider: egap,
});

return egap;
}

Expand Down
3 changes: 3 additions & 0 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,9 @@ registries:
withdrawn: 'No withdrawn registrations have been found'
pending_withdraw: 'No registrations found pending withdrawal'
pending_moderation: 'No registrations found with updates pending'
embargoEndDate: 'Embargoed Registration'
EmbargoEndPrefix: 'with an end date of'
public: 'Public Registration'
reviewActions:
triggerPastTense:
submit: 'submitted'
Expand Down

0 comments on commit 94a69a5

Please sign in to comment.