message: Implement migrateEntry to update entry IDs correctly
diff: @@ -20,7 +20,8 @@ var BridgeRequest = require("../models/BridgeRequest");
  var stats = require("../config/stats");
  var DataStore = require("../DataStore");
  var log = require("../logging").get("IrcBridge");
  -const { Bridge, MatrixUser, PrometheusMetrics, Logging } = require("matrix-appservice-bridge");
  +const { Bridge, MatrixUser, MatrixRoom,
  + PrometheusMetrics, Logging } = require("matrix-appservice-bridge");
  const MatrixActivityTracker = require("matrix-lastactive").MatrixActivityTracker;
  var DebugApi = require("../DebugApi");
  @@ -117,6 +118,7 @@ function IrcBridge(config, registration) {
  // We want to handle this in _onRoomUpgrade
  migrateGhosts: false,
  onRoomMigrated: this._onRoomUpgrade.bind(this),
  + migrateEntry: this._roomUpgradeMigrateEntry.bind(this),
  }
  });
  @@ -1048,6 +1050,19 @@ IrcBridge.prototype._fetchJoinedRooms = Promise.coroutine(function*() {
  }
  });
  +
  +IrcBridge.prototype._roomUpgradeMigrateEntry = function(entry, newRoomId) {
  + const oldRoomId = entry.matrix.getId();
  + // Often our IDs for entries depend upon the room, so replace them.
  + entry.id = entry.id.replace(oldRoomId, newRoomId);
  + entry.matrix = new MatrixRoom(newRoomId, {
  + name: entry.name,
  + topic: entry.topic,
  + extras: entry._extras,
  + });
  + return entry;
  +}
  +
  IrcBridge.prototype._onRoomUpgrade = Promise.coroutine(function*(oldRoomId, newRoomId) {
  log.info(`Room has been upgraded from ${oldRoomId} to ${newRoomId}, updating ghosts..`);
  // Get the channels for the room_id
  