Remove streaming channel from live stream "participants".

This commit is contained in:
John Preston 2023-05-24 13:20:13 +04:00
parent ad573ecc84
commit b6395d08d8
1 changed files with 16 additions and 1 deletions

View File

@ -70,8 +70,10 @@ rpl::producer<Ui::GroupCallBarContent> GroupCallBarContentByCall(
std::vector<UserpicInRow> userpics;
Ui::GroupCallBarContent current;
base::has_weak_ptr guard;
uint64 ownerId = 0;
bool someUserpicsNotLoaded = false;
bool pushScheduled = false;
bool noUserpics = false;
};
// speaking DESC, std::max(date, lastActive) DESC
@ -244,6 +246,8 @@ rpl::producer<Ui::GroupCallBarContent> GroupCallBarContentByCall(
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
auto state = lifetime.make_state<State>();
state->noUserpics = call->listenersHidden();
state->ownerId = call->peer()->id.value;
state->current.shown = true;
state->current.livestream = call->peer()->isBroadcast();
@ -254,7 +258,18 @@ rpl::producer<Ui::GroupCallBarContent> GroupCallBarContentByCall(
state->pushScheduled = true;
crl::on_main(&state->guard, [=] {
state->pushScheduled = false;
consumer.put_next_copy(state->current);
auto copy = state->current;
if (state->noUserpics && copy.count > 0) {
const auto i = ranges::find(
copy.users,
state->ownerId,
&Ui::GroupCallUser::id);
if (i != end(copy.users)) {
copy.users.erase(i);
--copy.count;
}
}
consumer.put_next(std::move(copy));
});
};