Skip to content

Commit f9dfb74

Browse files
committed
Revert "fix: publications not becoming ready when stopping evaluation early"
This reverts commit 7d12edf.
1 parent 7d12edf commit f9dfb74

File tree

6 files changed

+30
-120
lines changed

6 files changed

+30
-120
lines changed

meteor/server/publications/organization.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ import { getCurrentTime } from '../lib/lib'
1818
meteorPublish(
1919
MeteorPubSub.organization,
2020
async function (organizationId: OrganizationId | null, token: string | undefined) {
21-
if (!organizationId) {
22-
this.ready()
23-
return null
24-
}
21+
if (!organizationId) return null
2522

2623
const { cred, selector } = await AutoFillSelector.organizationId(this.userId, { _id: organizationId }, token)
2724
const modifier: FindOptions<DBOrganization> = {
@@ -46,10 +43,7 @@ meteorPublish(CorelibPubSub.blueprints, async function (blueprintIds: BlueprintI
4643
check(blueprintIds, Match.Maybe(Array))
4744

4845
// If values were provided, they must have values
49-
if (blueprintIds && blueprintIds.length === 0) {
50-
this.ready()
51-
return null
52-
}
46+
if (blueprintIds && blueprintIds.length === 0) return null
5347

5448
const { cred, selector } = await AutoFillSelector.organizationId<Blueprint>(this.userId, {}, token)
5549

meteor/server/publications/peripheralDevice.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ meteorPublish(
4444
check(peripheralDeviceIds, Match.Maybe(Array))
4545

4646
// If values were provided, they must have values
47-
if (peripheralDeviceIds && peripheralDeviceIds.length === 0) {
48-
this.ready()
49-
return null
50-
}
47+
if (peripheralDeviceIds && peripheralDeviceIds.length === 0) return null
5148

5249
const { cred, selector } = await AutoFillSelector.organizationId<PeripheralDevice>(this.userId, {}, token)
5350

meteor/server/publications/rundown.ts

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ meteorPublish(PeripheralDevicePubSub.rundownsForDevice, async function (deviceId
6565
throw new Meteor.Error(403, 'Publication can only be used by authorized PeripheralDevices')
6666

6767
// No studio, then no rundowns
68-
if (!resolvedCred.device.studioId) {
69-
this.ready()
70-
return null
71-
}
68+
if (!resolvedCred.device.studioId) return null
7269

7370
selector.studioId = resolvedCred.device.studioId
7471

@@ -90,10 +87,7 @@ meteorPublish(
9087
check(playlistIds, Array)
9188

9289
// If values were provided, they must have values
93-
if (playlistIds.length === 0) {
94-
this.ready()
95-
return null
96-
}
90+
if (playlistIds.length === 0) return null
9791

9892
const { cred, selector } = await AutoFillSelector.organizationId<DBRundown>(
9993
this.userId,
@@ -127,10 +121,7 @@ meteorPublish(
127121
async function (showStyleBaseIds: ShowStyleBaseId[], token: string | undefined) {
128122
check(showStyleBaseIds, Array)
129123

130-
if (showStyleBaseIds.length === 0) {
131-
this.ready()
132-
return null
133-
}
124+
if (showStyleBaseIds.length === 0) return null
134125

135126
const { cred, selector } = await AutoFillSelector.organizationId<DBRundown>(
136127
this.userId,
@@ -165,10 +156,7 @@ meteorPublish(
165156
async function (rundownIds: RundownId[], filter: { omitHidden?: boolean } | undefined, token: string | undefined) {
166157
check(rundownIds, Array)
167158

168-
if (rundownIds.length === 0) {
169-
this.ready()
170-
return null
171-
}
159+
if (rundownIds.length === 0) return null
172160

173161
const selector: MongoQuery<DBSegment> = {
174162
rundownId: { $in: rundownIds },
@@ -195,14 +183,8 @@ meteorPublish(
195183
check(rundownIds, Array)
196184
check(segmentIds, Match.Maybe(Array))
197185

198-
if (rundownIds.length === 0) {
199-
this.ready()
200-
return null
201-
}
202-
if (segmentIds && segmentIds.length === 0) {
203-
this.ready()
204-
return null
205-
}
186+
if (rundownIds.length === 0) return null
187+
if (segmentIds && segmentIds.length === 0) return null
206188

207189
const modifier: FindOptions<DBPart> = {
208190
fields: {
@@ -237,10 +219,7 @@ meteorPublish(
237219
check(rundownIds, Array)
238220
check(playlistActivationId, Match.Maybe(String))
239221

240-
if (rundownIds.length === 0 || !playlistActivationId) {
241-
this.ready()
242-
return null
243-
}
222+
if (rundownIds.length === 0 || !playlistActivationId) return null
244223

245224
const modifier: FindOptions<DBPartInstance> = {
246225
fields: {
@@ -273,10 +252,7 @@ meteorPublish(
273252
) {
274253
check(rundownIds, Array)
275254

276-
if (rundownIds.length === 0) {
277-
this.ready()
278-
return null
279-
}
255+
if (rundownIds.length === 0) return null
280256

281257
const selector: MongoQuery<DBPartInstance> = {
282258
rundownId: { $in: rundownIds },
@@ -314,10 +290,7 @@ meteorPublish(
314290
check(partIds, Match.Maybe(Array))
315291

316292
// If values were provided, they must have values
317-
if (partIds && partIds.length === 0) {
318-
this.ready()
319-
return null
320-
}
293+
if (partIds && partIds.length === 0) return null
321294

322295
const selector: MongoQuery<Piece> = {
323296
startRundownId: { $in: rundownIds },
@@ -388,10 +361,7 @@ const adlibPiecesSubFields: MongoFieldSpecifierZeroes<AdLibPiece> = {
388361
meteorPublish(CorelibPubSub.adLibPieces, async function (rundownIds: RundownId[], token: string | undefined) {
389362
check(rundownIds, Array)
390363

391-
if (rundownIds.length === 0) {
392-
this.ready()
393-
return null
394-
}
364+
if (rundownIds.length === 0) return null
395365

396366
const selector: MongoQuery<AdLibPiece> = {
397367
rundownId: { $in: rundownIds },
@@ -447,14 +417,8 @@ meteorPublish(
447417
check(partInstanceIds, Match.Maybe(Array))
448418

449419
// If values were provided, they must have values
450-
if (rundownIds.length === 0) {
451-
this.ready()
452-
return null
453-
}
454-
if (partInstanceIds && partInstanceIds.length === 0) {
455-
this.ready()
456-
return null
457-
}
420+
if (rundownIds.length === 0) return null
421+
if (partInstanceIds && partInstanceIds.length === 0) return null
458422

459423
const selector: MongoQuery<PieceInstance> = {
460424
rundownId: { $in: rundownIds },
@@ -521,10 +485,7 @@ meteorPublish(
521485
) {
522486
check(rundownIds, Array)
523487

524-
if (rundownIds.length === 0) {
525-
this.ready()
526-
return null
527-
}
488+
if (rundownIds.length === 0) return null
528489

529490
const selector: MongoQuery<PieceInstance> = {
530491
rundownId: { $in: rundownIds },
@@ -561,10 +522,7 @@ meteorPublish(
561522
if (!peripheralDevice) throw new Meteor.Error(`PeripheralDevice "${deviceId}" not found`)
562523

563524
const studioId = peripheralDevice.studioId
564-
if (!studioId) {
565-
this.ready()
566-
return null
567-
}
525+
if (!studioId) return null
568526

569527
return ExpectedPlayoutItems.findWithCursor({ studioId })
570528
}
@@ -593,10 +551,7 @@ meteorPublish(
593551
async function (rundownIds: RundownId[], token: string | undefined) {
594552
check(rundownIds, Array)
595553

596-
if (rundownIds.length === 0) {
597-
this.ready()
598-
return null
599-
}
554+
if (rundownIds.length === 0) return null
600555

601556
const selector: MongoQuery<RundownBaselineAdLibItem> = {
602557
rundownId: { $in: rundownIds },
@@ -624,10 +579,7 @@ const adlibActionSubFields: MongoFieldSpecifierZeroes<AdLibAction> = {
624579
meteorPublish(CorelibPubSub.adLibActions, async function (rundownIds: RundownId[], token: string | undefined) {
625580
check(rundownIds, Array)
626581

627-
if (rundownIds.length === 0) {
628-
this.ready()
629-
return null
630-
}
582+
if (rundownIds.length === 0) return null
631583

632584
const selector: MongoQuery<AdLibAction> = {
633585
rundownId: { $in: rundownIds },
@@ -666,10 +618,7 @@ meteorPublish(
666618
async function (rundownIds: RundownId[], token: string | undefined) {
667619
check(rundownIds, Array)
668620

669-
if (rundownIds.length === 0) {
670-
this.ready()
671-
return null
672-
}
621+
if (rundownIds.length === 0) return null
673622

674623
const selector: MongoQuery<RundownBaselineAdLibAction> = {
675624
rundownId: { $in: rundownIds },

meteor/server/publications/rundownPlaylist.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@ meteorPublish(
2424
check(studioIds, Match.Maybe(Array))
2525

2626
// If values were provided, they must have values
27-
if (rundownPlaylistIds && rundownPlaylistIds.length === 0) {
28-
this.ready()
29-
return null
30-
}
31-
if (studioIds && studioIds.length === 0) {
32-
this.ready()
33-
return null
34-
}
27+
if (rundownPlaylistIds && rundownPlaylistIds.length === 0) return null
28+
if (studioIds && studioIds.length === 0) return null
3529

3630
const { cred, selector } = await AutoFillSelector.organizationId<DBRundownPlaylist>(this.userId, {}, token)
3731

meteor/server/publications/showStyle.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ meteorPublish(
1919
check(showStyleBaseIds, Match.Maybe(Array))
2020

2121
// If values were provided, they must have values
22-
if (showStyleBaseIds && showStyleBaseIds.length === 0) {
23-
this.ready()
24-
return null
25-
}
22+
if (showStyleBaseIds && showStyleBaseIds.length === 0) return null
2623

2724
const { cred, selector } = await AutoFillSelector.organizationId<DBShowStyleBase>(this.userId, {}, token)
2825

@@ -53,14 +50,8 @@ meteorPublish(
5350
check(showStyleVariantIds, Match.Maybe(Array))
5451

5552
// If values were provided, they must have values
56-
if (showStyleBaseIds && showStyleBaseIds.length === 0) {
57-
this.ready()
58-
return null
59-
}
60-
if (showStyleVariantIds && showStyleVariantIds.length === 0) {
61-
this.ready()
62-
return null
63-
}
53+
if (showStyleBaseIds && showStyleBaseIds.length === 0) return null
54+
if (showStyleVariantIds && showStyleVariantIds.length === 0) return null
6455

6556
const { cred, selector } = await AutoFillSelector.showStyleBaseId<DBShowStyleVariant>(this.userId, {}, token)
6657

@@ -86,10 +77,7 @@ meteorPublish(
8677
check(showStyleBaseIds, Match.Maybe(Array))
8778

8879
// If values were provided, they must have values
89-
if (showStyleBaseIds && showStyleBaseIds.length === 0) {
90-
this.ready()
91-
return null
92-
}
80+
if (showStyleBaseIds && showStyleBaseIds.length === 0) return null
9381

9482
const selector0: MongoQuery<RundownLayoutBase> = {}
9583
if (showStyleBaseIds) selector0.showStyleBaseId = { $in: showStyleBaseIds }

meteor/server/publications/studio.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ meteorPublish(CorelibPubSub.studios, async function (studioIds: StudioId[] | nul
4242
check(studioIds, Match.Maybe(Array))
4343

4444
// If values were provided, they must have values
45-
if (studioIds && studioIds.length === 0) {
46-
this.ready()
47-
return null
48-
}
45+
if (studioIds && studioIds.length === 0) return null
4946

5047
const { cred, selector } = await AutoFillSelector.organizationId<DBStudio>(this.userId, {}, token)
5148

@@ -81,10 +78,7 @@ meteorPublish(CorelibPubSub.expectedPackages, async function (studioIds: StudioI
8178
// Note: This differs from the expected packages sent to the Package Manager, instead @see PubSub.expectedPackagesForDevice
8279
check(studioIds, Array)
8380

84-
if (studioIds.length === 0) {
85-
this.ready()
86-
return null
87-
}
81+
if (studioIds.length === 0) return null
8882

8983
if (await StudioReadAccess.studioContent(studioIds, { userId: this.userId, token })) {
9084
return ExpectedPackages.findWithCursor({
@@ -98,10 +92,7 @@ meteorPublish(
9892
async function (studioIds: StudioId[], token: string | undefined) {
9993
check(studioIds, Array)
10094

101-
if (studioIds.length === 0) {
102-
this.ready()
103-
return null
104-
}
95+
if (studioIds.length === 0) return null
10596

10697
if (await StudioReadAccess.studioContent(studioIds, { userId: this.userId, token })) {
10798
return ExpectedPackageWorkStatuses.findWithCursor({
@@ -116,10 +107,7 @@ meteorPublish(
116107
async function (studioIds: StudioId[], token: string | undefined) {
117108
check(studioIds, Array)
118109

119-
if (studioIds.length === 0) {
120-
this.ready()
121-
return null
122-
}
110+
if (studioIds.length === 0) return null
123111

124112
if (await StudioReadAccess.studioContent(studioIds, { userId: this.userId, token })) {
125113
return PackageContainerStatuses.findWithCursor({

0 commit comments

Comments
 (0)