mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-03-13 15:39:18 +08:00
Fix version view and deletion
This commit is contained in:
parent
310dfdf5ed
commit
07a33e7599
@ -14,7 +14,7 @@ public class ProjectVersionVisibilityChangesTable {
|
||||
private long versionId;
|
||||
private String comment;
|
||||
private OffsetDateTime resolvedAt;
|
||||
private long resolvedBy;
|
||||
private Long resolvedBy;
|
||||
private Visibility visibility;
|
||||
|
||||
public ProjectVersionVisibilityChangesTable(long createdBy, long versionId, String comment, Visibility visibility) {
|
||||
@ -80,11 +80,11 @@ public class ProjectVersionVisibilityChangesTable {
|
||||
}
|
||||
|
||||
|
||||
public long getResolvedBy() {
|
||||
public Long getResolvedBy() {
|
||||
return resolvedBy;
|
||||
}
|
||||
|
||||
public void setResolvedBy(long resolvedBy) {
|
||||
public void setResolvedBy(Long resolvedBy) {
|
||||
this.resolvedBy = resolvedBy;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,9 @@ public class ProjectFactory {
|
||||
if (projectVersions.stream().filter(p -> p.getVisibility() == Visibility.PUBLIC).count() <= 1) {
|
||||
throw new HangarException("error.version.onlyOnePublic");
|
||||
}
|
||||
if (versionData.getV().getId() == versionData.getP().getRecommendedVersion().getId()) { // pick new recommended
|
||||
|
||||
ProjectVersionsTable recommended = versionData.getP().getRecommendedVersion();
|
||||
if (recommended != null && versionData.getV().getId() == recommended.getId()) { // pick new recommended
|
||||
Optional<ProjectVersionsTable> tableOptional = projectVersions.stream().filter(v -> v.getId() != versionData.getV().getId() && v.getVisibility() != Visibility.SOFTDELETE).findFirst();
|
||||
tableOptional.ifPresent(projectVersionsTable -> {
|
||||
versionData.getP().getProject().setRecommendedVersionId(projectVersionsTable.getId());
|
||||
|
@ -143,7 +143,7 @@
|
||||
<#if v.v.visibility == Visibility.SOFTDELETE>
|
||||
<li><a href="#" data-toggle="modal" data-target="#modal-restore">Undo delete</a></li>
|
||||
</#if>
|
||||
<#if headerData.globalPerm(Permission.HardDeleteVersion) && !v.recommended && (v.p.publicVersions gt 1 || v.v.visibility == Visibility.SoftDelete)>
|
||||
<#if headerData.globalPerm(Permission.HardDeleteVersion) && !v.recommended && (v.p.publicVersions gt 1 || v.v.visibility == Visibility.SOFTDELETE)>
|
||||
<li><a href="#" data-toggle="modal" data-target="#modal-harddelete" style="color: darkred">Hard delete</a></li>
|
||||
</#if>
|
||||
</#if>
|
||||
|
Loading…
Reference in New Issue
Block a user