setRedactionEvent method

void setRedactionEvent(
  1. Event redactedBecause
)

Implementation

void setRedactionEvent(Event redactedBecause) {
  unsigned = {
    'redacted_because': redactedBecause.toJson(),
  };
  prevContent = null;
  _originalSource = null;
  final contentKeyWhiteList = <String>[];
  switch (type) {
    case EventTypes.RoomMember:
      contentKeyWhiteList.add('membership');
      break;
    case EventTypes.RoomCreate:
      contentKeyWhiteList.add('creator');
      break;
    case EventTypes.RoomJoinRules:
      contentKeyWhiteList.add('join_rule');
      break;
    case EventTypes.RoomPowerLevels:
      contentKeyWhiteList.add('ban');
      contentKeyWhiteList.add('events');
      contentKeyWhiteList.add('events_default');
      contentKeyWhiteList.add('kick');
      contentKeyWhiteList.add('redact');
      contentKeyWhiteList.add('state_default');
      contentKeyWhiteList.add('users');
      contentKeyWhiteList.add('users_default');
      break;
    case EventTypes.RoomAliases:
      contentKeyWhiteList.add('aliases');
      break;
    case EventTypes.HistoryVisibility:
      contentKeyWhiteList.add('history_visibility');
      break;
    default:
      break;
  }
  content.removeWhere((k, v) => !contentKeyWhiteList.contains(k));
}