Commit 3d09d3f6 authored by Robert Knight's avatar Robert Knight

Simplify `groups#load` by calling `combineGroups` in one place

parent 13543328
...@@ -255,34 +255,27 @@ function groups( ...@@ -255,34 +255,27 @@ function groups(
// If the directLinkedAnnotation's group fetch failed, return // If the directLinkedAnnotation's group fetch failed, return
// the list of groups without it. // the list of groups without it.
if (!directLinkedAnnGroup) { if (!directLinkedAnnGroup) {
return [ return [myGroups, allFeaturedGroups, documentUri, token];
combineGroups(myGroups, allFeaturedGroups, documentUri),
token,
];
} }
// If the directLinkedAnnotation's group fetch was successful, // If the directLinkedAnnotation's group fetch was successful,
// combine it with the other groups. // combine it with the other groups.
return [ return [
combineGroups(
myGroups, myGroups,
allFeaturedGroups.concat(directLinkedAnnGroup), allFeaturedGroups.concat(directLinkedAnnGroup),
documentUri documentUri,
),
token, token,
]; ];
}); });
} }
} }
// If there is no direct-linked annotation, return the list of groups without it. // If there is no direct-linked annotation, return the list of groups without it.
return [ return [myGroups, allFeaturedGroups, documentUri, token];
combineGroups(myGroups, allFeaturedGroups, documentUri),
token,
];
} }
); );
}) })
.then(([groups, token]) => { .then(([myGroups, featuredGroups, documentUri, token]) => {
const groups = combineGroups(myGroups, featuredGroups, documentUri);
const isLoggedIn = token !== null; const isLoggedIn = token !== null;
return filterGroups( return filterGroups(
groups, groups,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment