Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Merge requests
!57
HIN-974
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
HIN-974
HIN-974
into
develop
Overview
0
Commits
11
Pipelines
0
Changes
27
Merged
Alexandru Munteanu
requested to merge
HIN-974
into
develop
6 years ago
Overview
0
Commits
11
Pipelines
0
Changes
27
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
802a552b
11 commits,
6 years ago
27 files
+
1103
−
702
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
27
Search (e.g. *.vue) (Ctrl+P)
packages/component-faraday-selectors/src/index.js
+
47
−
13
Options
import
{
get
,
last
,
chain
}
from
'
lodash
'
import
{
get
,
has
,
last
,
chain
}
from
'
lodash
'
import
{
selectCurrentUser
}
from
'
xpub-selectors
'
export
const
isHEToManuscript
=
(
state
,
collectionId
)
=>
{
@@ -8,18 +8,6 @@ export const isHEToManuscript = (state, collectionId) => {
return
get
(
collection
,
'
handlingEditor.id
'
)
===
currentUserId
}
const
canMakeRecommendationStatuses
=
[
'
heAssigned
'
,
'
underReview
'
,
'
reviewCompleted
'
,
]
export
const
canMakeRecommendation
=
(
state
,
collection
,
fragment
=
{})
=>
{
if
(
fragment
.
id
!==
last
(
get
(
collection
,
'
fragments
'
,
[])))
return
false
const
isHE
=
isHEToManuscript
(
state
,
get
(
collection
,
'
id
'
,
''
))
const
status
=
get
(
collection
,
'
status
'
,
'
draft
'
)
return
isHE
&&
canMakeRecommendationStatuses
.
includes
(
status
)
}
export
const
currentUserIs
=
({
currentUser
:
{
user
}
},
role
)
=>
{
const
isAdmin
=
get
(
user
,
'
admin
'
)
const
isEic
=
get
(
user
,
'
editorInChief
'
)
@@ -228,3 +216,49 @@ export const getInvitationsWithReviewersForFragment = (state, fragmentId) =>
),
}))
.
value
()
// #region Editorial and reviewer recommendations
export
const
getFragmentRecommendations
=
(
state
,
fragmentId
)
=>
get
(
state
,
`fragments.
${
fragmentId
}
.recommendations`
,
[])
export
const
getFragmentReviewerRecommendations
=
(
state
,
fragmentId
)
=>
getFragmentRecommendations
(
state
,
fragmentId
).
filter
(
r
=>
r
.
recommendationType
===
'
review
'
,
)
const
getOwnRecommendations
=
(
state
,
fragmentId
)
=>
chain
(
state
)
.
get
(
`fragments.
${
fragmentId
}
.recommendations`
,
[])
.
filter
(
r
=>
r
.
userId
===
get
(
state
,
'
currentUser.user.id
'
,
''
))
.
value
()
export
const
getOwnPendingRecommendation
=
(
state
,
fragmentId
)
=>
chain
(
getOwnRecommendations
(
state
,
fragmentId
))
.
find
(
r
=>
r
.
userId
===
get
(
state
,
'
currentUser.user.id
'
,
''
)
&&
!
has
(
r
,
'
submittedOn
'
),
)
.
value
()
export
const
getOwnSubmittedRecommendation
=
(
state
,
fragmentId
)
=>
chain
(
getOwnRecommendations
(
state
,
fragmentId
))
.
find
(
r
=>
r
.
userId
===
get
(
state
,
'
currentUser.user.id
'
,
''
)
&&
has
(
r
,
'
submittedOn
'
),
)
.
value
()
const
canMakeRecommendationStatuses
=
[
'
heAssigned
'
,
'
underReview
'
,
'
reviewCompleted
'
,
]
export
const
canMakeRecommendation
=
(
state
,
collection
,
fragment
=
{})
=>
{
if
(
fragment
.
id
!==
last
(
get
(
collection
,
'
fragments
'
,
[])))
return
false
const
isHE
=
isHEToManuscript
(
state
,
get
(
collection
,
'
id
'
,
''
))
const
status
=
get
(
collection
,
'
status
'
,
'
draft
'
)
return
isHE
&&
canMakeRecommendationStatuses
.
includes
(
status
)
}
// #endregion