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

Function onUpdateSubmit

packages/shared/src/components/post/write/ShareLink.tsx:108–133  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

106 });
107
108 const onUpdateSubmit: FormEventHandler<HTMLFormElement> = async (e) => {
109 if (!fetchedPost?.id || !squad) {
110 return null;
111 }
112
113 const isSameAsBefore = [fetchedPost?.title, moderated?.content].includes(
114 commentary,
115 );
116 if (isSameAsBefore) {
117 return push(squad.permalink);
118 }
119
120 if (moderated) {
121 return onUpdatePostModeration({
122 type: PostType.Share,
123 sourceId: squad.id,
124 id: moderated.id,
125 title: moderated.sharedPost ? commentary : preview.title,
126 content: moderated.sharedPost ? null : commentary,
127 imageUrl: moderated.sharedPost ? null : preview.image,
128 externalLink: moderated.sharedPost ? null : preview.url,
129 });
130 }
131
132 return onUpdateSharePost(e, fetchedPost.id, commentary, squad);
133 };
134
135 const onSubmit: FormEventHandler<HTMLFormElement> = async (e) => {
136 e.preventDefault();

Callers 1

onSubmitFunction · 0.85

Calls 1

pushFunction · 0.85

Tested by

no test coverage detected