Also check if user can upload in order to restore
The thought behind this is that a restoration is an upload, and the workaround for not restoring would be to make a fresh upload (which we don't want). The main use case is the scenario in which a branch has been closed to further improvements and changes shouldn't be restored. Rather than introduce a new permission for this, keep the abandon conditions so someone can undo an accidental abandon. Change-Id: I31fa95c1325ac932f1fc2c90abf3a5a42c1b24db
This commit is contained in:
@@ -452,6 +452,9 @@ This category controls whether users are allowed to abandon changes
|
|||||||
to projects in Gerrit. It can give permission to abandon a specific
|
to projects in Gerrit. It can give permission to abandon a specific
|
||||||
change to a given ref.
|
change to a given ref.
|
||||||
|
|
||||||
|
This also grants the permission to restore a change if the change
|
||||||
|
can be uploaded.
|
||||||
|
|
||||||
[[category_create]]
|
[[category_create]]
|
||||||
Create reference
|
Create reference
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
@@ -211,7 +211,8 @@ public class ChangeControl {
|
|||||||
|
|
||||||
/** Can this user restore this change? */
|
/** Can this user restore this change? */
|
||||||
public boolean canRestore() {
|
public boolean canRestore() {
|
||||||
return canAbandon(); // Anyone who can abandon the change can restore it back
|
return canAbandon() // Anyone who can abandon the change can restore it back
|
||||||
|
&& getRefControl().canUpload(); // as long as you can upload too
|
||||||
}
|
}
|
||||||
|
|
||||||
/** All value ranges of any allowed label permission. */
|
/** All value ranges of any allowed label permission. */
|
||||||
|
Reference in New Issue
Block a user