Skip to content
Snippets Groups Projects

Hin 1036

Merged Andrei Cioromila requested to merge hin-1036 into develop
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
200 206 }
201 207
202 208 if (operation === 'PATCH') {
203 if (get(object, 'type') === 'collection') {
204 return helpers.isOwner({ user, object })
209 if (get(object.current, 'type') === 'collection') {
210 return helpers.isOwner({ user, object: object.current })
205 211 }
206 212
207 if (get(object, 'type') === 'fragment') {
208 return helpers.isOwner({ user, object })
213 if (get(object.current, 'type') === 'fragment') {
  • Why did you use get(object.current, 'type') === 'fragment') and not get(object, 'current.type') === 'fragment') ?

  • The current property is added by pubsweet for every PATCH request. Therefore, I know I can rely on it to always exist. Moreover, object.current is the actual object that is relevant to my business logic, thus I prefer to use that one

  • Please register or sign in to reply
  • mentioned in commit 28b3149a

  • Please register or sign in to reply