UBER-1227: fix members duplicates (#4721)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Kristina 2024-02-20 19:18:37 +04:00 committed by GitHub
parent b9fd44ca62
commit 9123751990
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 30 additions and 20 deletions

View File

@ -145,7 +145,7 @@
{:else}
<div class="embeddedMarker" />
{/if}
<div class="content ml-2 w-full clear-mins">
<div class="flex-col ml-2 w-full clear-mins">
<div class="header clear-mins">
{#if person}
<EmployeePresenter value={person} shouldShowAvatar={false} />

View File

@ -294,6 +294,10 @@
}
async function updateSelectedDate () {
if (!withDates) {
return
}
if (scrollContentBox === undefined || scrollElement === undefined) {
return
}
@ -456,7 +460,7 @@
{#if startFromBottom}
<div class="grower" />
{/if}
{#if selectedDate}
{#if withDates && selectedDate}
<div class="ml-2 pr-2">
<JumpToDateSelector {selectedDate} fixed on:jumpToDate={jumpToDate} />
</div>
@ -522,7 +526,9 @@
margin: 0 1.5rem;
min-height: 4.375rem;
height: auto;
display: contents;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.grower {

View File

@ -31,7 +31,7 @@
const currentAccount = getCurrentAccount()
let members: Ref<Person>[] = []
let members = new Set<Ref<Person>>()
$: creatorPersonRef = object?.createdBy
? $personAccountByIdStore.get(object.createdBy as Ref<PersonAccount>)?.person
@ -42,19 +42,21 @@
function updateMembers (object: Channel | undefined) {
if (object === undefined) {
members = []
members = new Set()
return
}
members = object.members
.map((accountId) => {
const personAccount = $personAccountByIdStore.get(accountId as Ref<PersonAccount>)
if (personAccount === undefined) {
return undefined
}
return personAccount.person
})
.filter((_id): _id is Ref<Person> => !!_id)
members = new Set(
object.members
.map((accountId) => {
const personAccount = $personAccountByIdStore.get(accountId as Ref<PersonAccount>)
if (personAccount === undefined) {
return undefined
}
return personAccount.person
})
.filter((_id): _id is Ref<Person> => !!_id)
)
}
async function changeMembers (personRefs: Ref<Person>[], object?: Channel) {
@ -85,13 +87,15 @@
return
}
const personAccount = Array.from($personAccountByIdStore.values()).find((account) => account.person === personId)
const accounts = Array.from($personAccountByIdStore.values())
.filter((account) => account.person === personId)
.map(({ _id }) => _id)
if (personAccount === undefined) {
if (accounts.length === 0) {
return
}
await leaveChannel(object, personAccount._id)
await leaveChannel(object, accounts)
}
function openSelectUsersPopup () {
@ -139,7 +143,7 @@
<div class="members">
<ChannelMembers
ids={members}
ids={Array.from(members)}
disableRemoveFor={disabledRemoveFor}
on:add={openSelectUsersPopup}
on:remove={removeMember}

View File

@ -15,7 +15,7 @@ export class EmployeeDetailsPage extends CommonPage {
this.page = page
this.pageHeader = page.locator('span[class$="title"]', { hasText: 'Employee' })
this.textActivity = page.locator('div.header')
this.textActivityContent = page.locator('div.activityMessage div.content div[class*="content"]')
this.textActivityContent = page.locator('div.activityMessage div[class*="content"]')
this.textEmployeeFirstName = page.locator('input[placeholder="First name"]')
this.textEmployeeLastName = page.locator('input[placeholder="Last name"]')
}

View File

@ -35,7 +35,7 @@ export class CommonTrackerPage extends CalendarPage {
this.buttonKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] span.toggle-switch')
this.inputKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] input[type="checkbox"]')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
this.textActivityContent = page.locator('div.activityMessage div.content div.content')
this.textActivityContent = page.locator('div.activityMessage div.content')
this.linkInActivity = page.locator('div[id="activity:string:Activity"] a')
this.inputCommentFile = page.locator('input#file')
this.commentImg = page.locator('div.activityMessage div.content img')