Skip to content

Commit 7305e11

Browse files
Make owner invites case-insensitive
Co-authored-by: Yuki Okushi <[email protected]>
1 parent de16f1d commit 7305e11

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/models/owner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Owner {
7171
)?))
7272
} else {
7373
users::table
74-
.filter(users::gh_login.eq(name))
74+
.filter(crate::lower(users::gh_login).eq(name.to_lowercase()))
7575
.filter(users::gh_id.ne(-1))
7676
.order(users::gh_id.desc())
7777
.first(conn)

src/tests/owners.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ fn new_crate_owner() {
9292
let crate_to_publish = PublishBuilder::new("foo_owner").version("1.0.0");
9393
token.enqueue_publish(crate_to_publish).good();
9494

95-
// Add the second user as an owner
96-
let user2 = app.db_new_user("bar");
97-
token.add_user_owner("foo_owner", "bar");
95+
// Add the second user as an owner (with a different case to make sure that works)
96+
let user2 = app.db_new_user("Bar");
97+
token.add_user_owner("foo_owner", "BAR");
9898

9999
// accept invitation for user to be added as owner
100100
let crate_id = app.db(|conn| Crate::by_name("foo_owner").first::<Crate>(conn).unwrap().id);
@@ -104,7 +104,7 @@ fn new_crate_owner() {
104104
let crates = user2.search_by_user_id(user2.as_model().id);
105105
assert_eq!(crates.crates.len(), 1);
106106

107-
// And upload a new crate as the second user
107+
// And upload a new version as the second user
108108
let crate_to_publish = PublishBuilder::new("foo_owner").version("2.0.0");
109109
user2
110110
.db_new_token("bar_token")

0 commit comments

Comments
 (0)