feat: add optional mood to thoughts with custom moods support
Some checks failed
lint / lint (push) Failing after 9m28s
test / unit (push) Successful in 16m8s

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:
2026-05-29 15:38:35 +02:00
parent be27fe04e2
commit 442a61bbdb
34 changed files with 294 additions and 42 deletions

View File

@@ -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(),

View File

@@ -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(),
}
}

View File

@@ -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?;

View File

@@ -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?;