File tree Expand file tree Collapse file tree
migrations/2019-11-11-162609_drop_email_from_user Expand file tree Collapse file tree 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> {
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
Original file line number Diff line number Diff 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" ]
2626pub 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
Original file line number Diff line number Diff line change @@ -136,8 +136,9 @@ impl TestApp {
136136
137137 let user = self . db ( |conn| {
138138 let email = "cow@mammals.milk" ;
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 ( (
You can’t perform that action at this time.
0 commit comments