@@ -58,52 +58,10 @@ impl NewTeam<'_> {
5858}
5959
6060impl Team {
61- /// Tries to create the Team in the DB (assumes a `:` has already been found).
62- ///
63- /// # Panics
64- ///
65- /// This function will panic if login contains less than 2 `:` characters.
66- pub async fn create_or_update (
67- gh_client : & dyn GitHubClient ,
68- conn : & mut AsyncPgConnection ,
69- login : & str ,
70- req_user : & User ,
71- ) -> AppResult < Self > {
72- // must look like system:xxxxxxx
73- let mut chunks = login. split ( ':' ) ;
74- // unwrap is okay, split on an empty string still has 1 chunk
75- match chunks. next ( ) . unwrap ( ) {
76- // github:rust-lang:owners
77- "github" => {
78- // unwrap is documented above as part of the calling contract
79- let org = chunks. next ( ) . unwrap ( ) ;
80- let team = chunks. next ( ) . ok_or_else ( || {
81- bad_request (
82- "missing github team argument; \
83- format is github:org:team",
84- )
85- } ) ?;
86- Team :: create_or_update_github_team (
87- gh_client,
88- conn,
89- & login. to_lowercase ( ) ,
90- org,
91- team,
92- req_user,
93- )
94- . await
95- }
96- _ => Err ( bad_request (
97- "unknown organization handler, \
98- only 'github:org:team' is supported",
99- ) ) ,
100- }
101- }
102-
10361 /// Tries to create or update a Github Team. Assumes `org` and `team` are
10462 /// correctly parsed out of the full `name`. `name` is passed as a
10563 /// convenience to avoid rebuilding it.
106- async fn create_or_update_github_team (
64+ pub async fn create_or_update_github_team (
10765 gh_client : & dyn GitHubClient ,
10866 conn : & mut AsyncPgConnection ,
10967 login : & str ,
0 commit comments