Merge branch '1.4.15' into 1.5.0
This commit is contained in:
commit
818cffd368
@ -774,7 +774,17 @@ command_result ConnectedClient::handleCommandChannelCreate(Command &cmd) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd["channel_name"].string().length() < 1) return command_result{error::channel_name_inuse, "Invalid channel name"};
|
if (cmd["channel_name"].string().length() < 1) {
|
||||||
|
return command_result{error::channel_name_invalid};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd[0].has("channel_name") && count_characters(cmd["channel_name"]) > 40) {
|
||||||
|
return command_result{error::channel_name_invalid};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count_characters(cmd["channel_name_phonetic"]) > 40) {
|
||||||
|
return command_result{error::channel_name_invalid};
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if (target_tree->findChannel(cmd["channel_name"].as<std::string>(), parent ? dynamic_pointer_cast<BasicChannel>(parent->entry) : nullptr)) return command_result{error::channel_name_inuse, "Name already in use"};
|
if (target_tree->findChannel(cmd["channel_name"].as<std::string>(), parent ? dynamic_pointer_cast<BasicChannel>(parent->entry) : nullptr)) return command_result{error::channel_name_inuse, "Name already in use"};
|
||||||
@ -1013,13 +1023,18 @@ command_result ConnectedClient::handleCommandChannelEdit(Command &cmd) {
|
|||||||
require_write_lock = true;
|
require_write_lock = true;
|
||||||
} else if (key == "channel_name") {
|
} else if (key == "channel_name") {
|
||||||
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_name, 1, channel_id);
|
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_name, 1, channel_id);
|
||||||
if (count_characters(cmd["channel_name"]) < 1)
|
if (count_characters(cmd["channel_name"]) < 1) {
|
||||||
return command_result{error::channel_name_invalid};
|
return command_result{error::channel_name_invalid};
|
||||||
if (count_characters(cmd["channel_name"]) > 40)
|
}
|
||||||
return command_result{error::channel_name_invalid};
|
if (count_characters(cmd["channel_name"]) > 40) {
|
||||||
|
return command_result{error::channel_name_invalid};
|
||||||
|
}
|
||||||
require_write_lock = true;
|
require_write_lock = true;
|
||||||
update_name = true;
|
update_name = true;
|
||||||
} else if (key == "channel_name_phonetic") {
|
} else if (key == "channel_name_phonetic") {
|
||||||
|
if (count_characters(cmd["channel_name_phonetic"]) > 40) {
|
||||||
|
return command_result{error::parameter_invalid, "channel_name_phonetic"};
|
||||||
|
}
|
||||||
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_name, 1, channel_id);
|
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_name, 1, channel_id);
|
||||||
} else if (key == "channel_topic") {
|
} else if (key == "channel_topic") {
|
||||||
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_topic, 1, channel_id);
|
ACTION_REQUIRES_PERMISSION(permission::b_channel_modify_topic, 1, channel_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user