Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion models/contact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
//

import activity from '@hcengineering/activity'
import activity, { type ActivityMessageControl } from '@hcengineering/activity'
import { type Role, type Card } from '@hcengineering/card'
import {
AvatarType,
Expand Down Expand Up @@ -340,6 +340,13 @@ export function createModel (builder: Builder): void {
preposition: contact.string.For
})

// Prevent leaking private social identifiers (emails, external handles) via activity updates.
builder.createDoc<ActivityMessageControl<Person>>(activity.class.ActivityMessageControl, core.space.Model, {
objectClass: contact.class.Person,
skip: [],
skipFields: ['socialIds']
})

builder.mixin(contact.mixin.Employee, core.class.Class, activity.mixin.ActivityDoc, {
preposition: contact.string.For
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Icon, Label, tooltip } from '@hcengineering/ui'
import contact, { SocialIdentity, SocialIdentityProvider } from '@hcengineering/contact'
import contact, { SocialIdentity, SocialIdentityProvider, getCurrentEmployee } from '@hcengineering/contact'
import { getClient } from '@hcengineering/presentation'

export let value: SocialIdentity
export let socialIdProvider: SocialIdentityProvider | undefined = undefined
export let shouldShowAvatar = true

const client = getClient()
let isOwner = false

onMount(() => {
if (socialIdProvider == null) {
Expand All @@ -31,6 +32,10 @@
})

$: icon = socialIdProvider?.icon ?? contact.icon.Profile
$: {
const me = getCurrentEmployee()
isOwner = me != null && value.attachedTo === me
}
</script>

{#if socialIdProvider != null}
Expand All @@ -46,8 +51,12 @@
</div>

<div class="flex-col flex-gap-0-5">
<div>{value.displayValue ?? value.value}</div>
{#if shouldShowAvatar}
{#if isOwner}
<div>{value.displayValue ?? value.value}</div>
{#if shouldShowAvatar}
<div class="type"><Label label={socialIdProvider.label} /></div>
{/if}
{:else}
<div class="type"><Label label={socialIdProvider.label} /></div>
{/if}
</div>
Expand Down
Loading