Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import { Record, List } from 'immutable'
  2.  
  3. const BundleRecord = Record({
  4. id: null,
  5. slug: null,
  6. name: null,
  7. description: null,
  8. creator: null,
  9. shares: List(),
  10. links_count: null,
  11. favorited: null,
  12. created_at: null,
  13. joined: false
  14. })
  15.  
  16. export default class Bundle extends BundleRecord {
  17. canRemove (userId) {
  18. return this.creator === userId
  19. }
  20.  
  21. canShare (userId) {
  22. return this.creator === userId
  23. }
  24.  
  25. shareIdFor (userId) {
  26. let share = this.shares.find(share => share.user.id === userId)
  27.  
  28. return share ? share.id : null
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement