-
Notifications
You must be signed in to change notification settings - Fork 63
Show revisions when registration is pending or initial + Fix moderation actions posting to original revision only #1326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
futa-ikeda
merged 4 commits into
CenterForOpenScience:feature/versioning-mirage
from
futa-ikeda:more-update-dropdown-logic
Oct 13, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
lib/osf-components/addon/components/registries/update-dropdown/list-item/component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { inject as service } from '@ember/service'; | ||
| import Component from '@glimmer/component'; | ||
| import Intl from 'ember-intl/services/intl'; | ||
| import SchemaResponseModel, { RevisionReviewStates } from 'ember-osf-web/models/schema-response'; | ||
|
|
||
| interface Args { | ||
| revision: SchemaResponseModel; | ||
| isModeratorMode: boolean; | ||
| index: number; | ||
| totalRevisions: number; | ||
| } | ||
|
|
||
| export default class ListItem extends Component<Args> { | ||
| @service intl!: Intl; | ||
|
|
||
| get shouldShow() { | ||
| const { revision, isModeratorMode } = this.args; | ||
| const visibleStates = [RevisionReviewStates.Approved]; | ||
| if (isModeratorMode) { | ||
| visibleStates.push(RevisionReviewStates.RevisionPendingModeration); | ||
| } | ||
| return revision.isOriginalResponse || visibleStates.includes(revision.reviewsState); | ||
| } | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
lib/osf-components/addon/components/registries/update-dropdown/list-item/styles.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| .UpdateContainer { | ||
| padding-right: 10px; | ||
| padding-left: 10px; | ||
| padding-top: 10px; | ||
| padding-bottom: 10px; | ||
|
|
||
| &:hover { | ||
| background-color: rgba(#337ab7, 0.2); | ||
| } | ||
|
|
||
| svg { | ||
| margin-right: 15px; | ||
| } | ||
| } | ||
|
|
||
| .UpdateLink { | ||
| display: flex; | ||
| text-decoration: none; | ||
|
|
||
| &:global(.active) { | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| &:hover { | ||
| text-decoration: none; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
lib/osf-components/addon/components/registries/update-dropdown/list-item/template.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {{#if this.shouldShow}} | ||
| <div data-test-revision-link={{@index}} local-class='UpdateContainer'> | ||
| {{!-- Using LinkTo instead of OsfLink due to how queryParams are buggy for setting active state --}} | ||
| <LinkTo @route='overview.index' @query={{hash revisionId=@revision.id}} local-class='UpdateLink'> | ||
| <Registries::UpdateDropdown::UpdateLabel | ||
| @totalRevisions={{@totalRevisions}} | ||
| @index={{@index}} | ||
| /> | ||
| </LinkTo> | ||
| </div> | ||
| {{/if}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../update-dropdown/update-item/component.js → ...es/update-dropdown/list-item/component.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export { default } from 'osf-components/components/registries/update-dropdown/update-item/component'; | ||
| export { default } from 'osf-components/components/registries/update-dropdown/list-item/component'; |
2 changes: 1 addition & 1 deletion
2
...s/update-dropdown/update-item/template.js → ...ies/update-dropdown/list-item/template.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export { default } from 'osf-components/components/registries/update-dropdown/update-item/template'; | ||
| export { default } from 'osf-components/components/registries/update-dropdown/list-item/template'; |
1 change: 1 addition & 0 deletions
1
lib/osf-components/app/components/registries/update-dropdown/update-label/component.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from 'osf-components/components/registries/update-dropdown/update-label/component'; |
1 change: 1 addition & 0 deletions
1
lib/osf-components/app/components/registries/update-dropdown/update-label/template.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from 'osf-components/components/registries/update-dropdown/update-label/template'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the class for items that populate the dropdown and defines which revisions should appaer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! This class is responsible for making the decision on whether or not to show a given revision in the dropdown in the overview page