@social-mail/social-mail-web-server 1.5.112 → 1.5.113

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.5.112",
3
+ "version": "1.5.113",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -166,6 +166,8 @@ export default class EmailAddressService {
166
166
 
167
167
  const domainID = await this.getOrCreateDomain(domainName);
168
168
 
169
+ name ||= username;
170
+
169
171
  for (let index = 0; index < 3; index++) {
170
172
  try {
171
173
 
@@ -190,8 +192,10 @@ export default class EmailAddressService {
190
192
  // schedule for names tag
191
193
  const wc = ServiceProvider.resolve(this, WorkflowContext);
192
194
  await wc.queue(RepairEmailNameTagsWorkflow, { id: ea.emailAddressID, name });
193
- // we should try to save username as well but without stripping numbers
194
- await wc.queue(RepairEmailNameTagsWorkflow, { id: ea.emailAddressID, name:username, includeNumbers: true });
195
+ if (name !== username) {
196
+ // we should try to save username as well but without stripping numbers
197
+ await wc.queue(RepairEmailNameTagsWorkflow, { id: ea.emailAddressID, name:username, includeNumbers: true });
198
+ }
195
199
  }
196
200
  if(!hasMailbox && ((name && ea.name !== name) || ea.domainID !== domainID)) {
197
201
  ea.name = name;
@@ -33,7 +33,7 @@ export default class RepairEmailNameTagsWorkflow extends Workflow<{ id: number,
33
33
  for(let i = 0;i< 100;i++) {
34
34
  const emails = await db.emailAddresses.where({ start }, (p) => (x) => x.emailAddressID > p.start)
35
35
  .orderBy(void 0, (p) => (x) => x.emailAddressID)
36
- .limit(10)
36
+ .limit(50)
37
37
  .toArray();
38
38
 
39
39
  if (!emails.length) {
@@ -42,10 +42,9 @@ export default class RepairEmailNameTagsWorkflow extends Workflow<{ id: number,
42
42
 
43
43
  for (const { emailAddressID, name, emailAddress } of emails) {
44
44
  start = emailAddressID;
45
- if (!name) {
46
- continue;
45
+ if (name) {
46
+ await nts.updateName(name, { emailAddressID });
47
47
  }
48
- await nts.updateName(name, { emailAddressID });
49
48
  const [username ] = emailAddress.split("@", 2);
50
49
  await nts.updateName(username, { emailAddressID }, true);
51
50