zulip/zerver/lib
Mateusz Mandera 90636d5e81 events: Fix bug in get_recent_conversations_recipient_id.
user_profile.id was confused for user_profile.recipient_id. These bugs
are particularly sneaky as they can go undetected by tests due to ids of
objects accidentally coinciding. We add a mitigation for this class of
mistakes by shifting the Recipient.id sequence in test db.

This was introduced in dda3ff41e1.
On the rare occasion where user_profile.id would coincide with
recipient_id passed to the function, we would return the wrong value.
That is, instead of correctly returning recipient_id, we would return
sender.recipient_id - recipient id of the sender of the message, thus
possibly returning user_profile.recipient_id (if user_profile is the
sender) - exactly the situation the function wanted to avoid
with the `if recipient_id == my_recipient_id:` if. Ultimately resulting
in incorrect/malformed data in
state['raw_recent_private_conversations'].
2021-02-09 17:45:34 -08:00
..
markdown api docs: Cleaned up CSS for parameter classes. 2021-02-09 10:31:36 -08:00
url_preview url preview: Update Zulip User-Agent. 2021-01-25 14:24:48 -08:00
webhooks newrelic: Added owner field and cleaned up code. 2020-12-15 12:04:46 -08:00
__init__.py
actions.py minor: Clean up code formatting for do_create_user. 2021-02-08 09:07:04 -05:00
addressee.py addressee: Remove redundant casts. 2020-06-22 17:11:42 -07:00
alert_words.py docs: Standardize on PostgreSQL, not Postgres. 2020-10-28 11:55:16 -07:00
attachments.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
avatar.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
avatar_hash.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
bot_config.py python: Rewrite dict() as {}. 2020-09-02 11:15:41 -07:00
bot_lib.py python: Rewrite dict() as {}. 2020-09-02 11:15:41 -07:00
bot_storage.py test_service_bot_system: Fix type: ignore issues. 2020-06-30 18:58:23 -07:00
bulk_create.py create_user: Remove redundant argument of get_display_email_address. 2021-01-21 13:04:38 -08:00
cache.py python: Convert os.open(…, O_EXCL) to open(…, "x"). 2020-11-09 14:31:01 -08:00
cache_helpers.py sessions: Fix type: ignore issues. 2020-06-30 18:58:23 -07:00
camo.py python: Replace binascii with bytes.hex to skip some decode operations. 2020-10-30 11:36:38 -07:00
ccache.py python: Remove force_bytes. 2020-10-30 11:36:38 -07:00
context_managers.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
create_user.py users: Use realm.host in dummy user addresses without email visibility. 2021-01-21 13:04:38 -08:00
data_types.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
db.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
debug.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
dev_ldap_directory.py python: Close opened files. 2020-10-26 12:31:30 -07:00
digest.py digest: Remove comments from get_hot_topics. 2021-02-09 10:35:47 -08:00
display_recipient.py api: Remove (sender_)short_name from message APIs. 2020-07-17 11:15:14 -07:00
domains.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
email_mirror.py message: Bundle message stripping, validation, and truncation. 2020-12-18 17:44:13 -08:00
email_mirror_helpers.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
email_notifications.py email_notifications: Fix HTML injection bug. 2021-01-26 13:27:50 -08:00
email_validation.py isort: Enable black profile. 2020-09-02 11:00:07 -07:00
emoji.py python: Replace ujson with orjson. 2020-08-11 10:55:12 -07:00
error_notify.py errors: Remove references to "deployment", use "host". 2021-01-17 11:08:12 -08:00
event_schema.py apply_event: Fix broken deepcopy attempt for subs. 2021-01-21 15:04:07 -08:00
events.py apply_event: Fix broken deepcopy attempt for subs. 2021-01-21 15:04:07 -08:00
exceptions.py message: Raise exception when trying to mirror an already sent message. 2020-12-18 16:40:11 -08:00
export.py refactor: Access a bucket by calling `zerver.lib.uploads.get_bucket`. 2020-10-28 21:52:08 -07:00
external_accounts.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
fix_unreads.py pointer: Remove fix_pre_pointer fixing logic. 2020-06-18 12:55:59 -07:00
generate_test_data.py populate_db: Add images in test data. 2021-01-27 17:52:28 -08:00
github.py apps: Use GitHub API for generating the web app download link. 2020-10-28 23:04:14 -07:00
home.py refactor: Clean up args for fetch_initial_state_data. 2021-01-17 12:31:04 -05:00
hotspots.py i18n: Be deliberate about distinguishing ugettext and ugettext_lazy. 2020-10-18 14:31:15 -07:00
html_diff.py html_diff: Really return str, not bytes. 2020-08-07 11:12:32 -07:00
html_to_text.py python: Skip unnecessary decode before BeautifulSoup parsing. 2020-10-30 11:36:38 -07:00
i18n.py django3: Save language preference in a cookie rather than the session. 2021-01-17 10:38:58 -08:00
import_realm.py refactor: Access a bucket by calling `zerver.lib.uploads.get_bucket`. 2020-10-28 21:52:08 -07:00
initial_password.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
integrations.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
logging_util.py webhooks: Add a missing format for the realm. 2020-09-22 15:11:48 -07:00
management.py management: Use signal.pause to sleep forever. 2020-10-07 16:15:19 -07:00
mdiff.py python: Use universal_newlines to get str from subprocess. 2020-10-30 11:36:38 -07:00
mention.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
message.py events: Fix bug in get_recent_conversations_recipient_id. 2021-02-09 17:45:34 -08:00
migrate.py docs: Standardize on PostgreSQL, not Postgres. 2020-10-28 11:55:16 -07:00
mobile_auth_otp.py python: Replace binascii with bytes.hex to skip some decode operations. 2020-10-30 11:36:38 -07:00
name_restrictions.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
narrow.py message_fetch: Allow access to web-public msgs for unauth users. 2020-08-12 16:39:02 -07:00
onboarding.py actions: Refactor check_message to change return dataclass instead of Dict. 2020-12-21 12:55:30 -08:00
outgoing_webhook.py python: Use requests.Response.text instead of decoding content. 2020-10-30 11:36:38 -07:00
presence.py python: Tweak some magic trailing commas to avoid Black bugs. 2020-09-03 17:51:09 -07:00
profile.py decorator: Strengthen types of signature-preserving decorators. 2020-06-30 18:58:23 -07:00
push_notifications.py python: Replace binascii with bytes.hex to skip some decode operations. 2020-10-30 11:36:38 -07:00
pysa.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
queue.py python: Catch BaseException when we need to clean something up. 2020-10-11 16:16:16 -07:00
rate_limiter.py exceptions: Make RateLimited into a subclass of JsonableError. 2020-12-01 13:40:56 -08:00
realm_description.py refactor: Rename convert to markdown_convert. 2020-07-06 12:39:59 -07:00
realm_icon.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
realm_logo.py realm_logo: Return default logo for realms on LIMITED plan. 2020-06-18 17:46:26 -07:00
redis_utils.py requirements: Upgrade Python requirements. 2021-01-26 13:27:50 -08:00
remote_server.py python: Replace ujson with orjson. 2020-08-11 10:55:12 -07:00
request.py python: Catch specific exceptions from orjson. 2020-10-11 16:11:41 -07:00
response.py exceptions: Make RateLimited into a subclass of JsonableError. 2020-12-01 13:40:56 -08:00
rest.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
retention.py retention: Eliminate redundant recipient JOIN from cross-realm query. 2021-01-18 21:40:37 -08:00
send_email.py docs: Fix some spelling errors. 2020-10-13 15:47:13 -07:00
server_initialization.py models: Rename is_api_super_user to can_forge_sender, 2020-12-21 13:15:39 -08:00
sessions.py sessions: Fix type: ignore issues. 2020-06-30 18:58:23 -07:00
soft_deactivation.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
sqlalchemy_utils.py mypy: Use sqlalchemy-stubs. 2020-11-16 18:17:41 -08:00
statistics.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
storage.py
stream_subscription.py refactor: Compute peers for public streams later. 2020-10-20 11:31:22 -07:00
stream_topic.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
streams.py models: Rename is_api_super_user to can_forge_sender, 2020-12-21 13:15:39 -08:00
subdomains.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
test_classes.py home: Allow logged out user through home. 2020-11-02 17:07:12 -08:00
test_console_output.py tests: Add extra console output detection in test-backend output. 2020-08-27 11:39:53 -07:00
test_data.source.txt docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
test_fixtures.py tools: Rename postgres to postgresql in tool names. 2020-10-28 11:57:02 -07:00
test_helpers.py url_preview: Allow Beautiful Soup to get the charset from <meta>. 2020-12-15 11:30:57 -08:00
test_runner.py dependencies: Upgrade to Django 3.1. 2021-01-26 10:20:00 -08:00
tex.py python: Convert subprocess.Popen.communicate to run or check_output. 2020-09-03 17:42:35 -07:00
thumbnail.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
timeout.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
timestamp.py timestamp: Remove datetime_to_precise_timestamp for datetime.timestamp. 2020-07-31 22:10:14 -07:00
timezone.py timezone: Correct common_timezones dictionary. 2021-01-27 15:23:15 -08:00
topic.py message_edit: Don't rely on .recipient_id change not affecting recipient. 2021-01-17 10:39:46 -08:00
topic_mutes.py mypy: Use sqlalchemy-stubs. 2020-11-16 18:17:41 -08:00
transfer.py import_realm: Close the memcached connection before forking. 2020-10-01 11:20:39 -07:00
type_debug.py decorator: Replace type: ignore with cast, avoid Any. 2020-06-30 18:58:23 -07:00
types.py i18n: Be deliberate about distinguishing ugettext and ugettext_lazy. 2020-10-18 14:31:15 -07:00
unminify.py python: Manually convert more percent-formatting to f-strings. 2020-06-14 23:27:22 -07:00
upload.py uploads: Support non-AWS S3-compatible server. 2020-10-28 21:59:07 -07:00
url_encoding.py url_encoding: Skip unnecessary encode before quote. 2020-10-30 11:36:38 -07:00
user_agent.py user_agent: Compile the regular expression. 2020-02-14 10:26:37 -08:00
user_groups.py python: Replace unnecessary intermediate lists with generators. 2020-09-02 11:15:41 -07:00
user_status.py python: Rewrite dict() as {}. 2020-09-02 11:15:41 -07:00
users.py users: Clarify readability issues related to access_user_by_id. 2021-02-05 17:31:45 -08:00
utils.py mypy: Use str in statsd_key. 2020-09-29 16:49:10 -07:00
validator.py validator: Reject ISO 8601 dates missing leading zeros. 2020-12-15 16:36:50 -08:00
widget.py actions: Refactor check_message to change return dataclass instead of Dict. 2020-12-21 12:55:30 -08:00
zcommand.py python: Rewrite dict() as {}. 2020-09-02 11:15:41 -07:00
zephyr.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00