Fixed the default channel group assignment

This commit is contained in:
WolverinDEV
2021-04-12 19:12:02 +02:00
parent 3aa50a2c1a
commit bf643b4797
3 changed files with 27 additions and 21 deletions
+6 -2
View File
@@ -578,15 +578,19 @@ GroupAssignmentResult GroupAssignmentManager::set_channel_group(ClientDbId clien
{
std::lock_guard cache_lock{*this->client_cache_lock};
for(auto& entry : this->client_cache) {
if(entry->client_database_id != client) continue;
if(entry->client_database_id != client) {
continue;
}
auto it = std::find_if(entry->channel_group_assignments.begin(), entry->channel_group_assignments.end(), [&](const std::unique_ptr<InternalChannelGroupAssignment>& assignment) {
return assignment->channel_id == channel_id;
});
if(it != entry->channel_group_assignments.end()) {
if(group) {
if((*it)->group_id == group)
if((*it)->group_id == group) {
return GroupAssignmentResult::SET_ALREADY_MEMBER_OF_GROUP;
}
(*it)->group_id = group;
} else {
entry->channel_group_assignments.erase(it);