Use SharedTypes

This commit is contained in:
Reto Brunner 2024-02-24 16:47:48 +01:00
parent f0ee3be6fb
commit 383907c2b8
3 changed files with 13 additions and 15 deletions

View file

@ -1,6 +1,5 @@
import {defineComponent} from "vue"; import {defineComponent} from "vue";
import {SharedMessage} from "../../shared/types/msg";
import {SharedChan} from "../../shared/types/chan"; import {SharedChan} from "../../shared/types/chan";
import {SharedNetwork} from "../../shared/types/network"; import {SharedNetwork} from "../../shared/types/network";
import {SharedUser} from "../../shared/models/user"; import {SharedUser} from "../../shared/models/user";
@ -20,11 +19,6 @@ type ClientUser = SharedUser & {
// //
}; };
type ClientMessage = Omit<SharedMessage, "users"> & {
time: Date;
users: string[];
};
type ClientChan = Omit<SharedChan, "users" | "messages"> & { type ClientChan = Omit<SharedChan, "users" | "messages"> & {
moreHistoryAvailable: boolean; moreHistoryAvailable: boolean;
editTopic: boolean; editTopic: boolean;

View file

@ -96,3 +96,8 @@ export type SharedMsg = {
statusmsgGroup?: string; statusmsgGroup?: string;
params?: string[]; params?: string[];
}; };
export type ClientMessage = Omit<SharedMsg, "users"> & {
time: Date;
users: string[];
};

View file

@ -1,9 +1,8 @@
import {ClientMessage, ClientNetwork, InitClientChan} from "../../client/js/types"; import {ClientNetwork, InitClientChan} from "../../client/js/types";
import {Mention} from "../client"; import {SharedMention} from "../../shared/types/mention";
import {ChanState} from "../models/chan"; import {ChanState} from "../../shared/types/chan";
import Msg from "../models/msg"; import {SharedMsg, ClientMessage} from "../../shared/types/msg";
import Network from "../models/network"; import {SharedUser} from "../../shared/types/user";
import User from "../models/user";
import {ChangelogData} from "../plugins/changelog"; import {ChangelogData} from "../plugins/changelog";
import {LinkPreview} from "../plugins/irc-events/link"; import {LinkPreview} from "../plugins/irc-events/link";
import {ClientConfiguration} from "../server"; import {ClientConfiguration} from "../server";
@ -40,7 +39,7 @@ interface ServerToClientEvents {
"sessions:list": (data: Session[]) => void; "sessions:list": (data: Session[]) => void;
"mentions:list": (data: Mention[]) => void; "mentions:list": (data: SharedMention[]) => void;
"setting:new": ({name: string, value: any}) => void; "setting:new": ({name: string, value: any}) => void;
"setting:all": (settings: {[key: string]: any}) => void; "setting:all": (settings: {[key: string]: any}) => void;
@ -49,7 +48,7 @@ interface ServerToClientEvents {
"mute:changed": (response: {target: number; status: boolean}) => void; "mute:changed": (response: {target: number; status: boolean}) => void;
names: (data: {id: number; users: User[]}) => void; names: (data: {id: number; users: SharedUser[]}) => void;
network: (data: {networks: ClientNetwork[]}) => void; network: (data: {networks: ClientNetwork[]}) => void;
"network:options": (data: {network: string; serverOptions: {[key: string]: any}}) => void; "network:options": (data: {network: string; serverOptions: {[key: string]: any}}) => void;
@ -89,7 +88,7 @@ interface ServerToClientEvents {
totalMessages, totalMessages,
}: { }: {
chan: number; chan: number;
messages: Msg[]; messages: SharedMsg[];
totalMessages: number; totalMessages: number;
}) => void; }) => void;