discourse/spec/lib
Régis Hanol 5fcb7c262d
FIX: prevents duplicate attachments in incoming emails (#25986)
## What?

Depending on the email software used, when you reply to an email that has some attachments, they will be sent along, since they're part of the embedded (replied to) email.

When Discourse processes the reply as an incoming email, it will automatically add all the (valid) attachments at the end of the post. Including those that were sent as part of the "embedded reply".

This generates posts in Discourse with duplicate attachments 🙁

## How?

When processing attachments of an incoming email, before we add it to the bottom of the post, we check it against all the previous uploads in the same topic. If there already is an `Upload` record, it means that it's a duplicate and it is _therefore_ skipped.

All the inline attachments are left untouched since they're more likely new attachments added by the sender.
2024-03-01 18:38:49 +01:00
..
auth FEATURE: Add scheduled Twitter login problem check - Part 1 (#25830) 2024-02-26 12:08:12 +08:00
backup_restore DEV: Use freeze_time_safe in more places (#25949) 2024-03-01 10:07:35 +10:00
common_passwords DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
compression
concern FIX: Webauthn origin was incorrect for subfolder setups (#25651) 2024-02-12 16:27:24 -05:00
content_security_policy Revert "FIX: Omit CSP nonce and hash values when unsafe-inline enabled (#25590)" (#25609) 2024-02-08 11:44:09 +00:00
discourse_webauthn FIX: Webauthn origin was incorrect for subfolder setups (#25651) 2024-02-12 16:27:24 -05:00
email FIX: prevents duplicate attachments in incoming emails (#25986) 2024-03-01 18:38:49 +01:00
file_store DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
final_destination FIX: FinalDestination::HTTP: validate address argument (#25407) 2024-01-24 18:50:42 -03:00
freedom_patches DEV: Fix reloading type map not clearing cache (#25924) 2024-02-28 14:56:15 +08:00
guardian DEV: Change min_trust_level_to_allow_profile_background to trust level setting (#25721) 2024-02-19 10:47:47 +10:00
highlight_js
i18n DEV: Update I18n to 1.13.0 (#21685) 2023-05-24 08:59:37 +08:00
imap DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
import
middleware DEV: Use freeze_time_safe in more places (#25949) 2024-03-01 10:07:35 +10:00
migration DEV: Allow `DROP NOT NULL` in pre-deploy migrations (#20775) 2023-03-22 14:43:32 +00:00
onebox FIX: Allow sanitized-HTML in GH issues and categories oneboxes. (#25374) 2024-01-22 15:25:29 -03:00
plugin DEV: Fix random typos (#25957) 2024-02-29 12:24:37 +01:00
pretty_text FEATURE: Async load of category and chat hashtags (#25526) 2024-02-12 12:07:14 +02:00
problem_check FEATURE: Add scheduled Twitter login problem check - Part 1 (#25830) 2024-02-26 12:08:12 +08:00
rate_limiter
scheduler PERF: Don't allow a single user to monopolize the defer queue (#25593) 2024-02-07 13:47:50 -06:00
second_factor DEV: Allow `run_second_factor!` to be used before login (#25420) 2024-01-29 12:28:47 +00:00
seed_data FIX: missing translation of guidelines_topic.body (#25505) 2024-01-31 15:33:09 -05:00
site_settings FIX: Account for moderators in group to TL mapping (#25326) 2024-01-19 11:10:28 +08:00
stylesheet DEV: Fix test incorrectly removing stylesheet cache of other processes (#25103) 2024-01-03 13:15:35 +08:00
summarization DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
svg_sprite DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
theme_settings_manager DEV: Validate objects when updating typed objects theme settings (#25902) 2024-02-28 10:33:22 +08:00
theme_store FEATURE: Theme settings migrations (#24071) 2023-11-02 08:10:15 +03:00
topic_query DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
turbo_tests/flaky DEV: Include exception details for each test in flaky tests report (#24892) 2023-12-14 11:11:11 +08:00
validators DEV: Move min_trust_to_post_embedded_media to group setting (#25238) 2024-01-25 09:50:59 +10:00
wizard DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
admin_confirmation_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
admin_user_index_query_spec.rb
archetype_spec.rb
bookmark_manager_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
bookmark_query_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
bookmark_reminder_notification_handler_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
browser_detection_spec.rb
cache_spec.rb
category_badge_spec.rb FIX: email category badges shouldn't use category text color (#25655) 2024-02-13 10:18:36 -05:00
category_guardian_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
color_math_spec.rb
composer_messages_finder_spec.rb FIX: do not show send pm prompt when user cant pm (#25912) 2024-02-27 11:54:05 +01:00
content_buffer_spec.rb
content_security_policy_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
cooked_post_processor_spec.rb DEV: Move min_trust_to_post_embedded_media to group setting (#25238) 2024-01-25 09:50:59 +10:00
crawler_detection_spec.rb
current_user_spec.rb
db_helper_spec.rb
directory_helper_spec.rb
discourse_diff_spec.rb
discourse_event_spec.rb
discourse_hub_spec.rb DEV: include more data in Discourse Discover enrollment payload. (#25846) 2024-02-25 10:42:50 +05:30
discourse_js_processor_spec.rb DEV: Merge root JS packages (#25857) 2024-02-26 13:45:58 +00:00
discourse_plugin_registry_spec.rb DEV: Remove sprockets from plugin 'extra js' pipeline (#25502) 2024-02-01 11:48:31 +00:00
discourse_redis_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
discourse_sourcemapping_url_processor_spec.rb
discourse_spec.rb FIX: Sort plugins by their setting category name (#25128) 2024-01-08 09:57:25 +10:00
discourse_tagging_spec.rb DEV: Convert min_trust_level_to_tag_topics to groups (#25273) 2024-01-26 13:25:03 +08:00
discourse_updates_spec.rb FEATURE: call hub API to update Discourse discover enrollment. (#25634) 2024-02-23 11:42:28 +05:30
distributed_cache_spec.rb
distributed_memoizer_spec.rb
distributed_mutex_spec.rb
email_cook_spec.rb
email_updater_spec.rb
ember_cli_spec.rb FIX: EmberCli cache clearance issue in production (#24343) 2023-11-13 10:34:06 +00:00
encodings_spec.rb
enum_spec.rb
excerpt_parser_spec.rb FIX: Internal oneboxes with github links (#22829) 2023-07-28 09:07:53 -06:00
feed_element_installer_spec.rb
feed_item_accessor_spec.rb
file_helper_spec.rb
filter_best_posts_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
final_destination_spec.rb FIX: Don't error out when trying to retrieve title and URL won't encode (#24660) 2023-12-01 15:03:06 +08:00
flag_settings_spec.rb
gaps_spec.rb
gc_stat_instrumenter_spec.rb DEV: Seperate concerns of tracking GC stat from `MethodProfiler` (#22921) 2023-08-02 10:46:37 +08:00
git_repo_spec.rb FEATURE: display commit hash for each plugin on `/admin/plugins` page. (#22176) 2023-06-26 10:09:57 +05:30
git_url_spec.rb
global_path_spec.rb
group_lookup_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
guardian_spec.rb FIX: is_my_own? check for users who are anonymously doing actions (#25716) 2024-02-16 14:28:12 +10:00
has_errors_spec.rb
hijack_spec.rb FIX: Ensure app-cdn CORS is not overridden by cors_origin setting (#24661) 2023-12-01 12:57:11 +00:00
html_prettify_spec.rb
html_to_markdown_spec.rb FIX: Remove newlines from img alt & title in HTML to markdown parser (#25473) 2024-01-31 10:23:09 +10:00
image_sizer_spec.rb
inline_oneboxer_spec.rb DEV: update syntax tree to latest (#24623) 2023-11-29 16:38:07 +11:00
js_locale_helper_spec.rb DEV: Merge root JS packages (#25857) 2024-02-26 13:45:58 +00:00
json_error_spec.rb
letter_avatar_spec.rb
message_id_service_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
method_profiler_spec.rb DEV: Seperate concerns of tracking GC stat from `MethodProfiler` (#22921) 2023-08-02 10:46:37 +08:00
mini_sql_multisite_connection_spec.rb
mobile_detection_spec.rb
new_post_manager_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00
new_post_result_spec.rb
onebox_spec.rb
oneboxer_spec.rb DEV: Revert guardian changes (#24742) 2023-12-06 16:37:32 +10:00
onpdiff_spec.rb
password_hasher_spec.rb FEATURE: Persist password hashing algorithm/params in database (#20980) 2023-04-11 10:16:28 +01:00
pbkdf2_spec.rb
pinned_check_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
plain_text_to_markdown_spec.rb
post_action_creator_spec.rb DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
post_action_destroyer_spec.rb DEV: Convert min_trust_to_flag_posts setting to groups (#24864) 2023-12-13 17:18:42 +08:00
post_creator_spec.rb DEV: Use freeze_time_safe in more places (#25949) 2024-03-01 10:07:35 +10:00
post_destroyer_spec.rb DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
post_jobs_enqueuer_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
post_locker_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
post_merger_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
post_revisor_spec.rb DEV: Convert min_trust_level_to_tag_topics to groups (#25273) 2024-01-26 13:25:03 +08:00
presence_channel_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
pretty_text_spec.rb FIX: quoted private topic url respects subfolder install (#25643) 2024-02-13 13:20:24 +08:00
problem_check_spec.rb FEATURE: Add scheduled Twitter login problem check - Part 1 (#25830) 2024-02-26 12:08:12 +08:00
promotion_spec.rb FIX: Do not validate email in TL promotion (#20892) 2023-03-30 13:52:10 +10:00
quote_comparer_spec.rb DEV: Correct `Style/RedundantReturn` rubocop issues (#23052) 2023-08-10 02:03:38 +02:00
quote_rewriter_spec.rb DEV: Update display name in new quote format - Part 2 (#22104) 2023-06-26 11:01:59 +08:00
rate_limiter_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
retrieve_title_spec.rb FIX: Don't error out when trying to retrieve title and URL won't encode (#24660) 2023-12-01 15:03:06 +08:00
rtl_spec.rb
s3_cors_rulesets_spec.rb
s3_helper_spec.rb
s3_inventory_multisite_spec.rb
s3_inventory_spec.rb DEV: update syntax tree to latest (#24623) 2023-11-29 16:38:07 +11:00
score_calculator_spec.rb
scss_checker_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
search_spec.rb FIX: Remap postgres text search proximity operator (#25497) 2024-02-01 07:20:46 +08:00
secure_session_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
shrink_uploaded_image_spec.rb DEV: Move min_trust_to_post_embedded_media to group setting (#25238) 2024-01-25 09:50:59 +10:00
sidebar_section_links_updater_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
site_icon_manager_spec.rb
site_setting_extension_multisite_spec.rb
site_setting_extension_spec.rb DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
slug_spec.rb
spam_handler_spec.rb DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
suggested_topics_builder_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
system_message_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
text_cleaner_spec.rb
text_sentinel_spec.rb
theme_flag_modifier_spec.rb
theme_javascript_compiler_spec.rb DEV: Add gjs support for themes (#23473) 2023-10-02 12:36:06 +02:00
theme_settings_manager_spec.rb DEV: Refactor subclasses in `ThemeSettingsManager` to individual files (#25605) 2024-02-08 12:59:52 +08:00
theme_settings_object_validator_spec.rb DEV: Support topic, post, group, upload and tag type for theme objects setting (#25907) 2024-02-27 14:27:10 +08:00
theme_settings_parser_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
theme_settings_validator_spec.rb FIX: `ThemeSettingsValidator.validate_value` returning wrong error (#25901) 2024-02-27 15:46:12 +08:00
timeline_lookup_spec.rb
tiny_japanese_segmenter_spec.rb
topic_creator_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00
topic_publisher_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_query_spec.rb FIX: muted tags breaking hot page when filtered to tags (#25824) 2024-02-23 17:11:39 +11:00
topic_retriever_spec.rb
topic_upload_security_manager_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
topic_view_spec.rb DEV: Remove full group refreshes from tests (#25414) 2024-01-25 14:28:26 +08:00
topics_bulk_action_spec.rb DEV: Convert min_trust_level_to_tag_topics to groups (#25273) 2024-01-26 13:25:03 +08:00
topics_filter_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
trashable_spec.rb
truncate_logs_formatter_spec.rb SECURITY: Add a default limit as to when logs should be truncated 2023-10-16 10:34:38 -04:00
trust_level_spec.rb
twitter_api_spec.rb
unread_spec.rb
upload_creator_spec.rb PERF: Use `-ping` option to ImageMagick `identify` command (#25713) 2024-02-16 07:39:49 +08:00
upload_markdown_spec.rb
upload_recovery_spec.rb DEV: Move min_trust_to_post_embedded_media to group setting (#25238) 2024-01-25 09:50:59 +10:00
upload_security_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
url_helper_spec.rb FIX: Wrong argument error being thrown in UrlHelper (#24506) 2023-11-22 15:19:40 +10:00
user_comm_screener_spec.rb DEV: Update the rubocop-discourse gem 2023-06-26 11:41:52 +02:00
user_lookup_spec.rb
user_name_suggester_spec.rb DEV: Fix various spec linting issues (#24672) 2023-12-04 13:45:19 +01:00
version_spec.rb SECURITY: Add limits for themes and theme assets 2023-09-12 15:31:31 -03:00
work_queue_spec.rb PERF: Don't allow a single user to monopolize the defer queue (#25593) 2024-02-07 13:47:50 -06:00