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
Commits
fecf90ff
Commit
fecf90ff
authored
6 years ago
by
Tania Fecheta
Browse files
Options
Downloads
Patches
Plain Diff
refactor(currentUserIsAuthor): refactor currectUserIsAuthor to get authors from fragment
parent
e1775400
No related branches found
No related tags found
3 merge requests
!160
Update staging with master features
,
!150
Develop
,
!144
fix(Only authors can see Reviewer Reports): Only authors can see Reviewer Reports
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/component-faraday-selectors/src/index.js
+6
-6
6 additions, 6 deletions
packages/component-faraday-selectors/src/index.js
with
6 additions
and
6 deletions
packages/component-faraday-selectors/src/index.js
+
6
−
6
View file @
fecf90ff
...
@@ -80,7 +80,7 @@ export const authorCanViewReportsDetails = (
...
@@ -80,7 +80,7 @@ export const authorCanViewReportsDetails = (
collection
=
{},
collection
=
{},
fragmentId
,
fragmentId
,
)
=>
{
)
=>
{
const
isAuthor
=
currentUserIsAuthor
(
state
)
const
isAuthor
=
currentUserIsAuthor
(
state
,
fragmentId
)
return
(
return
(
authorCanViewReportsDetailsStatuses
.
includes
(
authorCanViewReportsDetailsStatuses
.
includes
(
get
(
collection
,
'
status
'
,
'
draft
'
),
get
(
collection
,
'
status
'
,
'
draft
'
),
...
@@ -153,7 +153,7 @@ export const canAuthorViewEditorialComments = (
...
@@ -153,7 +153,7 @@ export const canAuthorViewEditorialComments = (
collection
=
{},
collection
=
{},
fragmentId
,
fragmentId
,
)
=>
{
)
=>
{
const
isAuthor
=
currentUserIsAuthor
(
state
)
const
isAuthor
=
currentUserIsAuthor
(
state
,
fragmentId
)
return
(
return
(
isAuthor
&&
isAuthor
&&
!
cannotAuthorViewEditorialCommentsStatuses
.
includes
(
!
cannotAuthorViewEditorialCommentsStatuses
.
includes
(
...
@@ -251,10 +251,10 @@ export const canMakeRevision = (state, collection = {}, fragment = {}) => {
...
@@ -251,10 +251,10 @@ export const canMakeRevision = (state, collection = {}, fragment = {}) => {
)
)
}
}
export
const
currentUserIsAuthor
=
state
=>
{
export
const
currentUserIsAuthor
=
(
state
,
fragmentId
)
=>
{
const
authors
=
state
.
collections
[
0
].
owners
.
map
(
e
=>
e
.
id
)
const
{
id
:
userId
}
=
selectCurrentUser
(
state
)
const
user
=
state
.
currentUser
.
user
.
id
const
authors
=
get
(
state
,
`fragments.
${
fragmentId
}
.authors`
,
[])
return
authors
.
in
cludes
(
user
)
return
!!
authors
.
f
in
d
(
a
=>
a
.
id
===
user
Id
)
}
}
export
const
getUserPermissions
=
({
teams
=
[]
})
=>
export
const
getUserPermissions
=
({
teams
=
[]
})
=>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment