Skip to content

Commit f5ded96

Browse files
committed
Merge remote-tracking branch 'nrk/release52' into bbc-release52
2 parents 370cefd + 29c0800 commit f5ded96

File tree

8 files changed

+20
-23
lines changed

8 files changed

+20
-23
lines changed

meteor/server/api/__tests__/cleanup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ import {
4444
TranslationsBundles,
4545
PackageContainerStatuses,
4646
TimelineDatastore,
47-
SofieIngestDataCache,
4847
Notifications,
48+
SofieIngestDataCache,
4949
} from '../../collections'
5050
import { Collections } from '../../collections/lib'
5151
import { generateTranslationBundleOriginId } from '../translationsBundles'

meteor/server/api/cleanup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ import {
6969
UserActionsLog,
7070
Workers,
7171
WorkerThreadStatuses,
72-
SofieIngestDataCache,
7372
Notifications,
73+
SofieIngestDataCache,
7474
} from '../collections'
7575
import { AsyncOnlyMongoCollection, AsyncOnlyReadOnlyMongoCollection } from '../collections/collection'
7676
import { getCollectionKey } from '../collections/lib'

meteor/server/publications/system.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { meteorPublish } from './lib/lib'
22
import { MeteorPubSub } from '@sofie-automation/meteor-lib/dist/api/pubsub'
33
import { CoreSystem, Notifications } from '../collections'
4-
import { SYSTEM_ID } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
54
import { RundownId, RundownPlaylistId, StudioId } from '@sofie-automation/corelib/dist/dataModel/Ids'
6-
import { triggerWriteAccessBecauseNoCheckNecessary } from '../security/securityVerify'
75
import { check } from 'meteor/check'
6+
import { SYSTEM_ID } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
7+
import { triggerWriteAccessBecauseNoCheckNecessary } from '../security/securityVerify'
88

