mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 21:01:23 +00:00
Getting your votes on a user details page.
This commit is contained in:
parent
9570c21dca
commit
679ec011db
2 changed files with 17 additions and 2 deletions
|
@ -323,6 +323,7 @@ pub struct GetUserDetails {
|
||||||
limit: Option<i64>,
|
limit: Option<i64>,
|
||||||
community_id: Option<i32>,
|
community_id: Option<i32>,
|
||||||
saved_only: bool,
|
saved_only: bool,
|
||||||
|
auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -2069,6 +2070,19 @@ impl Perform for GetUserDetails {
|
||||||
|
|
||||||
let conn = establish_connection();
|
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
|
//TODO add save
|
||||||
let sort = SortType::from_str(&self.sort)?;
|
let sort = SortType::from_str(&self.sort)?;
|
||||||
|
|
||||||
|
@ -2099,7 +2113,7 @@ impl Perform for GetUserDetails {
|
||||||
self.community_id,
|
self.community_id,
|
||||||
Some(user_details_id),
|
Some(user_details_id),
|
||||||
None,
|
None,
|
||||||
None,
|
user_id,
|
||||||
self.saved_only,
|
self.saved_only,
|
||||||
false,
|
false,
|
||||||
self.page,
|
self.page,
|
||||||
|
@ -2121,7 +2135,7 @@ impl Perform for GetUserDetails {
|
||||||
None,
|
None,
|
||||||
Some(user_details_id),
|
Some(user_details_id),
|
||||||
None,
|
None,
|
||||||
None,
|
user_id,
|
||||||
self.saved_only,
|
self.saved_only,
|
||||||
self.page,
|
self.page,
|
||||||
self.limit)?
|
self.limit)?
|
||||||
|
|
|
@ -147,6 +147,7 @@ export class WebSocketService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUserDetails(form: GetUserDetailsForm) {
|
public getUserDetails(form: GetUserDetailsForm) {
|
||||||
|
this.setAuth(form, false);
|
||||||
this.subject.next(this.wsSendWrapper(UserOperation.GetUserDetails, form));
|
this.subject.next(this.wsSendWrapper(UserOperation.GetUserDetails, form));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue