Added a new channel property

This commit is contained in:
WolverinDEV 2020-12-03 10:49:21 +01:00
parent db63248677
commit 364b3781b1
4 changed files with 19 additions and 3 deletions

@ -1 +1 @@
Subproject commit 0bcc14c8eef4febba6e50bf089c84fbbe415bd95
Subproject commit c8eb58e3b1486e8d5ea8943562bf8e94afa0b37a

View File

@ -128,8 +128,9 @@ bool InstanceHandler::setupDefaultGroups() {
info->target == 0 ? GroupType::GROUP_TYPE_QUERY : GroupType::GROUP_TYPE_TEMPLATE,
info->name
);
for(auto perm : info->permissions) {
group->permissions()->set_permission(get<0>(perm), {get<1>(perm), get<2>(perm)}, permission::v2::set_value, permission::v2::set_value, get<3>(perm), get<4>(perm));
group->permissions()->set_permission(get<0>(perm), {get<1>(perm), get<2>(perm)}, get<1>(perm) == permNotGranted ? permission::v2::do_nothing : permission::v2::set_value, get<2>(perm) == permNotGranted ? permission::v2::do_nothing : permission::v2::set_value, get<3>(perm), get<4>(perm));
}
for(const auto& property : info->properties) {

View File

@ -1119,6 +1119,8 @@ command_result ConnectedClient::handleCommandChannelEdit(Command &cmd) {
default:
return command_result{error::parameter_invalid, "channel_conversation_mode"};
}
} else if(key == "channel_sidebar_mode") {
ACTION_REQUIRES_PERMISSION(permission::b_channel_create_modify_sidebar_mode, 1, channel_id);
} else {
logCritical(
this->getServerId(),
@ -1283,6 +1285,19 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
break;
}
case property::CHANNEL_SIDEBAR_MODE: {
switch (converter<ChannelSidebarMode>::from_string_view(value)) {
case ChannelSidebarMode::CHANNELSIDEBARMODE_CONVERSATION:
case ChannelSidebarMode::CHANNELSIDEBARMODE_DESCRIPTION:
case ChannelSidebarMode::CHANNELSIDEBARMODE_FILE_TRANSFER:
break;
default:
return command_result{error::parameter_invalid, std::string{property::describe(property).name}};
}
break;
}
/* non editable properties */
case property::CHANNEL_FLAG_ARE_SUBSCRIBED:
case property::CHANNEL_FORCED_SILENCE:

2
shared

@ -1 +1 @@
Subproject commit 3eedb7d77220145b01f3fc7f11e32656b532dcbd
Subproject commit b271cdd6ff2336512b337e8dfd4896b290454c2c