Skip to content

Commit

Permalink
fixup! feat(OpenConversationsList): expose description
Browse files Browse the repository at this point in the history
  • Loading branch information
DorraJaouad committed May 2, 2024
1 parent 8c77926 commit f25ae56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,11 @@ describe('Conversation.vue', () => {
testConversationLabel(item, 'Guest: hello')
})

test('displays last message for search results', () => {
test('displays description for search results', () => {
// search results have no actor id
item.actorId = null
testConversationLabel(item, 'Alice: hello', true)
item.description = 'This is a description'
testConversationLabel(item, 'This is a description', true)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ export default {

setup(props) {
const { item, isSearchResult } = toRefs(props)
const { counterType, conversationInformation } = useConversationInfo({ item, isSearchResult, exposeMessages: true, exposeDescription: true })
const { counterType, conversationInformation } = useConversationInfo({
item,
isSearchResult,
exposeMessages: !isSearchResult.value,
exposeDescription: isSearchResult.value
})

return {
counterType,
Expand Down
4 changes: 3 additions & 1 deletion src/composables/useConversationInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ export function useConversationInfo({
return t('spreed', 'Joining conversation …')
}

if (exposeMessages === false || !hasLastMessage.value) {
if (exposeMessages === false) {
return exposeDescription ? item.value?.description : ''
} else if (!hasLastMessage.value) {
return t('spreed', 'No messages')
}

if (shortLastChatMessageAuthor.value === '') {
Expand Down

0 comments on commit f25ae56

Please sign in to comment.