MCPcopy Create free account
hub / github.com/dailydotdev/apps / updatePostContentPreference

Function updatePostContentPreference

packages/shared/src/lib/query.ts:518–552  ·  view source on GitHub ↗
({
  data,
  status,
  entity,
  entityId,
}: {
  data: Post;
  status: ContentPreferenceStatus | null;
  entityId: string;
  entity: ContentPreferenceType;
})

Source from the content-addressed store, hash-verified

516};
517
518export const updatePostContentPreference = ({
519 data,
520 status,
521 entity,
522 entityId,
523}: {
524 data: Post;
525 status: ContentPreferenceStatus | null;
526 entityId: string;
527 entity: ContentPreferenceType;
528}): Post => {
529 if (typeof status === 'undefined') {
530 return data;
531 }
532
533 const newData = structuredClone(data);
534
535 if (newData.author?.id === entityId) {
536 newData.author = updateAuthorContentPreference({
537 data: newData.author,
538 status,
539 entity,
540 });
541 }
542
543 if (newData.scout?.id === entityId) {
544 newData.scout = updateAuthorContentPreference({
545 data: newData.scout,
546 status,
547 entity,
548 });
549 }
550
551 return newData;
552};
553
554export const updateCommentContentPreference = ({
555 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected