Skip to content

Commit

Permalink
Merge pull request #55 from philip-gai/users/philip-gai/more-renaming
Browse files Browse the repository at this point in the history
More renaming
  • Loading branch information
philip-gai authored Nov 9, 2021
2 parents 1e649fd + 96fbb19 commit 00bee39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions infrastructure/modules/cosmos-module.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ resource databaseAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
}
networkAclBypassResourceIds: []
}
resource repostDatabase 'sqlDatabases@2021-06-15' = {
name: 'Repost'
resource database 'sqlDatabases@2021-06-15' = {
name: 'AnnouncementDrafter'
properties: {
resource: {
id: 'Repost'
id: 'AnnouncementDrafter'
}
}

Expand Down
8 changes: 4 additions & 4 deletions web-app/src/eventHandlers/pullRequestEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,25 @@ Please fix the issues and recreate a new PR:
});

// Our app will skip it if our comment has been edited (for security)
const repostComments = pullRequestComments.filter(
const botComments = pullRequestComments.filter(
(comment) => comment.user.login === appLogin && !comment.in_reply_to_id && comment.path && !comment.body.includes(this.errorIcon)
);

if (repostComments.length == 0) {
if (botComments.length == 0) {
logger.info(`No ${appLogin} comments found on this PR`);
return;
}

// Get new tokens for all the users only once using their refresh tokens
const userTokenCache: { [login: string]: string } = {};
const users = repostComments.map((comment) => this.getAuthorLogin(comment.body));
const users = botComments.map((comment) => this.getAuthorLogin(comment.body));
const usersDistinct = Array.from(new Set(users));
for (const userLogin of usersDistinct) {
userTokenCache[userLogin] = await this._tokenService.refreshUserToken(userLogin);
}

// 2. Check for the approval reaction made by the author
for (const fileToPostComment of repostComments) {
for (const fileToPostComment of botComments) {
const authorLogin = this.getAuthorLogin(fileToPostComment.body);
const reactions = await appGitHubService.getPullRequestCommentReaction({
...pullInfo,
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/services/configService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ConfigService {

private static getDefaultConfig(): AppConfig {
return {
cosmos_database_id: 'Repost',
cosmos_database_id: 'AnnouncementDrafter',
cosmos_uri: process.env['COSMOS_URI'] || '',
cosmos_primary_key: process.env['COSMOS_PRIMARY_KEY'] || '',
github_callback_url: process.env['CALLBACK_URL'] || '',
Expand Down

0 comments on commit 00bee39

Please sign in to comment.