]> Untitled Git - lemmy.git/commitdiff
Getting your votes on a user details page.
authorDessalines <tyhou13@gmx.com>
Mon, 29 Apr 2019 21:19:00 +0000 (14:19 -0700)
committerDessalines <tyhou13@gmx.com>
Mon, 29 Apr 2019 21:19:00 +0000 (14:19 -0700)
server/src/websocket_server/server.rs
ui/src/services/WebSocketService.ts

index fb551cb31452bb79d16d7fd11bc2a297fcaabd17..fef60e8b4b03ba1160322e3d3b73a42681aafe8a 100644 (file)
@@ -323,6 +323,7 @@ pub struct GetUserDetails {
   limit: Option<i64>,
   community_id: Option<i32>,
   saved_only: bool,
+  auth: Option<String>,
 }
 
 #[derive(Serialize, Deserialize)]
@@ -2069,6 +2070,19 @@ impl Perform for GetUserDetails {
 
     let conn = establish_connection();
 
+    let user_id: Option<i32> = match &self.auth {
+      Some(auth) => {
+        match Claims::decode(&auth) {
+          Ok(claims) => {
+            let user_id = claims.claims.id;
+            Some(user_id)
+          }
+          Err(_e) => None
+        }
+      }
+      None => None
+    };
+
     //TODO add save
     let sort = SortType::from_str(&self.sort)?;
 
@@ -2099,7 +2113,7 @@ impl Perform for GetUserDetails {
                      self.community_id, 
                      Some(user_details_id), 
                      None, 
-                     None
+                     user_id
                      self.saved_only, 
                      false, 
                      self.page, 
@@ -2121,7 +2135,7 @@ impl Perform for GetUserDetails {
                         None, 
                         Some(user_details_id), 
                         None, 
-                        None
+                        user_id
                         self.saved_only, 
                         self.page, 
                         self.limit)?
index 06e604e95fb4326dcbd397e1642889194d40b50b..2b30f7d8f763dd2e0483fd1c5d5874abbacc82ff 100644 (file)
@@ -147,6 +147,7 @@ export class WebSocketService {
   }
 
   public getUserDetails(form: GetUserDetailsForm) {
+    this.setAuth(form, false);
     this.subject.next(this.wsSendWrapper(UserOperation.GetUserDetails, form));
   }