<!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>[5573] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Change edit actions dropdown to buttons with specific states.</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 { 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/5573">5573</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/5573","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>Otto42</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-06-15 14:05:54 +0000 (Thu, 15 Jun 2017)</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'>Plugin Directory: Change edit actions dropdown to buttons with specific states. props @SergeyBiryukov. Fixes <a href="http://meta.trac.wordpress.org/ticket/2796">#2796</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassstatustransitionsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminlisttableclasspluginpostsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscontrolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryjseditformjs">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp"></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/plugin-directory/admin/class-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/plugin-directory/admin/class-customizations.php  2017-06-15 13:12:31 UTC (rev 5572)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php    2017-06-15 14:05:54 UTC (rev 5573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,6 +32,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'load-edit.php', array( $this, 'bulk_reject_plugins' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'admin_head-edit.php', array( $this, 'plugin_posts_list_table' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'post_row_actions', array( $this, 'plugin_row_actions' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 add_action( 'edit_form_top', array( $this, 'show_permalink' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'admin_notices', array( $this, 'add_post_status_notice' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'all_admin_notices', array( $this, 'admin_notices' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -111,6 +112,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        wp_enqueue_style( 'plugin-admin-post-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 4 );
</span><span class="cx" style="display: block; padding: 0 10px">                                        wp_enqueue_script( 'plugin-admin-post-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util', 'wp-lists' ), 3 );
</span><span class="cx" style="display: block; padding: 0 10px">                                        wp_localize_script( 'plugin-admin-post-js', 'pluginDirectory', array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                'approvePluginAYS'   => __( 'Are you sure you want to approve this plugin?', 'wporg-plugins' ),
+                                               'rejectPluginAYS'    => __( 'Are you sure you want to reject this plugin?', 'wporg-plugins' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 'removeCommitterAYS' => __( 'Are you sure you want to remove this committer?', 'wporg-plugins' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                        break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,6 +165,22 @@
</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">+         * Disables Quick Edit for plugins.
+        *
+        * @param array $actions An array of row action links.
+        * @return array Filtered array of row action links.
+        */
+       public function plugin_row_actions( $actions ) {
+               global $post_type;
+
+               if ( 'plugin' === $post_type ) {
+                       unset( $actions['inline hide-if-no-js'] );
+               }
+
+               return $actions;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Rejects plugins in bulk.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function bulk_reject_plugins() {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassstatustransitionsphp"></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/plugin-directory/admin/class-status-transitions.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/plugin-directory/admin/class-status-transitions.php      2017-06-15 13:12:31 UTC (rev 5572)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php        2017-06-15 14:05:54 UTC (rev 5573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,6 +31,45 @@
</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">+         * Get the list of allowed status transitions for a given plugin.
+        *
+        * @param string $post_status Plugin post status.
+        * @return array An array of allowed post status transitions.
+        */
+       public static function get_allowed_transitions( $post_status ) {
+               switch ( $post_status ) {
+                       case 'new':
+                               $transitions = array( 'pending', 'approved', 'rejected' );
+                               break;
+                       case 'pending':
+                               $transitions = array( 'approved', 'rejected' );
+                               break;
+                       case 'approved':
+                               // Plugins move from 'approved' to 'publish' on first commit, but cannot be published manually.
+                               $transitions = array( 'disabled', 'closed' );
+                               break;
+                       case 'rejected':
+                               // Rejections cannot be recovered.
+                               $transitions = array();
+                               break;
+                       case 'publish':
+                               $transitions = array( 'disabled', 'closed' );
+                               break;
+                       case 'disabled':
+                               $transitions = array( 'publish', 'closed' );
+                               break;
+                       case 'closed':
+                               $transitions = array( 'publish', 'disabled' );
+                               break;
+                       default:
+                               $transitions = array( 'new', 'pending' );
+                               break;
+               }
+
+               return $transitions;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Checks permissions before allowing a post_status change for plugins.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param array $data    An array of slashed post data.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +90,7 @@
</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">                // ...or it's a plugin admin...
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( current_user_can( 'plugin_approve', $postarr['ID'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( current_user_can( 'plugin_approve', $postarr['ID'] ) && in_array( $postarr['post_status'], self::get_allowed_transitions( $old_status ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $data;
</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_htmlwpcontentpluginsplugindirectoryadminlisttableclasspluginpostsphp"></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/plugin-directory/admin/list-table/class-plugin-posts.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/plugin-directory/admin/list-table/class-plugin-posts.php 2017-06-15 13:12:31 UTC (rev 5572)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php   2017-06-15 14:05:54 UTC (rev 5573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,8 +74,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( $this->is_trash ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $actions['untrash'] = __( 'Restore', 'wporg-plugins' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        } else {
-                               $actions['edit'] = __( 'Edit', 'wporg-plugins' );
</del><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -289,6 +287,12 @@
</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">+         * Remove the Quick/Bulk Edit hidden row.
+        */
+       public function inline_edit() {
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Prepares list view links, including plugins that the current user has commit access to.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @global array $locked_post_status This seems to be deprecated.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscontrolsphp"></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/plugin-directory/admin/metabox/class-controls.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/plugin-directory/admin/metabox/class-controls.php        2017-06-15 13:12:31 UTC (rev 5572)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php  2017-06-15 14:05:54 UTC (rev 5573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordPressdotorg\Plugin_Directory\Admin\Status_Transitions;
</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">  * The Plugin Controls / Publish metabox.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,6 +31,40 @@
</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">+         * Get button label for setting the plugin status.
+        *
+        * @param string $post_status Plugin post status.
+        * @return string Status button label.
+        */
+       public static function get_status_button_label( $post_status ) {
+               switch ( $post_status ) {
+                       case 'approved':
+                               $label = __( 'Approve' );
+                               break;
+                       case 'rejected':
+                               $label = __( 'Reject' );
+                               break;
+                       case 'pending':
+                               $label = __( 'Mark as Pending' );
+                               break;
+                       case 'publish':
+                               $label = __( 'Open' );
+                               break;
+                       case 'disabled':
+                               $label = __( 'Disable' );
+                               break;
+                       case 'closed':
+                               $label = __( 'Close' );
+                               break;
+                       default:
+                               $label = __( 'Mark as Pending' );
+                               break;
+               }
+
+               return $label;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Displays the Plugin Status control in the Publish metabox.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected static function display_post_status() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,42 +76,22 @@
</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">                $statuses = array( 'new', 'pending' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( current_user_can( 'plugin_approve', $post ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( in_array( $post->post_status, array( 'new', 'draft', 'pending', 'rejected', 'approved' ) ) ) {
-                               $statuses = array_merge( $statuses, array( 'approved', 'rejected' ) );
-                       } else {
-                               $statuses = array( 'publish', 'disabled', 'closed', 'pending' );
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $statuses = Status_Transitions::get_allowed_transitions( $post->post_status );
</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">                <div class="misc-pub-section misc-pub-plugin-status">
</span><span class="cx" style="display: block; padding: 0 10px">                        <label for="post_status"><?php _e( 'Status:', 'wporg-plugins' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                        <strong id="plugin-status-display"><?php echo esc_html( get_post_status_object( $post->post_status )->label ); ?></strong>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <button type="button" class="button-link edit-plugin-status hide-if-no-js">
-                               <span aria-hidden="true"><?php _e( 'Edit', 'wporg-plugins' ); ?></span>
-                               <span class="screen-reader-text"><?php _e( 'Edit plugin status', 'wporg-plugins' ); ?></span>
-                       </button>
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <div id="plugin-status-select" class="plugin-control-select hide-if-js">
-                               <input type="hidden" name="hidden_post_status" id="hidden-post-status" value="<?php echo esc_attr( $post->post_status ); ?>">
-                               <label class="screen-reader-text" for="plugin-status"><?php _e( 'Plugin status', 'wporg-plugins' ); ?></label>
-                               <select name="post_status" id="plugin-status">
-                                       <?php
-                                       foreach ( $statuses as $statii ) {
-                                               $status_object = get_post_status_object( $statii );
-                                               printf(
-                                                       '<option value="%s" %s>%s</option>',
-                                                       esc_attr( $statii ),
-                                                       selected( $post->post_status, $statii, false ),
-                                                       esc_html( $status_object->label )
-                                               );
-                                       }
-                                       ?>
-                               </select>
-                               <button type="button" class="save-plugin-status hide-if-no-js button"><?php _e( 'OK', 'wporg-plugins' ); ?></button>
-                               <button type="button" class="cancel-plugin-status hide-if-no-js button-link"><?php _e( 'Cancel', 'wporg-plugins' ); ?></button>
-                       </div>
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <p>
+                       <?php foreach ( $statuses as $status ) : ?>
+                               <button type="submit" name="post_status" value="<?php echo esc_attr( $status ); ?>" class="button set-plugin-status">
+                                       <?php echo self::get_status_button_label( $status ); ?>
+                               </button>
+                       <?php endforeach; ?>
+                       </p>
</ins><span class="cx" style="display: block; padding: 0 10px">                 </div><!-- .misc-pub-section --><?php
</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_htmlwpcontentpluginsplugindirectoryjseditformjs"></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/plugin-directory/js/edit-form.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/plugin-directory/js/edit-form.js 2017-06-15 13:12:31 UTC (rev 5572)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js   2017-06-15 14:05:54 UTC (rev 5573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,19 +5,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ( function( $, wp, pluginDirectory ) {
</span><span class="cx" style="display: block; padding: 0 10px">        var PluginEdit = {
</span><span class="cx" style="display: block; padding: 0 10px">                $testedWith: {},
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $pluginStatus: {},
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                ready: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        PluginEdit.$testedWith   = $( '#tested-with-select' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        PluginEdit.$pluginStatus = $( '#plugin-status-select' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#submitdiv' )
</span><span class="cx" style="display: block; padding: 0 10px">                                .on( 'click', '.edit-tested-with',     PluginEdit.editTestedWith )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                .on( 'click', '.edit-plugin-status',   PluginEdit.editPluginStatus )
</del><span class="cx" style="display: block; padding: 0 10px">                                 .on( 'click', '.save-tested-with',     PluginEdit.updateTestedWith )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                .on( 'click', '.save-plugin-status',   PluginEdit.updatePluginStatus )
</del><span class="cx" style="display: block; padding: 0 10px">                                 .on( 'click', '.cancel-tested-with',   PluginEdit.cancelTestedWith )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                .on( 'click', '.cancel-plugin-status', PluginEdit.cancelPluginStatus );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         .on( 'click', '.set-plugin-status',    PluginEdit.setPluginStatus );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        _.each( $( '#post-body' ).find( '.comments-box' ), PluginEdit.loadComments );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,33 +48,24 @@
</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">-                editPluginStatus: function() {
-                       if ( PluginEdit.$pluginStatus.is( ':hidden' ) ) {
-                               PluginEdit.$pluginStatus.slideDown( 'fast', function() {
-                                       $( 'select', PluginEdit.$pluginStatus ).focus();
-                               } );
-                               $( this ).hide();
-                       }
-               },
-
</del><span class="cx" style="display: block; padding: 0 10px">                 updateTestedWith: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        PluginEdit.$testedWith.slideUp( 'fast' ).siblings( 'button.edit-tested-with' ).show().focus();
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#tested-with-display' ).text( $( 'option:selected', PluginEdit.$testedWith ).text() );
</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">-                updatePluginStatus: function() {
-                       PluginEdit.$pluginStatus.slideUp( 'fast' ).siblings( 'button.edit-plugin-status' ).show().focus();
-                       $( '#plugin-status-display' ).text( $( 'option:selected', PluginEdit.$pluginStatus ).text() );
-               },
-
</del><span class="cx" style="display: block; padding: 0 10px">                 cancelTestedWith: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#tested-with' ).val( $( '#hidden-tested-with' ).val() );
</span><span class="cx" style="display: block; padding: 0 10px">                        PluginEdit.updateTestedWith();
</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">-                cancelPluginStatus: function() {
-                       $( '#post-status' ).val( $( '#hidden-post-status' ).val() );
-                       PluginEdit.updatePluginStatus( event );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         setPluginStatus: function() {
+                       if ( 'approved' === $(this).val() ) {
+                               return confirm( pluginDirectory.approvePluginAYS );
+                       } else if ( 'rejected' === $(this).val() ) {
+                               return confirm( pluginDirectory.rejectPluginAYS );
+                       } else {
+                               return true;
+                       }
</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">                loadComments: function ( element ) {
</span></span></pre>
</div>
</div>

</body>
</html>