feat: add optional mood to thoughts with custom moods support
Mood is an optional label+emoji string (e.g. "relaxed 😌") on thoughts.
Users can define up to 8 custom moods in profile settings.
Mood federates via AP Note JSON and displays on thought cards.
This commit is contained in:
@@ -32,6 +32,14 @@ pub fn to_user_response(u: &domain::models::user::User) -> UserResponse {
|
||||
value: v.clone(),
|
||||
})
|
||||
.collect(),
|
||||
custom_moods: u
|
||||
.custom_moods
|
||||
.iter()
|
||||
.map(|(n, v)| ProfileField {
|
||||
name: n.clone(),
|
||||
value: v.clone(),
|
||||
})
|
||||
.collect(),
|
||||
local: u.local,
|
||||
is_followed_by_viewer: false,
|
||||
created_at: u.created_at,
|
||||
@@ -48,6 +56,7 @@ pub fn to_summary_response(u: &UserSummary) -> UserResponse {
|
||||
header_url: None,
|
||||
custom_css: None,
|
||||
profile_fields: vec![],
|
||||
custom_moods: vec![],
|
||||
local: true,
|
||||
is_followed_by_viewer: false,
|
||||
created_at: chrono::Utc::now(),
|
||||
|
||||
@@ -109,6 +109,7 @@ pub fn to_thought_response(e: &domain::models::feed::FeedEntry) -> ThoughtRespon
|
||||
created_at: e.thought.created_at,
|
||||
updated_at: e.thought.updated_at,
|
||||
note_extensions: e.thought.note_extensions.clone(),
|
||||
mood: e.thought.mood.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ pub async fn post_thought(
|
||||
visibility: body.visibility,
|
||||
content_warning: body.content_warning,
|
||||
sensitive: body.sensitive.unwrap_or(false),
|
||||
mood: body.mood,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -117,6 +117,9 @@ pub async fn patch_profile(
|
||||
profile_fields: body
|
||||
.profile_fields
|
||||
.map(|f| f.into_iter().map(|pf| (pf.name, pf.value)).collect()),
|
||||
custom_moods: body
|
||||
.custom_moods
|
||||
.map(|f| f.into_iter().map(|pf| (pf.name, pf.value)).collect()),
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user