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} {:else}
<div class="embeddedMarker" /> <div class="embeddedMarker" />
{/if} {/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"> <div class="header clear-mins">
{#if person} {#if person}
<EmployeePresenter value={person} shouldShowAvatar={false} /> <EmployeePresenter value={person} shouldShowAvatar={false} />

View File

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

View File

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

View File

@ -15,7 +15,7 @@ export class EmployeeDetailsPage extends CommonPage {
this.page = page this.page = page
this.pageHeader = page.locator('span[class$="title"]', { hasText: 'Employee' }) this.pageHeader = page.locator('span[class$="title"]', { hasText: 'Employee' })
this.textActivity = page.locator('div.header') 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.textEmployeeFirstName = page.locator('input[placeholder="First name"]')
this.textEmployeeLastName = page.locator('input[placeholder="Last 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.buttonKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] span.toggle-switch')
this.inputKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] input[type="checkbox"]') 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.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.linkInActivity = page.locator('div[id="activity:string:Activity"] a')
this.inputCommentFile = page.locator('input#file') this.inputCommentFile = page.locator('input#file')
this.commentImg = page.locator('div.activityMessage div.content img') this.commentImg = page.locator('div.activityMessage div.content img')