Skip to content

Commit

Permalink
Refactored logic so that works for sharing with multiple users
Browse files Browse the repository at this point in the history
  • Loading branch information
grgprarup committed Jan 2, 2023
1 parent 64d0ce1 commit fb6eae0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ public function shareWithUserOrGroup(
);
$userFound = false;
foreach ($userElements as $user) {
if ($this->getTrimmedText($user) === $nameToMatch) {
$trimmedText = $this->getTrimmedText($user);
// The logic is changed due to "Add multiple users" because the order of users in autocomplete items is not fixed
$trimmedUsers = preg_split("/[\s,]+/", $trimmedText);
$usersToMatch = preg_split("/[\s,]+/", $nameToMatch);
if (empty(array_diff($trimmedUsers, $usersToMatch))) {
$user->click();
$this->waitForAjaxCallsToStartAndFinish($session);
$userFound = true;
Expand Down

0 comments on commit fb6eae0

Please sign in to comment.