1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use serde::{Deserialize, Serialize};
use url::Url;
use crate::v1::types::{misc::Color, text::Language, MediaId};
#[cfg(feature = "utoipa")]
use utoipa::ToSchema;
// TODO: switch to a common profile structure between room, thread, user, etc info?
/// generic profile data thing
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct Profile {
pub name: String,
pub description: Option<String>,
/// avatar, profile picture, icon. always square.
pub avatar: Option<MediaId>,
/// a larger background image
// TODO: does it have a constant aspect ratio? if so, what is it?
pub banner: Option<MediaId>,
/// list of preferred locales, in order of most to least preferred
pub languages: Vec<Language>,
// a color? could be useful, unsure what it would be used for. needs ui design.
pub color: Color,
/// links to other websites
pub links: Vec<ProfileUrl>,
}
/// minor profile for things like tags/roles
// NOTE: what do i remove, what do i keep? is it this even necessary to have a separate struct?
// well, i guess banner and languages don't make much sense for roles and tags.
// or i guess i could create separate "topic"(?) pages for them.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct ProfileMinor {
pub name: String,
pub description: Option<String>,
/// always a square image
pub icon: Option<MediaId>,
// a color? could be useful, unsure what it would be used for. needs ui design.
pub color: Color,
}
// does it make sense to allow overriding to `null`? eg. description, avatar, etc
// whats the ui design like? overrides existing for both rooms and threads might be confusing
// do overrides persist (keep name, avatar, etc) for historical messages? again, might be cool, might be annoying
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct ProfileOverride {
pub override_name: Option<String>,
pub override_description: Option<String>,
pub override_avatar: Option<MediaId>,
pub override_banner: Option<MediaId>,
pub override_color: Option<Color>,
/// prepended instead of replaced
pub extra_languages: Vec<Language>,
/// prepended (in a new section?) instead of replaced
pub extra_links: Vec<ProfileUrl>,
}
/// a link to another website
// maybe parse some types of urls, extract usernames, generate embeds, idk
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct ProfileUrl {
pub url: Url,
pub verified: bool,
}