update default license (#659)

fix #595
This commit is contained in:
fdb-hiroshima 2019-08-27 21:47:45 +02:00 committed by Ana Gelez
parent bf7603d439
commit 83cad55b22
2 changed files with 5 additions and 0 deletions

View file

@ -149,6 +149,7 @@ impl Instance {
open_registrations: bool,
short_description: SafeString,
long_description: SafeString,
default_license: String,
) -> Result<()> {
let (sd, _, _) = md_to_html(
short_description.as_ref(),
@ -170,6 +171,7 @@ impl Instance {
instances::long_description.eq(long_description),
instances::short_description_html.eq(sd),
instances::long_description_html.eq(ld),
instances::default_license.eq(default_license),
))
.execute(conn)
.map(|_| ())
@ -482,6 +484,7 @@ pub(crate) mod tests {
false,
SafeString::new("[short](#link)"),
SafeString::new("[long_description](/with_link)"),
"CC-BY-SAO".to_owned(),
)
.unwrap();
let inst = Instance::get(conn, inst.id).unwrap();
@ -500,6 +503,7 @@ pub(crate) mod tests {
inst.short_description_html,
SafeString::new("<p><a href=\"#link\">short</a></p>\n")
);
assert_eq!(inst.default_license, "CC-BY-SAO".to_owned());
Ok(())
});

View file

@ -136,6 +136,7 @@ pub fn update_settings(
form.open_registrations,
form.short_description.clone(),
form.long_description.clone(),
form.default_license.clone(),
)
.expect("instance::update_settings: save error");
Flash::success(