99
meteorPublish(MeteorPubSub.coreSystem, async function (_token: string | undefined) {
1010
triggerWriteAccessBecauseNoCheckNecessary()

packages/job-worker/src/__mocks__/collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ export function getMockCollections(): {
285285
BucketAdLibPieces: new MockMongoCollection<BucketAdLib>(CollectionName.BucketAdLibPieces),
286286
ExpectedMediaItems: new MockMongoCollection(CollectionName.ExpectedMediaItems),
287287
ExpectedPlayoutItems: new MockMongoCollection<ExpectedPlayoutItem>(CollectionName.ExpectedPlayoutItems),
288-
SofieIngestDataCache: new MockMongoCollection<SofieIngestDataCacheObj>(CollectionName.SofieIngestDataCache),
289288
Notifications: new MockMongoCollection<DBNotificationObj>(CollectionName.Notifications),
289+
SofieIngestDataCache: new MockMongoCollection<SofieIngestDataCacheObj>(CollectionName.SofieIngestDataCache),
290290
NrcsIngestDataCache: new MockMongoCollection<NrcsIngestDataCacheObj>(CollectionName.NrcsIngestDataCache),
291291
Parts: new MockMongoCollection<DBPart>(CollectionName.Parts),
292292
PartInstances: new MockMongoCollection<DBPartInstance>(CollectionName.PartInstances),
@@ -343,8 +343,8 @@ export interface IMockCollections {
343343
BucketAdLibPieces: MockMongoCollection<BucketAdLib>
344344
ExpectedMediaItems: MockMongoCollection<ExpectedMediaItem>
345345
ExpectedPlayoutItems: MockMongoCollection<ExpectedPlayoutItem>
346-
SofieIngestDataCache: MockMongoCollection<SofieIngestDataCacheObj>
347346
Notifications: MockMongoCollection<DBNotificationObj>
347+
SofieIngestDataCache: MockMongoCollection<SofieIngestDataCacheObj>
348348
NrcsIngestDataCache: MockMongoCollection<NrcsIngestDataCacheObj>
349349
Parts: MockMongoCollection<DBPart>
350350
PartInstances: MockMongoCollection<DBPartInstance>

packages/job-worker/src/db/collections.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ export interface IDirectCollections {
9999
BucketAdLibPieces: ICollection<BucketAdLib>
100100
ExpectedMediaItems: ICollection<ExpectedMediaItem>
101101
ExpectedPlayoutItems: ICollection<ExpectedPlayoutItem>
102-
SofieIngestDataCache: ICollection<SofieIngestDataCacheObj>
103102
Notifications: ICollection<DBNotificationObj>
103+
SofieIngestDataCache: ICollection<SofieIngestDataCacheObj>
104104
NrcsIngestDataCache: ICollection<NrcsIngestDataCacheObj>
105105
Parts: ICollection<DBPart>
106106
PartInstances: ICollection<DBPartInstance>
@@ -162,11 +162,11 @@ export function getMongoCollections(
162162
database.collection(CollectionName.ExpectedPlayoutItems),
163163
allowWatchers
164164
),
165+
Notifications: wrapMongoCollection(database.collection(CollectionName.Notifications), allowWatchers),
165166
SofieIngestDataCache: wrapMongoCollection(
166167
database.collection(CollectionName.SofieIngestDataCache),
167168
allowWatchers
168169
),
169-
Notifications: wrapMongoCollection(database.collection(CollectionName.Notifications), allowWatchers),
170170
NrcsIngestDataCache: wrapMongoCollection(
171171
database.collection(CollectionName.NrcsIngestDataCache),
172172
allowWatchers

packages/job-worker/src/ingest/createAdlibTestingRundown.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import type {
1313
IngestRundown,
1414
} from '@sofie-automation/blueprints-integration'
1515
import { logger } from '../logging'
16-
import { RundownId } from '@sofie-automation/corelib/dist/dataModel/Ids'
17-
import { handleUpdatedRundown } from './ingestRundownJobs'
18-
import { runIngestUpdateOperation } from './runOperation'
1916
import { NotificationsModelHelper } from '../notifications/NotificationsModelHelper'
2017
import { unprotectString } from '@sofie-automation/corelib/dist/protectedString'
2118
import { convertNoteToNotification } from '../notifications/util'
19+
import { RundownId } from '@sofie-automation/corelib/dist/dataModel/Ids'
20+
import { handleUpdatedRundown } from './ingestRundownJobs'
21+
import { runIngestUpdateOperation } from './runOperation'
2222

2323
export async function handleCreateAdlibTestingRundownForShowStyleVariant(
2424
context: JobContext,

packages/job-worker/src/notifications/NotificationsModelHelper.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { isEqual } from 'underscore'
1616
interface NotificationsLoadState {
1717
dbNotifications: ReadonlyMap<string, DBNotificationObj> | null
1818
updatedNotifications: Map<string, Omit<DBNotificationObj, 'created' | 'modified'> | null>
19-
// createdTimestamps: Map<string, number>
2019

2120
removeAllMissing: boolean
2221
}
@@ -67,7 +66,7 @@ export class NotificationsModelHelper implements INotificationsModel {
6766
}
6867

6968
async getAllNotifications(category: string): Promise<INotificationWithTarget[]> {
70-
const notificationsForCategory = this.#getOrCategoryEntry(category)
69+
const notificationsForCategory = this.#getOrCreateCategoryEntry(category)
7170

7271
await this.#getAllNotificationsRaw(notificationsForCategory, category)
7372

@@ -99,14 +98,14 @@ export class NotificationsModelHelper implements INotificationsModel {
9998
}
10099

101100
clearNotification(category: string, notificationId: string): void {
102-
const notificationsForCategory = this.#getOrCategoryEntry(category)
101+
const notificationsForCategory = this.#getOrCreateCategoryEntry(category)
103102

104103
// The notification may or may not be loaded, but this indicates that to the saving that we intend to delete it
105104
notificationsForCategory.updatedNotifications.set(notificationId, null)
106105
}
107106

108107
setNotification(category: string, notification: INotificationWithTarget): void {
109-
const notificationsForCategory = this.#getOrCategoryEntry(category)
108+
const notificationsForCategory = this.#getOrCreateCategoryEntry(category)
110109

111110
const fullCategory = this.#getFullCategoryName(category)
112111
notificationsForCategory.updatedNotifications.set(notification.id, {
@@ -120,7 +119,7 @@ export class NotificationsModelHelper implements INotificationsModel {
120119
}
121120

122121
clearAllNotifications(category: string): void {
123-
const notificationsForCategory = this.#getOrCategoryEntry(category)
122+
const notificationsForCategory = this.#getOrCreateCategoryEntry(category)
124123

125124
// Tell this store that any documents not in the `updatedNotifications` should be deleted
126125
notificationsForCategory.removeAllMissing = true
@@ -129,7 +128,7 @@ export class NotificationsModelHelper implements INotificationsModel {
129128
notificationsForCategory.updatedNotifications.clear()
130129
}
131130

132-
#getOrCategoryEntry(category: string): NotificationsLoadState {
131+
#getOrCreateCategoryEntry(category: string): NotificationsLoadState {
133132
let notificationsForCategory = this.#notificationsByCategory.get(category)
134133
if (!notificationsForCategory) {
135134
notificationsForCategory = {
@@ -199,9 +198,7 @@ export class NotificationsModelHelper implements INotificationsModel {
199198
updates.push({
200199
replaceOne: {
201200
filter: {
202-
category: this.#getFullCategoryName(category),
203-
localId: localId,
204-
'relatedTo.studioId': this.#context.studioId,
201+
_id: updatedNotification._id,
205202
},
206203
replacement: {
207204
...updatedNotification,
@@ -218,9 +215,9 @@ export class NotificationsModelHelper implements INotificationsModel {
218215
updates.push({
219216
deleteMany: {
220217
filter: {
218+
'relatedTo.studioId': this.#context.studioId,
221219
category: this.#getFullCategoryName(category),
222220
localId: { $nin: localIdsToKeep },
223-
'relatedTo.studioId': this.#context.studioId,
224221
},
225222
},
226223
})
@@ -229,9 +226,9 @@ export class NotificationsModelHelper implements INotificationsModel {
229226
updates.push({
230227
deleteMany: {
231228
filter: {
229+
'relatedTo.studioId': this.#context.studioId,
232230
category: this.#getFullCategoryName(category),
233231
localId: { $in: localIdsToDelete },
234-
'relatedTo.studioId': this.#context.studioId,
235232
},
236233
},
237234
})

packages/job-worker/src/playout/model/implementation/PlayoutModelImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ export class PlayoutModelImpl extends PlayoutModelReadonlyImpl implements Playou
671671
...writePartInstancesAndPieceInstances(this.context, this.allPartInstances),
672672
writeAdlibTestingSegments(this.context, this.rundownsImpl),
673673
this.#baselineHelper.saveAllToDatabase(),
674-
this.context.saveRouteSetChanges(),
675674
this.#notificationsHelper.saveAllToDatabase(),
675+
this.context.saveRouteSetChanges(),
676676
])
677677

678678
this.#playlistHasChanged = false

0 commit comments

Comments
 (0)