@remit/mailbox-service 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
IThreadMessageRepository,
|
|
10
10
|
ThreadMessageItem,
|
|
11
11
|
} from "@remit/data-ports";
|
|
12
|
+
import { MessageSystemFlag } from "@remit/domain-enums";
|
|
12
13
|
import type { ManagedConnectionFactory } from "./connection-factory.js";
|
|
13
14
|
import { MessageSyncService } from "./message-sync.js";
|
|
14
15
|
import type { ImapEnvelope } from "./types.js";
|
|
@@ -129,3 +130,28 @@ describe("message sync maps IMAP flags onto the created ThreadMessage", () => {
|
|
|
129
130
|
assert.equal(input.hasStars, true);
|
|
130
131
|
});
|
|
131
132
|
});
|
|
133
|
+
|
|
134
|
+
// #79: the mapping above was correct and still shipped broken. The sync path
|
|
135
|
+
// compares a server flag list against these members, so what they hold has to
|
|
136
|
+
// be the spelling IMAP puts on the wire — a leading backslash and all. The
|
|
137
|
+
// published images carried `Flagged`, the member's *name*, because the emitter
|
|
138
|
+
// that generates them was installed unpatched and ate the escape. Every
|
|
139
|
+
// comparison then quietly stopped matching: mail flagged on the server arrived
|
|
140
|
+
// unstarred, and a star set in the app went out as a custom keyword no other
|
|
141
|
+
// client reads. Asserted against literals rather than the enum, because the
|
|
142
|
+
// enum is the thing under test.
|
|
143
|
+
describe("the generated flag members carry the IMAP wire spelling", () => {
|
|
144
|
+
test("system flags keep their leading backslash", () => {
|
|
145
|
+
assert.equal(MessageSystemFlag.Flagged, "\\Flagged");
|
|
146
|
+
assert.equal(MessageSystemFlag.Seen, "\\Seen");
|
|
147
|
+
assert.equal(MessageSystemFlag.Answered, "\\Answered");
|
|
148
|
+
assert.equal(MessageSystemFlag.Deleted, "\\Deleted");
|
|
149
|
+
assert.equal(MessageSystemFlag.Draft, "\\Draft");
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("a member's name is never its value", () => {
|
|
153
|
+
for (const [name, value] of Object.entries(MessageSystemFlag)) {
|
|
154
|
+
assert.notEqual(value, name);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
package/src/message-sync.ts
CHANGED
|
@@ -1244,7 +1244,8 @@ export class MessageSyncService {
|
|
|
1244
1244
|
|
|
1245
1245
|
for (const { localPart, domain, displayName, order } of addressData) {
|
|
1246
1246
|
const normalizedEmail = `${localPart}@${domain}`.toLowerCase();
|
|
1247
|
-
const normalizedCompound =
|
|
1247
|
+
const normalizedCompound =
|
|
1248
|
+
`${displayName.toLowerCase()} ${normalizedEmail}`.trim();
|
|
1248
1249
|
|
|
1249
1250
|
const addressId = deriveAddressId(accountConfigId, normalizedEmail);
|
|
1250
1251
|
|