Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions: Delete zerver.lib.actions.
Anders Kaseorgcc30ed8ec72c
diff --git a/analytics/lib/counts.py b/analytics/lib/counts.pyindex 8afc0068ba6..b1a6e9f68a1 100644--- a/analytics/lib/counts.py+++ b/analytics/lib/counts.py@@ -288,7 +288,7 @@ def do_aggregate_to_summary_table(## Utility functions called from outside counts.py ##-# called from zerver/lib/actions.py; should not throw any errors+# called from zerver.actions; should not throw any errorsdef do_increment_logging_stat(zerver_object: Union[Realm, UserProfile, Stream],stat: CountStat,diff --git a/docs/contributing/code-style.md b/docs/contributing/code-style.mdindex 916db3cd95b..8654736b961 100644--- a/docs/contributing/code-style.md+++ b/docs/contributing/code-style.md@@ -155,7 +155,7 @@ object before the first thread wrote out its change.### Using raw saves to update important model objects-In most cases, we already have a function in zerver/lib/actions.py with+In most cases, we already have a function in `zerver.actions` witha name like do_activate_user that will correctly handle lookups,caching, and notifying running browsers via the event system about yourchange. So please check whether such a function exists before writingdiff --git a/docs/overview/directory-structure.md b/docs/overview/directory-structure.mdindex 0183b3b46f8..04ceb7274eb 100644--- a/docs/overview/directory-structure.md+++ b/docs/overview/directory-structure.md@@ -23,7 +23,7 @@ paths will be familiar to Django developers.- `zerver/lib/*.py` Most library code.-- `zerver/lib/actions.py` Most code doing writes to user-facing+- `zerver/actions/*.py` Most code doing writes to user-facingdatabase tables lives here. In particular, we have a policy thatall code calling `send_event` to trigger [pushing data toclients](../subsystems/events-system.md) must live here.diff --git a/docs/production/management-commands.md b/docs/production/management-commands.mdindex 6036945da2e..4c5dafabb33 100644--- a/docs/production/management-commands.md+++ b/docs/production/management-commands.md@@ -91,12 +91,12 @@ database, for most objects, in addition to saving the changes to thedatabase, one may also need to flush caches, notify the apps and openbrowser windows, and record the change in Zulip's `RealmAuditLog`audit history table. For almost any data change you want to do, there-is already a function in `zerver.lib.actions.py` with a name like+is already a function in `zerver.actions` with a name like`do_change_full_name` that updates that field and notifies clientscorrectly.-For convenience, Zulip automatically import `zerver/models.py` and-`zerver/lib/actions.py` into every management shell; if you need to+For convenience, Zulip automatically imports `zerver/models.py`+into every management shell; if you need toaccess other functions, you'll need to import them yourself.## Other useful manage.py commandsdiff --git a/docs/subsystems/management-commands.md b/docs/subsystems/management-commands.mdindex 7e42a2f2090..65b6d71c4f1 100644--- a/docs/subsystems/management-commands.md+++ b/docs/subsystems/management-commands.md@@ -51,7 +51,7 @@ project.(and ideally, also used in Zulip's existing code). Look for code in`zerver/lib/` that already does what you need. For most actions,you can just call a `do_change_foo` type function from- `zerver/lib/actions.py` to do all the work; this is usually far+ `zerver/actions/` to do all the work; this is usually farbetter than manipulating the database directly, since the libraryfunctions used by the UI are maintained to correctly live-update theUI if needed.diff --git a/docs/testing/testing.md b/docs/testing/testing.mdindex 6045e22883d..cbc5ac471a2 100644--- a/docs/testing/testing.md+++ b/docs/testing/testing.md@@ -32,7 +32,7 @@ because it takes a long time. Instead, your edit/refresh cycle willtypically involve running subsets of the tests with commands like these:```bash-./tools/lint zerver/lib/actions.py # Lint the file you just changed+./tools/lint zerver/models.py # Lint the file you just changed./tools/test-backend zerver.tests.test_markdown.MarkdownTest.test_inline_youtube./tools/test-backend MarkdownTest # Run `test-backend --help` for more options./tools/test-js-with-node utildiff --git a/docs/tutorials/writing-views.md b/docs/tutorials/writing-views.mdindex 4d94827c89f..0e088640db7 100644--- a/docs/tutorials/writing-views.md+++ b/docs/tutorials/writing-views.md@@ -242,7 +242,7 @@ change the server more than once or cause unwanted side effects.### Making changes to the databaseIf the view does any modification to the database, that change is done-in a helper function in `zerver/lib/actions.py`. Those functions are+in a helper function in `zerver/actions/*.py`. Those functions areresponsible for doing a complete update to the state of the server,which often entails both updating the database and sending any eventsto notify clients about the state change. When possible, we prefer todiff --git a/scripts/lib/pythonrc.py b/scripts/lib/pythonrc.pyindex 45fbf566694..43d79500001 100644--- a/scripts/lib/pythonrc.py+++ b/scripts/lib/pythonrc.py@@ -2,7 +2,6 @@ try:from django.conf import settings # noqa: F401from analytics.models import * # noqa: F401, F403- from zerver.lib.actions import * # noqa: F401, F403from zerver.models import * # noqa: F401, F403except Exception:import tracebackdiff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex a489dde55a9..acc69738cbb 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -374,7 +374,7 @@ python_rules = RuleList(},{"pattern": "get_stream[(]",- "include_only": {"zerver/views/", "zerver/actions/", "zerver/lib/actions.py"},+ "include_only": {"zerver/views/", "zerver/actions/"},"exclude_line": {# This one in check_message is kinda terrible, since it's# how most instances are written, but better to exclude something than nothingdiff --git a/tools/test-queue-worker-reload b/tools/test-queue-worker-reloadindex 4ee137cd6ea..589728937b8 100755--- a/tools/test-queue-worker-reload+++ b/tools/test-queue-worker-reload@@ -88,7 +88,7 @@ if __name__ == "__main__":time.sleep(1.3)print("Attempting to modify a file")- os.utime("zerver/lib/actions.py")+ os.utime("zerver/models.py")failed = check_worker_launch(run_dev)run_dev.send_signal(signal.SIGINT)diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pydeleted file mode 100644index 8b137891791..00000000000--- a/zerver/lib/actions.py+++ /dev/null@@ -1 +0,0 @@-diff --git a/zerver/tornado/django_api.py b/zerver/tornado/django_api.pyindex af9d6b9d058..dc3da3f362a 100644--- a/zerver/tornado/django_api.py+++ b/zerver/tornado/django_api.py@@ -149,7 +149,7 @@ def send_notification_http(realm: Realm, data: Mapping[str, Any]) -> None:# The core function for sending an event from Django to Tornado (which# will then push it to web and mobile clients for the target users).# By convention, send_event should only be called from-# zerver/lib/actions.py, which helps make it easy to find event+# zerver/actions/*.py, which helps make it easy to find event# generation code.## Every call point should be covered by a test in `test_events.py`,