@social-mail/social-mail-web-server 1.7.73 → 1.7.74

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.7.73",
3
+ "version": "1.7.74",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -41,6 +41,7 @@ export default class BroadcastEmail extends Workflow<IBroadcastEmail> {
41
41
  }
42
42
 
43
43
  private from: string;
44
+ private threadID: number;
44
45
 
45
46
  async run() {
46
47
 
@@ -48,9 +49,10 @@ export default class BroadcastEmail extends Workflow<IBroadcastEmail> {
48
49
  this.failedPreserveTime = TimeSpan.fromHours(1);
49
50
 
50
51
  if (!this.input.subscribe) {
51
- const { from } = await this.publish();
52
+ const { from, threadID } = await this.publish();
52
53
 
53
54
  this.from = from;
55
+ this.threadID = threadID;
54
56
  }
55
57
 
56
58
  for (let i = 0; i < 10000; i++) {
@@ -115,7 +117,7 @@ export default class BroadcastEmail extends Workflow<IBroadcastEmail> {
115
117
 
116
118
  // load email..
117
119
  const from = (await eas.getEmailAddress(this.input.mailboxID)).emailAddress;
118
- return { from };
120
+ return { from, threadID: email.threadID };
119
121
 
120
122
  }
121
123
 
@@ -198,13 +200,15 @@ export default class BroadcastEmail extends Workflow<IBroadcastEmail> {
198
200
  && !x.emailAddress.subscriberActivities.some((sa) => sa.emailID === p.emailID)).include((x) => x.emailAddress);
199
201
  }
200
202
 
201
- return db.mailboxContacts.where(this.input, (p) => (x) => x.mailboxID === p.mailboxID
203
+ const input = { ... this.input, threadID: this.threadID ?? this.input.emailID };
204
+
205
+ return db.mailboxContacts.where(input, (p) => (x) => x.mailboxID === p.mailboxID
202
206
  && x.emailAddressID !== p.mailboxID
203
207
  && !x.emailAddress.subscriberActivities.some((sa) => sa.emailID === p.emailID)
204
208
  && x.status === "active"
205
209
  && (x.subscriptionType === null
206
210
  || x.subscriptionType === "all"
207
- || x.mailbox.emails.some((ce) => ce.email.thread.threadParticipants.some((tp) => tp.emailAddressID === x.emailAddressID)) )
211
+ || x.mailbox.emails.some((ce) => ce.emailID === p.threadID && ce.email.threadParticipants.some((tp) => tp.emailAddressID === x.emailAddressID)) )
208
212
  )
209
213
  .include((x) => x.emailAddress);
210
214
  }