@@ -258,13 +258,13 @@ pub async fn associate_x_handle(
258258 ) ) )
259259 } ) ?;
260260
261- let bio = twitter_user. description . unwrap_or_default ( ) ;
262- let x_bio_mention = state. config . get_x_bio_mention ( ) ;
263- if !bio . to_lowercase ( ) . contains ( & x_bio_mention . to_lowercase ( ) ) {
261+ let name = twitter_user. name ;
262+ let x_association_keywords = state. config . get_x_association_keywords ( ) ;
263+ if !name . to_lowercase ( ) . contains ( & x_association_keywords . to_lowercase ( ) ) {
264264 return Err ( AppError :: Handler ( HandlerError :: Address (
265265 AddressHandlerError :: Unauthorized ( format ! (
266- "Twitter bio must contain '{}' to verify ownership" ,
267- x_bio_mention
266+ "Twitter name must contain '{}' to verify ownership" ,
267+ x_association_keywords
268268 ) ) ,
269269 ) ) ) ;
270270 }
@@ -431,14 +431,14 @@ mod tests {
431431 let mut mock_user_api = MockUserApi :: new ( ) ;
432432
433433 // Expect get_by_username
434- let bio_mention = state. config . get_x_bio_mention ( ) . to_string ( ) ;
434+ let x_association_keywords = state. config . get_x_association_keywords ( ) . to_string ( ) ;
435435 mock_user_api. expect_get_by_username ( ) . returning ( move |_, _| {
436436 Ok ( TwitterApiResponse {
437437 data : Some ( User {
438438 id : "u1" . to_string ( ) ,
439- name : "Test User" . to_string ( ) ,
439+ name : format ! ( "Test User {}" , x_association_keywords ) ,
440440 username : "test_user" . to_string ( ) ,
441- description : Some ( format ! ( "I love {}" , bio_mention ) ) , // Contains keyword from config
441+ description : Some ( format ! ( "I love {}" , x_association_keywords ) ) , // Contains keyword from config
442442 public_metrics : None ,
443443 } ) ,
444444 includes : None ,
@@ -552,17 +552,17 @@ mod tests {
552552 let mut mock_user_api = MockUserApi :: new ( ) ;
553553
554554 // Expect get_by_username
555- let bio_mention = state. config . get_x_bio_mention ( ) . to_string ( ) ;
555+ let x_association_keywords = state. config . get_x_association_keywords ( ) . to_string ( ) ;
556556 // Create a lowercase version of the mention for the bio
557- let lowercase_bio_mention = bio_mention . to_lowercase ( ) ;
557+ let lowercase_x_association_keywords = x_association_keywords . to_lowercase ( ) ;
558558
559559 mock_user_api. expect_get_by_username ( ) . returning ( move |_, _| {
560560 Ok ( TwitterApiResponse {
561561 data : Some ( User {
562562 id : "u1" . to_string ( ) ,
563- name : "Test User" . to_string ( ) ,
563+ name : format ! ( "Test User {}" , lowercase_x_association_keywords ) ,
564564 username : "test_user" . to_string ( ) ,
565- description : Some ( format ! ( "I love {}" , lowercase_bio_mention ) ) , // Contains lowercase keyword
565+ description : Some ( format ! ( "I love {}" , lowercase_x_association_keywords ) ) , // Contains lowercase keyword
566566 public_metrics : None ,
567567 } ) ,
568568 includes : None ,
0 commit comments