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
@@ -593,13 +593,12 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
auto admin_group_id = this->server->properties()[property::VIRTUALSERVER_DEFAULT_CHANNEL_ADMIN_GROUP].as_or<GroupId>(0);
auto admin_group = this->server->group_manager()->channel_groups()->find_group(groups::GroupCalculateMode::GLOBAL, admin_group_id);
if(!admin_group) {
logError(this->getServerId(), "Missing servers default channel admin group {}. Using the default channel gropup.", admin_group_id);
admin_group = this->server->default_channel_group();
logError(this->getServerId(), "Missing servers default channel admin group {}.", admin_group_id);
}
/* admin_group might still be null since default_channel_group() could return nullptr */
if(admin_group) {
this->server->group_manager()->assignments().set_channel_group(this->getClientDatabaseId(), created_channel->channelId(), admin_group->group_id(), false);
this->server->group_manager()->assignments().set_channel_group(this->getClientDatabaseId(), admin_group->group_id(), created_channel->channelId(), false);
serverInstance->action_logger()->group_assignment_logger.log_group_assignment_remove(
this->getServerId(), this->server->getServerRoot(),
log::GroupTarget::CHANNEL,
@@ -1194,8 +1193,11 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
}
}
/* We need to calculate the type for other checks as well do don't only calculate it when updating the type */
ChannelType::ChannelType target_channel_type;
if(updating_type) {
(void) updating_type;
{
auto flag_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_PERMANENT));
auto flag_semi_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_SEMI_PERMANENT));
@@ -1228,7 +1230,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
* We may should test if the user really set them to -1 but nvm.
*
* Since we must come from a limited channel, else we would not have a change, we can ensure that the previous value isn't -1.
* This means that we've definatifly a change.
* This means that we've definitively a change.
*/
changed_values[property::CHANNEL_MAXCLIENTS] = "-1";
} else if(!changed_values.contains(property::CHANNEL_MAXCLIENTS)) {