[openstreetmap/openstreetmap-website] Separate forms for preferences and profile (#3257)

Andy Allan notifications at github.com
Wed Jul 21 10:10:56 UTC 2021


@gravitystorm commented on this pull request.



> +  layout "site"
+
+  before_action :authorize_web
+  before_action :set_locale
+
+  authorize_resource :class => false
+
+  before_action :check_database_readable
+  before_action :check_database_writable, :only => [:update]
+
+  def show; end
+
+  def edit; end
+
+  def update
+    current_user.languages = params[:user][:languages].split(",")

There's a small discussion of that in the commit message for 9b8f2bb, but the main reason for removing it is that we no longer render a page if the update is successful. We redirect instead, which means on the subsequent page load, the user object is freshly loaded and the page will show in the new language. If the save is unsuccessful, the form is rendered again but I think that's appropriate to show the original language.

The one tiny edge case is that the flash message shown will be in the original language, so I could change that if you think the complexity is worth it?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3257#discussion_r673842697
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210721/4d9c7e19/attachment.htm>


More information about the rails-dev mailing list