Commit c913999a authored by Robert Knight's avatar Robert Knight

Tidy up comments following CR feedback

 - Capitalize "API" consistently
 - Remove a couple of comments that repeated the code below
parent d2938dd3
...@@ -201,9 +201,10 @@ function groups( ...@@ -201,9 +201,10 @@ function groups(
auth.tokenGetter(), auth.tokenGetter(),
]; ];
// If there is a directLinkedAnnId, fetch the annotation to see if there needs // If there is a direct-linked annotation, fetch the annotation to see
// to be a second api request to fetch its group since the group may not be in // if there needs to be a second API request to fetch its group since
// the results returned by group.list, profile.groups, or the direct-linked group. // the group may not be in the results returned by group.list,
// profile.groups, or the direct-linked group.
let directLinkedAnnApi = Promise.resolve(null); let directLinkedAnnApi = Promise.resolve(null);
if (directLinkedAnnId) { if (directLinkedAnnId) {
directLinkedAnnApi = api.annotation directLinkedAnnApi = api.annotation
...@@ -215,7 +216,7 @@ function groups( ...@@ -215,7 +216,7 @@ function groups(
} }
groupApiRequests = groupApiRequests.concat(directLinkedAnnApi); groupApiRequests = groupApiRequests.concat(directLinkedAnnApi);
// If there is a directLinkedGroupId, add an api request to get that // If there is a direct-linked group, add an API request to get that
// particular group since it may not be in the results returned by // particular group since it may not be in the results returned by
// group.list or profile.groups. // group.list or profile.groups.
let directLinkedGroupApi = Promise.resolve(null); let directLinkedGroupApi = Promise.resolve(null);
...@@ -255,7 +256,7 @@ function groups( ...@@ -255,7 +256,7 @@ function groups(
? featuredGroups.concat([directLinkedGroup]) ? featuredGroups.concat([directLinkedGroup])
: featuredGroups; : featuredGroups;
// If there's a selected annotation it may require an extra api call // If there's a direct-linked annotation it may require an extra API call
// to fetch its group. // to fetch its group.
if (directLinkedAnn) { if (directLinkedAnn) {
// Set the directLinkedAnnotationGroupId to be used later in // Set the directLinkedAnnotationGroupId to be used later in
...@@ -274,14 +275,9 @@ function groups( ...@@ -274,14 +275,9 @@ function groups(
id: directLinkedAnn.group, id: directLinkedAnn.group,
expand: params.expand, expand: params.expand,
}).then(directLinkedAnnGroup => { }).then(directLinkedAnnGroup => {
// If the directLinkedAnnotation's group fetch failed, return
// the list of groups without it.
if (!directLinkedAnnGroup) { if (!directLinkedAnnGroup) {
return initialFeaturedGroups; return initialFeaturedGroups;
} }
// If the directLinkedAnnotation's group fetch was successful,
// combine it with the other groups.
return initialFeaturedGroups.concat(directLinkedAnnGroup); return initialFeaturedGroups.concat(directLinkedAnnGroup);
}); });
} }
......
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