mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 14:44:13 +00:00
shared: extract chan + user
This commit is contained in:
parent
3f0ee6a961
commit
d0b71aba32
3 changed files with 55 additions and 4 deletions
8
client/js/types.d.ts
vendored
8
client/js/types.d.ts
vendored
|
@ -1,9 +1,9 @@
|
|||
import {defineComponent} from "vue";
|
||||
|
||||
import Chan from "../../server/models/chan";
|
||||
import Network from "../../server/models/network";
|
||||
import User from "../../server/models/user";
|
||||
import SharedMessage from "../../shared/types/msg";
|
||||
import SharedChan from "../../shared/types/chan";
|
||||
import SharedUser from "../../shared/models/user";
|
||||
import {Mention} from "../../server/client";
|
||||
import {ClientConfiguration} from "../../server/server";
|
||||
import {LinkPreview} from "../../server/plugins/irc-events/link";
|
||||
|
@ -16,7 +16,7 @@ interface LoungeWindow extends Window {
|
|||
};
|
||||
}
|
||||
|
||||
type ClientUser = User & {
|
||||
type ClientUser = SharedUser & {
|
||||
//
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ type ClientMessage = Omit<SharedMessage, "users"> & {
|
|||
users: string[];
|
||||
};
|
||||
|
||||
type ClientChan = Omit<Chan, "users" | "messages"> & {
|
||||
type ClientChan = Omit<SharedChan, "users" | "messages"> & {
|
||||
moreHistoryAvailable: boolean;
|
||||
editTopic: boolean;
|
||||
users: ClientUser[];
|
||||
|
|
43
shared/types/chan.ts
Normal file
43
shared/types/chan.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import {SharedMsg} from "./msg";
|
||||
import {SharedUser} from "./user";
|
||||
|
||||
export enum ChanType {
|
||||
CHANNEL = "channel",
|
||||
LOBBY = "lobby",
|
||||
QUERY = "query",
|
||||
SPECIAL = "special",
|
||||
}
|
||||
|
||||
export enum SpecialChanType {
|
||||
BANLIST = "list_bans",
|
||||
INVITELIST = "list_invites",
|
||||
CHANNELLIST = "list_channels",
|
||||
IGNORELIST = "list_ignored",
|
||||
}
|
||||
|
||||
export enum ChanState {
|
||||
PARTED = 0,
|
||||
JOINED = 1,
|
||||
}
|
||||
|
||||
export type SharedChan = {
|
||||
// TODO: don't force existence, figure out how to make TS infer it.
|
||||
id: number;
|
||||
messages: SharedMsg[];
|
||||
name: string;
|
||||
key: string;
|
||||
topic: string;
|
||||
firstUnread: number;
|
||||
unread: number;
|
||||
highlight: number;
|
||||
users: Map<string, SharedUser>;
|
||||
muted: boolean;
|
||||
type: ChanType;
|
||||
state: ChanState;
|
||||
|
||||
userAway?: boolean;
|
||||
special?: SpecialChanType;
|
||||
data?: any;
|
||||
closed?: boolean;
|
||||
num_users?: number;
|
||||
};
|
8
shared/types/user.ts
Normal file
8
shared/types/user.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
export type SharedUser = {
|
||||
modes: string[];
|
||||
// Users in the channel have only one mode assigned
|
||||
mode: string;
|
||||
away: string;
|
||||
nick: string;
|
||||
lastMessage: number;
|
||||
};
|
Loading…
Reference in a new issue