Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
penginn-net committed Nov 8, 2024
1 parent bbb4e86 commit 32aa78a
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions packages/backend/src/core/ReactionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,14 @@ export class ReactionService {
// Create reaction
try {
await this.noteReactionsRepository.insert(record);
if (!(note.searchableBy === 'private' && note.userHost !== null)) {
await this.advancedSearchService.indexReaction({
id: record.id,
noteId: record.noteId,
userId: record.userId,
reaction: record.reaction,
remote: user.host === null ? false : true,
searchableBy: note.searchableBy ?? undefined,
});
}
await this.advancedSearchService.indexReaction({
id: record.id,
noteId: record.noteId,
userId: record.userId,
reaction: record.reaction,
remote: user.host === null ? false : true,
searchableBy: note.searchableBy ?? undefined,
});
} catch (e) {
if (isDuplicateKeyValueError(e)) {
const exists = await this.noteReactionsRepository.findOneByOrFail({
Expand Down Expand Up @@ -311,9 +309,7 @@ export class ReactionService {

// Delete reaction
const result = await this.noteReactionsRepository.delete(exist.id);
if (note.searchableBy !== 'private') {
await this.advancedSearchService.unindexReaction(exist.id, user.host !== null, note.id, exist.reaction);
}
await this.advancedSearchService.unindexReaction(exist.id, user.host !== null, note.id, exist.reaction);

if (result.affected !== 1) {
throw new IdentifiableError('60527ec9-b4cb-4a88-a6bd-32d3ad26817d', 'not reacted');
Expand Down

0 comments on commit 32aa78a

Please sign in to comment.