@@ -49,6 +49,7 @@ static CHECKS: &[Check<fn(&Data, &mut Vec<String>)>] = checks![
4949 validate_zulip_group_ids,
5050 validate_zulip_group_extra_people,
5151 validate_unique_zulip_streams,
52+ validate_unique_zulip_user_ids,
5253 validate_zulip_stream_ids,
5354 validate_zulip_stream_extra_people,
5455 validate_repos,
@@ -720,6 +721,22 @@ fn validate_zulip_users(data: &Data, zulip: &ZulipApi, errors: &mut Vec<String>)
720721 } )
721722}
722723
724+ /// Ensure that no two users have the same Zulip ID
725+ fn validate_unique_zulip_user_ids ( data : & Data , errors : & mut Vec < String > ) {
726+ let mut zulip_ids = HashMap :: new ( ) ;
727+ wrapper ( data. people ( ) , errors, |person, _| {
728+ if let Some ( zulip_id) = person. zulip_id ( ) {
729+ if let Some ( previous) = zulip_ids. insert ( zulip_id, person. github ( ) ) {
730+ return Err ( anyhow:: anyhow!(
731+ "{previous} and {} have the same Zulip user ID: {zulip_id}" ,
732+ person. github( )
733+ ) ) ;
734+ }
735+ }
736+ Ok ( ( ) )
737+ } )
738+ }
739+
723740/// Ensure team members in Zulip groups have a Zulip id
724741fn validate_zulip_group_ids ( data : & Data , errors : & mut Vec < String > ) {
725742 wrapper ( data. teams ( ) , errors, |team, errors| {
0 commit comments