Fixed a small bug
This commit is contained in:
@@ -642,6 +642,9 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
|
||||
}
|
||||
test_permission(1, permission::b_channel_create_child);
|
||||
}
|
||||
|
||||
new_values[property::CHANNEL_PID] = cmd[key].string();
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto &property = property::find<property::ChannelProperties>(key);
|
||||
@@ -731,10 +734,10 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
|
||||
auto value = cmd["channel_flag_conversation_private"].as<bool>();
|
||||
if (value) {
|
||||
ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_conversation_mode_private, 1, parent_channel_id);
|
||||
cmd[property::name(property::CHANNEL_CONVERSATION_MODE)] = CHANNELCONVERSATIONMODE_PRIVATE;
|
||||
new_values[property::CHANNEL_CONVERSATION_MODE] = std::to_string(CHANNELCONVERSATIONMODE_PRIVATE);
|
||||
} else {
|
||||
ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_conversation_mode_public, 1, parent_channel_id);
|
||||
cmd[property::name(property::CHANNEL_CONVERSATION_MODE)] = CHANNELCONVERSATIONMODE_PUBLIC;
|
||||
new_values[property::CHANNEL_CONVERSATION_MODE] = std::to_string(CHANNELCONVERSATIONMODE_PUBLIC);
|
||||
}
|
||||
continue;
|
||||
} else if (key == "channel_conversation_mode") {
|
||||
@@ -765,6 +768,11 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
|
||||
new_values.emplace((property::ChannelProperties) property.property_index, cmd[key].string());
|
||||
}
|
||||
|
||||
/* Fix since the default value of channel_flag_permanent is 1 which should be zero... */
|
||||
if(!new_values.contains(property::CHANNEL_FLAG_PERMANENT)) {
|
||||
new_values[property::CHANNEL_FLAG_PERMANENT] = std::to_string(false);
|
||||
}
|
||||
|
||||
if (!cmd[0]["channel_flag_permanent"].as<bool>() && !this->server) {
|
||||
return command_result{error::parameter_invalid, "You can only create a permanent channel"};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user