Skip to content

Commit db37ee5

Browse files
committed
Show "Attach issues" form only if user has access
When a Changeset is not linked to any issue, the List page displays a text field and an Attach button as a shortcut to link issues without having to go to the View Changeset page. The input form was also shown when user has no privileges to update Changesets. Fixes #354
1 parent c10ef2a commit db37ee5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/Source.ViewAPI.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru
1414
return;
1515
}
1616

17+
plugin_push_current( 'Source' );
18+
$t_can_update = access_has_global_level( plugin_config_get( 'update_threshold' ) );
19+
plugin_pop_current();
20+
1721
if ( is_null( $p_repos ) || !is_array( $p_repos ) ) {
1822
$t_repos = SourceRepo::load_by_changesets( $p_changesets );
1923
} else {
@@ -103,7 +107,7 @@ function( $p_bug_id ) use ( $t_view_bug_threshold ) {
103107
plugin_lang_get( 'affected_issues', 'Source' ),
104108
'</span><br>';
105109
echo '<span>', implode( ', ', $t_bugs ), '</span>';
106-
} else {
110+
} elseif( $t_can_update ) {
107111
?>
108112
<form action="<?php echo plugin_page( 'attach' ) ?>" method="post">
109113
<?php echo form_security_field( 'plugin_Source_attach' ) ?>

0 commit comments

Comments
 (0)