]> git.openstreetmap.org Git - rails.git/commit
Use hash-based flash objects to render complex flash messages
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 23 Jun 2021 15:26:50 +0000 (16:26 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 23 Jun 2021 19:10:55 +0000 (20:10 +0100)
commit24f6aeda6a1b657d68a4e66f3a34d14ef408d652
tree39f75abd34183b895f0bf1a69eb61414b00478a5
parentf6818bb2ed53f18548e301b3c120139851ad2e11
Use hash-based flash objects to render complex flash messages

Since flash objects can only be String, Hash or Array (notably excluding SafeBuffers), then this approach is necessary to render complex html in a safe manner.

Each local can be treated as an (unsafe) string, and therefore escaped normally when rendered into the template. The template (and translation strings) can
contain html since they are no longer stored in the flash as a plain string.

Fixes #3215
app/controllers/confirmations_controller.rb
app/helpers/application_helper.rb
app/views/confirmations/_resend_success_flash.html.erb [new file with mode: 0644]
app/views/layouts/_flash.html.erb
test/controllers/confirmations_controller_test.rb
test/system/confirmation_resend.rb [new file with mode: 0644]