Making WordPress.org

Changeset 8908


Ignore:
Timestamp:
06/03/2019 02:36:52 PM (4 years ago)
Author:
vedjain
Message:

WC Participant Notifier: Code review fixes. See desc:

  1. Use is_post_notifiable to make code DRY
  2. Better descriptive code comment.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-participation-notifier/wordcamp-participation-notifier.php

    r8907 r8908  
    113113     * or organizer post changes.
    114114     *
    115      * IMPORTANT NOTE: If a draft post is published via block editor, we will have to add badges and activity here instead of `post_published_or_unpublished` method.
     115     * IMPORTANT NOTE: When a draft post is published via the block editor, badges and activity must be managed here instead of in the `post_published_or_unpublished` method.
    116116     * This is because when post is updated via Block editor, the status change request will not have any POST data, see @link https://github.com/WordPress/gutenberg/issues/12897
    117117     *
     
    174174     */
    175175    protected function add_badge( $post, $user_id ) {
    176         if ( ! in_array( $post->post_type, [ 'wcb_speaker', 'wcb_organizer' ] ) || ! $user_id ) {
     176        if ( ! $this->is_post_notifiable( $post ) ) {
    177177            return;
    178178        }
     
    199199        global $wpdb;
    200200
    201         if ( ! in_array( $post->post_type, [ 'wcb_speaker', 'wcb_organizer' ] ) ) {
     201        if ( ! $this->is_post_notifiable( $post ) ) {
    202202            return;
    203203        }
Note: See TracChangeset for help on using the changeset viewer.