File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed
migrations/2019-11-11-162609_drop_email_from_user Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 1
- -- Your SQL goes here
2
- ALTER TABLE users DROP COLUMN email CASCADE;
1
+ ALTER TABLE users DROP COLUMN email CASCADE;
Original file line number Diff line number Diff line change @@ -38,10 +38,9 @@ pub fn me(req: &mut dyn Request) -> CargoResult<Response> {
38
38
39
39
let verified = verified. unwrap_or ( false ) ;
40
40
let verification_sent = verified || verification_sent;
41
- let user = User { ..user } ;
42
41
43
42
Ok ( req. json ( & EncodableMe {
44
- user : user. encodable_private ( email, verified, verification_sent) ? ,
43
+ user : user. encodable_private ( email, verified, verification_sent) ,
45
44
} ) )
46
45
}
47
46
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ pub struct User {
20
20
pub gh_id : i32 ,
21
21
}
22
22
23
- /// Represents a new user record insertible to the `users` table
23
+ /// Represents a new user record insertable to the `users` table
24
24
#[ derive( Insertable , Debug , Default ) ]
25
25
#[ table_name = "users" ]
26
26
pub struct NewUser < ' a > {
@@ -186,10 +186,9 @@ impl User {
186
186
pub fn encodable_private (
187
187
self ,
188
188
email : Option < String > ,
189
-
190
189
email_verified : bool ,
191
190
email_verification_sent : bool ,
192
- ) -> CargoResult < EncodablePrivateUser > {
191
+ ) -> EncodablePrivateUser {
193
192
let User {
194
193
id,
195
194
name,
@@ -199,7 +198,7 @@ impl User {
199
198
} = self ;
200
199
let url = format ! ( "https://github.com/{}" , gh_login) ;
201
200
202
- Ok ( EncodablePrivateUser {
201
+ EncodablePrivateUser {
203
202
id,
204
203
email,
205
204
email_verified,
@@ -208,7 +207,7 @@ impl User {
208
207
login : gh_login,
209
208
name,
210
209
url : Some ( url) ,
211
- } )
210
+ }
212
211
}
213
212
214
213
/// Queries for the email belonging to a particular user
Original file line number Diff line number Diff line change @@ -136,8 +136,9 @@ impl TestApp {
136
136
137
137
let user = self . db ( |conn| {
138
138
let email = "cow@mammals.milk" ;
139
+
139
140
let user = crate :: new_user ( username)
140
- . create_or_update ( Some ( email ) , conn)
141
+ . create_or_update ( None , conn)
141
142
. unwrap ( ) ;
142
143
diesel:: insert_into ( emails:: table)
143
144
. values ( (
You can’t perform that action at this time.
0 commit comments