add link to the thread of a message

This commit is contained in:
grimhilt 2023-07-15 00:19:39 +02:00
parent 3bffd88108
commit edddf9afbf
5 changed files with 37 additions and 2 deletions

View File

@ -38,6 +38,7 @@ export async function getRooms(mailboxId: number) {
room.room_type AS roomType,
mailbox_message.mailbox_id AS mailboxId,
app_thread.parent_id
FROM app_room room
INNER JOIN message ON message.message_id = room.message_id
INNER JOIN mailbox_message ON mailbox_message.message_id = message.message_id
@ -55,6 +56,7 @@ export async function getRooms(mailboxId: number) {
)
) notSeenRoom ON notSeenRoom.room_id = room.room_id
-- get not seen in thread
LEFT JOIN (
SELECT app_room_message.message_id, app_thread.parent_id
FROM app_room
@ -89,7 +91,8 @@ export async function getMessages(roomId: number) {
subjectT.value AS subject,
content.text AS content,
message.idate AS date,
GROUP_CONCAT(flagT.flag_name) AS flags
GROUP_CONCAT(flagT.flag_name) AS flags,
thread.room_id AS thread
FROM app_room_message msg
${queryFromId} fromT ON msg.message_id = fromT.message_id
@ -121,6 +124,13 @@ export async function getMessages(roomId: number) {
INNER JOIN message ON message.message_id = msg.message_id
-- get room_id of thread room with this message as origin
LEFT JOIN app_room thread ON (
thread.message_id = msg.message_id AND
msg.room_id != thread.room_id AND
thread.room_type = 4
)
WHERE msg.room_id = ?
GROUP BY msg.message_id
ORDER BY message.idate ASC;

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.4143 4.58594L10.4142 11.0003L16.0003 11.0004L16.0003 13.0004L10.4142 13.0003L10.4141 19.4144L3 12.0002L10.4143 4.58594ZM18.0002 19.0002V5.00018H20.0002V19.0002H18.0002Z"></path></svg>

After

Width:  |  Height:  |  Size: 256 B

View File

@ -7,6 +7,7 @@ import Content from "./Content.vue";
import Options from "./Options.vue";
import { isSeenFc } from "@/utils/flagsUtils";
import SvgLoader from "@/components/utils/SvgLoader.vue";
import { useRouter } from "vue-router";
export interface Props {
msg: Message;
@ -43,6 +44,8 @@ const classes = (): string => {
}
return "msg-basic";
};
const router = useRouter();
</script>
<!-- to if to is more than me
cc -->
@ -81,16 +84,34 @@ const classes = (): string => {
/>
<Options class="options" :msg="props.msg" />
</div>
<div id="thread-link" v-if="props.msg?.thread" @click="router.push(`/${props.msg?.thread}`)">
<SvgLoader svg="expand-left-fill" />
<!-- <SvgLoader svg="expand-left-fill" :loading="true" /> -->
<span>Go to the full conversation.</span>
</div>
</div>
</template>
<style scoped>
<style scoped lang="scss">
.message {
width: auto;
/* border: white 1px solid; */
margin: 10px 5px 0px 5px;
}
#thread-link {
&:hover {
background-color: var(--selected);
}
display: flex;
flex-direction: row;
align-items: center;
background-color: var(--quaternary-background);
padding: 3px 10px;
border-radius: 4px 4px 0 0;
cursor: pointer;
}
#context {
display: flex;
flex-direction: row;

View File

@ -21,9 +21,11 @@ const classes = () => props.classes?.split(",") ?? "";
<style lang="scss" scoped>
.mainSvg {
display: flex;
&.selectable {
display: inline-block;
border-radius: 6px;
cursor: pointer;
&:hover,
&.is-active {
background-color: var(--selected);

View File

@ -15,6 +15,7 @@ export interface Message {
content: string;
date: string;
flags: string[];
threads: number | null;
}
export enum LoadingState {