message: Move userId switching code to enqueue section
diff: @@ -64,7 +64,7 @@ function IrcHandler(ircBridge, config) {
  // QueuePool for leaving "concurrently" without slowing leaves to a crawl.
  // Takes {
  // rooms: MatrixRoom[],
  - // matrixUser: MatrixUser,
  + // userId: string,
  // shouldKick: boolean
  // req: Request
  //}
  @@ -73,17 +73,15 @@ function IrcHandler(ircBridge, config) {
  (item) => {
  const bridge = this.ircBridge.getAppServiceBridge();
  return Promise.all(item.rooms.map((room) => {
  - const userId = item.matrixUser.getId === undefined ?
  - item.matrixUser : item.matrixUser.getId();
  item.req.log.info(
  "Leaving room %s (%s)",
  room.getId(),
  - userId
  + item.userId
  );
  if (item.shouldKick) {
  return bridge.getIntent().kick(
  room.getId(),
  - userId,
  + item.userId,
  "Client PARTed from channel"
  ).catch(() => {
  item.req.log.info(
  @@ -96,7 +94,7 @@ function IrcHandler(ircBridge, config) {
  return bridge.getIntent(userId).leave(room.getId()).catch(() => {
  item.req.log.info(
  "Failed to leave %s from %s",
  - userId,
  + item.userId,
  room.getId()
  );
  });
  @@ -842,7 +840,7 @@ IrcHandler.prototype.onPart = Promise.coroutine(function*(req, server, leavingUs
  const promise = this._leaveQueue.enqueue(chan+leavingUser.nick, {
  rooms: matrixRooms,
  - matrixUser,
  + userId: typeof(matrixUser) === "string" ? matrixUser : matrixUser.getId(),
  shouldKick: leavingUser.isVirtual,
  req
  });
  