add alias support for `unlisted`

This commit is contained in:
Peter Cai 2020-04-08 18:11:35 +08:00
parent 7de1212993
commit aa95d978ec
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
1 changed files with 5 additions and 0 deletions

View File

@ -80,6 +80,9 @@ struct CustomMetadata {
// and if the post were published, it will // and if the post were published, it will
// be removed from the public list // be removed from the public list
unlist: Option<bool>, unlist: Option<bool>,
// An alias because I always want to use `unlisted` for some reason
// `unlist` takes precedence over this alias
unlisted: Option<bool>,
url: Option<String>, url: Option<String>,
timestamp: Option<String> // Should be something `js_sys::Date::parse` could handle timestamp: Option<String> // Should be something `js_sys::Date::parse` could handle
} }
@ -134,6 +137,8 @@ fn build_metadata(custom: Option<CustomMetadata>, uuid: &str, title: &str) -> Me
if let Some(custom) = custom { if let Some(custom) = custom {
if let Some(unlist) = custom.unlist { if let Some(unlist) = custom.unlist {
ret.unlist = unlist; ret.unlist = unlist;
} else if let Some(unlisted) = custom.unlisted {
ret.unlist = unlisted;
} }
if let Some(url) = custom.url { if let Some(url) = custom.url {