Remove groupCall.can_self_unmute in favor of groupCallParticipant fields.

This commit is contained in:
levlam 2021-04-13 01:58:40 +03:00
parent 2ddeead75f
commit b7d993c477
2 changed files with 9 additions and 13 deletions

View File

@ -2158,7 +2158,6 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall
//@is_active True, if the call is active
//@is_joined True, if the call is joined
//@need_rejoin True, if user was kicked from the call because of network loss and the call needs to be rejoined
//@can_unmute_self True, if the current user can unmute themself
//@can_be_managed True, if the current user can manage the group call
//@participant_count Number of participants in the group call
//@loaded_all_participants True, if all group call participants are loaded
@ -2167,7 +2166,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall
//@can_change_mute_new_participants True, if the current user can enable or disable mute_new_participants setting
//@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on
//@duration Call duration; for ended calls only
groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_joined:Bool need_rejoin:Bool can_unmute_self:Bool can_be_managed:Bool participant_count:int32 loaded_all_participants:Bool recent_speakers:vector<groupCallRecentSpeaker> mute_new_participants:Bool can_change_mute_new_participants:Bool record_duration:int32 duration:int32 = GroupCall;
groupCall id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 loaded_all_participants:Bool recent_speakers:vector<groupCallRecentSpeaker> mute_new_participants:Bool can_change_mute_new_participants:Bool record_duration:int32 duration:int32 = GroupCall;
//@description Describes a payload fingerprint for interaction with tgcalls @hash Value of the field hash @setup Value of the field setup @fingerprint Value of the field fingerprint
groupCallPayloadFingerprint hash:string setup:string fingerprint:string = GroupCallPayloadFingerprint;

View File

@ -2003,13 +2003,11 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
if (participant.is_self) {
auto *group_call = get_group_call(input_group_call_id);
CHECK(group_call != nullptr && group_call->is_inited);
if (group_call->is_joined && group_call->is_active) {
auto can_self_unmute = !participant.get_is_muted_by_admin();
if (can_self_unmute != group_call->can_self_unmute) {
group_call->can_self_unmute = can_self_unmute;
send_update_group_call(group_call, "process_group_call_participant 1");
sync_group_call_participants(input_group_call_id); // participant order is different for administrators
}
auto can_self_unmute = group_call->is_active && !participant.get_is_muted_by_admin();
if (can_self_unmute != group_call->can_self_unmute) {
group_call->can_self_unmute = can_self_unmute;
send_update_group_call(group_call, "process_group_call_participant 1");
sync_group_call_participants(input_group_call_id); // participant order is different for administrators
}
}
@ -4137,7 +4135,6 @@ tl_object_ptr<td_api::groupCall> GroupCallManager::get_group_call_object(
int32 scheduled_start_date = group_call->scheduled_start_date;
bool is_active = scheduled_start_date == 0 ? group_call->is_active : 0;
bool is_joined = group_call->is_joined && !group_call->is_being_left;
bool can_self_unmute = is_joined && group_call->can_self_unmute;
bool start_subscribed = get_group_call_start_subscribed(group_call);
bool mute_new_participants = get_group_call_mute_new_participants(group_call);
bool can_change_mute_new_participants =
@ -4146,9 +4143,9 @@ tl_object_ptr<td_api::groupCall> GroupCallManager::get_group_call_object(
int32 record_duration = record_start_date == 0 ? 0 : max(G()->unix_time() - record_start_date + 1, 1);
return td_api::make_object<td_api::groupCall>(
group_call->group_call_id.get(), get_group_call_title(group_call), scheduled_start_date, start_subscribed,
is_active, is_joined, group_call->need_rejoin, can_self_unmute, group_call->can_be_managed,
group_call->participant_count, group_call->loaded_all_participants, std::move(recent_speakers),
mute_new_participants, can_change_mute_new_participants, record_duration, group_call->duration);
is_active, is_joined, group_call->need_rejoin, group_call->can_be_managed, group_call->participant_count,
group_call->loaded_all_participants, std::move(recent_speakers), mute_new_participants,
can_change_mute_new_participants, record_duration, group_call->duration);
}
tl_object_ptr<td_api::updateGroupCall> GroupCallManager::get_update_group_call_object(