From: Dessalines Date: Mon, 29 Apr 2019 21:19:00 +0000 (-0700) Subject: Getting your votes on a user details page. X-Git-Url: http://these/git/%7B%60https:/%7B%60css/themes/%22https:/nerdica.net/%7Bthis.props.site.site.icon%7D?a=commitdiff_plain;h=8e0cc3498e87941fec05ba79ff19bd65db6ec3c0;p=lemmy.git Getting your votes on a user details page. --- diff --git a/server/src/websocket_server/server.rs b/server/src/websocket_server/server.rs index fb551cb3..fef60e8b 100644 --- a/server/src/websocket_server/server.rs +++ b/server/src/websocket_server/server.rs @@ -323,6 +323,7 @@ pub struct GetUserDetails { limit: Option, community_id: Option, saved_only: bool, + auth: Option, } #[derive(Serialize, Deserialize)] @@ -2069,6 +2070,19 @@ impl Perform for GetUserDetails { let conn = establish_connection(); + let user_id: Option = 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)? diff --git a/ui/src/services/WebSocketService.ts b/ui/src/services/WebSocketService.ts index 06e604e9..2b30f7d8 100644 --- a/ui/src/services/WebSocketService.ts +++ b/ui/src/services/WebSocketService.ts @@ -147,6 +147,7 @@ export class WebSocketService { } public getUserDetails(form: GetUserDetailsForm) { + this.setAuth(form, false); this.subject.next(this.wsSendWrapper(UserOperation.GetUserDetails, form)); }