notifications
This commit is contained in:
parent
b21921242e
commit
af1635b7da
@ -45,6 +45,7 @@ export class RocketChatAdapter implements NotificationAdapter {
|
||||
|
||||
/**
|
||||
* Get RocketChat user ID from email
|
||||
* Uses the same logic as the messages API: search by username OR email
|
||||
*/
|
||||
private async getRocketChatUserId(email: string): Promise<string | null> {
|
||||
try {
|
||||
@ -80,14 +81,19 @@ export class RocketChatAdapter implements NotificationAdapter {
|
||||
|
||||
logger.debug('[ROCKETCHAT_ADAPTER] Searching for user', {
|
||||
username,
|
||||
email,
|
||||
totalUsers: usersData.users.length,
|
||||
});
|
||||
|
||||
const currentUser = usersData.users.find((u: any) => u.username === username);
|
||||
// Use the exact same logic as the messages API
|
||||
const currentUser = usersData.users.find((user: any) =>
|
||||
user.username === username || user.emails?.some((e: any) => e.address === email)
|
||||
);
|
||||
|
||||
if (!currentUser) {
|
||||
logger.warn('[ROCKETCHAT_ADAPTER] User not found in RocketChat', {
|
||||
username,
|
||||
email,
|
||||
searchedIn: usersData.users.length,
|
||||
availableUsernames: usersData.users.slice(0, 5).map((u: any) => u.username),
|
||||
});
|
||||
@ -96,6 +102,8 @@ export class RocketChatAdapter implements NotificationAdapter {
|
||||
|
||||
logger.debug('[ROCKETCHAT_ADAPTER] Found user', {
|
||||
username,
|
||||
email,
|
||||
rocketChatUsername: currentUser.username,
|
||||
userId: currentUser._id,
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user