fix: label the search modal's archive action Unarchive for archived chats and report what happened (#30177)

This commit is contained in:
G30 2026-09-19 11:02:11 -04:00 • committed by GitHub
parent dbe538c033
commit 9e293a58ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 3 deletions

View file

@ -305,6 +305,7 @@ class ChatTitleIdResponse(BaseModel):
last_read_at: int | None = None
snippet: str | None = None
active: bool = False
archived: bool = False
class SharedChatResponse(BaseModel):

View file

@ -888,6 +888,7 @@ async def search_user_chats(
created_at=chat.created_at,
last_read_at=chat.last_read_at,
snippet=chat_search_snippet(chat.chat, search_text),
archived=chat.archived,
)
)

View file

@ -101,7 +101,7 @@
const archiveChatHandler = async (id) => {
try {
await archiveChatById(localStorage.token, id);
const res = await archiveChatById(localStorage.token, id);
chatList = chatList?.filter((c) => c.id !== id) ?? null;
@ -111,7 +111,7 @@
}
await refreshSidebar();
toast.success($i18n.t('Chat archived.'));
toast.success(res?.archived ? $i18n.t('Chat archived.') : $i18n.t('Chat unarchived.'));
} catch (error) {
toast.error($i18n.t('Failed to archive chat.'));
}
@ -816,6 +816,7 @@
<div class="flex items-center">
<ChatMenu
chatId={chat.id}
archived={chat.archived ?? false}
shareHandler={() => {
menuChatId = chat.id;
showShareChatModal = true;

View file

@ -43,6 +43,7 @@
export let markUnreadHandler: Function = () => {};
export let chatId = '';
export let archived = false;
let dropdown: Dropdown;
let show = false;
@ -457,7 +458,9 @@
}}
>
<ArchiveBoxIcon className="size-3.5" strokeWidth="1.7" />
<div class="flex items-center">{$i18n.t('Archive')}</div>
<div class="flex items-center">
{archived ? $i18n.t('Unarchive') : $i18n.t('Archive')}
</div>
</button>
{#if $user?.role === 'admin' || ($user?.permissions?.chat?.delete ?? true)}

View file

@ -343,6 +343,7 @@
"Chat Menu": "",
"Chat moved successfully": "",
"Chat Permissions": "",
"Chat unarchived.": "",
"Chat unshared successfully.": "",
"Chat Uploads": "",
"Chat Variables": "",
@ -3304,6 +3305,7 @@
"Type Hugging Face Resolve (Download) URL": "",
"Type your answer": "",
"Uh-oh! There was an issue with the response.": "",
"Unarchive": "",
"Unarchive Chat": "",
"Unassigned": "",
"Underline": "",