discourse/spec
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
..
components FEATURE: add user_session_refreshed trigger (#9412) 2020-04-14 09:32:24 -07:00
fabricators FEATURE: Webhooks and Event for user being granted a badge 2020-04-08 14:38:30 -07:00
fixtures FIX: Bulk badge awards should work even if the CSV has nil values 2020-02-27 11:08:24 -03:00
helpers DEV: Fix some more flaky tests (#9384) 2020-04-08 12:46:43 +02:00
import_export FIX: Import sub-sub-categories (#8810) 2020-01-30 18:46:33 +02:00
initializers FIX: We need to skip users with associated reviewables when auto-approving (#9080) 2020-03-02 14:33:52 -05:00
integration FEATURE: Hash user API keys in the database (#9344) 2020-04-07 16:42:52 +03:00
integrity DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
jobs FEATURE: enforce_canonical_emails site setting 2020-04-14 14:16:30 +10:00
lib DEV: Only include "report-sample" CSP directive when reporting is enabled (#9337) 2020-04-02 11:16:38 -04:00
mailers DEV: Add rubocop-rspec (#9288) 2020-03-27 17:35:40 +01:00
models FEATURE: New site setting embed_unlisted (#9391) 2020-04-13 15:17:02 -04:00
multisite FIX: Change secure media to encompass attachments as well (#9271) 2020-03-26 07:16:02 +10:00
requests DEV: Confirm email when creating users via the API 2020-04-14 14:56:32 -06: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
support FIX: respect automatic group membership when sso changes email 2020-04-08 16:33:50 +10:00
tasks DEV: Fix flaky time sensitive uploads.rake specs (#9283) 2020-03-26 13:31:39 +10:00
views/omniauth_callbacks FEATURE: Use full page redirection for all external auth methods (#8092) 2019-10-08 12:10:43 +01:00
rails_helper.rb DEV: reduce logging when no external id is specified 2020-04-08 12:42:28 +10:00