Skip to content

Commit

Permalink
fix: apply minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Feb 7, 2024
1 parent 7a0d729 commit a6b745e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/synchronizer/src/handlers/apiHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class ApiHandler {
}

async toggleSuppression(fingerprint: string, repoId: string, description: string, tokenInfo: TokenInfo) {
return this.queryApi<ApiSuppression>(toggleSuppressionMutation, tokenInfo, {fingerprint, repoId, description});
return this.queryApi<ApiSuppressionsData>(toggleSuppressionMutation, tokenInfo, {fingerprint, repoId, description});
}

generateDeepLink(path: string) {
Expand Down
1 change: 1 addition & 0 deletions packages/synchronizer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './handlers/deviceFlowHandler.js';
export * from './handlers/gitHandler.js';
export * from './handlers/storageHandler.js';
export * from './handlers/storageHandlerAuth.js';
export * from './handlers/storageHandlerJsonCache.js'
export * from './handlers/storageHandlerPolicy.js';

export * from './models/user.js';
Expand Down
7 changes: 4 additions & 3 deletions packages/synchronizer/src/utils/projectSynchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export class ProjectSynchronizer extends EventEmitter {
}

const suppressionResult = await this._apiHandler.toggleSuppression(fingerprint, id, description, tokenInfo);
if (suppressionResult) {
if (suppressionResult?.data?.getSuppressions?.data?.length) {
const existingSuppressions = await this.readSuppressions(repoData);
const allSuppressions = this.mergeSuppressions(existingSuppressions, [suppressionResult]);
const allSuppressions = this.mergeSuppressions(existingSuppressions, suppressionResult.data.getSuppressions.data);
await this.storeSuppressions(allSuppressions, repoData);

const cacheId = this.getCacheId(rootPath, projectSlug);
Expand Down Expand Up @@ -319,7 +319,8 @@ export class ProjectSynchronizer extends EventEmitter {
suppressionsMap[suppression.id] = suppression;
});

return Object.values(suppressionsMap);
return Object.values(suppressionsMap)
.filter(suppression => !(suppression.isDeleted || suppression.isRejected));
}

private async storeCacheMetadata(cacheMetadata: CacheMetadata, repoData: RepoRemoteInputData) {
Expand Down

0 comments on commit a6b745e

Please sign in to comment.