produces = "application/json")
@ResponseBody
@Timed
public Preferences updatePreferences(@RequestBody Preferences newPreferences, HttpServletResponse response) {
this.log.debug("REST request to set account's preferences");
Preferences preferences = null;
try {
User currentUser = authenticationService.getCurrentUser();
currentUser.setPreferencesMentionEmail(newPreferences.getMentionEmail());
currentUser.setDailyDigestSubscription(newPreferences.getDailyDigest());
currentUser.setWeeklyDigestSubscription(newPreferences.getWeeklyDigest());
String rssUid = userService.updateRssTimelinePreferences(newPreferences.getRssUidActive());
currentUser.setRssUid(rssUid);
preferences = new Preferences(currentUser);
userService.updateUser(currentUser);
userService.updateDailyDigestRegistration(newPreferences.getDailyDigest());
userService.updateWeeklyDigestRegistration(newPreferences.getWeeklyDigest());