@@ -284,17 +284,25 @@ public function update_repo_form( $p_repo ) {
284284 <td class="category"><?php echo plugin_lang_get ( 'hub_app_access_token ' ) ?> </td>
285285 <td>
286286 <?php
287+ $ t_hide_webhook_create = true ;
288+
287289 if ( empty ( $ t_hub_app_client_id ) || empty ( $ t_hub_app_secret ) ) {
288290 echo plugin_lang_get ( 'hub_app_client_id_secret_missing ' );
289291 } elseif ( empty ( $ t_hub_app_access_token ) ) {
290292 print_link ( $ this ->oauth_authorize_uri ( $ p_repo ), plugin_lang_get ( 'hub_app_authorize ' ) );
291293 } else {
294+ $ t_hide_webhook_create = false ;
292295 echo plugin_lang_get ( 'hub_app_authorized ' );
293296 # @TODO This would be better with an AJAX, but this will do for now
294297 ?>
295298 <input type="submit" class="btn btn-xs btn-primary btn-white btn-round" name="revoke" value="<?php echo plugin_lang_get ( 'hub_app_revoke ' ) ?> "/>
296299 <?php
297300 }
301+
302+ # Only show the webhook creation div when the app has been authorized
303+ if ( $ t_hide_webhook_create ) {
304+ $ t_webhook_create_css = ' class="hidden" ' ;
305+ }
298306 ?>
299307 </td>
300308</tr>
@@ -303,8 +311,8 @@ public function update_repo_form( $p_repo ) {
303311 <td class="category"><?php echo plugin_lang_get ( 'hub_webhook_secret ' ) ?> </td>
304312 <td>
305313 <input type="text" name="hub_webhook_secret" maxlength="250" size="40" value="<?php echo string_attribute ( $ t_hub_webhook_secret ) ?> "/>
306- <div class="space-2"></div >
307- <div id="webhook_create" >
314+ <div id="webhook_create" <?php echo $ t_webhook_create_css ; ?> >
315+ <div class="space-2"></div >
308316 <button type="button" class="btn btn-primary btn-white btn-round btn-sm">
309317 <?php echo plugin_lang_get ( 'webhook_create ' ); ?>
310318 </button>
0 commit comments