Compare commits

...
Author SHA1 Message Date
Muhsin KelothandGitHub 9b1e822d21 Merge branch 'develop' into fix/scroll-reply-to 2023-12-05 09:48:50 +05:30
Shivam Mishra fa97ac0691 refactor: defaults 2023-12-01 09:21:03 +05:30
Shivam Mishra 1a1f8c52b2 chore: revert class formatting 2023-12-01 09:19:59 +05:30
Shivam Mishra 97301c3080 fix: message URL navigation won't work 2023-11-30 20:46:37 +05:30
Shivam Mishra 8a7a5ca8d7 chore: remove behaviour 2023-11-30 20:26:43 +05:30
Shivam Mishra 04160c04cc fix: setting active chat when messageId is missing 2023-11-30 13:45:43 +05:30
Shivam Mishra 29292fd99d refactor: don't call setActiveChat 2023-11-30 13:08:49 +05:30
Shivam Mishra baf1323ebd refactor: move fetching logic to onScrollToMessage 2023-11-30 13:08:49 +05:30
Shivam Mishra 9cc6275c82 Revert "feat: remove click action"
This reverts commit 39e748bd739d8849a01e51b78e5db3c440d7c803.
2023-11-30 13:08:49 +05:30
Shivam Mishra 20dac9d77b Revert "chore: remove force option"
This reverts commit c65361ba82d7f0fd225d0c7aa51c9c5055e7fff6.
2023-11-30 13:08:30 +05:30
Shivam Mishra a6c28c94d4 Revert "chore: remove behavior option"
This reverts commit b09c946af35f8984aa852d8658eb4745cc5c5d00.
2023-11-30 13:08:30 +05:30
6 changed files with 30 additions and 6 deletions
@@ -28,6 +28,7 @@
:message="inReplyTo" :message="inReplyTo"
:message-type="data.message_type" :message-type="data.message_type"
:parent-has-attachments="hasAttachments" :parent-has-attachments="hasAttachments"
@click="navigateToMessage"
/> />
<bubble-text <bubble-text
v-if="data.content" v-if="data.content"
@@ -519,6 +520,13 @@ export default {
this.showBackgroundHighlight = false; this.showBackgroundHighlight = false;
}, HIGHLIGHT_TIMER); }, HIGHLIGHT_TIMER);
}, },
async navigateToMessage() {
this.$nextTick(() => {
bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE, {
messageId: this.inReplyToMessageId,
});
});
},
}, },
}; };
</script> </script>
@@ -377,12 +377,20 @@ export default {
removeBusListeners() { removeBusListeners() {
bus.$off(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage); bus.$off(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage);
}, },
onScrollToMessage({ messageId = '' } = {}) { async onScrollToMessage({ messageId = '' } = {}) {
if (messageId) {
await this.$store.dispatch('setActiveChat', {
data: this.currentChat,
after: messageId,
force: true,
});
}
this.$nextTick(() => { this.$nextTick(() => {
const messageElement = document.getElementById('message' + messageId); const messageElement = document.getElementById('message' + messageId);
if (messageElement) { if (messageElement) {
this.isProgrammaticScroll = true; this.isProgrammaticScroll = true;
messageElement.scrollIntoView({ behavior: 'smooth' }); messageElement.scrollIntoView();
this.fetchPreviousMessages(); this.fetchPreviousMessages();
} else { } else {
this.scrollToBottom(); this.scrollToBottom();
@@ -29,6 +29,7 @@
v-if="shouldShowReplyToMessage" v-if="shouldShowReplyToMessage"
:message="inReplyTo" :message="inReplyTo"
@dismiss="resetReplyToMessage" @dismiss="resetReplyToMessage"
@navigate-to-message="navigateToMessage"
/> />
<canned-response <canned-response
v-if="showMentions && hasSlashCommand" v-if="showMentions && hasSlashCommand"
@@ -1159,6 +1160,11 @@ export default {
LocalStorage.deleteFromJsonStore(replyStorageKey, this.conversationId); LocalStorage.deleteFromJsonStore(replyStorageKey, this.conversationId);
bus.$emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE); bus.$emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE);
}, },
navigateToMessage(messageId) {
bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE, {
messageId,
});
},
onNewConversationModalActive(isActive) { onNewConversationModalActive(isActive) {
// Issue is if the new conversation modal is open and we drag and drop the file // Issue is if the new conversation modal is open and we drag and drop the file
// then the file is not getting attached to the new conversation modal // then the file is not getting attached to the new conversation modal
@@ -1,6 +1,7 @@
<template> <template>
<div <div
class="reply-editor bg-slate-50 dark:bg-slate-800 rounded-md py-1 pl-2 pr-1 text-xs tracking-wide mt-2 flex items-center gap-1.5 -mx-2" class="reply-editor bg-slate-50 dark:bg-slate-800 rounded-md py-1 pl-2 pr-1 text-xs tracking-wide mt-2 flex items-center gap-1.5 -mx-2 cursor-pointer"
@click="$emit('navigate-to-message', message.id)"
> >
<fluent-icon class="flex-shrink-0 icon" icon="arrow-reply" size="14" /> <fluent-icon class="flex-shrink-0 icon" icon="arrow-reply" size="14" />
<div class="flex-grow gap-1 mt-px text-xs truncate"> <div class="flex-grow gap-1 mt-px text-xs truncate">
@@ -1,12 +1,13 @@
<template> <template>
<div <div
class="px-2 py-1.5 rounded-sm min-w-[10rem] mb-2" class="px-2 py-1.5 -mx-2 rounded-sm min-w-[15rem] mb-2 cursor-pointer"
:class="{ :class="{
'bg-slate-50 dark:bg-slate-600 dark:text-slate-50': 'bg-slate-50 dark:bg-slate-600 dark:text-slate-50':
messageType === MESSAGE_TYPE.INCOMING, messageType === MESSAGE_TYPE.INCOMING,
'bg-woot-600 text-woot-50': messageType === MESSAGE_TYPE.OUTGOING, 'bg-woot-600 text-woot-50': messageType === MESSAGE_TYPE.OUTGOING,
'-mx-2': !parentHasAttachments, '-mx-2': !parentHasAttachments,
}" }"
@click="$emit('click')"
> >
<message-preview <message-preview
:message="message" :message="message"
@@ -160,10 +160,10 @@ const actions = {
}); });
}, },
async setActiveChat({ commit, dispatch }, { data, after }) { async setActiveChat({ commit, dispatch }, { data, after, force = false }) {
commit(types.SET_CURRENT_CHAT_WINDOW, data); commit(types.SET_CURRENT_CHAT_WINDOW, data);
commit(types.CLEAR_ALL_MESSAGES_LOADED); commit(types.CLEAR_ALL_MESSAGES_LOADED);
if (data.dataFetched === undefined) { if (data.dataFetched === undefined || force) {
try { try {
await dispatch('fetchPreviousMessages', { await dispatch('fetchPreviousMessages', {
after, after,