New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bulbul-chat

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bulbul-chat - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

2

dist/package.json
{
"name": "bulbul-chat",
"version": "3.2.1",
"version": "3.2.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -104,3 +104,3 @@ "use strict";

this.upsert([rest]);
this.eventRegistry.emit('update', { rest: rest });
this.eventRegistry.emit('update', { channel: __assign({}, rest) });
}

@@ -107,0 +107,0 @@ };

@@ -319,7 +319,7 @@ "use strict";

.then(function (channel) { return __awaiter(_this, void 0, void 0, function () {
var currentUser, blackList, channelMemberships, lastReadMessageId, removeOnNewMessage, removeOnConnect;
var currentUser, channelMemberships_1, lastReadMessageId, blackList, channelMemberships, otherUserId, isBlockingMe_1, removeOnNewMessage, removeOnConnect;
var _this = this;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -331,7 +331,3 @@ if (unsubscribed) {

case 1:
currentUser = _b.sent();
return [4 /*yield*/, this.chatClient.getBlockedUsers()];
case 2:
blackList = _b.sent();
this.channelsStorage.setBlackList(blackList);
currentUser = _c.sent();
//Check if we need to join channel socket or the user channel is enough

@@ -351,12 +347,39 @@ //FIXME channel does not have listed & watching. Those property are from ChannelMembership.

if (!(channelMessageStorage.latestDate() &&
!channelMessageStorage.initialMessagesLoaded)) return [3 /*break*/, 3];
!channelMessageStorage.initialMessagesLoaded)) return [3 /*break*/, 2];
channelMessageStorage.loadAllLater(this.chatClient);
return [3 /*break*/, 5];
case 3: return [4 /*yield*/, this.channelMembershipsStorage.findMany(channel.id)];
case 4:
channelMemberships = _b.sent();
lastReadMessageId = ((_a = channelMemberships === null || channelMemberships === void 0 ? void 0 : channelMemberships.find(function (cm) { return cm.userId === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id); })) === null || _a === void 0 ? void 0 : _a.lastReadMessageId) || 0;
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, this.channelMembershipsStorage.findMany(channel.id)];
case 3:
channelMemberships_1 = _c.sent();
lastReadMessageId = ((_a = channelMemberships_1 === null || channelMemberships_1 === void 0 ? void 0 : channelMemberships_1.find(function (cm) { return cm.userId === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id); })) === null || _a === void 0 ? void 0 : _a.lastReadMessageId) || 0;
channelMessageStorage.loadEarlier(this.chatClient, channel.unreadMessageCount, lastReadMessageId);
_b.label = 5;
_c.label = 4;
case 4: return [4 /*yield*/, this.chatClient.getBlockedUsers()];
case 5:
blackList = _c.sent();
this.channelsStorage.setBlackList(blackList);
return [4 /*yield*/, this.channelMembershipsStorage.findMany(channel.id)];
case 6:
channelMemberships = _c.sent();
otherUserId = (_b = channelMemberships === null || channelMemberships === void 0 ? void 0 : channelMemberships.find(function (cm) { return cm.userId !== (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id); })) === null || _b === void 0 ? void 0 : _b.userId;
if (!otherUserId) return [3 /*break*/, 8];
return [4 /*yield*/, this.chatClient.isBlockingMe(otherUserId)];
case 7:
isBlockingMe_1 = _c.sent();
this.channelsStorage.sortedChannels().forEach(function (channel) { return __awaiter(_this, void 0, void 0, function () {
var channelMemberships;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.channelMembershipsStorage.findMany(channel.id)];
case 1:
channelMemberships = _a.sent();
if (channelMemberships === null || channelMemberships === void 0 ? void 0 : channelMemberships.some(function (cm) { return cm.userId === otherUserId; })) {
this.channelsStorage.update(__assign(__assign({}, channel), { isBlockingMe: isBlockingMe_1 }));
}
return [2 /*return*/];
}
});
}); });
_c.label = 8;
case 8:
removeOnNewMessage = this.chatClient.onNewMessage(channelId, function (message) {

@@ -363,0 +386,0 @@ var _a;

{
"name": "bulbul-chat",
"version": "3.2.1",
"version": "3.2.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -53,3 +53,3 @@ import { ChannelStoragStateType } from './useChannelsData';

this.upsert([rest]);
this.eventRegistry.emit('update', { rest });
this.eventRegistry.emit('update', { channel: { ...rest } });
}

@@ -56,0 +56,0 @@ }

@@ -261,5 +261,2 @@ import { diffInSeconds } from './utils';

const currentUser = await this.getCurrentUser();
// update black list with latest
const blackList = await this.chatClient.getBlockedUsers();
this.channelsStorage.setBlackList(blackList);

@@ -300,2 +297,24 @@ //Check if we need to join channel socket or the user channel is enough

}
// update black list and is blocking me with latest
const blackList = await this.chatClient.getBlockedUsers();
this.channelsStorage.setBlackList(blackList);
const channelMemberships =
await this.channelMembershipsStorage.findMany(channel.id);
const otherUserId = channelMemberships?.find(
(cm) => cm.userId !== currentUser?.id
)?.userId;
if (otherUserId) {
const isBlockingMe = await this.chatClient.isBlockingMe(otherUserId);
this.channelsStorage.sortedChannels().forEach(async (channel) => {
const channelMemberships =
await this.channelMembershipsStorage.findMany(channel.id);
if (channelMemberships?.some((cm) => cm.userId === otherUserId)) {
this.channelsStorage.update({ ...channel, isBlockingMe });
}
});
}
const removeOnNewMessage = this.chatClient.onNewMessage(

@@ -302,0 +321,0 @@ channelId,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc