about summary refs log tree commit diff
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-05-26T08·53+0200
committerVincent Ambo <github@tazj.in>2018-05-27T13·00+0200
commita14ece6af3a2d0f03af072c337ef50e311a79066 (patch)
tree91959834f373f9f3c486609199af99db26127644 /src/handlers.rs
parentc2a551146d04e5e69192cdf3799684f2f9be5104 (diff)
feat(errors): Introduce error variant for thread closing
(other minor change: log the user ID when invalid post editing
requests were constructed)
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index e5f21849fcf6..1c3d020e766e 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -207,7 +207,10 @@ pub fn edit_form(state: State<AppState>,
                 return Ok(post);
             }
 
-            Err(ConverseError::PostEditForbidden { id: post.id })
+            Err(ConverseError::PostEditForbidden {
+                user: user_id,
+                id: post.id,
+            })
         })
         .and_then(move |post| {
             let edit_msg = EditPostPage {
@@ -236,7 +239,10 @@ pub fn edit_post(state: State<AppState>,
             if user_id != 1 && post.user_id == user_id {
                  Ok(())
             } else {
-                Err(ConverseError::PostEditForbidden { id: post.id })
+                Err(ConverseError::PostEditForbidden {
+                    user: user_id,
+                    id: post.id,
+                })
             }
         })
         .and_then(move |_| state.db.send(update.0).from_err())