feat(frontend): feed of deleted and edited messages above the chat list and per chat in the changes panel
This commit is contained in:
1 parent
010fa29ce0
commit
9f16e2aa56
23 files changed
+1915
-71
No files matched your search
@@ -9,6 +9,11 @@ import type {
|
||||
ChatLinkView,
|
||||
DayCount,
|
||||
DiscoverItem,
|
||||
FeedChatKind,
|
||||
FeedKind,
|
||||
FeedMessagesPage,
|
||||
FeedPage,
|
||||
FeedUnseen,
|
||||
Folder,
|
||||
JobStatus,
|
||||
JobView,
|
||||
@@ -274,6 +279,39 @@ export function listDeleted(
|
||||
});
|
||||
}
|
||||
|
||||
export interface FeedQuery {
|
||||
chat_id?: number;
|
||||
chat_kind?: FeedChatKind;
|
||||
cursor?: string;
|
||||
kind?: FeedKind;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function listFeed(query: FeedQuery = {}): Promise<FeedPage> {
|
||||
return request<FeedPage>("/feed", { account: true, query: { ...query } });
|
||||
}
|
||||
|
||||
export function getFeedUnseen(): Promise<FeedUnseen> {
|
||||
return request<FeedUnseen>("/feed/unseen", { account: true });
|
||||
}
|
||||
|
||||
export function markFeedSeen(at?: string): Promise<FeedUnseen> {
|
||||
return request<FeedUnseen>("/feed/seen", {
|
||||
body: { account_id: accounts.selectedId, at },
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export function listFeedMessages(
|
||||
itemId: number,
|
||||
query: { cursor?: string; limit?: number } = {}
|
||||
): Promise<FeedMessagesPage> {
|
||||
return request<FeedMessagesPage>(`/feed/${itemId}/messages`, {
|
||||
account: true,
|
||||
query: { ...query },
|
||||
});
|
||||
}
|
||||
|
||||
export function getPeer(peerId: number): Promise<PeerView> {
|
||||
return request<PeerView>(`/peers/${peerId}`, { account: true });
|
||||
}
|
||||
|
||||
@@ -222,6 +222,52 @@ export interface MessageVersion {
|
||||
text: string | null;
|
||||
}
|
||||
|
||||
export type FeedKind = "all" | "deleted" | "edited";
|
||||
export type FeedChatKind = "dm" | "group" | "channel";
|
||||
|
||||
export interface FeedChat {
|
||||
chat_id: number;
|
||||
has_avatar: boolean;
|
||||
kind: FeedChatKind;
|
||||
title: string | null;
|
||||
}
|
||||
|
||||
export interface FeedItem {
|
||||
after: string | null;
|
||||
at: string;
|
||||
before: string | null;
|
||||
chat: FeedChat;
|
||||
edit_date: string | null;
|
||||
has_before: boolean;
|
||||
id: number;
|
||||
kind: Exclude<FeedKind, "all">;
|
||||
message: MessageView | null;
|
||||
message_count: number;
|
||||
message_id: number;
|
||||
outgoing: boolean;
|
||||
sender_id: number | null;
|
||||
sender_name: string | null;
|
||||
since: string;
|
||||
}
|
||||
|
||||
export interface FeedPage {
|
||||
items: FeedItem[];
|
||||
next_cursor: string | null;
|
||||
}
|
||||
|
||||
export interface FeedUnseen {
|
||||
count: number;
|
||||
deleted: number;
|
||||
edited: number;
|
||||
latest: FeedItem | null;
|
||||
seen_at: string | null;
|
||||
}
|
||||
|
||||
export interface FeedMessagesPage {
|
||||
messages: MessageView[];
|
||||
next_cursor: string | null;
|
||||
}
|
||||
|
||||
export interface MediaVersion {
|
||||
file_size: number | null;
|
||||
id: number;
|
||||
|
||||
Reference in new issue
Block a user