@social-mail/social-mail-web-server 1.4.735 → 1.4.736

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.4.735",
3
+ "version": "1.4.736",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import semver from "semver";
3
3
 
4
4
  export default async function seedUI(config: DBConfig) {
5
5
 
6
- const version = "1.2.289";
6
+ const version = "1.2.291";
7
7
 
8
8
  const existing = await config.get(UIPackageConfig, false);
9
9
  if (existing) {
@@ -26,6 +26,7 @@ import CleanupDeletedFilesWorkflow from "./clean-up/CleanupDeletedFilesWorkflow.
26
26
  import UpdateFolderSize from "./storage/files/UpdateFolderSize.js";
27
27
  import UpdateUserStorage from "./storage/user/UpdateUserStorage.js";
28
28
  import RepairPathWorkflow from "./storage/files/RepairPathWorkflow.js";
29
+ import RepairEmailCountsWorkflow from "./repair/counts/RepairEmailCountsWorkflow.js";
29
30
 
30
31
  @RegisterSingleton
31
32
  export default class SocialWorkflowContext extends WorkflowContext {
@@ -52,6 +53,7 @@ export default class SocialWorkflowContext extends WorkflowContext {
52
53
  this.register(SendWebPushNotification);
53
54
  this.register(ChannelSubscriberAddedWorkflow);
54
55
  this.register(RepairPathWorkflow);
56
+ this.register(RepairEmailCountsWorkflow);
55
57
  // this.register(MigrateEmailFilesWorkflow);
56
58
  this.register(CleanupDeletedFilesWorkflow);
57
59
 
@@ -85,7 +85,10 @@ export default class RepairEmailCountsWorkflow extends Workflow<{ mailboxID? }>
85
85
  ) {
86
86
  const mbID = this.input.mailboxID;
87
87
  const q = db.mailboxContacts
88
- .where({ start, mbID }, (p) => (x) => x.emailAddressID > p.start && x.mailboxID === p.mbID );
88
+ .where({ start, mbID }, (p) => (x) => x.emailAddressID > p.start && x.mailboxID === p.mbID
89
+ && x.autoClose === false
90
+ && x.blocked === false
91
+ );
89
92
  const list = await q
90
93
  .orderBy(void 0, (p) => (x) => x.emailAddressID)
91
94
  .limit(100)
@@ -94,7 +97,14 @@ export default class RepairEmailCountsWorkflow extends Workflow<{ mailboxID? }>
94
97
  return 0;
95
98
  }
96
99
  for (const iterator of list) {
97
- const { mailboxID, emailAddressID } = iterator;
100
+ const { mailboxID, emailAddressID, autoClose, blocked } = iterator;
101
+ if (autoClose || blocked) {
102
+ await db.mailboxContacts.statements.update({
103
+ totalThreads: 0,
104
+ openThreads: 0
105
+ }, { mailboxID, emailAddressID});
106
+ continue;
107
+ }
98
108
  const all = await db.emails
99
109
  .where(iterator, (p) => (x) => x.threadContacts.some((t) => t.mailboxID === p.mailboxID
100
110
  && t.emailAddressID === p.emailAddressID)