discourse/app
Krzysztof Kotlarek c21df2286c
FIX: add short_path to upload_serializer (#9417)
What problem I am trying to solve?

When an encrypted message is crafted and the image is added - discourse needs a hard refresh to display that image.

What is happening?

Everything starts here - when the upload is finished we add serialized object to the cache https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/composer-editor.js#L748:L757

Then, `discourse-encrypt` is trying to get an image from the cache and use `short_path` property
https://github.com/discourse/discourse-encrypt/blob/master/assets/javascripts/discourse/initializers/hook-decrypt-post.js.es6#L142:L143

Why is it working after a hard refresh?

After refresh, we populate cache once again using that function: https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/upload-short-url.js#L11:L17

And lookup_urls method from backend is returning `short_path`
https://github.com/discourse/discourse/blob/master/app/controllers/uploads_controller.rb#L55:L64

TL;DR We should expose short path in upload serializer. I ensured that this serializer is used only when attachments are uploaded so it should not affect performance.
2020-04-15 09:19:59 +10:00
..
assets DEV: pass widget back when cleaning up stream (#9422) 2020-04-14 18:45:40 +02:00
controllers DEV: Confirm email when creating users via the API 2020-04-14 14:56:32 -06:00
helpers FIX: Display small post actions when embedding a topic (#9278) 2020-03-26 09:07:41 -03:00
jobs FIX: CSV Exports were throwing errors with invalid dates 2020-04-07 14:05:27 -04:00
mailers FEATURE: High priority bookmark reminder notifications (#9290) 2020-04-01 09:09:20 +10:00
models FEATURE: enforce_canonical_emails site setting 2020-04-14 14:16:30 +10:00
serializers FIX: add short_path to upload_serializer (#9417) 2020-04-15 09:19:59 +10:00
services DEV: themes_install_task find existing themes consistently (#9424) 2020-04-14 14:20:21 -05:00
views UX: Improve published page avatar resolution (#9405) 2020-04-13 08:57:27 -07:00