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

Function buildFeedbackMessage

packages/shared/src/hooks/post/useHidePost.ts:40–62  ·  view source on GitHub ↗
(
  { tags, blockSource }: HideFeedbackPayload,
  source?: Source,
)

Source from the content-addressed store, hash-verified

38}
39
40const buildFeedbackMessage = (
41 { tags, blockSource }: HideFeedbackPayload,
42 source?: Source,
43): string => {
44 const sourceName = source?.name ?? 'this source';
45 const tagCount = tags.length;
46
47 if (blockSource && tagCount > 0) {
48 return tagCount === 1
49 ? `Unfollowed ${sourceName} and blocked #${tags[0]}`
50 : `Unfollowed ${sourceName} and blocked ${tagCount} tags`;
51 }
52
53 if (blockSource) {
54 return `You won't see posts from ${sourceName} anymore`;
55 }
56
57 if (tagCount === 1) {
58 return `Blocked #${tags[0]}`;
59 }
60
61 return `Blocked ${tagCount} tags`;
62};
63
64export const useHidePost = ({
65 post,

Callers 1

useHidePostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected