Commit 6623a3bb authored by Robert Knight's avatar Robert Knight

Revise code comments in response to review feedback

 - Avoid references to specific API requests, which might get out of
   date
 - Move a comment up a few lines above another line of code which exists
   for the reason explained in that comment
parent 928a0b90
...@@ -183,10 +183,9 @@ function groups( ...@@ -183,10 +183,9 @@ function groups(
params.document_uri = documentUri; params.document_uri = documentUri;
} }
// If there is a direct-linked annotation, fetch the annotation to see // If there is a direct-linked annotation, fetch the annotation in case
// if there needs to be a second API request to fetch its group since // the associated group has not already been fetched and we need to make
// the group may not be in the results returned by group.list, // an additional request for it.
// profile.groups, or the direct-linked group.
const directLinkedAnnId = store.getState().directLinkedAnnotationId; const directLinkedAnnId = store.getState().directLinkedAnnotationId;
let directLinkedAnnApi = null; let directLinkedAnnApi = null;
if (directLinkedAnnId) { if (directLinkedAnnId) {
...@@ -199,8 +198,8 @@ function groups( ...@@ -199,8 +198,8 @@ function groups(
} }
// If there is a direct-linked group, 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 set of groups that are
// group.list or profile.groups. // fetched by other requests.
const directLinkedGroupId = store.getState().directLinkedGroupId; const directLinkedGroupId = store.getState().directLinkedGroupId;
let directLinkedGroupApi = null; let directLinkedGroupApi = null;
if (directLinkedGroupId) { if (directLinkedGroupId) {
...@@ -252,12 +251,12 @@ function groups( ...@@ -252,12 +251,12 @@ function groups(
// the filterGroups method. // the filterGroups method.
directLinkedAnnotationGroupId = directLinkedAnn.group; directLinkedAnnotationGroupId = directLinkedAnn.group;
// If the direct-linked annotation's group has not already been fetched,
// fetch it.
const directLinkedAnnGroup = myGroups const directLinkedAnnGroup = myGroups
.concat(featuredGroups) .concat(featuredGroups)
.find(g => g.id === directLinkedAnn.group); .find(g => g.id === directLinkedAnn.group);
// If the direct-linked annotation's group has not already been fetched,
// fetch it.
if (!directLinkedAnnGroup) { if (!directLinkedAnnGroup) {
const directLinkedAnnGroup = await fetchGroup({ const directLinkedAnnGroup = await fetchGroup({
id: directLinkedAnn.group, id: directLinkedAnn.group,
......
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