Skip to content

Commit 83b35ed

Browse files
Merge pull request #362 from topcoder-platform/PROD-4120
update topcoder-react-lib and community-app for topgear submit URL issue
2 parents fd71be9 + 8c9fc49 commit 83b35ed

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- attach_workspace:
2929
at: .
3030
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
31-
- run: npm publish
31+
- run: npm publish --tag test-release
3232
# dont change anything
3333
workflows:
3434
version: 2

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "1.2.10",
34+
"version": "1000.29.17",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"config": "^3.2.0",

Diff for: src/services/groups.js

+10-19
Original file line numberDiff line numberDiff line change
@@ -319,28 +319,19 @@ class GroupService {
319319
* cache. Defaults to 5 minutes.
320320
* @return {Promise} Resolves to ID array.
321321
*/
322-
async getGroupTreeIds(rootGroupId, maxage = 5 * 60 * 1000) {
323-
const now = Date.now();
324-
const cache = this.private.cache.groupTreeIds;
322+
async getGroupTreeIds(rootGroupId) {
323+
const rootGroupURL = `/groups/${rootGroupId}`;
324+
const rootGroupRes = await this.private.api.get(rootGroupURL);
325+
const rootGroupJSON = await handleApiResponse(rootGroupRes);
325326

326-
/* Clean-up: removes stale records from the cache. */
327-
const CLEAN_UP_INTERVAL = 24 * 60 * 60 * 1000; // 1 day in ms.
328-
if (now - cache.lastCleanUp > CLEAN_UP_INTERVAL) {
329-
_.forOwn(cache, ({ timestamp }, key) => {
330-
if (now - timestamp > CLEAN_UP_INTERVAL) delete cache[key];
331-
});
332-
cache.lastCleanUp = now;
333-
}
327+
const url = `/groups/${rootGroupJSON.id}?flattenGroupIdTree=true`;
328+
const response = await this.private.api.get(url);
329+
const responseJSON = await handleApiResponse(response);
334330

335-
/* If result is found in cache, and is fresh enough, return it. */
336-
const cached = cache[rootGroupId];
337-
if (cached && now - cached.timestamp < maxage) return _.clone(cached.data);
331+
const treeIds = responseJSON.flattenGroupIdTree;
332+
treeIds.unshift(responseJSON.id);
338333

339-
/* Otherwise, fetch result from the API, write it to the cache, and
340-
* finally return that. */
341-
const res = reduceGroupIds(await this.getGroup(rootGroupId));
342-
cache[rootGroupId] = { data: res, timestamp: now };
343-
return _.clone(res);
334+
return treeIds;
344335
}
345336

346337
/**

0 commit comments

Comments
 (0)