Some minor fixes

This commit is contained in:
WolverinDEV 2020-12-04 12:37:52 +01:00
parent 97e2ded4fb
commit 75b6d0c677
1 changed files with 6 additions and 1 deletions

View File

@ -818,8 +818,9 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
auto max_channels = this->calculate_permission(permission::i_client_max_channels, parent_channel_id, false);
if (max_channels.has_value) {
if (!permission::v2::permission_granted(created_perm + created_semi + created_tmp + 1, max_channels))
if (!permission::v2::permission_granted(created_perm + created_semi + created_tmp + 1, max_channels)) {
return command_result{permission::i_client_max_channels};
}
}
if (cmd[0]["channel_flag_permanent"].as<bool>()) {
@ -894,6 +895,10 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
return ts::command_result{error::vs_critical, "failed to find created channel"};
}
created_channel->properties()[property::CHANNEL_CREATED_BY] = this->getClientDatabaseId();
created_channel->properties()[property::CHANNEL_CREATED_AT] =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();
{
auto default_modify_power = this->calculate_permission(permission::i_channel_modify_power, parent_channel_id, false);
auto default_delete_power = this->calculate_permission(permission::i_channel_delete_power, parent_channel_id, false);