-
Notifications
You must be signed in to change notification settings - Fork 84
Add email notifications for new quote events #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
292ceb5
Add email notifications for new quote events
pfefferle e8703fc
Update includes/class-mailer.php
pfefferle 9434ff8
Update templates/emails/new-quote.php
pfefferle 06fd4b0
Add changelog
matticbot 30ddfbe
Update comment style for mention action hook
pfefferle 1795260
Update @covers annotations from quoted to quote
pfefferle b369c92
Update includes/class-mailer.php
pfefferle ee8c1c2
Refactor comments and quote URL assignment in mailer
pfefferle 7bd5426
Update templates/emails/new-quote.php
pfefferle ccbed26
Update includes/class-mailer.php
pfefferle 097dffb
Merge branch 'trunk' into add/quote-notification
pfefferle 70fde38
Update email message for new quote notification
pfefferle 31de72c
Merge branch 'trunk' into add/quote-notification
pfefferle 422caa1
Merge branch 'trunk' into add/quote-notification
pfefferle 0b8fd5e
Prevent processing when quoted_url is empty
pfefferle b78c9a1
Improve quote notification email with post references (#2310)
obenland 3fceb13
Enhance quote notification with full object handling
obenland 86bac33
Assume we always have a post to embed
obenland 6545041
Update quote notification tests to properly mock remote object fetching
obenland 97af2ef
Merge branch 'trunk' into add/quote-notification
pfefferle 1892282
Merge branch 'trunk' into add/quote-notification
pfefferle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: minor | ||
| Type: added | ||
|
|
||
| Added email notifications for quoted posts, with user and blog-level settings and a new customizable email template. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?php | ||
| /** | ||
| * ActivityPub New Quote E-Mail template with styles. | ||
| * | ||
| * @package Activitypub | ||
| */ | ||
|
|
||
| use Activitypub\Embed; | ||
|
|
||
| use function Activitypub\site_supports_blocks; | ||
|
|
||
| /* @var array $args Template arguments. */ | ||
| $args = wp_parse_args( $args ?? array() ); | ||
|
|
||
| $comment_author = esc_html( $args['actor']['webfinger'] ); | ||
| if ( ! empty( $args['actor']['url'] ) ) { | ||
| $comment_author = sprintf( '<a href="%s">%s</a>', esc_url( $args['actor']['url'] ), esc_html( $args['actor']['webfinger'] ) ); | ||
| } | ||
|
|
||
| /* translators: 1: actor name/link, 2: quoted post URL */ | ||
| $message = __( 'Looks like one of your posts caught someone’s attention! %1$s just shared <a href="%2$s">your post</a>. Here’s what they said:', 'activitypub' ); | ||
| if ( ! empty( $args['quoted_title'] ) ) { | ||
| /* translators: 1: actor name/link, 2: quoted post URL, 3: quoted post title */ | ||
| $message = __( 'Looks like one of your posts caught someone’s attention! %1$s just shared <a href="%2$s">%3$s</a>. Here’s what they said:', 'activitypub' ); | ||
| } | ||
|
|
||
| // Load header. | ||
| require __DIR__ . '/parts/header.php'; | ||
| ?> | ||
|
|
||
| <h1><?php esc_html_e( 'Your post was quoted!', 'activitypub' ); ?></h1> | ||
|
|
||
| <p> | ||
| <?php | ||
| printf( | ||
| wp_kses( $message, array( 'a' => array( 'href' => array() ) ) ), | ||
| wp_kses( $comment_author, array( 'a' => array( 'href' => array() ) ) ), | ||
| esc_url( $args['quoted_url'] ), | ||
| esc_html( $args['quoted_title'] ) | ||
| ); | ||
| ?> | ||
| </p> | ||
|
|
||
| <div class="embed"> | ||
| <?php | ||
| // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
| echo Embed::get_html_for_object( $args['quote_object'] ); | ||
| ?> | ||
| </div> | ||
|
|
||
| <?php if ( site_supports_blocks() && ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) : ?> | ||
| <p> | ||
| <a class="button" href="<?php echo esc_url( admin_url( 'post-new.php?in_reply_to=' . rawurlencode( $args['quote_object']['id'] ) ) ); ?>"> | ||
| <?php esc_html_e( 'Reply to the post', 'activitypub' ); ?> | ||
| </a> | ||
| </p> | ||
| <?php endif; ?> | ||
|
|
||
| <?php | ||
| /** | ||
| * Fires at the bottom of the new quote emails. | ||
| * | ||
| * @param array $args The template arguments. | ||
| */ | ||
| do_action( 'activitypub_new_quote_email', $args ); | ||
|
|
||
| // Load footer. | ||
| require __DIR__ . '/parts/footer.php'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.