feat(mm-client, mm-bridge): resolve sender display names in history
- Add User::display_name() helper (first+last name, fallback to username) - Add get_users_by_ids batch endpoint in mm-client - Add user_display_name field to Post model (skip_deserializing) - Enrich posts in handle_get_history via single /users/ids request - Emacs already uses user_display_name when available
This commit is contained in:
@@ -51,6 +51,20 @@ pub struct User {
|
||||
pub last_name: String,
|
||||
}
|
||||
|
||||
impl User {
|
||||
/// Human-readable display name: "First Last", falling back to username.
|
||||
pub fn display_name(&self) -> String {
|
||||
let full = format!("{} {}", self.first_name, self.last_name)
|
||||
.trim()
|
||||
.to_string();
|
||||
if full.is_empty() {
|
||||
self.username.clone()
|
||||
} else {
|
||||
full
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Persisted per-server configuration (no secrets).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ServerConfig {
|
||||
@@ -88,4 +102,8 @@ pub struct Post {
|
||||
pub delete_at: i64,
|
||||
#[serde(default)]
|
||||
pub file_ids: Vec<String>,
|
||||
/// Populated by the bridge after resolving user_id via /users/ids.
|
||||
/// Skipped during deserialization from Mattermost API.
|
||||
#[serde(default, skip_deserializing)]
|
||||
pub user_display_name: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user