mirror of
https://github.com/nextcloud/spreed.git
synced 2025-07-21 10:37:10 +00:00
feat(Quote): add a shortcut to threaded view from replies
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
This commit is contained in:
@ -13,6 +13,7 @@ import { useRoute } from 'vue-router'
|
||||
import NcButton from '@nextcloud/vue/components/NcButton'
|
||||
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
|
||||
import IconClose from 'vue-material-design-icons/Close.vue'
|
||||
import IconForumOutline from 'vue-material-design-icons/ForumOutline.vue'
|
||||
import IconPencilOutline from 'vue-material-design-icons/PencilOutline.vue'
|
||||
import AvatarWrapper from './AvatarWrapper/AvatarWrapper.vue'
|
||||
import { useGetThreadId } from '../composables/useGetThreadId.ts'
|
||||
@ -104,6 +105,10 @@ const shortenedQuoteMessage = computed(() => {
|
||||
return simpleQuotedMessage.value.length >= 250 ? simpleQuotedMessage.value.substring(0, 250) + '…' : simpleQuotedMessage.value
|
||||
})
|
||||
|
||||
const showThreadShortcut = computed(() => {
|
||||
return !threadId.value && isExistingMessage(message) && message.isThread && message.threadId
|
||||
})
|
||||
|
||||
/**
|
||||
* Check whether message to quote (parent) existing on server
|
||||
* Otherwise server returns ['id' => (int)$parentId, 'deleted' => true]
|
||||
@ -112,6 +117,12 @@ function isExistingMessage(message: ChatMessage | DeletedParentMessage): message
|
||||
return 'messageType' in message
|
||||
}
|
||||
|
||||
function goToThread() {
|
||||
if (isExistingMessage(message) && message.threadId) {
|
||||
threadId.value = message.threadId
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abort replying / editing process
|
||||
*/
|
||||
@ -196,7 +207,7 @@ function handleQuoteClick() {
|
||||
</span>
|
||||
|
||||
<NcButton v-if="canCancel"
|
||||
class="quote__close"
|
||||
class="quote__button"
|
||||
variant="tertiary"
|
||||
:title="t('spreed', 'Cancel quote')"
|
||||
:aria-label="t('spreed', 'Cancel quote')"
|
||||
@ -205,6 +216,16 @@ function handleQuoteClick() {
|
||||
<IconClose :size="20" />
|
||||
</template>
|
||||
</NcButton>
|
||||
<NcButton v-else-if="showThreadShortcut"
|
||||
class="quote__button"
|
||||
variant="tertiary"
|
||||
:title="t('spreed', 'Go to thread')"
|
||||
:aria-label="t('spreed', 'Go to thread')"
|
||||
@click.stop.prevent="goToThread">
|
||||
<template #icon>
|
||||
<IconForumOutline :size="20" />
|
||||
</template>
|
||||
</NcButton>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
@ -302,10 +323,12 @@ function handleQuoteClick() {
|
||||
}
|
||||
}
|
||||
|
||||
&__close {
|
||||
&__button {
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
inset-inline-end: 0;
|
||||
height: 100%;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user