Go to file
Mateusz Mandera da4443f392 thumbnail: Make thumbnailing work with data import.
We didn't have thumbnailing for images coming from data import and this
commit adds the functionality.

There are a few fundamental issues that the implementation needs to
solve.

1. The images come from an untrusted source and therefore we don't want
   to just pass them through to thumbnailing without checking. For that
   reason, we cannot just import ImageAttachment rows from the export
   data, even for zulip=>zulip imports.
   The right way to process images is to pass them to maybe_thumbail(),
   which runs libvips_check_image() on them to verify we're okay with
   thumbnailing, creates ImageAttachment rows for them and sends them
   to the thumbnailing queue worker. This approach lets us handle both
   zulip=>zulip and 3rd party=>zulip imports in the same way,

2. There is a somewhat circular dependency between the Message,
   Attachment and ImageAttachment import process:

- ImageAttachments would ideally be created after importing
  Attachments, but they need to already exist at the time of Message
  import. Otherwise, the markdown processor doesn't know it has to add
  HTML for image previews to messages that reference images. This would
  mean that messages imported from 3rd party tools don't get image
  previews.
- Attachments only get created after Message import however, due to the
  many-to-many relationship between Message and Attachment.

This is solved by fixing up some data of Attachments pre-emptively, such
as the path_ids. This gives us the necessary information for creating
ImageAttachments before importing Messages.

While we generate ImageAttachment rows synchronously, the actual
thumbnailing job is sent to the queue worker. Theoretically, the worker
could be very backlogged and not process the thumbnails anytime soon.
This is fine - if the app is loaded and tries to display a message with
such a not-yet-generated thumbnail, the code in `serve_file` will
generate the thumbnails synchronously on the fly and the user will see
the image preview displayed normally. See:

