From: David ‘Bombe’ Roden Date: Wed, 12 Jan 2011 12:44:07 +0000 (+0100) Subject: Merge branch 'next' into profile-fields X-Git-Tag: 0.4^2~9^2~40 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8c251a1b15c1d8a8a2766e55e6decf10e9330bbe;p=Sone.git Merge branch 'next' into profile-fields --- 8c251a1b15c1d8a8a2766e55e6decf10e9330bbe diff --cc src/main/java/net/pterodactylus/sone/web/EditProfilePage.java index 1183100,01d4815..5b2c301 --- a/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java +++ b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java @@@ -63,27 -64,27 +64,27 @@@ public class EditProfilePage extends So Integer birthMonth = profile.getBirthMonth(); Integer birthYear = profile.getBirthYear(); if (request.getMethod() == Method.POST) { - firstName = request.getHttpRequest().getPartAsStringFailsafe("first-name", 256).trim(); - middleName = request.getHttpRequest().getPartAsStringFailsafe("middle-name", 256).trim(); - lastName = request.getHttpRequest().getPartAsStringFailsafe("last-name", 256).trim(); - birthDay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-day", 256).trim()); - birthMonth = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-month", 256).trim()); - birthYear = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-year", 256).trim()); - profile.setFirstName(firstName.length() > 0 ? firstName : null); - profile.setMiddleName(middleName.length() > 0 ? middleName : null); - profile.setLastName(lastName.length() > 0 ? lastName : null); - profile.setBirthDay(birthDay).setBirthMonth(birthMonth).setBirthYear(birthYear); - if (profile.isModified()) { + if (request.getHttpRequest().getPartAsStringFailsafe("saveProfile", 4).equals("true")) { + firstName = request.getHttpRequest().getPartAsStringFailsafe("first-name", 256).trim(); + middleName = request.getHttpRequest().getPartAsStringFailsafe("middle-name", 256).trim(); + lastName = request.getHttpRequest().getPartAsStringFailsafe("last-name", 256).trim(); + birthDay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-day", 256).trim()); + birthMonth = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-month", 256).trim()); + birthYear = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("birth-year", 256).trim()); + profile.setFirstName(firstName.length() > 0 ? firstName : null); + profile.setMiddleName(middleName.length() > 0 ? middleName : null); + profile.setLastName(lastName.length() > 0 ? lastName : null); + profile.setBirthDay(birthDay).setBirthMonth(birthMonth).setBirthYear(birthYear); currentSone.setProfile(profile); + throw new RedirectException("index.html"); } - throw new RedirectException("index.html"); } - template.set("firstName", firstName); - template.set("middleName", middleName); - template.set("lastName", lastName); - template.set("birthDay", birthDay); - template.set("birthMonth", birthMonth); - template.set("birthYear", birthYear); + dataProvider.set("firstName", firstName); + dataProvider.set("middleName", middleName); + dataProvider.set("lastName", lastName); + dataProvider.set("birthDay", birthDay); + dataProvider.set("birthMonth", birthMonth); + dataProvider.set("birthYear", birthYear); } }