Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ client_id = "WlVrcm4xSEpXQ2l3TURFM3lLZnE6MTpjaQ"
client_secret = "lfXc45dZLqYTzP62Ms32EhXinGQzxcIP9TvjJml2B-h0T1nIJK"

[x_association]
keywords = "quantus"
keywords = "@quantusnetwork"

[tweet_sync]
api_key = "some-key"
Expand Down
2 changes: 1 addition & 1 deletion config/example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ client_id = "example-id"
client_secret = "example-secret"

[x_association]
keywords = "quantus"
keywords = "@quantusnetwork"

[tweet_sync]
api_key = "some-key"
Expand Down
2 changes: 1 addition & 1 deletion config/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ client_id = "test-id"
client_secret = "test-secret"

[x_association]
keywords = "quantus"
keywords = "@quantusnetwork"

[tweet_sync]
api_key = "some-key"
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ pub async fn associate_x_handle(
)))
})?;

let name = twitter_user.name;
let bio = twitter_user.description.unwrap_or_default();
let x_association_keywords = state.config.get_x_association_keywords();
if !name.to_lowercase().contains(&x_association_keywords.to_lowercase()) {
if !bio.to_lowercase().contains(&x_association_keywords.to_lowercase()) {
return Err(AppError::Handler(HandlerError::Address(
AddressHandlerError::Unauthorized(format!(
"Twitter name must contain '{}' to verify ownership",
"Twitter bio must mention '{}' to verify ownership",
x_association_keywords
)),
)));
Expand Down Expand Up @@ -436,7 +436,7 @@ mod tests {
Ok(TwitterApiResponse {
data: Some(User {
id: "u1".to_string(),
name: format!("Test User {}", x_association_keywords),
name: "Test User".to_string(),
username: "test_user".to_string(),
description: Some(format!("I love {}", x_association_keywords)), // Contains keyword from config
public_metrics: None,
Expand Down