zulip/zerver/lib/bugdown
Rohitt Vashishtha 3892a8afd8 messages: Set has_attachment correctly using Bugdown.
Previously, we would naively set has_attachment just by searching
the whole messages for strings like `/user_uploads/...`. We now
prevent running do_claim_attachments for messages that obviously
do not have an attachment in them that we previously ran.

For example: attachments in codeblocks or
             attachments that otherwise do not match our link syntax.

The new implementation runs that check on only the urls that
bugdown determines should be rendered. We also refactor some
Attachment tests in test_messages to test this change.

The new method is:

1. Create a list of potential_attachment_urls in Bugdown while rendering.
2. Loop over this list in do_claim_attachments for the actual claiming.
   For saving:
3. If we claimed an attachment, set message.has_attachment to True.
   For updating:
3. If claimed_attachment != message.has_attachment: update has_attachment.

We do not modify the logic for 'unclaiming' attachments when editing.
2019-12-11 11:03:44 -08:00
..
__init__.py messages: Set has_attachment correctly using Bugdown. 2019-12-11 11:03:44 -08:00
api_arguments_table_generator.py bugdown: Cast enum elements to string in APIArgumentsTablePreprocessor. 2019-10-07 11:42:52 -07:00
api_code_examples.py openapi: Specify securityScheme for the API in root level. 2019-12-06 11:19:08 -08:00
fenced_code.py openapi: Suggest the -sS options to curl. 2019-08-17 11:35:08 -07:00
help_emoticon_translations_table.py templates: Fix more low-hanging HTML validation problems. 2019-04-23 13:00:59 -07:00
help_relative_links.py bugdown: Remove unused imports. 2019-02-02 17:25:22 -08:00
help_settings_links.py exports: Update wording on settings page, /help and /features. 2019-08-22 13:17:03 -07:00
include.py bugdown: Remove unused imports. 2019-02-02 17:25:22 -08:00
nested_code_blocks.py bugdown: Remove unused imports. 2019-02-02 17:25:22 -08:00
tabbed_sections.py help: Make minor updates to import-from-mattermost. 2019-04-16 17:49:42 -07:00
testing_mocks.py zerver/lib: Change use of typing.Text to str. 2018-05-10 14:19:49 -07:00
tlds-alpha-by-domain.txt