summaryrefslogtreecommitdiffstats
path: root/sys/nixpkgs/pkgs/comments/src/info_json.rs
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-02-11 16:07:52 +0100
committerSoispha <soispha@vhack.eu>2024-02-11 16:07:52 +0100
commit9ddb7d8548968a27ae222a74de5f1a6b953c485f (patch)
tree6097d7b959f427f18ab67d96ce776be69729a56a /sys/nixpkgs/pkgs/comments/src/info_json.rs
parentfix(hm/conf/taskwarrior): Correctly parse project.nix file (diff)
downloadnixos-config-9ddb7d8548968a27ae222a74de5f1a6b953c485f.zip
fix(sys/nixpkgs/pkgs/comments): Allow unknown comment author
Diffstat (limited to '')
-rw-r--r--sys/nixpkgs/pkgs/comments/src/info_json.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/nixpkgs/pkgs/comments/src/info_json.rs b/sys/nixpkgs/pkgs/comments/src/info_json.rs
index e479c320..70eae738 100644
--- a/sys/nixpkgs/pkgs/comments/src/info_json.rs
+++ b/sys/nixpkgs/pkgs/comments/src/info_json.rs
@@ -92,7 +92,7 @@ pub enum Parent {
impl Parent {
pub fn id(&self) -> Option<&str> {
if let Self::Id(id) = self {
- Some(&id)
+ Some(id)
} else {
None
}
@@ -130,6 +130,7 @@ pub struct Comment {
#[serde(default = "zero")]
pub like_count: u32,
pub author_id: String,
+ #[serde(default = "unknown")]
pub author: String,
pub author_thumbnail: String,
pub parent: Parent,
@@ -142,6 +143,9 @@ pub struct Comment {
pub author_is_uploader: bool,
pub is_favorited: bool,
}
+fn unknown() -> String {
+ "<Unknown>".to_string()
+}
fn zero() -> u32 {
0
}