Conserve expiry time when promoting/demoting (#2794)

This commit is contained in:
Luck 2021-01-01 20:25:47 +00:00
parent 68167490d4
commit 8124a17adb
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -316,7 +316,7 @@ public final class Track {
}
user.unsetNode(DataType.NORMAL, oldNode);
user.setNode(DataType.NORMAL, Inheritance.builder(nextGroup.getName()).withContext(context).build(), true);
user.setNode(DataType.NORMAL, oldNode.toBuilder().group(nextGroup.getName()).build(), true);
if (context.isEmpty() && user.getPrimaryGroup().getStoredValue().orElse(GroupManager.DEFAULT_GROUP_NAME).equalsIgnoreCase(old)) {
user.getPrimaryGroup().setStoredValue(nextGroup.getName());
@ -370,7 +370,7 @@ public final class Track {
}
user.unsetNode(DataType.NORMAL, oldNode);
user.setNode(DataType.NORMAL, Inheritance.builder(previousGroup.getName()).withContext(context).build(), true);
user.setNode(DataType.NORMAL, oldNode.toBuilder().group(previousGroup.getName()).build(), true);
if (context.isEmpty() && user.getPrimaryGroup().getStoredValue().orElse(GroupManager.DEFAULT_GROUP_NAME).equalsIgnoreCase(old)) {
user.getPrimaryGroup().setStoredValue(previousGroup.getName());