Skip to content

Commit

Permalink
fix: correct parameter order in callbackHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogarim committed Sep 16, 2024
1 parent fad7f97 commit 15a7b3c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion apps/meteor/app/autotranslate/server/autotranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ export class TranslationProviderRegistry {
return;
}

callbacks.add('afterSaveMessage', provider.translateMessage.bind(provider), callbacks.priority.MEDIUM, 'autotranslate');
callbacks.add(
'afterSaveMessage',
(message, { room }) => provider.translateMessage(message, { room }),
callbacks.priority.MEDIUM,
'autotranslate',
);
}
}

Expand Down
7 changes: 6 additions & 1 deletion apps/meteor/app/integrations/server/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ const callbackHandler = function _callbackHandler(eventType: string) {
};
};

callbacks.add('afterSaveMessage', callbackHandler('sendMessage'), callbacks.priority.LOW, 'integrations-sendMessage');
callbacks.add(
'afterSaveMessage',
(message, { room }) => callbackHandler('sendMessage')(message, room),
callbacks.priority.LOW,
'integrations-sendMessage',
);
callbacks.add('afterCreateChannel', callbackHandler('roomCreated'), callbacks.priority.LOW, 'integrations-roomCreated');
callbacks.add('afterCreatePrivateGroup', callbackHandler('roomCreated'), callbacks.priority.LOW, 'integrations-roomCreated');
callbacks.add('afterCreateUser', callbackHandler('userCreated'), callbacks.priority.LOW, 'integrations-userCreated');
Expand Down
7 changes: 6 additions & 1 deletion apps/meteor/ee/server/lib/engagementDashboard/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { fillFirstDaysOfMessagesIfNeeded, handleMessagesDeleted, handleMessagesS
import { fillFirstDaysOfUsersIfNeeded, handleUserCreated } from './users';

export const attachCallbacks = (): void => {
callbacks.add('afterSaveMessage', handleMessagesSent, callbacks.priority.MEDIUM, 'engagementDashboard.afterSaveMessage');
callbacks.add(
'afterSaveMessage',
(message, { room }) => handleMessagesSent(message, { room }),
callbacks.priority.MEDIUM,
'engagementDashboard.afterSaveMessage',
);
callbacks.add('afterDeleteMessage', handleMessagesDeleted, callbacks.priority.MEDIUM, 'engagementDashboard.afterDeleteMessage');
callbacks.add('afterCreateUser', handleUserCreated, callbacks.priority.MEDIUM, 'engagementDashboard.afterCreateUser');
};
Expand Down

0 comments on commit 15a7b3c

Please sign in to comment.