Making WordPress.org


Ignore:
Timestamp:
11/23/2022 06:22:00 PM (3 years ago)
Author:
amieiro
Message:

Translate: Add mentions to comment box and Disable only Feedback <summary> events

https://github.com/GlotPress/gp-translation-helpers/pull/113
https://github.com/GlotPress/gp-translation-helpers/pull/143

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php

    r12205 r12274  
    267267        }
    268268
     269        // phpcs:ignore WordPress.Security.NonceVerification.Missing
     270        $locale_exists = isset( $_POST['meta']['locale'] ) && ! empty( $this->sanitize_comment_locale( $_POST['meta']['locale'] ) );
     271
     272        // phpcs:ignore WordPress.Security.NonceVerification.Missing
     273        $locale_slug = $locale_exists ? $_POST['meta']['locale'] : null;
     274
     275        $set_slug = $locale_exists ? 'default' : null;
     276
    269277        // We were able to gather all information, let's put it in the cache.
    270         $cache[ $post->ID ] = GP_Route_Translation_Helpers::get_permalink( $project->path, $original_id );
     278        $cache[ $post->ID ] = GP_Route_Translation_Helpers::get_permalink( $project->path, $original_id, $set_slug, $locale_slug );
    271279
    272280        return $cache[ $post->ID ];
     
    562570        remove_action( 'comment_form_top', 'rosetta_comment_form_support_hint' );
    563571
    564         $post   = self::maybe_get_temporary_post( self::get_shadow_post_id( $this->data['original_id'] ) );
     572        $post          = self::maybe_get_temporary_post( self::get_shadow_post_id( $this->data['original_id'] ) );
     573        $mentions_list = apply_filters( 'gp_mentions_list', array(), $comments, $this->data['locale_slug'], $this->data['original_id'] );
     574
    565575        $output = gp_tmpl_get_output(
    566576            'translation-discussion-comments',
     
    574584                'project'              => $this->data['project'],
    575585                'translation_set_slug' => $this->data['translation_set_slug'],
     586                'mentions_list'        => $mentions_list,
     587
    576588            ),
    577589            $this->assets_dir . 'templates'
Note: See TracChangeset for help on using the changeset viewer.