Skip to content

Add default text for form links#1222

Merged
3mcd merged 3 commits into
mainfrom
aking/1148/email-invitation-links
May 5, 2025
Merged

Add default text for form links#1222
3mcd merged 3 commits into
mainfrom
aking/1148/email-invitation-links

Conversation

@allisonking

Copy link
Copy Markdown
Contributor

Issue(s) Resolved

Closes #1148

High-level Explanation of PR

Make sure we still include some texts for form links. This wasn't working for forms because we figure out their links (with auth tokens) later in the flow, and the logic that defaults to the link occurs earlier than when the forms get their links.

Test Plan

Follow steps in the issue, but your email should have some text.

Screenshots (if applicable)

With :link{form="review"}
image

With :link{form="review" text="test"}
image

Notes

Comment on lines +267 to +274
assert(isParent(node));
// Include default text
node.children = [
{
type: "text",
value: attrs.text ?? props.href,
},
];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is copied from

https://github.com/pubpub/platform/blob/974b002ee13d1d61accf775c06e13cf226dacd2d/core/lib/server/render/pub/renderMarkdownWithPub.ts#L168-L174

in visitLinkDirective. However, the href at this point is just an empty string because this defers the creation of the link to further down in the file

https://github.com/pubpub/platform/blob/974b002ee13d1d61accf775c06e13cf226dacd2d/core/lib/server/render/pub/renderMarkdownWithPub.ts#L261-L266

I'm not sure if there's a way we can reuse what was already there, but I'm guessing not since this exception for form links was already carved out.

@allisonking allisonking marked this pull request as ready for review May 1, 2025 20:29
@allisonking allisonking added the preview Auto-deploys a preview application label May 1, 2025
@allisonking allisonking requested a review from 3mcd May 1, 2025 20:29
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1222 May 1, 2025 20:33 Inactive
@3mcd 3mcd had a problem deploying to gh-654103159-pr-1222 May 5, 2025 12:58 Error
@3mcd 3mcd merged commit 5244e3f into main May 5, 2025
17 checks passed
@3mcd 3mcd deleted the aking/1148/email-invitation-links branch May 5, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Auto-deploys a preview application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: email action invitation form links with no text don't render

2 participants