unblockUser static method

Future<void> unblockUser(
  1. Session session,
  2. int userId
)

Unblocks a user so that they can log in again, and invalidates the cache for the user so that they can be blocked again

Implementation

static Future<void> unblockUser(
  Session session,
  int userId,
) async {
  var userInfo = await findUserByUserId(session, userId);
  if (userInfo == null) {
    throw 'userId $userId not found';
  } else if (!userInfo.blocked) {
    throw 'userId $userId already unblocked';
  }
  userInfo.blocked = false;
  await session.db.updateRow(userInfo);
  await invalidateCacheForUser(session, userId);
}