fix #3672 - remove the watchings items if the user is not project member in the user home
parent
e2ac1d1470
commit
5df43360d3
|
@ -68,28 +68,35 @@ class HomeService extends taiga.Service
|
|||
watching = workInProgress.get("watching")
|
||||
|
||||
if watching.get("userStories")
|
||||
_duties = watching.get("userStories").map (duty) ->
|
||||
_duties = watching.get("userStories").filter (duty) ->
|
||||
return !!projectsById.get(String(duty.get('project')))
|
||||
|
||||
_duties = _duties.map (duty) ->
|
||||
return _attachProjectInfoToDuty(duty, "userstories")
|
||||
|
||||
watching = watching.set("userStories", _duties)
|
||||
|
||||
if watching.get("tasks")
|
||||
_duties = watching.get("tasks").map (duty) ->
|
||||
_duties = watching.get("tasks").filter (duty) ->
|
||||
return !!projectsById.get(String(duty.get('project')))
|
||||
|
||||
_duties = _duties.map (duty) ->
|
||||
return _attachProjectInfoToDuty(duty, "tasks")
|
||||
|
||||
watching = watching.set("tasks", _duties)
|
||||
|
||||
if watching.get("issues")
|
||||
_duties = watching.get("issues").map (duty) ->
|
||||
_duties = watching.get("issues").filter (duty) ->
|
||||
return !!projectsById.get(String(duty.get('project')))
|
||||
|
||||
_duties = _duties.map (duty) ->
|
||||
return _attachProjectInfoToDuty(duty, "issues")
|
||||
|
||||
watching = watching.set("issues", _duties)
|
||||
|
||||
|
||||
workInProgress = workInProgress.set("assignedTo", assignedTo)
|
||||
workInProgress = workInProgress.set("watching", watching)
|
||||
|
||||
|
||||
getWorkInProgress: (userId) ->
|
||||
projectsById = Immutable.Map()
|
||||
|
||||
|
|
|
@ -80,9 +80,25 @@ describe "tgHome", ->
|
|||
{id: 2, name: "fake2", slug: "project-2"}
|
||||
]))
|
||||
|
||||
mocks.resources.userstories.listInAllProjects.promise()
|
||||
mocks.resources.userstories.listInAllProjects
|
||||
.withArgs(sinon.match({
|
||||
is_closed: false
|
||||
assigned_to: userId
|
||||
}))
|
||||
.promise()
|
||||
.resolve(Immutable.fromJS([{id: 1, ref: 1, project: "1"}]))
|
||||
|
||||
mocks.resources.userstories.listInAllProjects
|
||||
.withArgs(sinon.match({
|
||||
is_closed: false
|
||||
watchers: userId
|
||||
}))
|
||||
.promise()
|
||||
.resolve(Immutable.fromJS([
|
||||
{id: 1, ref: 1, project: "1"},
|
||||
{id: 2, ref: 2, project: "10"} # the user is not member of this project
|
||||
]))
|
||||
|
||||
mocks.resources.tasks.listInAllProjects.promise()
|
||||
.resolve(Immutable.fromJS([{id: 2, ref: 2, project: "1"}]))
|
||||
|
||||
|
|
Loading…
Reference in New Issue