<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12003] sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers: Translate: Update from remote repo</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/12003">12003</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/12003","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>amieiro</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-08-01 10:47:56 +0000 (Mon, 01 Aug 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Translate: Update from remote repo</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersgptranslationhelpersphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/gp-translation-helpers.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpershelpershelpertranslationdiscussionphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpershelpersassetstemplatestranslationdiscussioncommentsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers-assets/templates/translation-discussion-comments.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclassgpnotificationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclassgptranslationhelpersphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclasswporgnotificationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersjsrejectfeedbackjs">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/reject-feedback.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelperstemplatestranslationroweditormetafeedbackphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/translation-row-editor-meta-feedback.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclasswporgcustomizationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-customizations.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersgptranslationhelpersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/gp-translation-helpers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/gp-translation-helpers.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/gp-translation-helpers.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,6 +34,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/class-gth-temporary-post.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/class-gp-notifications.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/class-wporg-notifications.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/includes/class-wporg-customizations.php';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'gp_init', array( 'GP_Translation_Helpers', 'init' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'gp_init', array( 'WPorg_GlotPress_Notifications', 'init' ) ); // todo: include this class in a different plugin.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'gp_init', array( 'WPorg_GlotPress_Customizations', 'init' ) ); // todo: include this class in a different plugin.
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpershelpershelpertranslationdiscussionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -699,11 +699,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Throws an exception with an error message if the original id is incorrect.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Used as callback to validate the original_id passed on rejecting a string with feedback
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Used as callback to validate the original_id passed on updating a string with feedback
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.0.2
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int|string $original_id The id of the original for the rejected translation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int|string $original_id The id of the original for the updated translation.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int|string
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -718,13 +718,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Return an array of allowed rejection reasons and explanation of each reason.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Return an array of allowed comment reasons and explanation of each reason.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.0.2
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function get_reject_reasons(): array {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function get_comment_reasons(): array {
</ins><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'style' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'name' => __( 'Style Guide' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -823,10 +823,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $current_translation_id = $args['translation_id'];
</span><span class="cx" style="display: block; padding: 0 10px"> $comment_translation_id = get_comment_meta( $comment->comment_ID, 'translation_id', true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_reason = get_comment_meta( $comment->comment_ID, 'reject_reason', true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_reason = get_comment_meta( $comment->comment_ID, 'reject_reason', true );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $classes = array( 'comment-locale-' . $comment_locale );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $reject_reason ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $comment_reason ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $classes[] = 'rejection-feedback';
</span><span class="cx" style="display: block; padding: 0 10px"> $classes[] = 'rejection-feedback-' . $comment_locale;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -875,28 +875,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $linked_comment = str_replace( $parts['path'], $parts['path'] . '/' . $current_locale . '/default', $linked_comment );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $reject_reason ) :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $comment_reason ) :
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> was rejected with <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'a reason that is being discussed here' ); ?></a>.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'is being discussed here' ); ?></a>.
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'Please continue the discussion here' ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php comment_text(); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( $reject_reason ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( $comment_reason ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php echo esc_html( _n( 'Rejection Reason: ', 'Rejection Reasons: ', count( $reject_reason ) ) ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php echo esc_html( _n( 'Comment Reason: ', 'Comment Reasons: ', count( $comment_reason ) ) ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $number_of_items = count( $reject_reason );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $number_of_items = count( $comment_reason );
</ins><span class="cx" style="display: block; padding: 0 10px"> $counter = 0;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_reasons = Helper_Translation_Discussion::get_reject_reasons();
- foreach ( $reject_reason as $reason ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_reasons = Helper_Translation_Discussion::get_comment_reasons();
+ foreach ( $comment_reason as $reason ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo wp_kses(
</span><span class="cx" style="display: block; padding: 0 10px"> sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: 1: Title with the explanation of the reject reason , 2: The reject reason */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: 1: Title with the explanation of the comment reason , 2: The comment reason */
</ins><span class="cx" style="display: block; padding: 0 10px"> __( '<span title="%1$s" class="tooltip">%2$s</span> <span class="tooltip dashicons dashicons-info" title="%1$s"></span>', 'glotpress' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_reasons[ $reason ]['explanation'],
- $reject_reasons[ $reason ]['name'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_reasons[ $reason ]['explanation'],
+ $comment_reasons[ $reason ]['name'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'span' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -956,7 +956,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $is_linking_comment ) :
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $comment_translation_id && $comment_translation_id !== $current_translation_id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- gth_print_translation( $comment_translation_id, $args, empty( $reject_reason ) ? 'Translation: ' : 'Translation (Rejected): ' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ gth_print_translation( $comment_translation_id, $args, 'Translation: ' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpershelpersassetstemplatestranslationdiscussioncommentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers-assets/templates/translation-discussion-comments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers-assets/templates/translation-discussion-comments.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers-assets/templates/translation-discussion-comments.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,27 +59,62 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </ul><!-- .discussion-list -->
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // $option_typo = '<option value="typo">Typo in the English text (admins will be notified)</option>';
+ // $option_context = '<option value="context">Where does this string appear? (more context) (admins will be notified)</option>';
+ $optgroup_question = '';
+ if ( $locale_slug ) {
+ $gp_locale = GP_Locales::by_slug( $locale_slug );
+ if ( $gp_locale ) {
+ $optgroup_question = '
+ <optgroup label="Notify validators">
+ <option value="question">Question about translating to ' . esc_html( $gp_locale->english_name ) . '</option>
+ </optgroup>';
+ }
+ }
+ $options = '<select required="" name="comment_topic" id="comment_topic">
+ <option value="">Select a topic</option>
+ <optgroup label="Notify admins">
+ <option value="typo">Typo in the English text</option>
+ <option value="context">Where does this string appear? (more context)</option>
+ </optgroup>' .
+ $optgroup_question .
+ '</select>';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action(
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_form_logged_in_after',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function () use ( $locale_slug ) {
- $language_question = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function () use ( $locale_slug, $options ) {
+ /**
+ * Filters the options.
+ *
+ * @param string $options The options for the select element.
+ * @param string $locale_slug The slug of the current locale.
+ *
+ *@since 0.0.2
+ */
+ $options = apply_filters( 'gp_discussion_new_comment_options', $options, $locale_slug );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $locale_slug ) {
- $gp_locale = GP_Locales::by_slug( $locale_slug );
- if ( $gp_locale ) {
- $language_question = '<option value="question">Question about translating to ' . esc_html( $gp_locale->english_name ) . '</option>';
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> echo '<p class="comment-form-topic">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <label for="comment_topic">Topic <span class="required" aria-hidden="true">*</span> (required)</label>
- <select required name="comment_topic" id="comment_topic">
- <option value="">Select topic</option>
- <option value="typo">Typo in the English text</option>
- <option value="context">Where does this string appear? (more context)</option>' .
- wp_kses( $language_question, array( 'option' => array( 'value' => true ) ) ) .
- '</select>
- </p>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="comment_topic">Topic <span class="required" aria-hidden="true">*</span> (required)</label> ' .
+ wp_kses(
+ $options,
+ array(
+ 'select' =>
+ array(
+ 'required' => true,
+ 'name' => true,
+ 'id' => true,
+ ),
+ 'optgroup' =>
+ array(
+ 'label' => true,
+ ),
+ 'option' =>
+ array(
+ 'value' => true,
+ ),
+ )
+ ) .
+ '</p>';
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> 10,
</span><span class="cx" style="display: block; padding: 0 10px"> 2
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -103,7 +138,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'id_form' => 'commentform-' . $_post_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cancel_reply_link' => '<span></span>',
</span><span class="cx" style="display: block; padding: 0 10px"> 'format' => 'html5',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'class_submit' => 'button is-primary',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'class_submit' => 'button is-primary',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'comment_notes_after' => implode(
</span><span class="cx" style="display: block; padding: 0 10px"> "\n",
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclassgpnotificationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -366,10 +366,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|null
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function get_email_body( WP_Comment $comment, array $comment_meta ): string {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post = get_post( $comment->comment_post_ID );
- $project = self::get_project_from_post( $post );
- $original = self::get_original( $comment );
- $output = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post = get_post( $comment->comment_post_ID );
+ $project = self::get_project_from_post( $post );
+ $original = self::get_original( $comment );
+ $url = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
+ $link_to_comment = $url . '#comment-' . $comment->comment_ID;
+ $output = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the content of the email at the beginning of the function that gets its content.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -382,10 +384,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $output = apply_filters( 'gp_notification_pre_email_body', $output, $comment, $comment_meta );
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= esc_html__( 'Hi there,', 'glotpress' );
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= '<br><br>';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
</del><span class="cx" style="display: block; padding: 0 10px"> $output .= wp_kses(
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: The discussion URL where the user can find the comment. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- sprintf( __( 'There is a new comment in a <a href="%1$s">GlotPress discussion</a> that may be of interest to you.', 'glotpress' ), $url ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sprintf( __( 'There is a <a href="%1$s">new comment in a GlotPress discussion</a> that may be of interest to you.', 'glotpress' ), $link_to_comment ),
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'a' => array( 'href' => array() ),
</span><span class="cx" style="display: block; padding: 0 10px"> )
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclassgptranslationhelpersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,8 +60,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'gp_before_request', array( $this, 'before_request' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'rest_after_insert_comment', array( 'GP_Notifications', 'init' ), 10, 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'transition_comment_status', array( 'GP_Notifications', 'on_comment_status_change' ), 10, 3 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'gp_pre_tmpl_load', array( $this, 'register_reject_feedback_js' ), 10, 2 );
- add_action( 'wp_ajax_reject_with_feedback', array( $this, 'reject_with_feedback' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'gp_pre_tmpl_load', array( $this, 'register_comment_feedback_js' ), 10, 2 );
+ add_action( 'wp_ajax_comment_with_feedback', array( $this, 'comment_with_feedback' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_ajax_optout_discussion_notifications', array( $this, 'optout_discussion_notifications' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_thickbox();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -357,52 +357,52 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function register_reject_feedback_js( $template, $translation_set ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function register_comment_feedback_js( $template, $translation_set ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'translations' !== $template ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_register_script( 'gp-reject-feedback-js', plugins_url( '/../js/reject-feedback.js', __FILE__ ), array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ), '20220726' );
- gp_enqueue_script( 'gp-reject-feedback-js' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_register_script( 'gp-comment-feedback-js', plugins_url( '/../js/reject-feedback.js', __FILE__ ), array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ), '20220726' );
+ gp_enqueue_script( 'gp-comment-feedback-js' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> wp_localize_script(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'gp-reject-feedback-js',
- '$gp_reject_feedback_settings',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'gp-comment-feedback-js',
+ '$gp_comment_feedback_settings',
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'url' => admin_url( 'admin-ajax.php' ),
- 'nonce' => wp_create_nonce( 'gp_reject_feedback' ),
- 'locale_slug' => $translation_set['locale_slug'],
- 'reject_reasons' => Helper_Translation_Discussion::get_reject_reasons(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'url' => admin_url( 'admin-ajax.php' ),
+ 'nonce' => wp_create_nonce( 'gp_comment_feedback' ),
+ 'locale_slug' => $translation_set['locale_slug'],
+ 'comment_reasons' => Helper_Translation_Discussion::get_comment_reasons(),
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Is called from the AJAX request in reject-feedback.js to submit a rejection feedback.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Is called from the AJAX request in reject-feedback.js to submit an comment feedback.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.0.2
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function reject_with_feedback() {
- check_ajax_referer( 'gp_reject_feedback', 'nonce' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function comment_with_feedback() {
+ check_ajax_referer( 'gp_comment_feedback', 'nonce' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $helper_discussion = new Helper_Translation_Discussion();
</span><span class="cx" style="display: block; padding: 0 10px"> $locale_slug = $helper_discussion->sanitize_comment_locale( sanitize_text_field( $_POST['data']['locale_slug'] ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $translation_id_array = ! empty( $_POST['data']['translation_id'] ) ? array_map( array( $helper_discussion, 'sanitize_translation_id' ), $_POST['data']['translation_id'] ) : null;
</span><span class="cx" style="display: block; padding: 0 10px"> $original_id_array = ! empty( $_POST['data']['original_id'] ) ? array_map( array( $helper_discussion, 'sanitize_original_id' ), $_POST['data']['original_id'] ) : null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_reason = ! empty( $_POST['data']['reason'] ) ? $_POST['data']['reason'] : array( 'other' );
- $all_reject_reasons = array_keys( Helper_Translation_Discussion::get_reject_reasons() );
- $reject_reason = array_filter(
- $reject_reason,
- function( $reason ) use ( $all_reject_reasons ) {
- return in_array( $reason, $all_reject_reasons );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_reason = ! empty( $_POST['data']['reason'] ) ? $_POST['data']['reason'] : array( 'other' );
+ $all_comment_reasons = array_keys( Helper_Translation_Discussion::get_comment_reasons() );
+ $comment_reason = array_filter(
+ $comment_reason,
+ function( $reason ) use ( $all_comment_reasons ) {
+ return in_array( $reason, $all_comment_reasons );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_comment = sanitize_text_field( $_POST['data']['comment'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment = sanitize_text_field( $_POST['data']['comment'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $locale_slug || ! $translation_id_array || ! $original_id_array || ( ! $reject_reason && ! $reject_comment ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $locale_slug || ! $translation_id_array || ! $original_id_array || ( ! $comment_reason && ! $comment ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -411,13 +411,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $first_translation_id = array_shift( $translation_id_array );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Post comment on discussion page for the first string
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $first_comment_id = $this->insert_reject_comment( $reject_comment, $first_original_id, $reject_reason, $first_translation_id, $locale_slug, $_SERVER );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $first_comment_id = $this->insert_comment( $comment, $first_original_id, $comment_reason, $first_translation_id, $locale_slug, $_SERVER );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $original_id_array ) && ! empty( $translation_id_array ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // For other strings post link to the comment.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reject_comment = get_comment_link( $first_comment_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment = get_comment_link( $first_comment_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $original_id_array as $index => $single_original_id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $comment_id = $this->insert_reject_comment( $reject_comment, $single_original_id, $reject_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_id = $this->insert_comment( $comment, $single_original_id, $comment_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER );
</ins><span class="cx" style="display: block; padding: 0 10px"> $comment = get_comment( $comment_id );
</span><span class="cx" style="display: block; padding: 0 10px"> GP_Notifications::add_related_comment( $comment );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -463,20 +463,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Inserts rejection feedback as WordPress comment
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Inserts feedback as WordPress comment.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 0.0.2
- *
- * @param string $reject_comment Feedback entered by reviewer.
- * @param int $original_id ID of the original where the comment will be added.
- * @param array $reject_reason Reason(s) for rejection.
- * @param string $translation_id ID of the rejected translation.
- * @param string $locale_slug Locale of the rejected translation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $comment Feedback entered by reviewer.
+ * @param int $original_id ID of the original where the comment will be added.
+ * @param array $reason Reason(s) for comment.
+ * @param string $translation_id ID of the commented translation.
+ * @param string $locale_slug Locale of the commented translation.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $server The $_SERVER array
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return false|int
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 0.0.2
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- private function insert_reject_comment( $reject_comment, $original_id, $reject_reason, $translation_id, $locale_slug, $server ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private function insert_comment( $comment, $original_id, $reason, $translation_id, $locale_slug, $server ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_id = Helper_Translation_Discussion::get_or_create_shadow_post_id( $original_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $user = wp_get_current_user();
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_insert_comment(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -486,11 +485,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_author_email' => $user->user_email,
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_author_url' => $user->user_url,
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_author_IP' => sanitize_text_field( $server['REMOTE_ADDR'] ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'comment_content' => $reject_comment,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'comment_content' => $comment,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'comment_agent' => sanitize_text_field( $server['HTTP_USER_AGENT'] ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_id' => $user->ID,
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_meta' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'reject_reason' => $reject_reason,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'reject_reason' => $reason,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'translation_id' => $translation_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'locale' => $locale_slug,
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclasswporgcustomizationsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-customizations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-customizations.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-customizations.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,48 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Routes: WPorg_Customizations class
+ *
+ * Manages the WPorg customizations.
+ *
+ * @package gp-translation-helpers
+ * @since 0.0.2
+ */
+class WPorg_GlotPress_Customizations {
+ /**
+ * Adds the hooks to modify the options in the select item where we add a new comment in a discussion.
+ *
+ * @since 0.0.2
+ *
+ * @return void
+ */
+ public static function init() {
+ if ( defined( 'WPORG_TRANSLATE_BLOGID' ) && ( get_current_blog_id() === WPORG_TRANSLATE_BLOGID ) ) {
+ add_filter(
+ 'gp_discussion_new_comment_options',
+ function ( $options, $locale_slug ) {
+ $optgroup_question = '';
+ if ( $locale_slug ) {
+ $gp_locale = GP_Locales::by_slug( $locale_slug );
+ if ( $gp_locale ) {
+ $optgroup_question = '
+ <optgroup label="Notify GTE/PTE/CLPTE (if opted-in)">
+ <option value="question">Question about translating to ' . esc_html( $gp_locale->english_name ) . '</option>
+ </optgroup>';
+ }
+ }
+
+ return '<select required="" name="comment_topic" id="comment_topic">
+ <option value="">Select a topic</option>
+ <optgroup label="Notify developers (if opted-in)">
+ <option value="typo">Typo in the English text</option>
+ <option value="context">Where does this string appear? (more context)</option>
+ </optgroup>' .
+ $optgroup_question .
+ '</select>';
+ },
+ 10,
+ 2
+ );
+ }
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-customizations.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersincludesclasswporgnotificationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -297,16 +297,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|null The email body message.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function get_email_body( WP_Comment $comment, ?array $comment_meta ): ?string {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $project = self::get_project_from_post_id( $comment->comment_post_ID );
- $original = self::get_original( $comment->comment_post_ID );
- $output = esc_html__( 'Hi:' );
- $output .= '<br><br>';
- $output .= esc_html__( 'There is a new comment in a discussion of the WordPress translation system that may be of interest to you.' );
- $output .= '<br>';
- $output .= esc_html__( 'It would be nice if you have some time to review this comment and reply to it if needed.' );
- $output .= '<br><br>';
- $url = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
- $output .= '- <strong>' . esc_html__( 'Discussion URL: ' ) . '</strong><a href="' . $url . '">' . $url . '</a><br>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $project = self::get_project_from_post_id( $comment->comment_post_ID );
+ $original = self::get_original( $comment->comment_post_ID );
+ $url = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
+ $link_to_comment = $url . '#comment-' . $comment->comment_ID;
+ $output = esc_html__( 'Hi:' );
+ $output .= '<br><br>';
+ $output .= wp_kses(
+ /* translators: The comment URL where the user can find the comment. */
+ sprintf( __( 'There is a <a href="%1$s">new comment in a discussion</a> of the WordPress translation system that may be of interest to you.', 'glotpress' ), $link_to_comment ),
+ array(
+ 'a' => array( 'href' => array() ),
+ )
+ ) . '<br>';
+ $output .= esc_html__( 'It would be nice if you have some time to review this comment and reply to it if needed.' );
+ $output .= '<br><br>';
+ $output .= '- <strong>' . esc_html__( 'Discussion URL: ' ) . '</strong><a href="' . $url . '">' . $url . '</a><br>';
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( array_key_exists( 'locale', $comment_meta ) && ( ! empty( $comment_meta['locale'][0] ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= '- <strong>' . esc_html__( 'Locale: ' ) . '</strong>' . esc_html( $comment_meta['locale'][0] ) . '<br>';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelpersjsrejectfeedbackjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/reject-feedback.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/reject-feedback.js 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/reject-feedback.js 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,4 +1,4 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* global $gp, $gp_reject_feedback_settings, document, tb_show */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* global $gp, $gp_comment_feedback_settings, document, tb_show */
</ins><span class="cx" style="display: block; padding: 0 10px"> ( function( $, $gp ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $( document ).ready(
</span><span class="cx" style="display: block; padding: 0 10px"> function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,29 +58,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( 'body' ).on( 'click', '#modal-reject-btn', function( e ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var comment = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var rejectReason = [];
- var rejectData = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var commentReason = [];
+ var commentData = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> var form = $( this ).closest( 'form' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> form.find( 'input[name="modal_feedback_reason"]:checked' ).each(
</span><span class="cx" style="display: block; padding: 0 10px"> function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectReason.push( this.value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ commentReason.push( this.value );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> comment = form.find( 'textarea[name="modal_feedback_comment"]' ).val();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ( ! comment.trim().length && ! rejectReason.length ) || ( ! translationIds.length || ! originalIds.length ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ( ! comment.trim().length && ! commentReason.length ) || ( ! translationIds.length || ! originalIds.length ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $( 'form.filters-toolbar.bulk-actions, form#bulk-actions-toolbar-top' ).submit();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectData.locale_slug = $gp_reject_feedback_settings.locale_slug;
- rejectData.reason = rejectReason;
- rejectData.comment = comment;
- rejectData.original_id = originalIds;
- rejectData.translation_id = translationIds;
- rejectData.is_bulk_reject = true;
- rejectWithFeedback( rejectData );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ commentData.locale_slug = $gp_comment_feedback_settings.locale_slug;
+ commentData.reason = commentReason;
+ commentData.comment = comment;
+ commentData.original_id = originalIds;
+ commentData.translation_id = translationIds;
+ commentData.is_bulk_reject = true;
+ commentWithFeedback( commentData, false, 'rejected' );
</ins><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -90,36 +90,48 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $gp.editor.hooks.set_status_current = function() {
+ setStatus( $( this ), 'current' );
+ };
+
+ $gp.editor.hooks.set_status_fuzzy = function() {
+ setStatus( $( this ), 'fuzzy' );
+ };
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $gp.editor.hooks.set_status_rejected = function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var button = $( this );
- var rejectData = {};
- var rejectReason = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setStatus( $( this ), 'rejected' );
+ };
+
+ function setStatus( that, status ) {
+ var button = $( that );
+ var feedbackData = {};
+ var commentReason = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> var comment = '';
</span><span class="cx" style="display: block; padding: 0 10px"> var div = button.closest( 'div.meta' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> div.find( 'input[name="feedback_reason"]:checked' ).each(
</span><span class="cx" style="display: block; padding: 0 10px"> function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectReason.push( this.value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ commentReason.push( this.value );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> comment = div.find( 'textarea[name="feedback_comment"]' ).val();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! comment.trim().length && ! rejectReason.length ) {
- $gp.editor.set_status( button, 'rejected' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! comment.trim().length && ! commentReason.length ) {
+ $gp.editor.set_status( button, status );
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectData.locale_slug = $gp_reject_feedback_settings.locale_slug;
- rejectData.reason = rejectReason;
- rejectData.comment = comment;
- rejectData.original_id = [ $gp.editor.current.original_id ];
- rejectData.translation_id = [ $gp.editor.current.translation_id ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ feedbackData.locale_slug = $gp_comment_feedback_settings.locale_slug;
+ feedbackData.reason = commentReason;
+ feedbackData.comment = comment;
+ feedbackData.original_id = [ $gp.editor.current.original_id ];
+ feedbackData.translation_id = [ $gp.editor.current.translation_id ];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectWithFeedback( rejectData, button );
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ commentWithFeedback( feedbackData, button, status );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function rejectWithFeedback( rejectData, button ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function commentWithFeedback( feedbackData, button, status ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> var data = {};
</span><span class="cx" style="display: block; padding: 0 10px"> var div = {};
</span><span class="cx" style="display: block; padding: 0 10px"> if ( button ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,10 +139,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> data = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- action: 'reject_with_feedback',
- data: rejectData,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ action: 'comment_with_feedback',
+ data: feedbackData,
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _ajax_nonce: $gp_reject_feedback_settings.nonce,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _ajax_nonce: $gp_comment_feedback_settings.nonce,
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $.ajax(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,15 +149,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> type: 'POST',
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- url: $gp_reject_feedback_settings.url,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ url: $gp_comment_feedback_settings.url,
</ins><span class="cx" style="display: block; padding: 0 10px"> data: data,
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ).done(
</span><span class="cx" style="display: block; padding: 0 10px"> function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( rejectData.is_bulk_reject ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( feedbackData.is_bulk_reject ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $( 'form.filters-toolbar.bulk-actions, form#bulk-actions-toolbar-top' ).submit();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $gp.editor.set_status( button, 'rejected' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $gp.editor.set_status( button, status );
</ins><span class="cx" style="display: block; padding: 0 10px"> div.find( 'input[name="feedback_reason"]' ).prop( 'checked', false );
</span><span class="cx" style="display: block; padding: 0 10px"> div.find( 'textarea[name="feedback_comment"]' ).val( '' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,20 +175,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function getReasonList( ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var rejectReasons = $gp_reject_feedback_settings.reject_reasons;
- var rejectList = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var commentReasons = $gp_comment_feedback_settings.comment_reasons;
+ var commentList = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> var prefix = '';
</span><span class="cx" style="display: block; padding: 0 10px"> var suffix = '';
</span><span class="cx" style="display: block; padding: 0 10px"> var inputName = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // eslint-disable-next-line vars-on-top
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for ( var reason in rejectReasons ) {
- prefix = '<div class="modal-item"><label class="tooltip" title="' + rejectReasons[ reason ].explanation + '">';
- suffix = '</label> <span class="tooltip dashicons dashicons-info" title="' + rejectReasons[ reason ].explanation + '"></span></div>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( var reason in commentReasons ) {
+ prefix = '<div class="modal-item"><label class="tooltip" title="' + commentReasons[ reason ].explanation + '">';
+ suffix = '</label> <span class="tooltip dashicons dashicons-info" title="' + commentReasons[ reason ].explanation + '"></span></div>';
</ins><span class="cx" style="display: block; padding: 0 10px"> inputName = 'modal_feedback_reason';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rejectList += prefix + '<input type="checkbox" name="' + inputName + '" value="' + reason + '" /> ' + rejectReasons[ reason ].name + suffix;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ commentList += prefix + '<input type="checkbox" name="' + inputName + '" value="' + reason + '" /> ' + commentReasons[ reason ].name + suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return rejectList;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return commentList;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }( jQuery, $gp )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsgptranslationhelperstemplatestranslationroweditormetafeedbackphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/translation-row-editor-meta-feedback.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/translation-row-editor-meta-feedback.php 2022-07-29 08:10:39 UTC (rev 12002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/translation-row-editor-meta-feedback.php 2022-08-01 10:47:56 UTC (rev 12003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,10 +7,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <form>
</span><span class="cx" style="display: block; padding: 0 10px"> <h3 class="feedback-reason-title"><?php esc_html_e( 'Type (Optional)', 'glotpress' ); ?></h3>
</span><span class="cx" style="display: block; padding: 0 10px"> <ul class="feedback-reason-list">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
- $reject_reasons = Helper_Translation_Discussion::get_reject_reasons();
- foreach ( $reject_reasons as $key => $reason ) :
- ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ $comment_reasons = Helper_Translation_Discussion::get_comment_reasons();
+ foreach ( $comment_reasons as $key => $reason ) :
+ ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <li>
</span><span class="cx" style="display: block; padding: 0 10px"> <label class="tooltip" title="<?php echo esc_attr( $reason['explanation'] ); ?>"><input type="checkbox" name="feedback_reason" value="<?php echo esc_attr( $key ); ?>" /><?php echo esc_html( $reason['name'] ); ?></label><span class="tooltip dashicons dashicons-info" title="<?php echo esc_attr( $reason['explanation'] ); ?>"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> </li>
</span></span></pre>
</div>
</div>
</body>
</html>