show members in a room
This commit is contained in:
parent
7c98c1eb0c
commit
7e0e27c2b6
@ -100,13 +100,16 @@ export async function getMessages(roomId) {
|
|||||||
|
|
||||||
export async function getMembers(roomId) {
|
export async function getMembers(roomId) {
|
||||||
const query = `
|
const query = `
|
||||||
SELECT
|
SELECT
|
||||||
address.address_id AS id,
|
address.address_id AS id,
|
||||||
address.address_name AS name,
|
address.address_name AS name,
|
||||||
address.email AS email
|
address.email AS email,
|
||||||
FROM app_room_member
|
field_name.field_name as type
|
||||||
INNER JOIN address ON address.address_id = app_room_member.member_id
|
FROM app_room
|
||||||
WHERE app_room_member.room_id = ?
|
INNER JOIN address_field ON address_field.message_id = app_room.message_id
|
||||||
|
INNER JOIN address ON address.address_id = address_field.address_id
|
||||||
|
INNER JOIN field_name ON field_name.field_id = address_field.field_id
|
||||||
|
WHERE app_room.room_id = ?;
|
||||||
`;
|
`;
|
||||||
const values = [roomId];
|
const values = [roomId];
|
||||||
return await execQueryAsync(query, values);
|
return await execQueryAsync(query, values);
|
||||||
|
@ -153,6 +153,7 @@ CREATE TABLE app_room_message (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- 14
|
-- 14
|
||||||
|
-- todo needed ?
|
||||||
CREATE TABLE app_room_member (
|
CREATE TABLE app_room_member (
|
||||||
room_id INT NOT NULL,
|
room_id INT NOT NULL,
|
||||||
member_id INT NOT NULL,
|
member_id INT NOT NULL,
|
||||||
|
@ -43,4 +43,5 @@ export interface Address {
|
|||||||
id: number;
|
id: number;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
email: string;
|
email: string;
|
||||||
|
type: string;
|
||||||
}
|
}
|
||||||
|
@ -64,13 +64,8 @@ const store = createStore<State>({
|
|||||||
},
|
},
|
||||||
setActiveRoom(state, payload) {
|
setActiveRoom(state, payload) {
|
||||||
state.activeRoom = payload;
|
state.activeRoom = payload;
|
||||||
console.log("set active")
|
|
||||||
// todo load room on load page
|
// todo load room on load page
|
||||||
// let room;
|
|
||||||
console.log(payload)
|
|
||||||
console.log(state.rooms)
|
|
||||||
const room = state.rooms.find((room) => room.id == payload);
|
const room = state.rooms.find((room) => room.id == payload);
|
||||||
console.log(room)
|
|
||||||
if (!room) return;
|
if (!room) return;
|
||||||
store.dispatch("fetchMessages", { roomId: payload, room: room });
|
store.dispatch("fetchMessages", { roomId: payload, room: room });
|
||||||
},
|
},
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
import Badge from "@/components/Badge.vue";
|
import Badge from "@/components/Badge.vue";
|
||||||
import { RoomType } from "@/store/models/model";
|
import { RoomType, Address } from "@/store/models/model";
|
||||||
|
import MemberList from "./MemberList.vue";
|
||||||
|
|
||||||
const props = defineProps({ id: Number, room: Object });
|
const props = defineProps({ id: Number, room: Object });
|
||||||
|
|
||||||
const roomTitle = () => {
|
const roomTitle = () => {
|
||||||
const type = props.room?.roomType;
|
const type = props.room?.roomType;
|
||||||
if (type === RoomType.DM || type == RoomType.CHANNEL || type == RoomType.ROOM) {
|
if (type === RoomType.DM || type == RoomType.CHANNEL || type == RoomType.ROOM) {
|
||||||
return props.room?.user;
|
return props.room?.user;
|
||||||
}
|
}
|
||||||
return props.room?.roomName;
|
return props.room?.roomName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const to = () => props.room?.members.filter((member: Address) => member.type == "to");
|
||||||
|
const cc = () => props.room?.members.filter((member: Address) => member.type == "cc");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -23,20 +27,30 @@ const roomTitle = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="action">action: threads message important</div>
|
<div class="action">action: threads message important</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="members" v-if="room?.roomType != RoomType.DM">
|
||||||
|
<MemberList v-if="to()?.length > 0" type="to" :members="to()" />
|
||||||
|
<MemberList v-if="cc()?.length > 0" type="cc" :members="cc()" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.main {
|
||||||
|
border-bottom: 1px solid #505050;
|
||||||
|
}
|
||||||
.context {
|
.context {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
|
||||||
border-bottom: 1px solid #505050;
|
border-bottom: 1px solid #505050;
|
||||||
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.members {
|
||||||
|
}
|
||||||
|
|
||||||
.infos {
|
.infos {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { Address } from "@/store/models/model";
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
|
|
||||||
const props = defineProps({ type: String, members: Object });
|
const props = defineProps({ type: String, members: Object });
|
||||||
|
let emails = "";
|
||||||
|
props.members?.forEach((member: Address) => {
|
||||||
|
emails += member.email + "; ";
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
{{ props.type }}:
|
||||||
|
{{ emails }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
</style>
|
|
||||||
|
@ -3,7 +3,6 @@ import { defineProps, onMounted, ref, watch } from "vue";
|
|||||||
import { decodeEmojis } from "../../utils/string";
|
import { decodeEmojis } from "../../utils/string";
|
||||||
import { removeDuplicates } from "../../utils/array";
|
import { removeDuplicates } from "../../utils/array";
|
||||||
import DOMPurify from "dompurify";
|
import DOMPurify from "dompurify";
|
||||||
import store from "@/store/store";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
@ -12,7 +11,7 @@ const props = defineProps({
|
|||||||
content: String,
|
content: String,
|
||||||
date: String,
|
date: String,
|
||||||
},
|
},
|
||||||
members: Array
|
members: Array,
|
||||||
});
|
});
|
||||||
const iframe = ref(null);
|
const iframe = ref(null);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
import BaseAvatar from "../../avatars/BaseAvatar.vue";
|
import BaseAvatar from "../../avatars/BaseAvatar.vue";
|
||||||
import Badge from "../../../components/Badge.vue";
|
import Badge from "@/components/Badge.vue";
|
||||||
import ThreadList from "./threads/ThreadList.vue";
|
import ThreadList from "./threads/ThreadList.vue";
|
||||||
import store from "@/store/store";
|
import store from "@/store/store";
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import store from "@/store/store";
|
import store from "@/store/store";
|
||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import Badge from "@/components/Badge.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
threadId: Number,
|
threadId: Number,
|
||||||
|
Loading…
Reference in New Issue
Block a user