mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
refactor: remove read tracking from mentions (prep for notification center)
This commit is contained in:
parent
25eb240539
commit
80e19a52cb
11 changed files with 7 additions and 227 deletions
|
|
@ -14,10 +14,6 @@ import {
|
|||
getCommentsResponse,
|
||||
getMentionsRequest,
|
||||
getMentionsResponse,
|
||||
type MarkMentionReadRequest,
|
||||
markAllMentionsReadResponse,
|
||||
markMentionReadRequest,
|
||||
markMentionReadResponse,
|
||||
type UpdateCommentRequest,
|
||||
updateCommentRequest,
|
||||
updateCommentResponse,
|
||||
|
|
@ -127,39 +123,12 @@ class ChatCommentsApiService {
|
|||
if (parsed.data.search_space_id !== undefined) {
|
||||
params.set("search_space_id", String(parsed.data.search_space_id));
|
||||
}
|
||||
if (parsed.data.unread_only !== undefined) {
|
||||
params.set("unread_only", String(parsed.data.unread_only));
|
||||
}
|
||||
|
||||
const queryString = params.toString();
|
||||
const url = queryString ? `/api/v1/mentions?${queryString}` : "/api/v1/mentions";
|
||||
|
||||
return baseApiService.get(url, getMentionsResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark a mention as read
|
||||
*/
|
||||
markMentionRead = async (request: MarkMentionReadRequest) => {
|
||||
const parsed = markMentionReadRequest.safeParse(request);
|
||||
|
||||
if (!parsed.success) {
|
||||
const errorMessage = parsed.error.issues.map((issue) => issue.message).join(", ");
|
||||
throw new ValidationError(`Invalid request: ${errorMessage}`);
|
||||
}
|
||||
|
||||
return baseApiService.put(
|
||||
`/api/v1/mentions/${parsed.data.mention_id}/read`,
|
||||
markMentionReadResponse
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark all mentions as read
|
||||
*/
|
||||
markAllMentionsRead = async () => {
|
||||
return baseApiService.put("/api/v1/mentions/read-all", markAllMentionsReadResponse);
|
||||
};
|
||||
}
|
||||
|
||||
export const chatCommentsApiService = new ChatCommentsApiService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue