snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import onCreateRoom from './onCreateRoom';
|
||||
import onCreateUser from './onCreateUser';
|
||||
import onJoinRoom from './onJoinRoom';
|
||||
import onLeaveRoom from './onLeaveRoom';
|
||||
import onLogin from './onLogin';
|
||||
import onLogout from './onLogout';
|
||||
import onSaveMessage from './onSaveMessage';
|
||||
|
||||
export { onCreateRoom, onJoinRoom, onLeaveRoom, onLogin, onLogout, onSaveMessage, onCreateUser };
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Users } from '@rocket.chat/models';
|
||||
|
||||
export default async function handleOnCreateRoom(user, room) {
|
||||
const users = await Users.findByRoomId(room._id);
|
||||
|
||||
users.forEach((user) => {
|
||||
if (user.profile?.irc?.fromIRC) {
|
||||
this.sendCommand('joinChannel', { room, user });
|
||||
} else {
|
||||
this.sendCommand('joinedChannel', { room, user });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Rooms, Users } from '@rocket.chat/models';
|
||||
|
||||
export default async function handleOnCreateUser(newUser) {
|
||||
if (!newUser) {
|
||||
return this.log('Invalid handleOnCreateUser call');
|
||||
}
|
||||
if (!newUser.username) {
|
||||
return this.log('Invalid handleOnCreateUser call (Missing username)');
|
||||
}
|
||||
if (this.loggedInUsers.indexOf(newUser._id) !== -1) {
|
||||
return this.log('Duplicate handleOnCreateUser call');
|
||||
}
|
||||
|
||||
this.loggedInUsers.push(newUser._id);
|
||||
|
||||
await Users.updateOne(
|
||||
{ _id: newUser._id },
|
||||
{
|
||||
$set: {
|
||||
'profile.irc.fromIRC': false,
|
||||
'profile.irc.username': `${newUser.username}-rkt`,
|
||||
'profile.irc.nick': `${newUser.username}-rkt`,
|
||||
'profile.irc.hostname': 'rocket.chat',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const user = await Users.findOne({
|
||||
_id: newUser._id,
|
||||
});
|
||||
|
||||
this.sendCommand('registerUser', user);
|
||||
|
||||
const rooms = await Rooms.findBySubscriptionUserId(user._id).toArray();
|
||||
|
||||
rooms.forEach((room) => this.sendCommand('joinedChannel', { room, user }));
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default async function handleOnJoinRoom(user, room) {
|
||||
this.sendCommand('joinedChannel', { room, user });
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default async function handleOnLeaveRoom(user, room) {
|
||||
this.sendCommand('leftChannel', { room, user });
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Rooms, Users } from '@rocket.chat/models';
|
||||
|
||||
export default async function handleOnLogin(login) {
|
||||
if (login.user === null) {
|
||||
return this.log('Invalid handleOnLogin call');
|
||||
}
|
||||
if (!login.user.username) {
|
||||
return this.log('Invalid handleOnLogin call (Missing username)');
|
||||
}
|
||||
if (this.loggedInUsers.indexOf(login.user._id) !== -1) {
|
||||
return this.log('Duplicate handleOnLogin call');
|
||||
}
|
||||
|
||||
this.loggedInUsers.push(login.user._id);
|
||||
|
||||
await Users.updateOne(
|
||||
{ _id: login.user._id },
|
||||
{
|
||||
$set: {
|
||||
'profile.irc.fromIRC': false,
|
||||
'profile.irc.username': `${login.user.username}-rkt`,
|
||||
'profile.irc.nick': `${login.user.username}-rkt`,
|
||||
'profile.irc.hostname': 'rocket.chat',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const user = await Users.findOne({
|
||||
_id: login.user._id,
|
||||
});
|
||||
|
||||
this.sendCommand('registerUser', user);
|
||||
const rooms = await Rooms.findBySubscriptionUserId(user._id).toArray();
|
||||
|
||||
rooms.forEach((room) => {
|
||||
if (room.t === 'd') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendCommand('joinedChannel', { room, user });
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import _ from 'underscore';
|
||||
|
||||
export default async function handleOnLogout(user) {
|
||||
this.loggedInUsers = _.without(this.loggedInUsers, user._id);
|
||||
|
||||
this.sendCommand('disconnected', { user });
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Subscriptions, Users } from '@rocket.chat/models';
|
||||
|
||||
import { SystemLogger } from '../../../../lib/logger/system';
|
||||
|
||||
export default async function handleOnSaveMessage(message, to) {
|
||||
let toIdentification = '';
|
||||
// Direct message
|
||||
if (to.t === 'd') {
|
||||
const subscriptions = Subscriptions.findByRoomId(to._id).toArray();
|
||||
for await (const subscription of subscriptions) {
|
||||
if (subscription.u._id !== message.u._id) {
|
||||
const userData = await Users.findOne({ username: subscription.u.username });
|
||||
if (userData) {
|
||||
if (userData.profile && userData.profile.irc && userData.profile.irc.nick) {
|
||||
toIdentification = userData.profile.irc.nick;
|
||||
} else {
|
||||
toIdentification = userData.username;
|
||||
}
|
||||
} else {
|
||||
toIdentification = subscription.u.username;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!toIdentification) {
|
||||
SystemLogger.error('[irc][server] Target user not found');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
toIdentification = `#${to.name}`;
|
||||
}
|
||||
|
||||
const user = await Users.findOne({ _id: message.u._id });
|
||||
|
||||
this.sendCommand('sentMessage', { to: toIdentification, user, message: message.msg });
|
||||
}
|
||||
Reference in New Issue
Block a user