Deine Commit-Nachricht

This commit is contained in:
Johannes
2025-06-09 06:04:35 +02:00
parent 10ff2c4beb
commit 1f8d9f1b72
4 changed files with 26 additions and 10 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
letsencrypt
# Grafana
grafana

View File

@@ -33,8 +33,6 @@ router.post("/set-standard-name", async (req, res) => {
},
});
let eventRoles: string[] = [];
participant.forEach(async (p) => {
if (!p.Event.discordRoleId) return;
if (eventCompleted(p.Event, p)) {
@@ -47,7 +45,7 @@ router.post("/set-standard-name", async (req, res) => {
const publicUser = getPublicUser(user);
const member = await getMember(memberId);
await member.setNickname(`${publicUser.fullName} (${user.publicId})`);
await member.setNickname(`${publicUser.fullName} - ${user.publicId}`);
const isPilot = user.permissions.includes("PILOT");
const isDispatcher = user.permissions.includes("DISPO");

View File

@@ -38,6 +38,11 @@ export const Chat = () => {
refetchInterval: 10000,
});
useEffect(() => {
if(!session.data?.user.id) return;
setOwnId(session.data?.user.id);
}, [session.data?.user.id]);
const filteredDispatcher = dispatcher?.filter((d) => d.userId !== session.data?.user.id);
const filteredAircrafts = aircrafts?.filter((a) => a.userId !== session.data?.user.id);

View File

@@ -35,6 +35,8 @@ export const useLeftMenuStore = create<ChatStore>((set, get) => ({
chats: {},
sendMessage: (userId: string, message: string) => {
return new Promise((resolve, reject) => {
if(dispatchSocket.connected){
dispatchSocket.emit("send-message", { userId, message }, ({ error }: { error?: string }) => {
if (error) {
reject(error);
@@ -42,6 +44,15 @@ export const useLeftMenuStore = create<ChatStore>((set, get) => ({
resolve();
}
});
} else if(pilotSocket.connected){
pilotSocket.emit("send-message", { userId, message }, ({ error }: { error?: string }) => {
if (error) {
reject(error);
} else {
resolve();
}
});
}
});
},
addChat: (userId, name) => {