MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / _handleDataNotification

Method _handleDataNotification

apps/client/src/code/realtime/client.ts:335–424  ·  view source on GitHub ↗
(decoder: decoding.Decoder)

Source from the content-addressed store, hash-verified

333 }
334 }
335 private _handleDataNotification(decoder: decoding.Decoder) {
336 const numItems = decoding.readVarUint(decoder);
337
338 for (let i = 0; i < numItems; i++) {
339 const prefix = decoding.readVarString(decoder);
340 const suffix = decoding.readVarString(decoder);
341 const field = decoding.readVarString(decoder);
342 const value = unpack(decoding.readVarUint8Array(decoder));
343
344 const fullKey = getFullKey(prefix, suffix, field);
345
346 if (
347 prefix === 'group-member' &&
348 field === 'role' &&
349 this.isSynced(prefix, suffix, field) &&
350 value !== this.values[fullKey]
351 ) {
352 const groupId = splitStr(suffix, ':', 2)[0];
353
354 this._resubscribe('group', groupId, 'encrypted-content-keyring');
355 this._resubscribe('group', groupId, 'encrypted-name');
356 this._resubscribe('group', groupId, 'encrypted-private-keyring');
357 this._resubscribe('group', groupId, 'permanent-deletion-date');
358
359 this._resubscribe(
360 'group-join-invitation',
361 suffix,
362 'encrypted-name',
363 );
364 this._resubscribe('group-join-invitation', suffix, 'exists');
365 this._resubscribe('group-join-invitation', suffix, 'role');
366
367 this._resubscribe('group-join-request', suffix, 'encrypted-name');
368 this._resubscribe('group-join-request', suffix, 'rejected');
369 this._resubscribe('group-join-request', suffix, 'exists');
370
371 this._resubscribe('group-member', suffix, 'encrypted-name');
372 this._resubscribe('group-member', suffix, 'exists');
373 this._resubscribe('group-member', suffix, 'role');
374
375 for (const [fullKey, value] of Object.entries(this.values)) {
376 if (
377 fullKey.endsWith('>group-id') &&
378 fullKey.startsWith('page:') &&
379 value === groupId
380 ) {
381 const key = splitStr(fullKey, '>', 2)[0];
382 const pageId = splitStr(key, ':', 2)[1];
383
384 this._resubscribe('page', pageId, 'encrypted-absolute-title');
385 this._resubscribe('page', pageId, 'encrypted-relative-title');
386 this._resubscribe(
387 'page',
388 pageId,
389 'encrypted-symmetric-keyring',
390 );
391
392 this._resubscribe('page', pageId, 'permanent-deletion-date');

Callers 1

_handleMessageMethod · 0.80

Calls 8

getFullKeyFunction · 0.90
splitStrFunction · 0.90
isSyncedMethod · 0.80
_resubscribeMethod · 0.80
subMethod · 0.80
getMethod · 0.65
addMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected