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

View File

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