<p></p>
<p><b>@gravitystorm</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3257#discussion_r673842697">app/controllers/preferences_controller.rb</a>:</p>
<pre style='color:#555'>> + 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(",")
</pre>
<p>There's a small discussion of that in the commit message for <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/openstreetmap/openstreetmap-website/commit/9b8f2bbcbe2ce3a60919e6a0adcca2865f176090/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/commit/9b8f2bbcbe2ce3a60919e6a0adcca2865f176090"><tt>9b8f2bb</tt></a>, 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.</p>
<p>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?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3257#discussion_r673842697">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLKOIV72R3ITPV7B2G3TY2MLBANCNFSM5AL23W7Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLLIVP6LHZBCBB4GFX3TY2MLBA5CNFSM5AL23W72YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFJUGWLY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3257#discussion_r673842697",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3257#discussion_r673842697",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>