fix: route keyword writes to the email's own account in unified view

Tags applied to a shared/group-mailbox message did not persist. Custom
keywords (:*),  and  were written via Email/set
against the reaching client's primary account instead of the email's
owning account, so the server returned notUpdated without an error and
the change was lost on the next reload.

toggleStar already threaded an accountId through (#281); the keyword
methods did not. Add an optional accountId to updateEmailKeywords and
setKeyword and resolve it at the call sites from the email's source
account (sourceClientAccountId / sourceAccountId), matching the existing
delete/archive routing. Personal sources resolve to the account itself,
so behavior there is unchanged.
This commit is contained in:
Patrick Rotter
2026-07-04 14:53:15 +02:00
committed by Linus Rath
parent e9ac2de6cb
commit a099ab442a
5 changed files with 138 additions and 25 deletions
+4 -4
View File
@@ -1301,10 +1301,10 @@ export class JMAPClient implements IJMAPClient {
]);
}
async updateEmailKeywords(emailId: string, keywords: Record<string, boolean>): Promise<void> {
async updateEmailKeywords(emailId: string, keywords: Record<string, boolean>, accountId?: string): Promise<void> {
await this.request([
["Email/set", {
accountId: this.accountId,
accountId: accountId || this.accountId,
update: {
[emailId]: {
keywords,
@@ -1314,10 +1314,10 @@ export class JMAPClient implements IJMAPClient {
]);
}
async setKeyword(emailId: string, keyword: string): Promise<void> {
async setKeyword(emailId: string, keyword: string, accountId?: string): Promise<void> {
await this.request([
["Email/set", {
accountId: this.accountId,
accountId: accountId || this.accountId,
update: {
[emailId]: {
[`keywords/${keyword}`]: true,