types: Add EditHistoryEvent and APIEditHistoryEvent types.

These types will help make iteration on this code easier.

Note that `user_id` can be null due to the fact that
edit history entries before March 2017 did not log
the user that made the edit, which was years after
supporting topic edits (discovered in test deployment
of migration on chat.zulip.org).

Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
This commit is contained in:
Tim Abbott
2022-03-01 15:49:18 -08:00
parent 44e08c9289
commit f1e5ed91a1
5 changed files with 61 additions and 19 deletions

View File

@@ -13,6 +13,7 @@ from zulint.custom_rules import Rule, RuleList
FILES_WITH_LEGACY_SUBJECT = {
# This basically requires a big DB migration:
"zerver/lib/topic.py",
"zerver/lib/types.py",
# This is for backward compatibility.
"zerver/tests/test_legacy_subject.py",
# Other migration-related changes require extreme care.
@@ -229,7 +230,7 @@ python_rules = RuleList(
rules=[
{
"pattern": "subject|SUBJECT",
"exclude_pattern": "subject to the|email|outbox",
"exclude_pattern": "subject to the|email|outbox|edit_history_event",
"description": "avoid subject as a var",
"good_lines": ["topic_name"],
"bad_lines": ['subject="foo"', " MAX_SUBJECT_LEN"],