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

Function updatePostContentPreference

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

552};
553
554export const updatePostContentPreference = ({
555 data,
556 status,
557 entity,
558 entityId,
559}: {
560 data: Post;
561 status: ContentPreferenceStatus | null;
562 entityId: string;
563 entity: ContentPreferenceType;
564}): Post => {
565 if (typeof status === 'undefined') {
566 return data;
567 }
568
569 const newData = structuredClone(data);
570
571 if (newData.author?.id === entityId) {
572 newData.author = updateAuthorContentPreference({
573 data: newData.author,
574 status,
575 entity,
576 });
577 }
578
579 if (newData.scout?.id === entityId) {
580 newData.scout = updateAuthorContentPreference({
581 data: newData.scout,
582 status,
583 entity,
584 });
585 }
586
587 return newData;
588};
589
590export const updateCommentContentPreference = ({
591 data,

Callers 2

usePostByIdFunction · 0.90

Calls 1

Tested by

no test coverage detected