"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.checkUniqueUsers = exports.checkSingleUser = void 0;
var _roomStore = require("../roomStore");
var _getUnnamedUsers = require("./getUnnamedUsers");
var _roomMembers = require("../networking/api-requests/roomMembers.api");
const checkUniqueUsers = messages => {
  const unnamedUsers = (0, _getUnnamedUsers.getUnnamedUsers)(messages);
  if (unnamedUsers.length > 0) {
    const getApiUsers = async () => {
      const fixedUsers = await (0, _getUnnamedUsers.fixUnnamedArrayFromApi)(unnamedUsers);
      return fixedUsers;
    };
    const newUsers = getApiUsers();
    return newUsers;
  }
};
exports.checkUniqueUsers = checkUniqueUsers;
const checkSingleUser = async (usersSet, xmppUsername) => {
  if (usersSet[xmppUsername]) {
    return;
  }
  const fixedUser = await (0, _roomMembers.getUserByXmppUsername)(xmppUsername, _roomStore.store.getState().chatSettingStore.user.token);
  return fixedUser;
};
exports.checkSingleUser = checkSingleUser;
//# sourceMappingURL=checkUniqueUsers.js.map