1b47134d0d/zerver/views/upload.py (L333-L342)
2024-10-24 10:32:51 -07:00
.github ci: Enable Python warnings. 2024-10-23 10:55:55 -07:00
.tx provision: Replace transifex-client with new transifex-cli. 2022-12-13 12:34:08 -08:00
.vscode
analytics test_counts: Remove mostly unused assert_table_count helper. 2024-10-20 18:16:27 -07:00
api_docs update_user_backend: Add API changelog entries. 2024-10-22 16:36:38 -07:00
confirmation migrations: Squash most confirmation migrations. 2024-08-23 17:15:35 -07:00
corporate requirements: Upgrade Python requirements. 2024-10-20 18:16:27 -07:00
docs contributor docs: Link to new guide on continuing prior work. 2024-10-21 18:33:28 -07:00
help help: Improve groups documentation. 2024-10-21 15:43:19 -07:00
help-beta dependencies: Upgrade JavaScript dependencies. 2024-10-04 08:47:07 -07:00
locale i18n: Update translation data from Transifex. 2024-07-25 12:34:41 -07:00
patches dependencies: Upgrade JavaScript dependencies. 2024-10-04 08:47:07 -07:00
pgroonga migrations: Import BaseDatabaseSchemaEditor from its canonical module. 2023-03-05 14:46:28 -08:00
puppet nagios: Switch staging hosts to not page, but send a zulip. 2024-10-08 16:55:07 -07:00
requirements requirements: Upgrade Python requirements. 2024-10-20 18:16:27 -07:00
scripts requirements: Upgrade Python requirements. 2024-10-20 18:16:27 -07:00
static avatar: Ensure system bots' avatar URLs follow convention. 2024-10-23 10:35:42 -07:00
stubs/taint endpoints: Remove the has_request_variables decorator. 2024-09-05 16:02:12 -07:00
templates realm_redirect: Change bottom text. 2024-10-23 11:47:45 -07:00
tools user_topic_popover: Convert module to TypeScript. 2024-10-23 15:26:46 -07:00
var/puppeteer
web user_group_popover: Fix icon alignment. 2024-10-24 08:24:14 -07:00
zerver thumbnail: Make thumbnailing work with data import. 2024-10-24 10:32:51 -07:00
zilencer zilencer: Avoid repeated emails about locally deleted realms. 2024-10-15 13:26:48 -07:00
zproject settings: Replace deprecated STATICFILES_STORAGE. 2024-10-23 10:55:55 -07:00
.codecov.yml
.codespellignore codespell: Fix spelling mistakes caught by codespell. 2024-05-31 14:32:33 -07:00
.editorconfig editorconfig: Use [[shell]] section for shfmt options. 2024-02-22 16:36:16 -05:00
.eslintignore web: Move web app to ‘web’ directory. 2023-02-23 16:04:17 -08:00
.eslintrc.js eslint: Fix unicorn/prefer-node-protocol. 2024-10-08 16:54:15 -07:00
.gitattributes .gitattributes: Mark *.bmp, *.bson, *.mp3, *.pdf as binary. 2022-02-07 18:51:06 -08:00
.gitignore tsconfig: Enable composite. 2024-06-09 12:08:03 -07:00
.gitlint lint: Update line-length for commit message to 72 in gitlint. 2023-05-01 10:35:52 -07:00
.mailmap mailmap: Canonicalize name for Kunal Sharma. 2024-07-25 11:23:44 -07:00
.npmignore
.npmrc dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
.prettierignore marked: Fix type stub to declare marked as a CommonJS module. 2024-06-08 00:26:38 -07:00
.pyre_configuration
.readthedocs.yaml readthedocs: Add a configuration file. 2023-02-03 16:36:54 -08:00
.sonarcloud.properties
CODE_OF_CONDUCT.md linter: Add check for comma after "e.g." in md files. 2024-07-05 15:36:24 -07:00
CONTRIBUTING.md contributor docs: Link to new guide on continuing prior work. 2024-10-21 18:33:28 -07:00
Dockerfile-postgresql docs: Fix grammar errors found by mwic. 2023-10-09 13:24:09 -07:00
LICENSE
NOTICE
README.md docs: Update Black and isort references to Ruff. 2024-07-17 18:33:21 -07:00
SECURITY.md docs: Update .html links pointing to "Upgrade Zulip" or "Modify Zulip". 2023-08-11 16:49:32 -07:00
Vagrantfile Upgrade development environment to Ubuntu 22.04. 2024-04-01 13:27:39 -07:00
manage.py ruff: Fix UP007 Use `X | Y` for type annotations. 2024-07-13 22:28:22 -07:00
package.json stylelint: Enable stylelint-high-performance-animation. 2024-10-23 14:56:39 -07:00
pnpm-lock.yaml stylelint: Enable stylelint-high-performance-animation. 2024-10-23 14:56:39 -07:00
pnpm-workspace.yaml help-beta: Create initial starlight project. 2024-08-02 18:18:01 -07:00
prettier.config.js
pyproject.toml restart-server: Wait until chain reload has completed. 2024-08-29 12:12:34 -07:00
stylelint.config.js stylelint: Enable stylelint-high-performance-animation. 2024-10-23 14:56:39 -07:00
tsconfig.json help-beta: Create initial starlight project. 2024-08-02 18:18:01 -07:00
version.py stylelint: Enable stylelint-high-performance-animation. 2024-10-23 14:56:39 -07:00

README.md

Zulip overview

Zulip is an open-source team collaboration tool with unique topic-based threading that combines the best of email and chat to make remote work productive and delightful. Fortune 500 companies, leading open source projects, and thousands of other organizations use Zulip every day. Zulip is the only modern team chat app that is designed for both live and asynchronous conversations.

Zulip is built by a distributed community of developers from all around the world, with 74+ people who have each contributed 100+ commits. With over 1000 contributors merging over 500 commits a month, Zulip is the largest and fastest growing open source team chat project.

Come find us on the development community chat!

GitHub Actions build status coverage status Mypy coverage Ruff code style: prettier GitHub release docs Zulip chat Twitter GitHub Sponsors

Getting started

You may also be interested in reading our blog, and following us on Twitter and LinkedIn.

Zulip is distributed under the Apache 2.0 license.