Skip to content

Commit

Permalink
Merge branch 'master' of github.com:async-labs/saas
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Jul 4, 2019
2 parents bf372b1 + 86bd096 commit 8b542fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions api/server/api/team-member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ async function loadDiscussionsData(team, userId, body) {
const { discussionSlug } = body;

if (!discussionSlug) {
return {};
return [];
}

const { discussions } = await Discussion.getList({
userId,
teamId: team._id,
});

const data: any = { initialDiscussions: discussions };

for (const discussion of discussions) {
if (discussion.slug === discussionSlug) {
Object.assign(discussion, {
Expand All @@ -56,7 +54,7 @@ async function loadDiscussionsData(team, userId, body) {
}
}

return data;
return discussions;
}

async function loadTeamData(team, userId, body) {
Expand All @@ -73,9 +71,9 @@ async function loadTeamData(team, userId, body) {
});
}

Object.assign(team, await loadDiscussionsData(team, userId, body));
const initialDiscussions = await loadDiscussionsData(team, userId, body);

const data: any = { initialMembers, initialInvitations };
const data: any = { initialMembers, initialInvitations, initialDiscussions };

return data;
}
Expand Down

0 comments on commit 8b542fe

Please sign in to comment.