Add separate function for server group call participant order calculation.
This commit is contained in:
parent
c44c0f3fd3
commit
f972b3ad56
@ -2026,7 +2026,7 @@ void GroupCallManager::on_sync_group_call_participants(InputGroupCallId input_gr
|
||||
GroupCallParticipantOrder GroupCallManager::get_real_participant_order(bool can_self_unmute,
|
||||
const GroupCallParticipant &participant,
|
||||
const GroupCallParticipants *participants) {
|
||||
auto real_order = participant.get_real_order(can_self_unmute, participants->joined_date_asc, false);
|
||||
auto real_order = participant.get_real_order(can_self_unmute, participants->joined_date_asc);
|
||||
if (real_order >= participants->min_order) {
|
||||
return real_order;
|
||||
}
|
||||
@ -2096,7 +2096,7 @@ void GroupCallManager::process_group_call_participants(
|
||||
}
|
||||
|
||||
if (is_load) {
|
||||
auto real_order = participant.get_real_order(can_self_unmute, joined_date_asc, true);
|
||||
auto real_order = participant.get_server_order(can_self_unmute, joined_date_asc);
|
||||
if (real_order > min_order) {
|
||||
LOG(ERROR) << "Receive group call participant " << participant.dialog_id << " with order " << real_order
|
||||
<< " after group call participant " << debug_min_order_dialog_id << " with order " << min_order;
|
||||
|
@ -75,8 +75,7 @@ bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api:
|
||||
return participant->just_joined_ || participant->left_ || participant->versioned_;
|
||||
}
|
||||
|
||||
GroupCallParticipantOrder GroupCallParticipant::get_real_order(bool can_self_unmute, bool joined_date_asc,
|
||||
bool keep_active_date) const {
|
||||
GroupCallParticipantOrder GroupCallParticipant::get_real_order(bool can_self_unmute, bool joined_date_asc) const {
|
||||
auto sort_active_date = td::max(active_date, local_active_date);
|
||||
if (sort_active_date == 0 && !get_is_muted_by_admin()) { // if the participant isn't muted by admin
|
||||
if (get_is_muted_by_themselves()) {
|
||||
@ -85,7 +84,7 @@ GroupCallParticipantOrder GroupCallParticipant::get_real_order(bool can_self_unm
|
||||
sort_active_date = G()->unix_time();
|
||||
}
|
||||
}
|
||||
if (!keep_active_date && sort_active_date < G()->unix_time() - 300) {
|
||||
if (sort_active_date < G()->unix_time() - 300) {
|
||||
sort_active_date = 0;
|
||||
}
|
||||
auto sort_raise_hand_rating = can_self_unmute ? raise_hand_rating : 0;
|
||||
@ -94,6 +93,21 @@ GroupCallParticipantOrder GroupCallParticipant::get_real_order(bool can_self_unm
|
||||
return GroupCallParticipantOrder(has_video, sort_active_date, sort_raise_hand_rating, sort_joined_date);
|
||||
}
|
||||
|
||||
GroupCallParticipantOrder GroupCallParticipant::get_server_order(bool can_self_unmute, bool joined_date_asc) const {
|
||||
auto sort_active_date = active_date;
|
||||
if (sort_active_date == 0 && !server_is_muted_by_admin) { // if the participant isn't muted by admin
|
||||
if (server_is_muted_by_themselves) {
|
||||
sort_active_date = joined_date;
|
||||
} else {
|
||||
sort_active_date = G()->unix_time();
|
||||
}
|
||||
}
|
||||
auto sort_raise_hand_rating = can_self_unmute ? raise_hand_rating : 0;
|
||||
auto sort_joined_date = joined_date_asc ? std::numeric_limits<int32>::max() - joined_date : joined_date;
|
||||
bool has_video = !video_payload.is_empty() || !presentation_payload.is_empty();
|
||||
return GroupCallParticipantOrder(has_video, sort_active_date, sort_raise_hand_rating, sort_joined_date);
|
||||
}
|
||||
|
||||
bool GroupCallParticipant::get_is_muted_by_themselves() const {
|
||||
return have_pending_is_muted ? pending_is_muted_by_themselves : server_is_muted_by_themselves;
|
||||
}
|
||||
|
@ -78,7 +78,9 @@ struct GroupCallParticipant {
|
||||
|
||||
bool set_pending_is_muted(bool is_muted, bool can_manage, bool is_admin);
|
||||
|
||||
GroupCallParticipantOrder get_real_order(bool can_self_unmute, bool joined_date_asc, bool keep_active_date) const;
|
||||
GroupCallParticipantOrder get_real_order(bool can_self_unmute, bool joined_date_asc) const;
|
||||
|
||||
GroupCallParticipantOrder get_server_order(bool can_self_unmute, bool joined_date_asc) const;
|
||||
|
||||
bool is_valid() const {
|
||||
return dialog_id.is_valid();
|
||||
|
Loading…
Reference in New Issue
Block a user