Skip to content

Commit fc01ad4

Browse files
committed
add requested changes
1 parent 3544b91 commit fc01ad4

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
-- Your SQL goes here
2-
ALTER TABLE users DROP COLUMN email CASCADE;
1+
ALTER TABLE users DROP COLUMN email CASCADE;

src/controllers/user/me.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ pub fn me(req: &mut dyn Request) -> CargoResult<Response> {
3838

3939
let verified = verified.unwrap_or(false);
4040
let verification_sent = verified || verification_sent;
41-
let user = User { ..user };
4241

4342
Ok(req.json(&EncodableMe {
44-
user: user.encodable_private(email, verified, verification_sent)?,
43+
user: user.encodable_private(email, verified, verification_sent),
4544
}))
4645
}
4746

src/models/user.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct User {
2020
pub gh_id: i32,
2121
}
2222

23-
/// Represents a new user record insertible to the `users` table
23+
/// Represents a new user record insertable to the `users` table
2424
#[derive(Insertable, Debug, Default)]
2525
#[table_name = "users"]
2626
pub struct NewUser<'a> {
@@ -186,10 +186,9 @@ impl User {
186186
pub fn encodable_private(
187187
self,
188188
email: Option<String>,
189-
190189
email_verified: bool,
191190
email_verification_sent: bool,
192-
) -> CargoResult<EncodablePrivateUser> {
191+
) -> EncodablePrivateUser {
193192
let User {
194193
id,
195194
name,
@@ -199,7 +198,7 @@ impl User {
199198
} = self;
200199
let url = format!("https://github.com/{}", gh_login);
201200

202-
Ok(EncodablePrivateUser {
201+
EncodablePrivateUser {
203202
id,
204203
email,
205204
email_verified,
@@ -208,7 +207,7 @@ impl User {
208207
login: gh_login,
209208
name,
210209
url: Some(url),
211-
})
210+
}
212211
}
213212

214213
/// Queries for the email belonging to a particular user

src/tests/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ impl TestApp {
136136

137137
let user = self.db(|conn| {
138138
let email = "[email protected]";
139+
139140
let user = crate::new_user(username)
140-
.create_or_update(Some(email), conn)
141+
.create_or_update(None, conn)
141142
.unwrap();
142143
diesel::insert_into(emails::table)
143144
.values((

0 commit comments

Comments
 (0)