clearAll + same name checking before updating

This commit is contained in:
SessionHero01 2024-10-24 16:17:52 +11:00
parent d21cb39824
commit 6abe6c682c
No known key found for this signature in database
2 changed files with 18 additions and 3 deletions

View File

@ -441,7 +441,13 @@ class ConfigFactory @Inject constructor(
} }
fun clearAll() { fun clearAll() {
//TODO: clear all configs synchronized(userConfigs) {
userConfigs.clear()
}
synchronized(groupConfigs) {
groupConfigs.clear()
}
} }
private class GroupSubAccountSwarmAuth( private class GroupSubAccountSwarmAuth(

View File

@ -826,8 +826,17 @@ class GroupManagerV2Impl @Inject constructor(
withContext(dispatcher) { withContext(dispatcher) {
val adminKey = requireAdminAccess(groupId) val adminKey = requireAdminAccess(groupId)
configFactory.withMutableGroupConfigs(groupId) { val nameChanged = configFactory.withMutableGroupConfigs(groupId) { configs ->
it.groupInfo.setName(newName) if (configs.groupInfo.getName() != newName) {
configs.groupInfo.setName(newName)
true
} else {
false
}
}
if (!nameChanged) {
return@withContext
} }
val timestamp = clock.currentTimeMills() val timestamp = clock.currentTimeMills()