Skip to content

Commit 359748a

Browse files
manage real time block user
1 parent e3e9f8c commit 359748a

File tree

10 files changed

+817
-843
lines changed

10 files changed

+817
-843
lines changed

web-widget/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ app.use(express.static('dist'));
77
app.use(express.static('./'));
88

99
app.get('/', function(req, res) {
10-
res.sendfile('index.html');
10+
res.sendfile('index.html');
1111
});
1212

1313
app.listen(PORT);

web-widget/src/js/adapter.js

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -87,51 +87,51 @@ class ChannelizeAdapter {
8787
}
8888

8989
addMember(conversation, memberIds, cb) {
90-
conversation.addMembers(memberIds, function (err, res) {
91-
if (err) return cb(err);
90+
conversation.addMembers(memberIds, function (err, res) {
91+
if (err) return cb(err);
9292

93-
return cb(null, res);
94-
});
93+
return cb(null, res);
94+
});
9595
}
9696

9797
removeMember(conversation, memberIds, cb) {
98-
conversation.removeMembers(memberIds, function (err, res) {
99-
if (err) return cb(err);
98+
conversation.removeMembers(memberIds, function (err, res) {
99+
if (err) return cb(err);
100100

101-
return cb(null, res);
102-
});
101+
return cb(null, res);
102+
});
103103
}
104104

105105
blockMember(userId, cb) {
106106
this.channelize.User.block(userId, function (err, res) {
107-
if (err) return cb(err);
107+
if (err) return cb(err);
108108

109-
return cb(null, res);
110-
});
109+
return cb(null, res);
110+
});
111111
}
112112

113113
unblockMember(userId, cb) {
114114
this.channelize.User.unblock(userId, function (err, res) {
115-
if (err) return cb(err);
115+
if (err) return cb(err);
116116

117-
return cb(null, res);
118-
});
117+
return cb(null, res);
118+
});
119119
}
120120

121121
clearConversation(conversation, cb) {
122-
conversation.clear(function (err, res) {
123-
if (err) return cb(err);
122+
conversation.clear(function (err, res) {
123+
if (err) return cb(err);
124124

125-
return cb(null, res);
126-
});
125+
return cb(null, res);
126+
});
127127
}
128128

129129
leaveConversation(conversation, cb) {
130-
conversation.leave(function (err, res) {
131-
if (err) return cb(err);
130+
conversation.leave(function (err, res) {
131+
if (err) return cb(err);
132132

133-
return cb(null, res);
134-
});
133+
return cb(null, res);
134+
});
135135
}
136136

137137
muteConversation(conversation, cb) {
@@ -143,43 +143,43 @@ class ChannelizeAdapter {
143143
}
144144

145145
deleteConversation(conversation, cb) {
146-
conversation.delete(function (err, res) {
147-
if (err) return cb(err);
146+
conversation.delete(function (err, res) {
147+
if (err) return cb(err);
148148

149-
return cb(null, res);
150-
});
149+
return cb(null, res);
150+
});
151151
}
152152

153153
markAsReadConversation(conversation, cb) {
154-
conversation.markAllMessageRead(function (err, res) {
155-
if (err) return cb(err);
154+
conversation.markAllMessageRead(function (err, res) {
155+
if (err) return cb(err);
156156

157-
return cb(null, res);
158-
});
157+
return cb(null, res);
158+
});
159159
}
160160

161161
async sendTextMessage(conversation, body, tags = [], cb) {
162-
conversation.sendTextMessage(body, tags, function (err, res) {
163-
if (err) return cb(err);
162+
conversation.sendTextMessage(body, tags, function (err, res) {
163+
if (err) return cb(err);
164164

165-
return cb(null, res);
166-
});
165+
return cb(null, res);
166+
});
167167
}
168168

169169
async sendTextMessageToUser(userId, body, cb) {
170-
this.channelize.Message.sendTextMessage(userId, body, function (err, message) {
171-
if (err) return cb(err);
170+
this.channelize.Message.sendTextMessage(userId, body, function (err, message) {
171+
if (err) return cb(err);
172172

173-
return cb(null, message);
174-
});
173+
return cb(null, message);
174+
});
175175
}
176176

177177
async sendFileMessage(conversation, file, createThumbnail, cb) {
178-
conversation.sendFileMessage(file, createThumbnail, function(err, message) {
179-
if (err) return cb(err);
178+
conversation.sendFileMessage(file, createThumbnail, function(err, message) {
179+
if (err) return cb(err);
180180

181-
return cb(null, message);
182-
});
181+
return cb(null, message);
182+
});
183183
}
184184

185185
getMessages(conversation, limit = 50, skip = 0, cb) {
@@ -246,7 +246,6 @@ class ChannelizeAdapter {
246246
return cb(null, users);
247247
});
248248
}
249-
250249
}
251250

252251
export { ChannelizeAdapter as default };

0 commit comments

Comments
 (0)