discourse/spec/serializers
Martin Brennan 7c32411881
FEATURE: Secure media allowing duplicated uploads with category-level privacy and post-based access rules (#8664)
### General Changes and Duplication

* We now consider a post `with_secure_media?` if it is in a read-restricted category.
* When uploading we now set an upload's secure status straight away.
* When uploading if `SiteSetting.secure_media` is enabled, we do not check to see if the upload already exists using the `sha1` digest of the upload. The `sha1` column of the upload is filled with a `SecureRandom.hex(20)` value which is the same length as `Upload::SHA1_LENGTH`. The `original_sha1` column is filled with the _real_ sha1 digest of the file. 
* Whether an upload `should_be_secure?` is now determined by whether the `access_control_post` is `with_secure_media?` (if there is no access control post then we leave the secure status as is).
* When serializing the upload, we now cook the URL if the upload is secure. This is so it shows up correctly in the composer preview, because we set secure status on upload.

### Viewing Secure Media

* The secure-media-upload URL will take the post that the upload is attached to into account via `Guardian.can_see?` for access permissions
* If there is no `access_control_post` then we just deliver the media. This should be a rare occurrance and shouldn't cause issues as the `access_control_post` is set when `link_post_uploads` is called via `CookedPostProcessor`

### Removed

We no longer do any of these because we do not reuse uploads by sha1 if secure media is enabled.

* We no longer have a way to prevent cross-posting of a secure upload from a private context to a public context.
* We no longer have to set `secure: false` for uploads when uploading for a theme component.
2020-01-16 13:50:27 +10:00
..
admin_plugin_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
admin_user_list_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
basic_group_serializer_spec.rb FIX: Keep emoji images in group bio excerpt (#8329) 2019-11-11 18:42:08 +02:00
basic_group_user_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
basic_post_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
basic_user_serializer_spec.rb FIX: correct user serializer user method for extended serializer (#8590) 2019-12-19 09:48:01 -08:00
category_detailed_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
category_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
category_upload_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
current_user_serializer_spec.rb FIX: Muted tags are respected by TopicTrackingState (#8467) 2019-12-10 09:50:05 +11:00
group_show_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
new_post_result_serializer_spec.rb Support for custom messages and redirects when creating posts (#8434) 2019-11-29 09:30:54 -05:00
notification_serializer_spec.rb FIX: Include user id in notification webhook (#8195) 2019-10-21 16:24:41 -06:00
post_revision_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
post_serializer_spec.rb FIX: Hide old bookmark button on post-menu if SiteSetting.enable_bookmarks_with_reminders 2019-12-12 16:28:01 +10:00
reviewable_flagged_post_serializer_spec.rb Fix the actual failing test 2019-11-14 16:20:45 -08:00
reviewable_queued_post_serializer_spec.rb FEATURE: Allow viewing of raw emails for reviewable queued posts (#7910) 2019-07-19 11:56:14 -04:00
reviewable_serializer_spec.rb Fix the actual failing test 2019-11-14 16:20:45 -08:00
reviewable_user_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
single_sign_on_record_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
site_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
suggested_topic_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
tag_group_serializer_spec.rb FEATURE: Tag synonyms 2019-12-04 13:33:51 -05:00
theme_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
topic_link_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
topic_list_item_serializer_spec.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
topic_list_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
topic_view_posts_serializer_spec.rb PERF: optimize lookup of reviewable info in post stream 2019-06-07 18:12:30 +10:00
topic_view_serializer_spec.rb FEATURE: wiki editors are allowed edit tags for wiki topics. 2019-10-23 23:35:38 +05:30
upload_serializer_spec.rb FEATURE: Secure media allowing duplicated uploads with category-level privacy and post-based access rules (#8664) 2020-01-16 13:50:27 +10:00
user_auth_token_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
user_serializer_spec.rb PERF: Reduce DB queries when serializing ignore/mute information (#8629) 2020-01-02 13:04:08 +00:00
user_summary_serializer_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
web_hook_post_serializer_spec.rb Fix the WebHookPostSerializer spec. 2019-12-04 23:30:04 +05:30
web_hook_topic_view_serializer_spec.rb DEV: Prefabrication (test optimization) (#7414) 2019-05-07 13:12:20 +10:00
web_hook_user_serializer_spec.rb FEATURE: Featured topic for user profile & card (#8461) 2019-12-09 11:15:47 -08:00