Skip to content

Commit

Permalink
Merge branch 'rooms-to-async-4' into rooms-to-async-5
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok authored Mar 25, 2023
2 parents 1e702f4 + 011a0fd commit 3f6e745
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/meteor/app/slackbridge/server/SlackAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ export default class SlackAdapter {
{ ts: new Date(parseInt(slackMessage.ts.split('.')[0]) * 1000), imported: 'slackbridge' },
);
} else {
saveRoomTopic(rocketChannel._id, slackMessage.topic, rocketUser, false);
await saveRoomTopic(rocketChannel._id, slackMessage.topic, rocketUser, false);
}
}

Expand All @@ -997,7 +997,7 @@ export default class SlackAdapter {
{ ts: new Date(parseInt(slackMessage.ts.split('.')[0]) * 1000), imported: 'slackbridge' },
);
} else {
saveRoomTopic(rocketChannel._id, slackMessage.purpose, rocketUser, false);
await saveRoomTopic(rocketChannel._id, slackMessage.purpose, rocketUser, false);
}
}

Expand Down Expand Up @@ -1211,17 +1211,17 @@ export default class SlackAdapter {
}
}

copyChannelInfo(rid, channelMap) {
async copyChannelInfo(rid, channelMap) {
slackLogger.debug('Copying users from Slack channel to Rocket.Chat', channelMap.id, rid);
const channel = this.slackAPI.getRoomInfo(channelMap.id);
if (channel) {
const members = this.slackAPI.getMembers(channelMap.id);
if (members && Array.isArray(members) && members.length) {
for (const member of members) {
for await (const member of members) {
const user = this.rocket.findUser(member) || this.rocket.addUser(member);
if (user) {
slackLogger.debug('Adding user to room', user.username, rid);
Promise.await(addUserToRoom(rid, user, null, true));
await addUserToRoom(rid, user, null, true);
}
}
}
Expand Down Expand Up @@ -1250,7 +1250,7 @@ export default class SlackAdapter {
if (topic) {
const creator = this.rocket.findUser(topic_creator) || this.rocket.addUser(topic_creator);
slackLogger.debug('Setting room topic', rid, topic, creator.username);
saveRoomTopic(rid, topic, creator, false);
await saveRoomTopic(rid, topic, creator, false);
}
}
}
Expand Down Expand Up @@ -1297,7 +1297,7 @@ export default class SlackAdapter {
const rocketchat_room = Rooms.findOneById(rid);
if (rocketchat_room) {
if (this.getSlackChannel(rid)) {
this.copyChannelInfo(rid, this.getSlackChannel(rid));
await this.copyChannelInfo(rid, this.getSlackChannel(rid));

slackLogger.debug('Importing messages from Slack to Rocket.Chat', this.getSlackChannel(rid), rid);
let results = await this.importFromHistory(this.getSlackChannel(rid).family, {
Expand Down

0 comments on commit 3f6e745

Please sign in to comment.