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

Function updatePostContentPreference

packages/shared/src/lib/query.ts:543–577  ·  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

541};
542
543export const updatePostContentPreference = ({
544 data,
545 status,
546 entity,
547 entityId,
548}: {
549 data: Post;
550 status: ContentPreferenceStatus | null;
551 entityId: string;
552 entity: ContentPreferenceType;
553}): Post => {
554 if (typeof status === 'undefined') {
555 return data;
556 }
557
558 const newData = structuredClone(data);
559
560 if (newData.author?.id === entityId) {
561 newData.author = updateAuthorContentPreference({
562 data: newData.author,
563 status,
564 entity,
565 });
566 }
567
568 if (newData.scout?.id === entityId) {
569 newData.scout = updateAuthorContentPreference({
570 data: newData.scout,
571 status,
572 entity,
573 });
574 }
575
576 return newData;
577};
578
579export const updateCommentContentPreference = ({
580 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected