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

Function updateCommentContentPreference

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

Source from the content-addressed store, hash-verified

552};
553
554export const updateCommentContentPreference = ({
555 data,
556 status,
557 entity,
558 entityId,
559}: {
560 data: PostComment;
561 status: ContentPreferenceStatus | null;
562 entityId: string;
563 entity: ContentPreferenceType;
564}): PostComment => {
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 return newData;
580};
581
582type QueryKeyReturnType = ReturnType<typeof generateQueryKey>;
583

Calls 1

Tested by

no test coverage detected