0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd:Ⓜ️:room::power: Support defaulting level for the room creator.

This commit is contained in:
Jason Volk 2018-10-25 16:28:30 -07:00
parent 8733e16ca4
commit 61016b479b
2 changed files with 18 additions and 2 deletions

View file

@ -410,6 +410,7 @@ struct ircd::m::room::power
using closure = std::function<void (const string_view &, const int64_t &)>;
using closure_bool = std::function<bool (const string_view &, const int64_t &)>;
static const int64_t default_creator_level;
static const int64_t default_power_level;
static const int64_t default_event_level;
static const int64_t default_user_level;

View file

@ -1958,6 +1958,12 @@ const
// room::power
//
decltype(ircd::m::room::power::default_creator_level)
ircd::m::room::power::default_creator_level
{
100
};
decltype(ircd::m::room::power::default_power_level)
ircd::m::room::power::default_power_level
{
@ -2006,7 +2012,7 @@ const try
default_user_level
};
view([&user_id, &ret]
const auto closure{[&user_id, &ret]
(const json::object &content)
{
const json::object &users
@ -2015,7 +2021,16 @@ const try
};
ret = users.at<int64_t>(user_id);
});
}};
const bool has_power_levels_event
{
view(closure)
};
if(!has_power_levels_event)
if(creator(room, user_id))
ret = default_creator_level;
return ret;
}