Skip to content

Commit

Permalink
Merge pull request #1136 from givepraise/fix/relevant-praise-logging
Browse files Browse the repository at this point in the history
Fix/relevant praise logging
  • Loading branch information
kristoferlund authored Aug 18, 2023
2 parents deb7148 + 1b0144d commit 32cc67f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **API:** Decreased the amount of information logged when praising. Full praise is available in praise feed, now logging user id and praise ids only.
- **Frontend**: User pages can now be accessed with the username instead of the user id. #1128
- **Frontend**: Upgraded to the latest version of RainbowKit. This should fix some issues with the WalletConnect login flow.
- **API**: Backup restore script now supports specifying which database to import from and restore to
Expand Down
18 changes: 5 additions & 13 deletions packages/api/src/praise/praise.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,22 +247,14 @@ export class PraiseController {
): Promise<Praise[]> {
const praise = await this.praiseService.createPraiseItem(data);

let giver: string;
const praiseItem = praise[0];
if (praiseItem.giver && praiseItem.giver instanceof UserAccount) {
if (praiseItem.giver.user && praiseItem.giver.user instanceof User) {
giver = praiseItem.giver.user.username;
} else {
giver = String(praiseItem.giver._id);
}
} else {
giver = String(praiseItem.giver);
}

await this.eventLogService.logEventWithAuthContext({
authContext: request.authContext,
typeKey: EventLogTypeKey.PRAISE,
description: `Giver ${giver} created an Praise item with receiver IDS ${data.receiverIds}`,
description: `User ${data.giver.name}, accountId: ${
data.giver.accountId
}, created praise items: ${praise.map((p) => p._id)}, platform: ${
data.giver.platform
}`,
});

return praise;
Expand Down

0 comments on commit 32cc67f

Please sign in to comment.