Skip to content

Commit

Permalink
feat(LeftSidebar): use AvatarWrapper for users, add fast creating opt…
Browse files Browse the repository at this point in the history
…ion for federated users

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Mar 22, 2024
1 parent df78e4f commit 9bcd7cc
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
:name="item.label"
@click="createAndJoinConversation(item)">
<template #icon>
<ConversationIcon :item="iconData(item)" />
<AvatarWrapper v-bind="iconData(item)" />
</template>
<template #subname>
{{ t('spreed', 'New private conversation') }}
Expand Down Expand Up @@ -268,6 +268,23 @@
</template>
</NcListItem>
</template>

<!-- New conversations: Federated users -->
<template v-if="searchResultsFederated.length !== 0">
<NcAppNavigationCaption :name="t('spreed', 'Federated users')" />
<NcListItem v-for="item of searchResultsFederated"
:key="`federated_${item.id}`"
:data-nav-id="`federated_${item.id}`"
:name="item.label"
@click="createAndJoinConversation(item)">
<template #icon>
<AvatarWrapper v-bind="iconData(item)" />
</template>
<template #subname>
{{ t('spreed', 'New group conversation') }}
</template>
</NcListItem>
</template>
</template>

<!-- Search results: no results (yet) -->
Expand Down Expand Up @@ -328,6 +345,7 @@ import ConversationsListVirtual from './ConversationsList/ConversationsListVirtu
import InvitationHandler from './InvitationHandler.vue'
import OpenConversationsList from './OpenConversationsList/OpenConversationsList.vue'
import SearchBox from './SearchBox/SearchBox.vue'
import AvatarWrapper from '../AvatarWrapper/AvatarWrapper.vue'
import ConversationIcon from '../ConversationIcon.vue'
import Hint from '../Hint.vue'
import NewConversationDialog from '../NewConversationDialog/NewConversationDialog.vue'
Expand Down Expand Up @@ -360,6 +378,7 @@ export default {
name: 'LeftSidebar',
components: {
AvatarWrapper,
CallPhoneDialog,
InvitationHandler,
NcAppNavigation,
Expand Down Expand Up @@ -424,6 +443,7 @@ export default {
searchResultsUsers: [],
searchResultsGroups: [],
searchResultsCircles: [],
searchResultsFederated: [],
searchResultsListedConversations: [],
contactsLoading: false,
listedConversationsLoading: false,
Expand Down Expand Up @@ -714,6 +734,10 @@ export default {
})
this.searchResultsGroups = this.searchResults.filter((match) => match.source === ATTENDEE.ACTOR_TYPE.GROUPS)
this.searchResultsCircles = this.searchResults.filter((match) => match.source === ATTENDEE.ACTOR_TYPE.CIRCLES)
this.searchResultsFederated = this.searchResults.filter((match) => match.source === ATTENDEE.ACTOR_TYPE.REMOTES)
.map((item) => {
return { ...item, source: ATTENDEE.ACTOR_TYPE.FEDERATED_USERS }
})
this.contactsLoading = false
} catch (exception) {
if (CancelableRequest.isCancel(exception)) {
Expand Down Expand Up @@ -971,11 +995,15 @@ export default {
},
iconData(item) {
if (item.source === ATTENDEE.ACTOR_TYPE.USERS) {
if (item.source === ATTENDEE.ACTOR_TYPE.USERS
|| item.source === ATTENDEE.ACTOR_TYPE.FEDERATED_USERS) {
return {
type: CONVERSATION.TYPE.ONE_TO_ONE,
displayName: item.label,
name: item.id,
id: item.id,
name: item.label,
source: item.source,
disableMenu: true,
token: 'new',
showUserStatus: true,
}
}
return {
Expand Down

0 comments on commit 9bcd7cc

Please sign in to comment.