add: user follow requests
add: nsfw questions fix: inherit nsfw status from questions fix: inherit community from questions
This commit is contained in:
parent
d6c7372610
commit
ad17acec98
24 changed files with 492 additions and 59 deletions
|
@ -322,6 +322,14 @@ impl UserFollow {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum FollowResult {
|
||||
/// Request sent to follow other user.
|
||||
Requested,
|
||||
/// Successfully followed other user.
|
||||
Followed,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct UserBlock {
|
||||
pub id: usize,
|
||||
|
|
|
@ -307,6 +307,8 @@ pub struct Question {
|
|||
pub likes: isize,
|
||||
#[serde(default)]
|
||||
pub dislikes: isize,
|
||||
#[serde(default)]
|
||||
pub context: QuestionContext,
|
||||
}
|
||||
|
||||
impl Question {
|
||||
|
@ -326,6 +328,19 @@ impl Question {
|
|||
community: 0,
|
||||
likes: 0,
|
||||
dislikes: 0,
|
||||
context: QuestionContext::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct QuestionContext {
|
||||
#[serde(default)]
|
||||
pub is_nsfw: bool,
|
||||
}
|
||||
|
||||
impl Default for QuestionContext {
|
||||
fn default() -> Self {
|
||||
Self { is_nsfw: false }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,10 @@ pub enum ActionType {
|
|||
///
|
||||
/// `questions` table.
|
||||
Answer,
|
||||
/// A request follow a private account.
|
||||
///
|
||||
/// `users` table.
|
||||
Follow,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue