Skip to content

Commit

Permalink
Allow Reporters to Clone issues
Browse files Browse the repository at this point in the history
Previously, users needed to have update_bug_threshold to be able to
clone issues, since the creation of a relationship with the parent bug
requires to update it.

This patch lets Reporters clone issues and allows them to create a
relationship with the parent, even if they lack updater access.

Fixes #11290 (implements option 3)
  • Loading branch information
dregad committed Feb 13, 2014
1 parent a0ae5ce commit 8aafaaf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions bug_report.php
Expand Up @@ -88,13 +88,12 @@
}
$t_master_bug = bug_get( $f_master_bug_id, true );
$t_project_id = $t_master_bug->project_id;
project_ensure_exists( $t_project_id );
access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $f_master_bug_id );
} else {
$f_project_id = gpc_get_int( 'project_id' );
project_ensure_exists( $f_project_id );
$t_project_id = $f_project_id;
}
project_ensure_exists( $t_project_id );

if ( $t_project_id != helper_get_current_project() ) {
$g_project_override = $t_project_id;
}
Expand Down
8 changes: 3 additions & 5 deletions bug_report_page.php
Expand Up @@ -91,9 +91,6 @@

$t_bug = bug_get( $f_master_bug_id, true );

# the user can at least update the master bug (needed to add the relationship)...
access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_bug->project_id ), $f_master_bug_id );

#@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
# what the current project is set to.
if( $t_bug->project_id != helper_get_current_project() ) {
Expand Down Expand Up @@ -632,9 +629,10 @@
<label><input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?></label>
</td>
</tr>
<?php
<?php
}
//Relationship (in case of cloned bug creation...)

# Relationship (in case of cloned bug creation...)
if( $f_master_bug_id > 0 ) {
?>
<tr>
Expand Down
4 changes: 2 additions & 2 deletions core/html_api.php
Expand Up @@ -1618,12 +1618,12 @@ function html_button_bug_move( $p_bug_id ) {
}

/**
* Print a button to move the given bug to a different project
* Print a button to clone the given bug
* @param int $p_bug_id
* @return null
*/
function html_button_bug_create_child( $p_bug_id ) {
if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) {
if( access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug_id ) ) {
html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) );
}
}
Expand Down

0 comments on commit 8aafaaf

Please sign in to comment.