Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zephyr: Remove Zephyr mirroring support.

Anders Kaseorg40a022dcc3a4
diff --git a/analytics/management/commands/populate_analytics_db.py b/analytics/management/commands/populate_analytics_db.py
index a77f269bf21..e4cce0550ea 100644
--- a/analytics/management/commands/populate_analytics_db.py
+++ b/analytics/management/commands/populate_analytics_db.py
@@ -283,14 +283,14 @@ class Command(ZulipBaseCommand):
react_native, created = Client.objects.get_or_create(name="ZulipMobile")
flutter, created = Client.objects.get_or_create(name="ZulipFlutter")
API, created = Client.objects.get_or_create(name="API: Python")
- zephyr_mirror, created = Client.objects.get_or_create(name="zephyr_mirror")
+ irc_mirror, created = Client.objects.get_or_create(name="irc_mirror")
unused, created = Client.objects.get_or_create(name="unused")
long_webhook, created = Client.objects.get_or_create(name="ZulipLooooooooooongNameWebhook")
stat = COUNT_STATS["messages_sent:client:day"]
user_data = {
website.id: self.generate_fixture_data(stat, 2, 1, 1.5, 0.6, 8),
- zephyr_mirror.id: self.generate_fixture_data(stat, 0, 0.3, 1.5, 0.6, 8),
+ irc_mirror.id: self.generate_fixture_data(stat, 0, 0.3, 1.5, 0.6, 8),
}
insert_fixture_data(stat, user_data, UserCount)
realm_data = {
@@ -301,7 +301,7 @@ class Command(ZulipBaseCommand):
react_native.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3),
flutter.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3),
API.id: self.generate_fixture_data(stat, 5, 5, 5, 0.6, 3),
- zephyr_mirror.id: self.generate_fixture_data(stat, 1, 1, 3, 0.6, 3),
+ irc_mirror.id: self.generate_fixture_data(stat, 1, 1, 3, 0.6, 3),
unused.id: self.generate_fixture_data(stat, 0, 0, 0, 0, 0),
long_webhook.id: self.generate_fixture_data(stat, 5, 5, 2, 0.6, 3),
}
@@ -314,7 +314,7 @@ class Command(ZulipBaseCommand):
flutter.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3),
react_native.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3),
API.id: self.generate_fixture_data(stat, 50, 50, 5, 0.6, 3),
- zephyr_mirror.id: self.generate_fixture_data(stat, 10, 10, 3, 0.6, 3),
+ irc_mirror.id: self.generate_fixture_data(stat, 10, 10, 3, 0.6, 3),
unused.id: self.generate_fixture_data(stat, 0, 0, 0, 0, 0),
long_webhook.id: self.generate_fixture_data(stat, 50, 50, 2, 0.6, 3),
}
diff --git a/corporate/urls.py b/corporate/urls.py
index ab679956473..05a70c3c9ad 100644
--- a/corporate/urls.py
+++ b/corporate/urls.py
@@ -91,9 +91,6 @@ from zerver.lib.rest import rest_path
from zerver.lib.url_redirects import LANDING_PAGE_REDIRECTS
i18n_urlpatterns: Any = [
- # Zephyr/MIT
- path("zephyr/", TemplateView.as_view(template_name="corporate/zephyr.html")),
- path("zephyr-mirror/", TemplateView.as_view(template_name="corporate/zephyr-mirror.html")),
path("jobs/", TemplateView.as_view(template_name="corporate/jobs.html")),
# Billing
path("billing/", billing_page, name="billing_page"),
diff --git a/docs/THIRDPARTY b/docs/THIRDPARTY
index 6f709f01eae..89dea58a87e 100644
--- a/docs/THIRDPARTY
+++ b/docs/THIRDPARTY
@@ -697,10 +697,6 @@ Files: zerver/decorator.py zerver/management/commands/runtornado.py scripts/setu
Copyright: Django Software Foundation and individual contributors
License: BSD-3-Clause
-Files: zerver/lib/ccache.py
-Copyright: 2013 David Benjamin and Alan Huang
-License: Expat
-
Files: zerver/lib/markdown/fenced_code.py
Copyright: 2006-2008 Waylan Limberg
License: BSD-3-Clause
diff --git a/docs/production/security-model.md b/docs/production/security-model.md
index b0fb667d1d3..9da9b653d06 100644
--- a/docs/production/security-model.md
+++ b/docs/production/security-model.md
@@ -195,7 +195,7 @@ strength allowed is controlled by two settings in
- Bots with the `can_forge_sender` permission can send messages that appear to have been sent by
another user. They also have the ability to see the names of all
channels, including private channels. This is important for implementing
- integrations like the Jabber, IRC, and Zephyr mirrors.
+ integrations like the Jabber and IRC mirrors.
These bots cannot be created by Zulip users, including
organization owners. They can only be created on the command
diff --git a/package.json b/package.json
index ab6a4bd2b83..f5629478d44 100644
--- a/package.json
+++ b/package.json
@@ -90,7 +90,6 @@
"webpack": "^5.61.0",
"webpack-bundle-tracker": "^3.0.1",
"webpack-cli": "^6.0.1",
- "winchan": "^0.2.1",
"zod": "^4.1.5"
},
"devDependencies": {
@@ -125,7 +124,6 @@
"@types/throttle-debounce": "^5.0.2",
"@types/tinycolor2": "^1.4.5",
"@types/turndown": "^5.0.1",
- "@types/winchan": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@typescript-eslint/utils": "^8.25.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ebd856bcc64..b3a98ed4bd6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -296,9 +296,6 @@ importers:
webpack-cli:
specifier: ^6.0.1
- winchan:
- specifier: ^0.2.1
- version: 0.2.2
zod:
specifier: ^4.1.5
version: 4.1.5
@@ -396,9 +393,6 @@ importers:
'@types/turndown':
specifier: ^5.0.1
version: 5.0.5
- '@types/winchan':
- specifier: ^0.2.0
- version: 0.2.0
'@typescript-eslint/eslint-plugin':
specifier: ^8.2.0
@@ -2822,9 +2816,6 @@ packages:
resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
- '@types/[email protected]':
- resolution: {integrity: sha512-1NyyjFkmpFf9T5hpyB1KgS4kljPwy45nxaq/I6CndEU2kw6BpxzFIAa0SXs620EtnEsvkFljquX+yRdlLxqDkA==}
-
resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}
@@ -9737,9 +9728,6 @@ packages:
resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==}
- resolution: {integrity: sha512-pvN+IFAbRP74n/6mc6phNyCH8oVkzXsto4KCHPJ2AScniAnA1AmeLI03I2BzjePpaClGSI4GUMowzsD3qz5PRQ==}
-
resolution: {integrity: sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==}
engines: {node: '>= 12.0.0'}
@@ -12415,8 +12403,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
dependencies:
'@types/node': 22.18.1
@@ -21364,8 +21350,6 @@ snapshots:
-
dependencies:
logform: 2.7.0
diff --git a/puppet/kandra/files/krb5.conf b/puppet/kandra/files/krb5.conf
deleted file mode 100644
index b3fd7a251d5..00000000000
--- a/puppet/kandra/files/krb5.conf
+++ /dev/null
@@ -1,100 +0,0 @@
-[libdefaults]
- default_realm = ATHENA.MIT.EDU
-
-# The following krb5.conf variables are only for MIT Kerberos.
- kdc_timesync = 1
- ccache_type = 4
- forwardable = true
- proxiable = true
-
-# The following encryption type specification will be used by MIT Kerberos
-# if uncommented. In general, the defaults in the MIT Kerberos code are
-# correct and overriding these specifications only serves to disable new
-# encryption types as they are added, creating interoperability problems.
-#
-# The only time when you might need to uncomment these lines and change
-# the enctypes is if you have local software that will break on ticket
-# caches containing ticket encryption types it doesn't know about (such as
-# old versions of Sun Java).
-
-# default_tgs_enctypes = des3-hmac-sha1
-# default_tkt_enctypes = des3-hmac-sha1
-# permitted_enctypes = des3-hmac-sha1
-
-# The following libdefaults parameters are only for Heimdal Kerberos.
- fcc-mit-ticketflags = true
-
-[realms]
- ATHENA.MIT.EDU = {
- kdc = kerberos.mit.edu
- kdc = kerberos-1.mit.edu
- kdc = kerberos-2.mit.edu
- admin_server = kerberos.mit.edu
- master_kdc = kerberos.mit.edu
- }
- CSAIL.MIT.EDU = {
- kdc = kerberos-1.csail.mit.edu
- kdc = kerberos-2.csail.mit.edu
- admin_server = kerberos.csail.mit.edu
- }
- ZONE.MIT.EDU = {
- kdc = casio.mit.edu
- kdc = seiko.mit.edu
- admin_server = casio.mit.edu
- }
- IHTFP.ORG = {
- kdc = kerberos.ihtfp.org
- admin_server = kerberos.ihtfp.org
- }
- 1TS.ORG = {
- kdc = kerberos.1ts.org
- admin_server = kerberos.1ts.org
- }
- ANDREW.CMU.EDU = {
- admin_server = kerberos.andrew.cmu.edu
- default_domain = andrew.cmu.edu
- }
- CS.CMU.EDU = {
- kdc = kerberos-1.srv.cs.cmu.edu
- kdc = kerberos-2.srv.cs.cmu.edu
- kdc = kerberos-3.srv.cs.cmu.edu
- admin_server = kerberos.cs.cmu.edu
- }
- DEMENTIA.ORG = {
- kdc = kerberos.dementix.org
- kdc = kerberos2.dementix.org
- admin_server = kerberos.dementix.org
- }
- stanford.edu = {
- kdc = krb5auth1.stanford.edu
- kdc = krb5auth2.stanford.edu
- kdc = krb5auth3.stanford.edu
- master_kdc = krb5auth1.stanford.edu
- admin_server = krb5-admin.stanford.edu
- default_domain = stanford.edu
- }
- UTORONTO.CA = {
- kdc = kerberos1.utoronto.ca
- kdc = kerberos2.utoronto.ca
- kdc = kerberos3.utoronto.ca
- admin_server = kerberos1.utoronto.ca
- default_domain = utoronto.ca
- }
-
-[domain_realm]
- .exchange.mit.edu = EXCHANGE.MIT.EDU
- exchange.mit.edu = EXCHANGE.MIT.EDU
- .mit.edu = ATHENA.MIT.EDU
- mit.edu = ATHENA.MIT.EDU
- .win.mit.edu = WIN.MIT.EDU
- win.mit.edu = WIN.MIT.EDU
- .csail.mit.edu = CSAIL.MIT.EDU
- csail.mit.edu = CSAIL.MIT.EDU
- .media.mit.edu = MEDIA-LAB.MIT.EDU
- media.mit.edu = MEDIA-LAB.MIT.EDU
- .whoi.edu = ATHENA.MIT.EDU
- whoi.edu = ATHENA.MIT.EDU
- .stanford.edu = stanford.edu
- .slac.stanford.edu = SLAC.STANFORD.EDU
- .toronto.edu = UTORONTO.CA
- .utoronto.ca = UTORONTO.CA
diff --git a/templates/corporate/zephyr-mirror.html b/templates/corporate/zephyr-mirror.html
deleted file mode 100644
index 6223bcf3aaa..00000000000
--- a/templates/corporate/zephyr-mirror.html
+++ /dev/null
@@ -1,99 +0,0 @@
-{% extends "zerver/portico.html" %}
-
-{% block title %}
-<title>Zephyr mirroring information | Zulip</title>
-{% endblock %}
-
-{# Zephyr mirroring information page #}
-
-{% block portico_content %}
- <h1 style="margin-top:30px;">The Zephyr mirror script (not recommended)</h1>
-
- <p>
- Webathena is the easiest way to use Zulip. With Webathena, you don't need
- to run any software in a screen session. Your Athena password never leaves
- your computer and the only access that any Zulip computer ever receives is the
- ability to send/receive zephyrs as you.
- </p>
-
- <p>
- We recommend that you use Webathena instead of following these instructions.
- Please only follow these instructions if you know that you want to run the zephyr
- mirror script instead of using Webathena.
- </p>
-
- <h3 id="mirror">Running the Zephyr mirror script</h3>
-
- <p>
- On an Athena dialup
- (<a href="https://linerva.mit.edu">linerva.mit.edu</a>,
- <a href="https://athena.dialup.mit.edu">athena.dialup.mit.edu</a>,
- etc.), run the Zephyr mirroring script inside a screen
- session.
- </p>
-
- <p>
- <strong>IMPORTANT: You must keep the Zephyr mirroring script
- always running in a session with unexpired Kerberos
- tickets.</strong> The script forwards personals you receive on
- Zephyr to Zulip, and forwards messages you send in Zulip to
- Zephyr. <strong>If it is not running, only other Zulip users
- will receive messages you send from Zulip!</strong> The Zulip
- web application will warn you if the Zephyr mirroring script is
- not running.
- </p>
-
- <p>
- If you already have BarnOwl running in screen/tmux somewhere,
- you can just run:
- </p>
-
- <p><code>/mit/tabbott/zulip/zephyr_mirror.py</code></p>
-
- <p>inside that screen session.</p>
-
- <h4>Mirroring without a BarnOwl session</h4>
-
- <p>
- If you are not already running a screen/tmux for BarnOwl, you
- can set up a screen session to run the Zephyr mirroring script by
- running the following on a dialup such
- as <a href="https://linerva.mit.edu">linerva.mit.edu</a>:
- </p>
-
- <ol>
- <li><code>kinit -l7d && aklog</code></li>
- <li>(Type your password to create 7-day renewable Kerberos tickets)</li>
- <li>
- <code>env ZEPHYR_SCREEN_CLIENT=/mit/tabbott/zulip/zephyr_mirror.py
- SCREEN_SESSION_NAME=zulip athrun kchen owl-screen
- </code>
- </li>
- </ol>
-
- <p>
- This will run the Zephyr mirroring script inside a screen
- session, and use `/mit/kchen/bin/cont-renew-notify` to continually
- renew your Kerberos tickets for up to a week; each week, it will
- send you a Zephyr/Zulip letting you know that you need to renew
- your tickets. To do so, log in to the server that you set up the
- screen session on and use the following procedure:
- </p>
-
- <ol>
- <li>
- Run <code>screen -x zulip</code> to connect to the mirroring
- screen session created above.
- </li>
- <li>The first time, you'll need to type <code>Ctrl-A c</code> to switch to a new terminal in your screen session.</li>
- <li><code>kinit -l7d && aklog</code></li>
- <li>(Type your password to renew your Kerberos tickets).</li>
- </ol>
-
- <p>
- Don't run multiple copies of the Zephyr mirroring script;
- doing so will result in messages you sent being forwarded to
- Zephyr twice.
- </p>
-
-{% endblock %}
diff --git a/templates/corporate/zephyr.html b/templates/corporate/zephyr.html
deleted file mode 100644
index 62ab9910e60..00000000000
--- a/templates/corporate/zephyr.html
+++ /dev/null
@@ -1,79 +0,0 @@
-{% extends "zerver/portico.html" %}
-{% set entrypoint = "landing-page" %}
-
-{% block title %}
-<title>Zephyr for MIT | Zulip</title>
-{% endblock %}
-
-{% block customhead %}
-<meta name="viewport" content="width=device-width, initial-scale=1.0" />
-{% endblock %}
-
-{% block portico_content %}
-
-{% include 'zerver/landing_nav.html' %}
-<div class="portico-landing why-page">
- <div class="hero small-hero">
- <h1 class="center">Zulip for MIT Zephyr</h1>
- </div>
- <div class="main">
- <div class="padded-content">
- <div class="inner-content markdown">
- <p>If you have an MIT Athena account, you can start using Zulip for Zephyr in a couple of minutes.</p>
-
- <h2 id="first-time-setup">First time setup</h2>
- <ol>
- <li><p>Activate your account here: <a href="https://zephyr.zulipchat.com/register/">https://zephyr.zulipchat.com/register/</a></p></li>
- <li><p>Log in to Zulip here: <a href="https://zephyr.zulipchat.com">https://zephyr.zulipchat.com</a></p></li>
- <li><p>Follow the on-screen instructions for linking Zulip with Webathena</p></li>
- <li><p>(Optional) Get the Zulip desktop and/or mobile apps here: <a href="https://zephyr.zulipchat.com/apps/">https://zephyr.zulipchat.com/apps/</a></p></li>
- </ol>
-
- <h2 id="youre-done">You're done!</h2>
- <p>If you have any questions, please e-mail us at <a href="mailto:{{ support_email }}">{{ support_email }}</a></p>
-
- <h2 id="if-you-want-to-automatically-transfer-your-existing-zephyr-subscriptions">If you want to automatically transfer your existing Zephyr subscriptions</h2>
-
- <ol>
- <li>
- <p>
- Get your Zulip API key from the Zulip "Settings" panel and put it in a file in your
- Athena home directory called <code>~/Private/.zulip-api-key</code>.
- </p>
- </li>
-
- <li>
- <p>
- Run the following command to copy over all of your subscriptions:<br />
- <code>/mit/tabbott/zulip/zephyr_mirror.py --sync-subscriptions</code>
- </p>
-
- <p>
- <strong>NOTE</strong>: Zulip supports several ways to control what messages you want to read
- right now, but Zulip does not yet have a direct equivalent to BarnOwl filters.
- If you have more subscriptions than you generally read, we recommend that you use
- Zulip's "Mute" option to hide those subscriptions from your
- home view that you less commonly read. You can still easily access those channels
- from Zulip when you want to read them. You can control your subscriptions
- and what's in your home view by clicking the gear in the upper right-hand corner
- and then selecting "Channels".
- </p>
- </li>
- </ol>
-
- <h2 id="if-you-subscribe-to-any-encrypted-zephyr-classes">If you subscribe to any encrypted Zephyr classes</h2>
-
- <p>
- You can get set up to participate on an encrypted Zephyr class using Zulip by either:
- </p>
-
- <ol>
- <li><p>E-mailing us at <a href="mailto:{{ support_email }}">{{ support_email }}</a> to get set up, or</p></li>
- <li><p>Someone who is already set up to participate on that encrypted Zephyr class using Zulip can use Zulip to invite you</p></li>
- </ol>
- </div>
- </div>
- </div>
-</div>
-
-{% endblock %}
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index fc9f4210bf5..e6a8295b1ed 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -170,24 +170,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1943053 -->
<div id="alert-popup-container">
<div id="popup_banners_wrapper" class="banner-wrapper alert-box">
- <div class="alert alert_sidebar alert-error home-error-bar" id="zephyr-mirror-error">
- <div class="exit"></div>
- {# The below isn't tagged for translation
- intentionally, because the feature is only used at
- MIT. #}
- <strong>Your Zephyr mirror is not working.</strong>
- <span id="normal-zephyr-mirror-error-text">
- We recommend that
- you <a class="webathena_login">give Zulip the ability to mirror the messages for you via
- Webathena</a>. If you'd prefer, you can instead
- <a href="/zephyr-mirror/" target="_blank" rel="noopener noreferrer">run the
- Zephyr mirror script yourself</a> in a screen
- session.
- </span>
- <span id="desktop-zephyr-mirror-error-text" class="notdisplayed">
- To fix this, you'll need to use the web interface.
- </span>
- </div>
<div class="alert alert_sidebar alert-error home-error-bar" id="home-error"></div>
<div class="alert alert_sidebar" id="request-progress-status-banner">
<div class="alert-zulip-logo">
diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py
index 64c5ec39aca..47737eff446 100644
--- a/tools/lib/capitalization.py
+++ b/tools/lib/capitalization.py
@@ -31,7 +31,6 @@ IGNORED_PHRASES = [
r"JSON",
r"Jitsi",
r"Jotform",
- r"Kerberos",
r"LinkedIn",
r"LDAP",
r"Markdown",
@@ -47,9 +46,7 @@ IGNORED_PHRASES = [
r"Tuesday",
r"URL",
r"UUID",
- r"Webathena",
r"WordPress",
- r"Zephyr",
r"Zoom",
r"Zulip",
r"Zulip Server",
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index 14e0c9f6dfb..1a35bc35d69 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -742,8 +742,6 @@ html_rules: list["Rule"] = [
"templates/zerver/accounts_send_confirm.html",
"templates/zerver/integrations/index.html",
"templates/zerver/documentation_main.html",
- "templates/corporate/zephyr.html",
- "templates/corporate/zephyr-mirror.html",
},
"good_lines": ["#my-style {color: blue;}", 'style="display: none"', "style='display: none"],
"bad_lines": ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"'],
diff --git a/tools/test-backend b/tools/test-backend
index 46df052f910..c0c3560d038 100755
--- a/tools/test-backend
+++ b/tools/test-backend
@@ -94,10 +94,8 @@ not_yet_fully_covered = [
"zerver/lib/queue.py",
"zerver/lib/sqlalchemy_utils.py",
"zerver/lib/storage.py",
- "zerver/lib/zephyr.py",
"zerver/lib/templates.py",
# Low priority for coverage
- "zerver/lib/ccache.py",
"zerver/lib/generate_test_data.py",
"zerver/lib/server_initialization.py",
"zerver/lib/test_fixtures.py",
diff --git a/version.py b/version.py
index f0307f55739..b86f2c3f18c 100644
--- a/version.py
+++ b/version.py
@@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 425
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
-PROVISION_VERSION = (348, 1) # bumped 2025-09-10 to add astro-compressor.
+PROVISION_VERSION = (349, 0) # bumped 2025-09-12 to remove winchan
diff --git a/web/src/activity.ts b/web/src/activity.ts
index c393a9018c4..38656137e7c 100644
--- a/web/src/activity.ts
+++ b/web/src/activity.ts
@@ -19,7 +19,6 @@ export const post_presence_response_schema = z.object({
// response. If we're fetching presence data however, they should
// all be present, and send_presence_to_server() will validate that.
server_timestamp: z.optional(z.number()),
- zephyr_mirror_active: z.optional(z.boolean()),
presences: z.optional(
z.record(
z.string(),
@@ -145,13 +144,6 @@ export let send_presence_to_server = (redraw?: () => void): void => {
success(response) {
const data = post_presence_response_schema.parse(response);
- // Update Zephyr mirror activity warning
- if (data.zephyr_mirror_active === false) {
- $("#zephyr-mirror-error").addClass("show");
- } else {
- $("#zephyr-mirror-error").removeClass("show");
- }
-
set_new_user_input(false);
if (redraw) {
diff --git a/web/src/base_page_params.ts b/web/src/base_page_params.ts
index 2ca25d1e0a4..8c8a8cf8fbc 100644
--- a/web/src/base_page_params.ts
+++ b/web/src/base_page_params.ts
@@ -47,7 +47,6 @@ const home_params_schema = z.looseObject({
// processor time to compute.
realm_rendered_description: z.optional(z.string()),
show_try_zulip_modal: z.boolean(),
- show_webathena: z.boolean(),
state_data: z.nullable(state_data_schema),
translation_data: z.record(z.string(), z.string()),
});
diff --git a/web/src/buddy_data.ts b/web/src/buddy_data.ts
index 276668bd7e6..0a032ddbf0c 100644
--- a/web/src/buddy_data.ts
+++ b/web/src/buddy_data.ts
@@ -9,7 +9,6 @@ import {page_params} from "./page_params.ts";
import * as peer_data from "./peer_data.ts";
import * as people from "./people.ts";
import * as presence from "./presence.ts";
-import {realm} from "./state_data.ts";
import * as stream_data from "./stream_data.ts";
import * as timerender from "./timerender.ts";
import * as unread from "./unread.ts";
@@ -176,10 +175,7 @@ export function user_last_seen_time_status(
}
const last_active_date = presence.last_active_date(user_id);
- if (realm.realm_is_zephyr_mirror_realm) {
- // We don't send presence data to clients in Zephyr mirroring realms
- return $t({defaultMessage: "Activity unknown"});
- } else if (last_active_date === undefined) {
+ if (last_active_date === undefined) {
// There are situations where the client has incomplete presence
// history on a user. This can happen when users are deactivated,
// or when the user's last activity is older than what we fetch.
diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.ts
index 6851d315a79..fdd457af17a 100644
--- a/web/src/compose_banner.ts
+++ b/web/src/compose_banner.ts
@@ -63,7 +63,6 @@ export const CLASSNAMES = {
invalid_recipients: "invalid_recipients",
deactivated_user: "deactivated_user",
topic_missing: "topic_missing",
- zephyr_not_running: "zephyr_not_running",
generic_compose_error: "generic_compose_error",
user_not_subscribed: "user_not_subscribed",
unknown_zoom_user: "unknown_zoom_user",
diff --git a/web/src/compose_validate.ts b/web/src/compose_validate.ts
index d0410230b27..bebda6a26ca 100644
--- a/web/src/compose_validate.ts
+++ b/web/src/compose_validate.ts
@@ -274,15 +274,11 @@ export async function warn_if_private_stream_is_linked(
// Don't warn if subscribers list of current compose_stream is
// a subset of linked_stream's subscribers list, because
// everyone will be subscribed to the linked stream and so
- // knows it exists. (But always warn Zephyr users, since
- // we may not know their stream's subscribers.)
+ // knows it exists.
// Note: `is_subscriber_subset` can return `null` if we encounter
// an error fetching subscriber data. In that case, we just show
// the banner.
- if (
- (await peer_data.is_subscriber_subset(stream_id, linked_stream.stream_id)) &&
- !realm.realm_is_zephyr_mirror_realm
- ) {
+ if (await peer_data.is_subscriber_subset(stream_id, linked_stream.stream_id)) {
return;
}
@@ -321,11 +317,6 @@ export async function warn_if_mentioning_unsubscribed_user(
mentioned: UserOrMention,
$textarea: JQuery<HTMLTextAreaElement>,
): Promise<void> {
- // Disable for Zephyr mirroring realms, since we never have subscriber lists there
- if (realm.realm_is_zephyr_mirror_realm) {
- return;
- }
-
if (mentioned.type === "broadcast") {
return; // don't check if @all/@everyone/@stream
}
@@ -959,9 +950,6 @@ export function validate_private_message(show_banner = true): boolean {
disabled_send_tooltip_message_html = NO_PRIVATE_RECIPIENT_ERROR_MESSAGE;
}
return false;
- } else if (realm.realm_is_zephyr_mirror_realm) {
- // For Zephyr mirroring realms, the frontend doesn't know which users exist
- return true;
}
const direct_message_error_string = check_dm_permissions_and_get_error_string(user_ids_string);
@@ -1173,22 +1161,6 @@ export let validate = (scheduling_message: boolean, show_banner = true): boolean
$("textarea#compose-textarea").toggleClass("invalid", false);
}
- if ($("#zephyr-mirror-error").hasClass("show")) {
- const error_message = $t({
- defaultMessage: "You need to be running Zephyr mirroring in order to send messages!",
- });
- compose_banner.show_error_message(
- error_message,
- compose_banner.CLASSNAMES.zephyr_not_running,
- $("#compose_banners"),
- );
- if (is_validating_compose_box) {
- disabled_send_tooltip_message_html = error_message;
- }
- blueslip.debug("Invalid compose state: Zephyr mirroring not running");
- is_validating_compose_box = false;
- return false;
- }
// TODO: This doesn't actually show a banner, it triggers a flash
const trigger_flash = show_banner;
if (!validate_message_length($("#send_message_form"), trigger_flash)) {
diff --git a/web/src/filter.ts b/web/src/filter.ts
index c6d903ab69b..77fbf9308f5 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -16,7 +16,7 @@ import {page_params} from "./page_params.ts";
import type {User} from "./people.ts";
import * as people from "./people.ts";
import type {UserPillItem} from "./search_suggestion.ts";
-import {current_user, realm} from "./state_data.ts";
+import {current_user} from "./state_data.ts";
import type {NarrowTerm} from "./state_data.ts";
import * as stream_data from "./stream_data.ts";
import * as sub_store from "./sub_store.ts";
@@ -79,54 +79,6 @@ type ValidOrInvalidUser =
const channels_operands = new Set(["public", "web-public"]);
-function zephyr_stream_name_match(
- message: Message & {type: "stream"},
- stream_name: string,
-): boolean {
- // Zephyr users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/
- // (unsocial, ununsocial, social.d, etc)
- // TODO: hoist the regex compiling out of the closure
- const m = /^(?:un)*(.+?)(?:\.d)*$/i.exec(stream_name);
- let base_stream_name = stream_name;
- if (m?.[1] !== undefined) {
- base_stream_name = m[1];
- }
- const related_regexp = new RegExp(
- /^(un)*/.source + _.escapeRegExp(base_stream_name) + /(\.d)*$/.source,
- "i",
- );
- const message_stream_name = stream_data.get_stream_name_from_id(message.stream_id);
- return related_regexp.test(message_stream_name);
-}
-
-function zephyr_topic_name_match(message: Message & {type: "stream"}, operand: string): boolean {
- // Zephyr users expect narrowing to topic "foo" to also show messages to /^foo(.d)*$/
- // (foo, foo.d, foo.d.d, etc)
- // TODO: hoist the regex compiling out of the closure
- const m = /^(.*?)(?:\.d)*$/i.exec(operand);
- // m should never be null because any string matches that regex.
- assert(m !== null);
- const base_topic = m[1]!;
- let related_regexp;
-
- // Additionally, Zephyr users expect the empty instance and
- // instance "personal" to be the same.
- if (
- base_topic === "" ||
- base_topic.toLowerCase() === "personal" ||
- base_topic.toLowerCase() === '(instance "")'
- ) {
- related_regexp = /^(|personal|\(instance ""\))(\.d)*$/i;
- } else {
- related_regexp = new RegExp(
- /^/.source + _.escapeRegExp(base_topic) + /(\.d)*$/.source,
- "i",
- );
- }
-
- return related_regexp.test(message.topic);
-}
-
function message_in_home(message: Message): boolean {
// The home view contains messages not sent to muted channels,
// with additional logic for unmuted topics and
@@ -208,11 +160,6 @@ function message_matches_search_term(message: Message, operator: string, operand
return false;
}
- if (realm.realm_is_zephyr_mirror_realm) {
- const stream = stream_data.get_sub_by_id_string(operand);
- return zephyr_stream_name_match(message, stream?.name ?? "");
- }
-
return message.stream_id.toString() === operand;
}
@@ -237,9 +184,6 @@ function message_matches_search_term(message: Message, operator: string, operand
}
operand = operand.toLowerCase();
- if (realm.realm_is_zephyr_mirror_realm) {
- return zephyr_topic_name_match(message, operand);
- }
return message.topic.toLowerCase() === operand;
case "sender":
diff --git a/web/src/gear_menu.ts b/web/src/gear_menu.ts
index 10863ca9e9d..66b5cc7b895 100644
--- a/web/src/gear_menu.ts
+++ b/web/src/gear_menu.ts
@@ -1,13 +1,9 @@
import $ from "jquery";
import assert from "minimalistic-assert";
import type * as tippy from "tippy.js";
-import WinChan from "winchan";
-import * as z from "zod/mini";
import render_navbar_gear_menu_popover from "../templates/popovers/navbar/navbar_gear_menu_popover.hbs";
-import * as blueslip from "./blueslip.ts";
-import * as channel from "./channel.ts";
import * as demo_organizations_ui from "./demo_organizations_ui.ts";
import * as information_density from "./information_density.ts";
import * as popover_menus from "./popover_menus.ts";
@@ -117,63 +113,6 @@ export function initialize(): void {
onMount(instance) {
const $popper = $(instance.popper);
popover_menus.popover_instances.gear_menu = instance;
- $popper.on("click", ".webathena_login", (e) => {
- $("#zephyr-mirror-error").removeClass("show");
- const principal = ["zephyr", "zephyr"];
- WinChan.open(
- {
- url: "https://webathena.mit.edu/#!request_ticket_v1",
- relay_url: "https://webathena.mit.edu/relay.html",
- params: {
- realm: "ATHENA.MIT.EDU",
- principal,
- },
- },
- (err, raw_response) => {
- if (err !== null) {
- blueslip.warn(err);
- return;
- }
-
- // https://github.com/davidben/webathena/blob/0be20d9b1d62c19b4f94f77e621bd8721e504446/app/scripts-src/request_ticket.js
- const response_schema = z.discriminatedUnion("status", [
- z.object({
- status: z.literal("OK"),
- session: z.unknown(),
- }),
- z.object({
- status: z.literal("ERROR"),
- code: z.string(),
- message: z.string(),
- }),
- z.object({
- status: z.literal("DENIED"),
- code: z.string(),
- message: z.string(),
- }),
- ]);
- const r = response_schema.parse(raw_response);
- if (r.status !== "OK") {
- blueslip.warn(`Webathena: ${r.status}: ${r.message}`);
- return;
- }
-
- channel.post({
- url: "/accounts/webathena_kerberos_login/",
- data: {cred: JSON.stringify(r.session)},
- success() {
- $("#zephyr-mirror-error").removeClass("show");
- },
- error() {
- $("#zephyr-mirror-error").addClass("show");
- },
- });
- },
- );
- popover_menus.hide_current_popover_if_visible(instance);
- e.preventDefault();
- e.stopPropagation();
- });
$popper.on("click", ".convert-demo-organization", (e) => {
popover_menus.hide_current_popover_if_visible(instance);
diff --git a/web/src/people.ts b/web/src/people.ts
index 322cb834cd1..3836ba6f44f 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -1558,8 +1558,8 @@ export function _add_user(person: User): void {
// We eventually want to lock this down completely
// and report an error and not update other the data
// structures here, but we have a lot of edge cases
- // with cross-realm bots, zephyr users, etc., deactivated
- // users, where we are probably fine for now not to
+ // with cross-realm bots, deactivated users, etc.,
+ // where we are probably fine for now not to
// find them via user_id lookups.
blueslip.warn("No user_id provided", {email: person.email});
}
diff --git a/web/src/popover_menus_data.ts b/web/src/popover_menus_data.ts
index dd8d989c93e..071de6ce73e 100644
--- a/web/src/popover_menus_data.ts
+++ b/web/src/popover_menus_data.ts
@@ -131,7 +131,6 @@ type GearMenuContext = {
show_billing: boolean;
show_remote_billing: boolean;
show_plans: boolean;
- show_webathena: boolean;
sponsorship_pending: boolean;
user_has_billing_access: boolean;
user_color_scheme: number;
@@ -416,7 +415,6 @@ export function get_gear_menu_content_context(): GearMenuContext {
show_billing: billing_info.show_billing,
show_remote_billing: billing_info.show_remote_billing,
show_plans: billing_info.show_plans,
- show_webathena: page_params.show_webathena,
sponsorship_pending: realm_billing.has_pending_sponsorship_request,
user_has_billing_access,
// user color scheme
diff --git a/web/src/stream_data.ts b/web/src/stream_data.ts
index 4a16063365f..07f5df6aecf 100644
--- a/web/src/stream_data.ts
+++ b/web/src/stream_data.ts
@@ -1082,7 +1082,6 @@ export function create_sub_from_server_data(
delete attrs.partial_subscribers;
sub = {
- render_subscribers: !realm.realm_is_zephyr_mirror_realm || attrs.invite_only,
newly_subscribed: false,
is_muted: false,
pin_to_top: false,
diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts
index 04fc1c652e5..630a1d09359 100644
--- a/web/src/stream_edit.ts
+++ b/web/src/stream_edit.ts
@@ -171,10 +171,6 @@ function show_subscription_settings(sub: SettingsSubscription): void {
const $edit_container = stream_settings_containers.get_edit_container(sub);
stream_ui_updates.update_add_subscriptions_elements(sub);
- if (!sub.render_subscribers) {
- return;
- }
-
if (!stream_data.can_toggle_subscription(sub)) {
stream_ui_updates.initialize_cant_subscribe_popover();
}
diff --git a/web/src/stream_settings_ui.ts b/web/src/stream_settings_ui.ts
index 4a6f0f16aef..bc7e754d8e7 100644
--- a/web/src/stream_settings_ui.ts
+++ b/web/src/stream_settings_ui.ts
@@ -125,10 +125,6 @@ function selectText(element: Node): void {
sel.addRange(range);
}
-function should_list_all_streams(): boolean {
- return !realm.realm_is_zephyr_mirror_realm;
-}
-
export function toggle_pin_to_top_stream(sub: StreamSubscription): void {
stream_settings_api.set_stream_property(sub, {property: "pin_to_top", value: !sub.pin_to_top});
}
@@ -911,10 +907,8 @@ function setup_page(callback: () => void): void {
},
});
- if (should_list_all_streams()) {
- const $toggler_elem = toggler.get();
- $("#channels_overlay_container .list-toggler-container").prepend($toggler_elem);
- }
+ const $toggler_elem = toggler.get();
+ $("#channels_overlay_container .list-toggler-container").prepend($toggler_elem);
if (current_user.is_guest) {
toggler.disable_tab("all-streams");
toggler.disable_tab("available");
@@ -943,7 +937,7 @@ function setup_page(callback: () => void): void {
settings_data.user_can_create_private_streams() ||
settings_data.user_can_create_public_streams() ||
settings_data.user_can_create_web_public_streams(),
- can_view_all_streams: !current_user.is_guest && should_list_all_streams(),
+ can_view_all_streams: !current_user.is_guest,
max_stream_name_length: realm.max_stream_name_length,
max_stream_description_length: realm.max_stream_description_length,
is_owner: current_user.is_owner,
@@ -992,8 +986,7 @@ function setup_page(callback: () => void): void {
// When hitting Enter in the stream creation box, we open the
// "create stream" UI with the stream name prepopulated. This
// is only useful if the user has permission to create
- // streams, either explicitly via user_can_create_streams, or
- // implicitly because realm.realm_is_zephyr_mirror_realm.
+ // streams via user_can_create_streams.
$("#stream_filter input[type='text']").on("keydown", (e) => {
if (!keydown_util.is_enter_event(e)) {
return;
@@ -1002,8 +995,7 @@ function setup_page(callback: () => void): void {
if (
settings_data.user_can_create_private_streams() ||
settings_data.user_can_create_public_streams() ||
- settings_data.user_can_create_web_public_streams() ||
- realm.realm_is_zephyr_mirror_realm
+ settings_data.user_can_create_web_public_streams()
) {
open_create_stream();
e.preventDefault();
@@ -1021,10 +1013,6 @@ function setup_page(callback: () => void): void {
}
populate_and_fill();
-
- if (!should_list_all_streams()) {
- $(".create_stream_button").val($t({defaultMessage: "Subscribe"}));
- }
}
export function switch_to_stream_row(stream_id: number): void {
@@ -1232,14 +1220,6 @@ export function do_open_create_stream(folder_id?: number): void {
// Prefer open_create_stream().
const stream = $<HTMLInputElement>("input#search_stream_name").val()!;
-
- if (!should_list_all_streams()) {
- // Realms that don't allow listing streams should simply be subscribed to.
- stream_create.set_name(stream.trim());
- stream_settings_components.ajaxSubscribe(stream);
- return;
- }
-
stream_create.new_stream_clicked(stream.trim(), folder_id);
}
diff --git a/web/src/stream_ui_updates.ts b/web/src/stream_ui_updates.ts
index 0ee3740ad3e..defcc5370ee 100644
--- a/web/src/stream_ui_updates.ts
+++ b/web/src/stream_ui_updates.ts
@@ -512,7 +512,7 @@ export function update_add_subscriptions_elements(sub: SettingsSubscription): vo
// We are only concerned with the Subscribers tab for editing streams.
const $add_subscribers_container = $(".edit_subscribers_for_stream .subscriber_list_settings");
- if (current_user.is_guest || realm.realm_is_zephyr_mirror_realm) {
+ if (current_user.is_guest) {
// For guest users, we just hide the add_subscribers feature.
$add_subscribers_container.hide();
return;
diff --git a/web/src/sub_store.ts b/web/src/sub_store.ts
index 3d5c871370d..dd54410282e 100644
--- a/web/src/sub_store.ts
+++ b/web/src/sub_store.ts
@@ -23,7 +23,6 @@ export const stream_subscription_schema = z.object({
subscribers: true,
}).shape,
// These properties are added in `stream_data` when hydrating the streams and are not present in the data we get from the server.
- render_subscribers: z.boolean(),
newly_subscribed: z.boolean(),
subscribed: z.boolean(),
previously_subscribed: z.boolean(),
diff --git a/web/src/user_group_edit.ts b/web/src/user_group_edit.ts
index 8ad075055e2..153bf901600 100644
--- a/web/src/user_group_edit.ts
+++ b/web/src/user_group_edit.ts
@@ -157,7 +157,7 @@ function update_add_members_elements(group: UserGroup): void {
".edit_members_for_user_group .add_members_container",
);
- if (current_user.is_guest || realm.realm_is_zephyr_mirror_realm) {
+ if (current_user.is_guest) {
// For guest users, we just hide the add_members feature.
$add_members_container.hide();
return;
diff --git a/web/src/user_pill.ts b/web/src/user_pill.ts
index 890c830afde..33678fe435d 100644
--- a/web/src/user_pill.ts
+++ b/web/src/user_pill.ts
@@ -121,8 +121,8 @@ export function get_user_ids(
}
export function has_unconverted_data(pill_widget: UserPillWidget): boolean {
- // This returns true if we either have text that hasn't been
- // turned into pills or email-only pills (for Zephyr).
+ // This returns true if we have text that hasn't been
+ // turned into pills.
if (pill_widget.is_pending()) {
return true;
}
diff --git a/web/templates/popovers/navbar/navbar_gear_menu_popover.hbs b/web/templates/popovers/navbar/navbar_gear_menu_popover.hbs
index 3512d197a50..bb30b7c0298 100644
--- a/web/templates/popovers/navbar/navbar_gear_menu_popover.hbs
+++ b/web/templates/popovers/navbar/navbar_gear_menu_popover.hbs
@@ -189,7 +189,7 @@
{{/if}}
{{/if}}
{{!-- Group 3 --}}
- {{#if (or can_invite_users_by_email can_create_multiuse_invite is_spectator show_webathena)}}
+ {{#if (or can_invite_users_by_email can_create_multiuse_invite is_spectator)}}
<li role="separator" class="popover-menu-separator"></li>
{{/if}}
{{#if (or can_invite_users_by_email can_create_multiuse_invite)}}
@@ -200,14 +200,6 @@
</a>
</li>
{{/if}}
- {{#if show_webathena}}
- <li role="none" class="link-item popover-menu-list-item" title="{{t 'Grant Zulip the Kerberos tickets needed to run your Zephyr mirror via Webathena' }}" id="webathena_login_menu">
- <a role="menuitem" href="#webathena" class="webathena_login popover-menu-link">
- <i class="popover-menu-icon fa fa-bolt" aria-hidden="true"></i>
- <span class="popover-menu-label">{{t 'Link with Webathena' }}</span>
- </a>
- </li>
- {{/if}}
<li role="none" class="link-item popover-menu-list-item only-visible-for-spectators">
<a role="menuitem" href="{{login_link}}" class="navigate-link-on-enter popover-menu-link">
<i class="popover-menu-icon zulip-icon zulip-icon-log-in" aria-hidden="true"></i>
diff --git a/web/templates/stream_settings/stream_members.hbs b/web/templates/stream_settings/stream_members.hbs
index 4cdab9e8da5..d9a1f4f863d 100644
--- a/web/templates/stream_settings/stream_members.hbs
+++ b/web/templates/stream_settings/stream_members.hbs
@@ -1,4 +1,3 @@
-{{#if render_subscribers}}
<div class="subscriber_list_settings_container no-display">
<h4 class="stream_setting_subsection_title">
{{t "Add subscribers" }}
@@ -31,4 +30,3 @@
</div>
</div>
<div class="subscriber-list-settings-loading"></div>
-{{/if}}
diff --git a/web/tests/activity.test.cjs b/web/tests/activity.test.cjs
index 1f7294648d6..cffc90060f0 100644
--- a/web/tests/activity.test.cjs
+++ b/web/tests/activity.test.cjs
@@ -809,7 +809,6 @@ test("initialize", ({override, override_rewire}) => {
activity.initialize();
activity_ui.initialize({narrow_by_email() {}});
payload.success({
- zephyr_mirror_active: true,
presences: {},
msg: "",
result: "success",
@@ -821,7 +820,6 @@ test("initialize", ({override, override_rewire}) => {
assert.ok(scroll_handler_started);
assert.ok(!activity.new_user_input);
- assert.ok(!$("#zephyr-mirror-error").hasClass("show"));
assert.equal(activity.compute_active_status(), "active");
$(window).idle = (params) => {
@@ -834,7 +832,6 @@ test("initialize", ({override, override_rewire}) => {
activity.initialize();
activity_ui.initialize({narrow_by_email() {}});
payload.success({
- zephyr_mirror_active: false,
presences: {},
msg: "",
result: "success",
@@ -842,7 +839,6 @@ test("initialize", ({override, override_rewire}) => {
presence_last_update_id: -1,
});
- assert.ok($("#zephyr-mirror-error").hasClass("show"));
assert.ok(!activity.new_user_input);
assert.equal(activity.compute_active_status(), "idle");
diff --git a/web/tests/buddy_data.test.cjs b/web/tests/buddy_data.test.cjs
index 1b701920f71..9906368f9c2 100644
--- a/web/tests/buddy_data.test.cjs
+++ b/web/tests/buddy_data.test.cjs
@@ -569,12 +569,6 @@ test("user_last_seen_time_status", ({override}) => {
assert.equal(buddy_data.user_last_seen_time_status(selma.user_id), "translated: Active now");
- override(realm, "realm_is_zephyr_mirror_realm", true);
- assert.equal(
- buddy_data.user_last_seen_time_status(old_user.user_id),
- "translated: Activity unknown",
- );
- override(realm, "realm_is_zephyr_mirror_realm", false);
assert.equal(
buddy_data.user_last_seen_time_status(old_user.user_id),
"translated: Not active in the last year",
diff --git a/web/tests/compose_pm_pill.test.cjs b/web/tests/compose_pm_pill.test.cjs
index 69c3eb725ed..3b2891bcd2c 100644
--- a/web/tests/compose_pm_pill.test.cjs
+++ b/web/tests/compose_pm_pill.test.cjs
@@ -192,7 +192,7 @@ run_test("has_unconverted_data", ({override}) => {
override(compose_pm_pill.widget, "items", () => [{user_id: 99}, {email: "[email protected]"}]);
- // One of our items only knows email (as in a bridge-with-zephyr
+ // One of our items only knows email (as in a bridge
// scenario where we might not have registered the user yet), so
// we have some unconverted data.
assert.equal(compose_pm_pill.has_unconverted_data(), true);
diff --git a/web/tests/compose_validate.test.cjs b/web/tests/compose_validate.test.cjs
index 261233aafaa..422cf090f85 100644
--- a/web/tests/compose_validate.test.cjs
+++ b/web/tests/compose_validate.test.cjs
@@ -281,32 +281,14 @@ test_ui("validate", ({mock_template, override}) => {
assert.ok(!compose_validate.validate());
assert.ok(deactivated_user_error_rendered);
- override(realm, "realm_is_zephyr_mirror_realm", true);
- assert.ok(compose_validate.validate());
- override(realm, "realm_is_zephyr_mirror_realm", false);
-
initialize_pm_pill(mock_template);
add_content_to_compose_box();
compose_state.private_message_recipient_emails("[email protected]");
$("#send_message_form").set_find_results(".message-textarea", $("textarea#compose-textarea"));
assert.ok(compose_validate.validate());
- let zephyr_error_rendered = false;
// For this first block, we should fail due to empty compose.
let expected_invalid_state = true;
- mock_template("compose_banner/compose_banner.hbs", false, (data) => {
- if (data.classname === compose_banner.CLASSNAMES.zephyr_not_running) {
- assert.equal(
- data.banner_text,
- $t({
- defaultMessage:
- "You need to be running Zephyr mirroring in order to send messages!",
- }),
- );
- zephyr_error_rendered = true;
- }
- return "<banner-stub>";
- });
initialize_pm_pill(mock_template);
compose_state.private_message_recipient_emails("[email protected]");
$("textarea#compose-textarea").toggleClass = (classname, value) => {
@@ -317,13 +299,11 @@ test_ui("validate", ({mock_template, override}) => {
assert.ok(!$("#compose-send-button .loader").visible());
compose_validate.validate();
- // Now add content to compose, and expect to see the banner.
+ // Now add content to compose.
add_content_to_compose_box();
expected_invalid_state = false;
- $("#zephyr-mirror-error").addClass("show");
$("#send_message_form").set_find_results(".message-textarea", $("textarea#compose-textarea"));
- assert.ok(!compose_validate.validate());
- assert.ok(zephyr_error_rendered);
+ assert.ok(compose_validate.validate());
initialize_pm_pill(mock_template);
add_content_to_compose_box();
@@ -689,23 +669,20 @@ test_ui("warn_if_mentioning_unsubscribed_user", async ({override, mock_template}
return "<banner-stub>";
});
- async function test_noop_case(is_private, is_zephyr_mirror, type) {
+ async function test_noop_case(is_private, type) {
new_banner_rendered = false;
const msg_type = is_private ? "private" : "stream";
compose_state.set_message_type(msg_type);
- override(realm, "realm_is_zephyr_mirror_realm", is_zephyr_mirror);
mentioned_details.type = type;
await compose_validate.warn_if_mentioning_unsubscribed_user(mentioned_details, $textarea);
assert.ok(!new_banner_rendered);
}
- await test_noop_case(true, false, "user");
- await test_noop_case(false, true, "user");
- await test_noop_case(false, false, "broadcast");
+ await test_noop_case(true, "user");
+ await test_noop_case(false, "broadcast");
$("#compose_invite_users").hide();
compose_state.set_message_type("stream");
- override(realm, "realm_is_zephyr_mirror_realm", false);
// Test with empty stream name in compose box. It should return noop.
new_banner_rendered = false;
diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs
index 7cbee58be32..91ce9b43527 100644
--- a/web/tests/filter.test.cjs
+++ b/web/tests/filter.test.cjs
@@ -1434,48 +1434,6 @@ test("negated_predicates", () => {
assert.ok(predicate({}));
});
-function test_mit_exceptions() {
- const foo_stream_id = new_stream_id();
- make_sub("Foo", foo_stream_id);
- let predicate = get_predicate([
- ["channel", foo_stream_id.toString()],
- ["topic", "personal"],
- ]);
- assert.ok(predicate({type: stream_message, stream_id: foo_stream_id, topic: "personal"}));
- assert.ok(predicate({type: stream_message, stream_id: foo_stream_id, topic: ""}));
- // 9999 doesn't correspond to any channel
- assert.ok(!predicate({type: stream_message, stream_id: 9999}));
- assert.ok(!predicate({type: stream_message, stream_id: foo_stream_id, topic: "whatever"}));
- assert.ok(!predicate({type: direct_message}));
-
- predicate = get_predicate([
- ["channel", foo_stream_id.toString()],
- ["topic", "bar"],
- ]);
- assert.ok(predicate({type: stream_message, stream_id: foo_stream_id, topic: "bar.d"}));
-
- // Try to get the MIT regex to explode for an empty channel.
- let terms = [
- {operator: "channel", operand: ""},
- {operator: "topic", operand: "bar"},
- ];
- predicate = new Filter(terms).predicate();
- assert.ok(!predicate({type: stream_message, stream_id: foo_stream_id, topic: "bar"}));
-
- // Try to get the MIT regex to explode for an empty topic.
- terms = [
- {operator: "channel", operand: foo_stream_id.toString()},
- {operator: "topic", operand: ""},
- ];
- predicate = new Filter(terms).predicate();
- assert.ok(!predicate({type: stream_message, stream_id: foo_stream_id, topic: "bar"}));
-}
-
-test("mit_exceptions", ({override}) => {
- override(realm, "realm_is_zephyr_mirror_realm", true);
- test_mit_exceptions();
-});
-
test("predicate_edge_cases", () => {
let predicate;
// The code supports undefined as an operator to Filter, which results
diff --git a/web/tests/lib/compose_banner.cjs b/web/tests/lib/compose_banner.cjs
index c02c8a377bf..5d352e186f0 100644
--- a/web/tests/lib/compose_banner.cjs
+++ b/web/tests/lib/compose_banner.cjs
@@ -33,7 +33,6 @@ exports.mock_banners = () => {
$cb.set_find_results(".wildcard_warning", $stub);
$cb.set_find_results(".topic_missing", $stub);
$cb.set_find_results(".missing_stream", $stub);
- $cb.set_find_results(".zephyr_not_running", $stub);
$cb.set_find_results(".deactivated_user", $stub);
$cb.set_find_results(".missing_private_message_recipient", $stub);
$cb.set_find_results(".subscription_error", $stub);
diff --git a/web/tests/lib/example_realm.cjs b/web/tests/lib/example_realm.cjs
index 7409dc8ecb0..453202c33eb 100644
--- a/web/tests/lib/example_realm.cjs
+++ b/web/tests/lib/example_realm.cjs
@@ -90,7 +90,6 @@ exports.make_realm = (opts = {}) => {
realm_inline_image_preview: false,
realm_inline_url_embed_preview: false,
realm_invite_required: false,
- realm_is_zephyr_mirror_realm: false,
realm_jitsi_server_url: null,
realm_linkifiers: [],
realm_logo_source: "",
diff --git a/web/tests/lib/example_stream.cjs b/web/tests/lib/example_stream.cjs
index 0577df24560..9b410298293 100644
--- a/web/tests/lib/example_stream.cjs
+++ b/web/tests/lib/example_stream.cjs
@@ -40,7 +40,6 @@ exports.make_stream = (opts = {}) => {
pin_to_top: false,
previously_subscribed: false,
push_notifications: false,
- render_subscribers: false,
rendered_description: `<p>Description of ${name}</p>`,
stream_id,
/* STREAM_POST_POLICY_EVERYONE */
diff --git a/web/tests/pill_typeahead.test.cjs b/web/tests/pill_typeahead.test.cjs
index dd5808fcb6d..1576a847f4d 100644
--- a/web/tests/pill_typeahead.test.cjs
+++ b/web/tests/pill_typeahead.test.cjs
@@ -135,7 +135,6 @@ const denmark = {
stream_id: 1,
name: "Denmark",
subscribed: true,
- render_subscribers: true,
};
const denmark_item = stream_item(denmark);
diff --git a/web/tests/typeahead_helper.test.cjs b/web/tests/typeahead_helper.test.cjs
index f1fbb7dc56c..4d12c0f16ed 100644
--- a/web/tests/typeahead_helper.test.cjs
+++ b/web/tests/typeahead_helper.test.cjs
@@ -212,7 +212,6 @@ function test(label, f) {
peer_data.clear_for_testing();
people.clear_recipient_counts_for_testing();
helpers.override(current_user, "is_admin", false);
- helpers.override(realm, "realm_is_zephyr_mirror_realm", false);
f(helpers);
});
diff --git a/zerver/actions/create_user.py b/zerver/actions/create_user.py
index 3038be5f5bd..95674aa6159 100644
--- a/zerver/actions/create_user.py
+++ b/zerver/actions/create_user.py
@@ -295,12 +295,9 @@ def process_new_human_user(
)
realm = user_profile.realm
- mit_beta_user = realm.is_zephyr_mirror_realm
- # mit_beta_users don't have a referred_by field
if (
- not mit_beta_user
- and prereg_user is not None
+ prereg_user is not None
and prereg_user.referred_by is not None
and prereg_user.referred_by.is_active
and prereg_user.notify_referrer_on_join
diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.py
index 61355e35d20..b54e8260790 100644
--- a/zerver/actions/message_send.py
+++ b/zerver/actions/message_send.py
@@ -37,7 +37,6 @@ from zerver.lib.exceptions import (
StreamWithIDDoesNotExistError,
TopicsNotAllowedError,
TopicWildcardMentionNotAllowedError,
- ZephyrMessageAlreadySentError,
)
from zerver.lib.markdown import MessageRenderingResult, render_message_markdown
from zerver.lib.markdown import version as markdown_version
@@ -844,7 +843,7 @@ def get_active_presence_idle_user_ids(
UserPresence table.
"""
- if realm.presence_disabled:
+ if realm.presence_disabled: # nocoverage
return []
user_ids = set()
@@ -1269,35 +1268,6 @@ def do_send_messages(
return sent_message_results
-def already_sent_mirrored_message_id(message: Message) -> int | None:
- if message.recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
- # For group direct messages, we use a 10-second window because
- # the timestamps aren't guaranteed to actually match between
- # two copies of the same message.
- time_window = timedelta(seconds=10)
- else:
- time_window = timedelta(seconds=0)
-
- messages = Message.objects.filter(
- # Uses index: zerver_message_realm_recipient_subject for
- # channel messages or zerver_message_realm_sender_recipient for
- # DMs
- realm_id=message.realm_id,
- sender=message.sender,
- recipient=message.recipient,
- subject=message.topic_name(),
- is_channel_message=message.is_channel_message,
- content=message.content,
- sending_client=message.sending_client,
- date_sent__gte=message.date_sent - time_window,
- date_sent__lte=message.date_sent + time_window,
- )
-
- if messages.exists():
- return messages[0].id
- return None
-
-
def extract_stream_indicator(s: str) -> str | int:
# Users can pass stream name as either an id or a name,
# and if they choose to pass a name, they may JSON encode
@@ -1440,23 +1410,20 @@ def check_send_message(
read_by_sender: bool = False,
) -> SentMessageResult:
addressee = Addressee.legacy_build(sender, recipient_type_name, message_to, topic_name)
- try:
- message = check_message(
- sender,
- client,
- addressee,
- message_content,
- realm,
- forged,
- forged_timestamp,
- forwarder_user_profile,
- local_id,
- sender_queue_id,
- widget_content,
- skip_stream_access_check=skip_stream_access_check,
- )
- except ZephyrMessageAlreadySentError as e:
- return SentMessageResult(message_id=e.message_id)
+ message = check_message(
+ sender,
+ client,
+ addressee,
+ message_content,
+ realm,
+ forged,
+ forged_timestamp,
+ forwarder_user_profile,
+ local_id,
+ sender_queue_id,
+ widget_content,
+ skip_stream_access_check=skip_stream_access_check,
+ )
return do_send_messages([message], mark_as_read=[sender.id] if read_by_sender else [])[0]
@@ -1467,7 +1434,7 @@ def send_rate_limited_pm_notification_to_bot_owner(
Sends a direct message error notification to a bot's owner if one
hasn't already been sent in the last 5 minutes.
"""
- if sender.realm.is_zephyr_mirror_realm or sender.realm.deactivated:
+ if sender.realm.deactivated:
return
if not sender.is_bot or sender.bot_owner is None:
@@ -1799,7 +1766,6 @@ def check_message(
elif addressee.is_private():
user_profiles = addressee.user_profiles()
mirror_message = client.name in [
- "zephyr_mirror",
"irc_mirror",
"jabber_mirror",
"JabberMirror",
@@ -1851,11 +1817,6 @@ def check_message(
# We render messages later in the process.
assert message.rendered_content is None
- if client.name == "zephyr_mirror":
- id = already_sent_mirrored_message_id(message)
- if id is not None:
- raise ZephyrMessageAlreadySentError(id)
-
widget_content_dict = None
if widget_content is not None:
try:
diff --git a/zerver/actions/streams.py b/zerver/actions/streams.py
index 781d32db5ea..f8656c57aac 100644
--- a/zerver/actions/streams.py
+++ b/zerver/actions/streams.py
@@ -422,10 +422,7 @@ def send_subscription_add_events(
for sub_info in sub_info_list:
stream = sub_info.stream
if stream.id not in stream_subscribers_dict:
- if stream.is_in_zephyr_realm and not stream.invite_only:
- subscribers = []
- else:
- subscribers = list(subscriber_dict[stream.id])
+ subscribers = list(subscriber_dict[stream.id])
stream_subscribers_dict[stream.id] = subscribers
streams = [sub_info.stream for sub_info in sub_info_list]
@@ -602,9 +599,7 @@ def send_peer_subscriber_events(
stream_id for stream_id in altered_user_dict if stream_dict[stream_id].invite_only
]
public_stream_ids = [
- stream_id
- for stream_id in altered_user_dict
- if not stream_dict[stream_id].invite_only and not stream_dict[stream_id].is_in_zephyr_realm
+ stream_id for stream_id in altered_user_dict if not stream_dict[stream_id].invite_only
]
web_public_stream_ids = [
stream_id for stream_id in public_stream_ids if stream_dict[stream_id].is_web_public
diff --git a/zerver/actions/users.py b/zerver/actions/users.py
index 96ff03c0ff0..0e749b29c2b 100644
--- a/zerver/actions/users.py
+++ b/zerver/actions/users.py
@@ -82,9 +82,6 @@ from zerver.tornado.django_api import send_event_on_commit
def do_delete_user(user_profile: UserProfile, *, acting_user: UserProfile | None) -> None:
- if user_profile.realm.is_zephyr_mirror_realm:
- raise AssertionError("Deleting zephyr mirror users is not supported")
-
do_deactivate_user(user_profile, acting_user=acting_user)
to_resubscribe_recipient_ids = set(
@@ -187,9 +184,6 @@ def do_delete_user_preserving_messages(user_profile: UserProfile) -> None:
space of user IDs that contain actual users.
"""
- if user_profile.realm.is_zephyr_mirror_realm:
- raise AssertionError("Deleting zephyr mirror users is not supported")
-
do_deactivate_user(user_profile, acting_user=None)
user_id = user_profile.id
@@ -520,16 +514,6 @@ def do_deactivate_user(
do_deactivate_user(profile, _cascade=False, acting_user=acting_user)
with transaction.atomic(savepoint=False):
- if user_profile.realm.is_zephyr_mirror_realm: # nocoverage
- # For zephyr mirror users, we need to make them a mirror dummy
- # again; otherwise, other users won't get the correct behavior
- # when trying to send messages to this person inside Zulip.
- #
- # Ideally, we need to also ensure their zephyr mirroring bot
- # isn't running, but that's a separate issue.
- user_profile.is_mirror_dummy = True
- user_profile.save(update_fields=["is_mirror_dummy"])
-
change_user_is_active(user_profile, False)
clear_scheduled_emails([user_profile.id])
diff --git a/zerver/decorator.py b/zerver/decorator.py
index d66f4a0eac5..150de05ddc6 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -937,7 +937,7 @@ def authenticated_json_view(
*args: ParamT.args,
**kwargs: ParamT.kwargs,
) -> HttpResponse:
- if not request.user.is_authenticated:
+ if not request.user.is_authenticated: # nocoverage
raise UnauthorizedError
user_profile = request.user
diff --git a/zerver/forms.py b/zerver/forms.py
index c3b286b03c2..d40fc8b6c10 100644
--- a/zerver/forms.py
+++ b/zerver/forms.py
@@ -1,10 +1,8 @@
import base64
import logging
import re
-from email.headerregistry import Address
from typing import Any
-import dns.resolver
import orjson
from altcha import verify_solution
from django import forms
@@ -71,19 +69,6 @@ DEACTIVATED_ACCOUNT_ERROR = gettext_lazy(
PASSWORD_TOO_WEAK_ERROR = gettext_lazy("The password is too weak.")
-def email_is_not_mit_mailing_list(email: str) -> None:
- """Prevent MIT mailing lists from signing up for Zulip"""
- address = Address(addr_spec=email)
- if address.domain == "mit.edu":
- # Check whether the user exists and can get mail.
- try:
- dns.resolver.resolve(f"{address.username}.pobox.ns.athena.mit.edu", "TXT")
- except dns.resolver.NXDOMAIN:
- # This error is Markup only because 1. it needs to render HTML
- # 2. It's not formatted with any user input.
- raise ValidationError(MIT_VALIDATION_ERROR)
-
-
class OverridableValidationError(ValidationError):
pass
@@ -307,9 +292,6 @@ class HomepageForm(forms.Form):
_("Email addresses containing + are not allowed in this organization.")
)
- if realm.is_zephyr_mirror_realm:
- email_is_not_mit_mailing_list(email)
-
if settings.BILLING_ENABLED:
from corporate.lib.registration import (
check_spare_licenses_available_for_registering_new_user,
diff --git a/zerver/lib/bulk_create.py b/zerver/lib/bulk_create.py
index 207f6798fdb..cfaf73bd3c5 100644
--- a/zerver/lib/bulk_create.py
+++ b/zerver/lib/bulk_create.py
@@ -206,10 +206,6 @@ def bulk_create_streams(realm: Realm, stream_dict: dict[str, dict[str, Any]]) ->
}
streams_to_create: list[Stream] = []
for name, options in stream_dict.items():
- if "history_public_to_subscribers" not in options:
- options["history_public_to_subscribers"] = (
- not options.get("invite_only", False) and not realm.is_zephyr_mirror_realm
- )
creator = options.get("creator", None)
if name.lower() not in existing_streams:
stream = Stream(
@@ -218,9 +214,8 @@ def bulk_create_streams(realm: Realm, stream_dict: dict[str, dict[str, Any]]) ->
description=options["description"],
rendered_description=render_stream_description(options["description"], realm),
invite_only=options.get("invite_only", False),
- history_public_to_subscribers=options["history_public_to_subscribers"],
+ history_public_to_subscribers=options.get("history_public_to_subscribers", True),
is_web_public=options.get("is_web_public", False),
- is_in_zephyr_realm=realm.is_zephyr_mirror_realm,
creator=options.get("creator", None),
folder_id=options.get("folder_id", None),
topics_policy=options.get("topics_policy", StreamTopicsPolicyEnum.inherit.value),
diff --git a/zerver/lib/ccache.py b/zerver/lib/ccache.py
deleted file mode 100644
index 966962cdf0c..00000000000
--- a/zerver/lib/ccache.py
+++ /dev/null
@@ -1,216 +0,0 @@
-import base64
-import struct
-from typing import Any
-
-# This file is adapted from samples/shellinabox/ssh-krb-wrapper in
-# https://github.com/davidben/webathena, which has the following
-# license:
-#
-# Copyright (c) 2013 David Benjamin and Alan Huang
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-# Some DER encoding stuff. Bleh. This is because the ccache contains a
-# DER-encoded krb5 Ticket structure, whereas Webathena deserializes
-# into the various fields. Re-encoding in the client would be easy as
-# there is already an ASN.1 implementation, but in the interest of
-# limiting MIT Kerberos's exposure to malformed ccaches, encode it
-# ourselves. To that end, here's the laziest DER encoder ever.
-def der_encode_length(length: int) -> bytes:
- if length <= 127:
- return struct.pack("!B", length)
- out = b""
- while length > 0:
- out = struct.pack("!B", length & 0xFF) + out
- length >>= 8
- out = struct.pack("!B", len(out) | 0x80) + out
- return out
-
-
-def der_encode_tlv(tag: int, value: bytes) -> bytes:
- return struct.pack("!B", tag) + der_encode_length(len(value)) + value
-
-
-def der_encode_integer_value(val: int) -> bytes:
- if not isinstance(val, int):
- raise TypeError("int")
- # base 256, MSB first, two's complement, minimum number of octets
- # necessary. This has a number of annoying edge cases:
- # * 0 and -1 are 0x00 and 0xFF, not the empty string.
- # * 255 is 0x00 0xFF, not 0xFF
- # * -256 is 0xFF 0x00, not 0x00
-
- # Special-case to avoid an empty encoding.
- if val == 0:
- return b"\x00"
- sign = 0 # What you would get if you sign-extended the current high bit.
- out = b""
- # We can stop once sign-extension matches the remaining value.
- while val != sign:
- byte = val & 0xFF
- out = struct.pack("!B", byte) + out
- sign = -1 if byte & 0x80 == 0x80 else 0
- val >>= 8
- return out
-
-
-def der_encode_integer(val: int) -> bytes:
- return der_encode_tlv(0x02, der_encode_integer_value(val))
-
-
-def der_encode_int32(val: int) -> bytes:
- if val < -2147483648 or val > 2147483647:
- raise ValueError("Bad value")
- return der_encode_integer(val)
-
-
-def der_encode_uint32(val: int) -> bytes:
- if val < 0 or val > 4294967295:
- raise ValueError("Bad value")
- return der_encode_integer(val)
-
-
-def der_encode_string(val: str) -> bytes:
- if not isinstance(val, str):
- raise TypeError("unicode")
- return der_encode_tlv(0x1B, val.encode())
-
-
-def der_encode_octet_string(val: bytes) -> bytes:
- if not isinstance(val, bytes):
- raise TypeError("bytes")
- return der_encode_tlv(0x04, val)
-
-
-def der_encode_sequence(tlvs: list[bytes | None], tagged: bool = True) -> bytes:
- body = []
- for i, tlv in enumerate(tlvs):
- # Missing optional elements represented as None.
- if tlv is None:
- continue
- if tagged:
- # Assume kerberos-style explicit tagging of components.
- tlv = der_encode_tlv(0xA0 | i, tlv)
- body.append(tlv)
- return der_encode_tlv(0x30, b"".join(body))
-
-
-def der_encode_ticket(tkt: dict[str, Any]) -> bytes:
- return der_encode_tlv(
- 0x61, # Ticket
- der_encode_sequence(
- [
- der_encode_integer(5), # tktVno
- der_encode_string(tkt["realm"]),
- der_encode_sequence( # PrincipalName
- [
- der_encode_int32(tkt["sname"]["nameType"]),
- der_encode_sequence(
- [der_encode_string(c) for c in tkt["sname"]["nameString"]], tagged=False
- ),
- ]
- ),
- der_encode_sequence( # EncryptedData
- [
- der_encode_int32(tkt["encPart"]["etype"]),
- (
- der_encode_uint32(tkt["encPart"]["kvno"])
- if "kvno" in tkt["encPart"]
- else None
- ),
- der_encode_octet_string(base64.b64decode(tkt["encPart"]["cipher"])),
- ]
- ),
- ]
- ),
- )
-
-
-# Kerberos ccache writing code. Using format documentation from here:
-# https://www.gnu.org/software/shishi/manual/html_node/The-Credential-Cache-Binary-File-Format.html
-
-
-def ccache_counted_octet_string(data: bytes) -> bytes:
- if not isinstance(data, bytes):
- raise TypeError("bytes")
- return struct.pack("!I", len(data)) + data
-
-
-def ccache_principal(name: dict[str, str], realm: str) -> bytes:
- header = struct.pack("!II", name["nameType"], len(name["nameString"]))
- return (
- header
- + ccache_counted_octet_string(realm.encode())
- + b"".join(ccache_counted_octet_string(c.encode()) for c in name["nameString"])
- )
-
-
-def ccache_key(key: dict[str, str]) -> bytes:
- return struct.pack("!H", key["keytype"]) + ccache_counted_octet_string(
- base64.b64decode(key["keyvalue"])
- )
-
-
-def flags_to_uint32(flags: list[str]) -> int:
- ret = 0
- for i, v in enumerate(flags):
- if v:
- ret |= 1 << (31 - i)
- return ret
-
-
-def ccache_credential(cred: dict[str, Any]) -> bytes:
- out = ccache_principal(cred["cname"], cred["crealm"])
- out += ccache_principal(cred["sname"], cred["srealm"])
- out += ccache_key(cred["key"])
- out += struct.pack(
- "!IIII",
- cred["authtime"] // 1000,
- cred.get("starttime", cred["authtime"]) // 1000,
- cred["endtime"] // 1000,
- cred.get("renewTill", 0) // 1000,
- )
- out += struct.pack("!B", 0)
- out += struct.pack("!I", flags_to_uint32(cred["flags"]))
- # TODO: Care about addrs or authdata? Former is "caddr" key.
- out += struct.pack("!II", 0, 0)
- out += ccache_counted_octet_string(der_encode_ticket(cred["ticket"]))
- # No second_ticket.
- out += ccache_counted_octet_string(b"")
- return out
-
-
-def make_ccache(cred: dict[str, Any]) -> bytes:
- # Do we need a DeltaTime header? The ccache I get just puts zero
- # in there, so do the same.
- out = struct.pack(
- "!HHHHII",
- 0x0504, # file_format_version
- 12, # headerlen
- 1, # tag (DeltaTime)
- 8, # taglen (two uint32_ts)
- 0,
- 0, # time_offset / usec_offset
- )
- out += ccache_principal(cred["cname"], cred["crealm"])
- out += ccache_credential(cred)
- return out
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index 20283d057fc..502b3fff8bb 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -490,7 +490,7 @@ def fetch_initial_state_data(
)
state["server_generation"] = settings.SERVER_GENERATION
- state["realm_is_zephyr_mirror_realm"] = realm.is_zephyr_mirror_realm
+ state["realm_is_zephyr_mirror_realm"] = False
state["development_environment"] = settings.DEVELOPMENT
state["realm_org_type"] = realm.org_type
state["realm_plan_type"] = realm.plan_type
diff --git a/zerver/lib/exceptions.py b/zerver/lib/exceptions.py
index f679a627add..4528e07ea8a 100644
--- a/zerver/lib/exceptions.py
+++ b/zerver/lib/exceptions.py
@@ -518,11 +518,6 @@ class InvalidSubdomainError(JsonableError):
return _("Invalid subdomain")
-class ZephyrMessageAlreadySentError(Exception):
- def __init__(self, message_id: int) -> None:
- self.message_id = message_id
-
-
class InvitationError(JsonableError):
code = ErrorCode.INVITATION_FAILED
data_fields = [
diff --git a/zerver/lib/home.py b/zerver/lib/home.py
index 0fe9132d2b6..309aaeaf70e 100644
--- a/zerver/lib/home.py
+++ b/zerver/lib/home.py
@@ -37,7 +37,6 @@ class UserPermissionInfo:
is_guest: bool
is_realm_admin: bool
is_realm_owner: bool
- show_webathena: bool
def get_furthest_read_time(user_profile: UserProfile | None) -> float | None:
@@ -67,7 +66,6 @@ def get_user_permission_info(user_profile: UserProfile | None) -> UserPermission
is_guest=user_profile.is_guest,
is_realm_owner=user_profile.is_realm_owner,
is_realm_admin=user_profile.is_realm_admin,
- show_webathena=user_profile.realm.webathena_enabled,
)
else:
return UserPermissionInfo(
@@ -75,7 +73,6 @@ def get_user_permission_info(user_profile: UserProfile | None) -> UserPermission
is_guest=False,
is_realm_admin=False,
is_realm_owner=False,
- show_webathena=False,
)
@@ -151,7 +148,6 @@ def build_page_params_for_home_page_load(
furthest_read_time = get_furthest_read_time(user_profile)
two_fa_enabled = settings.TWO_FACTOR_AUTHENTICATION_ENABLED and user_profile is not None
- user_permission_info = get_user_permission_info(user_profile)
# Pass parameters to the client-side JavaScript code.
# These end up in a JavaScript Object named 'page_params'.
@@ -173,7 +169,6 @@ def build_page_params_for_home_page_load(
two_fa_enabled=two_fa_enabled,
apps_page_url=get_apps_page_url(),
promote_sponsoring_zulip=promote_sponsoring_zulip_in_realm(realm),
- show_webathena=user_permission_info.show_webathena,
# Adding two_fa_enabled as condition saves us 3 queries when
# 2FA is not enabled.
two_fa_enabled_user=two_fa_enabled and bool(default_device(user_profile)),
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
index 37727a38a40..e3ba7f66d39 100644
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -2136,7 +2136,6 @@ def get_sub_registry(r: markdown.util.Registry[T], keys: list[str]) -> markdown.
# These are used as keys ("linkifiers_keys") to md_engines and the respective
# linkifier caches
DEFAULT_MARKDOWN_KEY = -1
-ZEPHYR_MIRROR_MARKDOWN_KEY = -2
class ZulipMarkdown(markdown.Markdown):
@@ -2184,7 +2183,6 @@ class ZulipMarkdown(markdown.Markdown):
self.inlinePatterns = self.build_inlinepatterns()
self.treeprocessors = self.build_treeprocessors()
self.postprocessors = self.build_postprocessors()
- self.handle_zephyr_mirror()
return self
def build_preprocessors(self) -> markdown.util.Registry[markdown.preprocessors.Preprocessor]:
@@ -2347,26 +2345,6 @@ class ZulipMarkdown(markdown.Markdown):
)
return postprocessors
- def handle_zephyr_mirror(self) -> None:
- if self.linkifiers_key == ZEPHYR_MIRROR_MARKDOWN_KEY:
- # Disable almost all inline patterns for zephyr mirror
- # users' traffic that is mirrored. Note that
- # inline_interesting_links is a treeprocessor and thus is
- # not removed
- self.inlinePatterns = get_sub_registry(self.inlinePatterns, ["autolink"])
- self.treeprocessors = get_sub_registry(
- self.treeprocessors, ["inline_interesting_links", "rewrite_images_proxy"]
- )
- # insert new 'inline' processor because we have changed self.inlinePatterns
- # but InlineProcessor copies md as self.md in __init__.
- self.treeprocessors.register(
- markdown.treeprocessors.InlineProcessor(self), "inline", 25
- )
- self.preprocessors = get_sub_registry(self.preprocessors, ["custom_text_notifications"])
- self.parser.blockprocessors = get_sub_registry(
- self.parser.blockprocessors, ["paragraph"]
- )
-
md_engines: dict[tuple[int, bool], ZulipMarkdown] = {}
linkifier_data: dict[int, list[LinkifierDict]] = {}
@@ -2581,16 +2559,6 @@ def do_convert(
else:
logging_message_id = "unknown"
- if (
- message is not None
- and message_realm is not None
- and message_realm.is_zephyr_mirror_realm
- and message.sending_client.name == "zephyr_mirror"
- ):
- # Use slightly customized Markdown processor for content
- # delivered via zephyr_mirror
- linkifiers_key = ZEPHYR_MIRROR_MARKDOWN_KEY
-
maybe_update_markdown_engines(linkifiers_key, email_gateway)
md_engine_key = (linkifiers_key, email_gateway)
_md_engine = md_engines[md_engine_key]
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index ebd876dc4fb..124bf08fa55 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -653,9 +653,7 @@ def event_recipient_ids_for_action_on_messages(
# * Users who were initially subscribed and later unsubscribed
# (usermessages exist for messages they received while subscribed).
usermessage_rows = UserMessage.objects.filter(message_id__in=message_ids).exclude(
- # Excluding guests here implements can_access_public_channels,
- # since we already know realm.is_zephyr_mirror_realm is false,
- # based on the value of is_history_public_to_subscribers.
+ # Excluding guests here implements can_access_public_channels.
user_profile__role=UserProfile.ROLE_GUEST
)
if exclude_long_term_idle_users:
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.py
index fded59849ce..e692309674a 100644
--- a/zerver/lib/narrow.py
+++ b/zerver/lib/narrow.py
@@ -77,7 +77,6 @@ from zerver.models import (
UserProfile,
)
from zerver.models.recipients import get_direct_message_group_user_ids
-from zerver.models.streams import get_active_streams
from zerver.models.users import (
get_user_by_id_in_realm_including_cross_realm,
get_user_including_cross_realm,
@@ -450,25 +449,6 @@ class NarrowBuilder:
_alphanum = frozenset("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
- def _pg_re_escape(self, pattern: str) -> str:
- """
- Escape user input to place in a regex
-
- Python's re.escape escapes Unicode characters in a way which PostgreSQL
- fails on, '\u03bb' to '\\\u03bb'. This function will correctly escape
- them for PostgreSQL, '\u03bb' to '\\u03bb'.
- """
- s = list(pattern)
- for i, c in enumerate(s):
- if c not in self._alphanum:
- if ord(c) >= 128:
- # convert the character to hex PostgreSQL regex will take
- # \uXXXX
- s[i] = f"\\u{ord(c):0>4x}"
- else:
- s[i] = "\\" + c
- return "".join(s)
-
def by_channel(
self, query: Select, operand: str | int, maybe_negate: ConditionTransform
) -> Select:
@@ -485,32 +465,6 @@ class NarrowBuilder:
except Stream.DoesNotExist:
raise BadNarrowOperatorError("unknown channel " + str(operand))
- if self.realm.is_zephyr_mirror_realm:
- # MIT users expect narrowing to "social" to also show messages to
- # /^(un)*social(.d)*$/ (unsocial, ununsocial, social.d, ...).
-
- # In `ok_to_include_history`, we assume that a non-negated
- # `channel` term for a public channel will limit the query to
- # that specific channel. So it would be a bug to hit this
- # codepath after relying on this term there. But all channels in
- # a Zephyr realm are private, so that doesn't happen.
- assert not channel.is_public()
-
- m = re.search(r"^(?:un)*(.+?)(?:\.d)*$", channel.name, re.IGNORECASE)
- # Since the regex has a `.+` in it and "" is invalid as a
- # channel name, this will always match
- assert m is not None
- base_channel_name = m.group(1)
-
- matching_channels = get_active_streams(self.realm).filter(
- name__iregex=rf"^(un)*{self._pg_re_escape(base_channel_name)}(\.d)*$"
- )
- recipient_ids = [
- matching_channel.recipient_id for matching_channel in matching_channels
- ]
- cond = column("recipient_id", Integer).in_(recipient_ids)
- return query.where(maybe_negate(cond))
-
recipient_id = channel.recipient_id
assert recipient_id is not None
cond = column("recipient_id", Integer) == recipient_id
@@ -535,47 +489,6 @@ class NarrowBuilder:
def by_topic(self, query: Select, operand: str, maybe_negate: ConditionTransform) -> Select:
self.check_not_both_channel_and_dm_narrow(maybe_negate, is_channel_narrow=True)
- if self.realm.is_zephyr_mirror_realm:
- # MIT users expect narrowing to topic "foo" to also show messages to /^foo(.d)*$/
- # (foo, foo.d, foo.d.d, etc)
- m = re.search(r"^(.*?)(?:\.d)*$", operand, re.IGNORECASE)
- # Since the regex has a `.*` in it, this will always match
- assert m is not None
- base_topic = m.group(1)
-
- # Additionally, MIT users expect the empty instance and
- # instance "personal" to be the same.
- if base_topic in ("", "personal", '(instance "")'):
- cond: ClauseElement = or_(
- topic_match_sa(""),
- topic_match_sa(".d"),
- topic_match_sa(".d.d"),
- topic_match_sa(".d.d.d"),
- topic_match_sa(".d.d.d.d"),
- topic_match_sa("personal"),
- topic_match_sa("personal.d"),
- topic_match_sa("personal.d.d"),
- topic_match_sa("personal.d.d.d"),
- topic_match_sa("personal.d.d.d.d"),
- topic_match_sa('(instance "")'),
- topic_match_sa('(instance "").d'),
- topic_match_sa('(instance "").d.d'),
- topic_match_sa('(instance "").d.d.d'),
- topic_match_sa('(instance "").d.d.d.d'),
- )
- else:
- # We limit `.d` counts, since PostgreSQL has much better
- # query planning for this than they do for a regular
- # expression (which would sometimes table scan).
- cond = or_(
- topic_match_sa(base_topic),
- topic_match_sa(base_topic + ".d"),
- topic_match_sa(base_topic + ".d.d"),
- topic_match_sa(base_topic + ".d.d.d"),
- topic_match_sa(base_topic + ".d.d.d.d"),
- )
- return query.where(maybe_negate(cond))
-
cond = topic_match_sa(operand)
return query.where(maybe_negate(cond))
@@ -1128,7 +1041,6 @@ def get_base_query_for_search(
or_(
and_(
not_(literal_column("zerver_stream.invite_only", Boolean)),
- not_(literal_column("zerver_stream.is_in_zephyr_realm", Boolean)),
user_profile.can_access_public_streams(),
),
literal_column("zerver_stream.can_subscribe_group_id").in_(
diff --git a/zerver/lib/presence.py b/zerver/lib/presence.py
index 2f98aac9116..15e398b4a7f 100644
--- a/zerver/lib/presence.py
+++ b/zerver/lib/presence.py
@@ -234,7 +234,7 @@ def get_presences_for_realm(
history_limit_days: int | None,
requesting_user_profile: UserProfile,
) -> tuple[dict[str, dict[str, dict[str, Any]]], int]:
- if realm.presence_disabled:
+ if realm.presence_disabled: # nocoverage
# Return an empty dict if presence is disabled in this realm
return defaultdict(dict), -1
diff --git a/zerver/lib/stream_traffic.py b/zerver/lib/stream_traffic.py
index fe7e3ff5da0..01e5e14b755 100644
--- a/zerver/lib/stream_traffic.py
+++ b/zerver/lib/stream_traffic.py
@@ -9,10 +9,6 @@ from zerver.models import Realm
def get_streams_traffic(stream_ids: set[int], realm: Realm) -> dict[int, int] | None:
- if realm.is_zephyr_mirror_realm:
- # We do not need traffic data for streams in zephyr mirroring realm.
- return None
-
stat = COUNT_STATS["messages_in_stream:is_bot:day"]
traffic_from = timezone_now() - timedelta(days=28)
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py
index 8b376ffee9f..b53e8da73a1 100644
--- a/zerver/lib/streams.py
+++ b/zerver/lib/streams.py
@@ -169,11 +169,6 @@ def get_default_value_for_history_public_to_subscribers(
# history, we can remove this code path.
history_public_to_subscribers = True
- if realm.is_zephyr_mirror_realm:
- # In the Zephyr mirroring model, history is unconditionally
- # not public to subscribers, even for public streams.
- history_public_to_subscribers = False
-
return history_public_to_subscribers
@@ -400,7 +395,6 @@ def create_stream_if_needed(
invite_only=invite_only,
is_web_public=is_web_public,
history_public_to_subscribers=history_public_to_subscribers,
- is_in_zephyr_realm=realm.is_zephyr_mirror_realm,
message_retention_days=message_retention_days,
folder=folder,
topics_policy=topics_policy,
@@ -729,7 +723,6 @@ def user_has_content_access(
user_group_membership_details: UserGroupMembershipDetails,
*,
is_subscribed: bool,
- exclude_zephyr_realms_from_public_check: bool = False,
) -> bool:
if stream.is_web_public:
return True
@@ -740,9 +733,6 @@ def user_has_content_access(
if user_profile.is_guest:
return False
- if exclude_zephyr_realms_from_public_check and not stream.invite_only:
- return True
-
if stream.is_public():
return True
@@ -998,15 +988,6 @@ def check_stream_name_available(realm: Realm, name: str) -> None:
pass
-def check_zephyr_realm_invite_conditions(
- is_subscribing_other_users: bool, realm: Realm, invite_only: bool
-) -> None:
- if is_subscribing_other_users and realm.is_zephyr_mirror_realm and not invite_only:
- raise JsonableError(
- _("You can only invite other Zephyr mirroring users to private channels.")
- )
-
-
def access_stream_by_name(
user_profile: UserProfile,
stream_name: str,
@@ -1430,8 +1411,6 @@ def get_content_access_streams(
user_profile: UserProfile,
streams: Collection[Stream],
user_group_membership_details: UserGroupMembershipDetails,
- *,
- exclude_zephyr_realms_from_public_check: bool = False,
) -> list[Stream]:
if len(streams) == 0:
return []
@@ -1452,7 +1431,6 @@ def get_content_access_streams(
stream,
user_group_membership_details,
is_subscribed=is_subscribed,
- exclude_zephyr_realms_from_public_check=exclude_zephyr_realms_from_public_check,
):
content_access_streams.append(stream)
@@ -1469,14 +1447,11 @@ def filter_stream_authorization_for_adding_subscribers(
streams_to_which_user_cannot_add_subscribers=[],
)
- # For adding subscribers, we consider streams in zephyr realm
- # public.
user_group_membership_details = UserGroupMembershipDetails(user_recursive_group_ids=None)
content_access_streams = get_content_access_streams(
user_profile,
streams,
user_group_membership_details,
- exclude_zephyr_realms_from_public_check=True,
)
content_access_stream_ids = {stream.id for stream in content_access_streams}
@@ -1776,8 +1751,7 @@ def get_streams_for_user(
*Stream.API_FIELDS,
"can_send_message_group",
"can_send_message_group__named_user_group",
- # Both of these fields are need for get_content_access_streams.
- "is_in_zephyr_realm",
+ # This field is needed for get_content_access_streams.
"recipient_id",
)
)
@@ -1803,8 +1777,7 @@ def get_streams_for_user(
*Stream.API_FIELDS,
"can_send_message_group",
"can_send_message_group__named_user_group",
- # Both of these fields are need for get_content_access_streams.
- "is_in_zephyr_realm",
+ # This field is needed for get_content_access_streams.
"recipient_id",
)
)
diff --git a/zerver/lib/subscription_info.py b/zerver/lib/subscription_info.py
index ae054b68bff..d025536c3fa 100644
--- a/zerver/lib/subscription_info.py
+++ b/zerver/lib/subscription_info.py
@@ -196,7 +196,7 @@ def build_stream_api_dict(
stream_weekly_traffic = get_average_weekly_stream_traffic(
raw_stream_dict["id"], raw_stream_dict["date_created"], recent_traffic
)
- else:
+ else: # nocoverage
stream_weekly_traffic = None
# Backwards-compatibility for clients that haven't been
@@ -388,7 +388,7 @@ def build_stream_dict_for_never_sub(
stream_weekly_traffic = get_average_weekly_stream_traffic(
raw_stream_dict["id"], raw_stream_dict["date_created"], recent_traffic
)
- else:
+ else: # nocoverage
stream_weekly_traffic = None
can_add_subscribers_group_value = get_group_setting_value_for_register_api(
diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py
index 65e5d5763ff..82979c8e5ee 100644
--- a/zerver/lib/test_helpers.py
+++ b/zerver/lib/test_helpers.py
@@ -12,8 +12,6 @@ from unittest import mock
from unittest.mock import patch
import boto3.session
-import dns.rdtypes.ANY.TXT
-import dns.resolver
import fakeldap
import ldap
import orjson
@@ -796,16 +794,3 @@ def ratelimit_rule(
def consume_response(response: HttpResponseBase) -> None:
assert response.streaming
collections.deque(response, maxlen=0)
-
-
-def dns_txt_answer(name_str: str, txt: str) -> dns.resolver.Answer:
- name = dns.name.from_text(name_str)
- rdclass = dns.rdataclass.IN
- rdtype = dns.rdatatype.TXT
- response = dns.message.make_query(
- name, rdtype, rdclass, flags=dns.flags.QR | dns.flags.RA | dns.flags.RD
- )
- response.find_rrset(dns.message.ANSWER, name, rdclass, rdtype, create=True).add(
- dns.rdtypes.ANY.TXT.TXT(rdclass, rdtype, txt)
- )
- return dns.resolver.Answer(name, rdtype, rdclass, response)
diff --git a/zerver/lib/zephyr.py b/zerver/lib/zephyr.py
deleted file mode 100644
index 719f14dc824..00000000000
--- a/zerver/lib/zephyr.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import re
-import traceback
-
-import dns.resolver
-
-
-def compute_mit_user_fullname(email: str) -> str:
- try:
- # Input is either e.g. [email protected] or user|[email protected]
- match_user = re.match(r"^([a-zA-Z0-9_.-]+)(\|.+)?@mit\.edu$", email.lower())
- if match_user and match_user.group(2) is None:
- answer = dns.resolver.resolve(f"{match_user.group(1)}.passwd.ns.athena.mit.edu", "TXT")
- hesiod_name = answer[0].strings[0].decode().split(":")[4].split(",")[0].strip()
- if hesiod_name != "":
- return hesiod_name
- elif match_user:
- return match_user.group(1).lower() + "@" + match_user.group(2).upper().removeprefix("|")
- except dns.resolver.NXDOMAIN:
- pass
- except Exception:
- print(f"Error getting fullname for {email}:")
- traceback.print_exc()
- return email.lower()
diff --git a/zerver/middleware.py b/zerver/middleware.py
index 7a8ab0176cb..204cec65012 100644
--- a/zerver/middleware.py
+++ b/zerver/middleware.py
@@ -119,8 +119,6 @@ def is_slow_query(time_delta: float, path: str) -> bool:
is_exempt = path == "/activity" or path.startswith(("/realm_activity/", "/user_activity/"))
if is_exempt:
return time_delta >= 5
- if "webathena_kerberos" in path:
- return time_delta >= 10
return True
diff --git a/zerver/models/messages.py b/zerver/models/messages.py
index dd3d9906ca9..121df7a7656 100644
--- a/zerver/models/messages.py
+++ b/zerver/models/messages.py
@@ -245,9 +245,8 @@ class Message(AbstractMessage):
condition=Q(is_channel_message=True),
),
models.Index(
- # Used by already_sent_mirrored_message_id, and when
- # determining recent topics (we post-process to merge
- # and show the most recent case)
+ # Used when determining recent topics (we post-process
+ # to merge and show the most recent case)
"realm_id",
"recipient_id",
"subject",
diff --git a/zerver/models/realms.py b/zerver/models/realms.py
index 142997c5529..65118eff501 100644
--- a/zerver/models/realms.py
+++ b/zerver/models/realms.py
@@ -1181,17 +1181,9 @@ class Realm(models.Model):
default_host = f"{subdomain}.{settings.EXTERNAL_HOST}"
return settings.REALM_HOSTS.get(subdomain, default_host)
- @property
- def is_zephyr_mirror_realm(self) -> bool:
- return self.string_id == "zephyr"
-
- @property
- def webathena_enabled(self) -> bool:
- return self.is_zephyr_mirror_realm
-
@property
def presence_disabled(self) -> bool:
- return self.is_zephyr_mirror_realm
+ return False
def web_public_streams_enabled(self) -> bool:
if not settings.WEB_PUBLIC_STREAMS_ENABLED:
diff --git a/zerver/models/streams.py b/zerver/models/streams.py
index d3ae4344eda..28b3d7e905c 100644
--- a/zerver/models/streams.py
+++ b/zerver/models/streams.py
@@ -78,14 +78,6 @@ class Stream(models.Model):
"is_web_public": False,
"policy_name": gettext_lazy("Private, protected history"),
},
- # Public streams with protected history are currently only
- # available in Zephyr realms
- "public_protected_history": {
- "invite_only": False,
- "history_public_to_subscribers": False,
- "is_web_public": False,
- "policy_name": gettext_lazy("Public, protected history"),
- },
}
invite_only = models.BooleanField(default=False)
history_public_to_subscribers = models.BooleanField(default=True)
@@ -260,8 +252,7 @@ class Stream(models.Model):
return self.name
def is_public(self) -> bool:
- # All streams are private in Zephyr mirroring realms.
- return not self.invite_only and not self.is_in_zephyr_realm
+ return not self.invite_only
def is_history_realm_public(self) -> bool:
return self.is_public()
diff --git a/zerver/models/users.py b/zerver/models/users.py
index a4012346bb2..31d22661f59 100644
--- a/zerver/models/users.py
+++ b/zerver/models/users.py
@@ -613,13 +613,14 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
last_active_message_id = models.IntegerField(null=True)
# Mirror dummies are fake (!is_active) users used to provide
- # message senders in our cross-protocol Zephyr<->Zulip content
- # mirroring integration, so that we can display mirrored content
- # like native Zulip messages (with a name + avatar, etc.).
+ # message senders in cross-protocol mirroring integrations, so
+ # that we can display mirrored content like native Zulip messages
+ # (with a name + avatar, etc.). We also abuse this for data
+ # imports and deleted users.
is_mirror_dummy = models.BooleanField(default=False)
# Users with this flag set are allowed to forge messages as sent by another
- # user and to send to private streams; also used for Zephyr/Jabber mirroring.
+ # user and to send to private streams; also used for Jabber mirroring.
can_forge_sender = models.BooleanField(default=False, db_index=True)
# Users with this flag set can create other users via API.
can_create_users = models.BooleanField(default=False, db_index=True)
@@ -936,7 +937,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
return self.has_permission("can_summarize_topics_group")
def can_access_public_streams(self) -> bool:
- return not (self.is_guest or self.realm.is_zephyr_mirror_realm)
+ return not self.is_guest
def major_tos_version(self) -> int:
if self.tos_version is not None:
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 7ae7bbb124b..779e195aa64 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -11535,13 +11535,6 @@ paths:
the specified Zulip API email.
additionalProperties:
$ref: "#/components/schemas/LegacyPresenceFormat"
- zephyr_mirror_active:
- type: boolean
- deprecated: true
- description: |
- Legacy property for a part of the Zephyr mirroring system.
-
- **Deprecated**. Clients should ignore this field.
examples:
modern-presence-format-example:
description: |
diff --git a/zerver/tests/test_channel_access.py b/zerver/tests/test_channel_access.py
index bd503048a6b..5139e0c545b 100644
--- a/zerver/tests/test_channel_access.py
+++ b/zerver/tests/test_channel_access.py
@@ -85,17 +85,6 @@ class AccessStreamTest(ZulipTestCase):
with self.assertRaisesRegex(JsonableError, "Invalid channel name 'new_private_stream'"):
access_stream_by_name(sipbtest, stream.name)
- # MIT realm users cannot access even public streams in their realm
- with self.assertRaisesRegex(JsonableError, "Invalid channel ID"):
- access_stream_by_id(sipbtest, mit_stream.id)
- with self.assertRaisesRegex(JsonableError, "Invalid channel name 'mit_stream'"):
- access_stream_by_name(sipbtest, mit_stream.name)
-
- # But they can access streams they are subscribed to
- self.subscribe_via_post(sipbtest, [mit_stream.name], subdomain="zephyr")
- access_stream_by_id(sipbtest, mit_stream.id)
- access_stream_by_name(sipbtest, mit_stream.name)
-
def test_access_stream_allow_metadata_access_flag(self) -> None:
"""
A comprehensive security test for the access_stream_by_* API functions.
diff --git a/zerver/tests/test_channel_creation.py b/zerver/tests/test_channel_creation.py
index 06e317d067c..1297159fd0f 100644
--- a/zerver/tests/test_channel_creation.py
+++ b/zerver/tests/test_channel_creation.py
@@ -448,23 +448,6 @@ class TestCreateStreams(ZulipTestCase):
self.assertEqual(stream.name, "testing_channel4")
self.assertEqual(stream.topics_policy, StreamTopicsPolicyEnum.disable_empty_topic.value)
- realm = get_realm("zephyr")
- starnine = self.mit_user("starnine")
- espuser = self.mit_user("espuser")
- result = self.create_channel_via_post(
- starnine, [espuser.id], name="zephyr_channel", subdomain="zephyr"
- )
- self.assert_json_error(
- result, "You can only invite other Zephyr mirroring users to private channels."
- )
-
- result = self.create_channel_via_post(
- starnine, [espuser.id], name="zephyr_channel", invite_only=True, subdomain="zephyr"
- )
- self.assert_json_success(result)
- stream = get_stream("zephyr_channel", realm)
- self.assertEqual(stream.name, "zephyr_channel")
-
def _test_group_based_settings_for_creating_channels(
self,
stream_policy: str,
@@ -593,19 +576,6 @@ class TestCreateStreams(ZulipTestCase):
is_web_public=True,
)
- def test_history_public_to_subscribers_zephyr_realm(self) -> None:
- realm = get_realm("zephyr")
-
- stream, created = create_stream_if_needed(realm, "private_stream", invite_only=True)
- self.assertTrue(created)
- self.assertTrue(stream.invite_only)
- self.assertFalse(stream.history_public_to_subscribers)
-
- stream, created = create_stream_if_needed(realm, "public_stream", invite_only=False)
- self.assertTrue(created)
- self.assertFalse(stream.invite_only)
- self.assertFalse(stream.history_public_to_subscribers)
-
def test_auto_mark_stream_created_message_as_read_for_stream_creator(self) -> None:
# This test relies on email == delivery_email for
# convenience.
@@ -998,11 +968,6 @@ class TestCreateStreams(ZulipTestCase):
channel_creator = self.example_user("desdemona")
subdomain = "zulip"
- if policy_key == "public_protected_history":
- # This is a special channel policy only available in Zephyr realms.
- channel_creator = self.mit_user("starnine")
- subdomain = "zephyr"
-
self.login_user(channel_creator)
new_channel_name = f"New {policy_key} channel"
result = self.api_post(
@@ -1023,10 +988,6 @@ class TestCreateStreams(ZulipTestCase):
channel_events_messages = get_topic_messages(
channel_creator, new_channel, "channel events"
)
- if policy_key == "public_protected_history":
- # These do not get channel creation notification.
- self.assert_length(channel_events_messages, 0)
- continue
self.assert_length(channel_events_messages, 1)
self.assertIn(policy_key_map[policy_key], channel_events_messages[0].content)
diff --git a/zerver/tests/test_channel_fetch.py b/zerver/tests/test_channel_fetch.py
index d389011a2ab..34b8d023a61 100644
--- a/zerver/tests/test_channel_fetch.py
+++ b/zerver/tests/test_channel_fetch.py
@@ -1353,51 +1353,6 @@ class GetSubscribersTest(ZulipTestCase):
self.assertEqual(unsubscribed_streams[0]["is_web_public"], True)
self.assert_length(unsubscribed_streams[0]["subscribers"], 1)
- def test_gather_subscriptions_mit(self) -> None:
- """
- gather_subscriptions returns correct results with only 3 queries
- """
- # Subscribe only ourself because invites are disabled on mit.edu
- mit_user_profile = self.mit_user("starnine")
- user_id = mit_user_profile.id
- users_to_subscribe = [user_id, self.mit_user("espuser").id]
- for email in users_to_subscribe:
- stream = self.subscribe(mit_user_profile, "mit_stream")
- self.assertTrue(stream.is_in_zephyr_realm)
-
- self.subscribe_via_post(
- mit_user_profile,
- ["mit_invite_only"],
- dict(principals=orjson.dumps(users_to_subscribe).decode()),
- invite_only=True,
- subdomain="zephyr",
- )
-
- with self.assert_database_query_count(8):
- subscribed_streams, _ = gather_subscriptions(mit_user_profile, include_subscribers=True)
-
- self.assertGreaterEqual(len(subscribed_streams), 2)
- for sub in subscribed_streams:
- if not sub["name"].startswith("mit_"):
- raise AssertionError("Unexpected stream!")
- if sub["name"] == "mit_invite_only":
- self.assert_length(sub["subscribers"], len(users_to_subscribe))
- else:
- self.assert_length(sub["subscribers"], 0)
- self.assertIsNone(sub["stream_weekly_traffic"])
-
- # Create a web-public stream to test never_subscried data.
- self.make_stream("mit_stream_2", realm=mit_user_profile.realm, is_web_public=True)
- self.make_stream("mit_stream_3", realm=mit_user_profile.realm)
-
- sub_info = gather_subscriptions_helper(mit_user_profile, include_subscribers=True)
- never_subscribed_streams = sub_info.never_subscribed
- # Users in zephyr mirror realm can only access web-public never subscribed streams.
- self.assert_length(never_subscribed_streams, 1)
- self.assertEqual(never_subscribed_streams[0]["name"], "mit_stream_2")
- self.assertTrue(never_subscribed_streams[0]["is_web_public"])
- self.assertIsNone(never_subscribed_streams[0]["stream_weekly_traffic"])
-
def test_nonsubscriber(self) -> None:
"""
Even a non-subscriber to a public stream can query a stream's membership
diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.py
index f95fc49f31e..eda6de02cd1 100644
--- a/zerver/tests/test_decorators.py
+++ b/zerver/tests/test_decorators.py
@@ -1244,8 +1244,8 @@ class TestAuthenticatedJsonViewDecorator(ZulipTestCase):
)
def _do_test(self, user_email: str) -> "TestHttpResponse":
- data = {"password": initial_password(user_email)}
- return self.client_post(r"/accounts/webathena_kerberos_login/", data)
+ data = {"status_text": "working"}
+ return self.client_post(r"/json/users/me/status", data)
class TestPublicJsonViewDecorator(ZulipTestCase):
diff --git a/zerver/tests/test_external.py b/zerver/tests/test_external.py
index fc0d50c06aa..75cb9c6ce19 100644
--- a/zerver/tests/test_external.py
+++ b/zerver/tests/test_external.py
@@ -5,16 +5,13 @@ from contextlib import contextmanager
from typing import IO, TYPE_CHECKING, Any
from unittest import mock, skipUnless
-import dns.resolver
import orjson
from circuitbreaker import CircuitBreakerMonitor
from django.conf import settings
-from django.core.exceptions import ValidationError
from django.test import override_settings
from django.utils.timezone import now as timezone_now
from typing_extensions import override
-from zerver.forms import email_is_not_mit_mailing_list
from zerver.lib.cache import cache_delete
from zerver.lib.rate_limiter import (
RateLimitedIPAddr,
@@ -23,8 +20,7 @@ from zerver.lib.rate_limiter import (
get_tor_ips,
)
from zerver.lib.test_classes import ZulipTestCase
-from zerver.lib.test_helpers import dns_txt_answer, ratelimit_rule
-from zerver.lib.zephyr import compute_mit_user_fullname
+from zerver.lib.test_helpers import ratelimit_rule
from zerver.models import PushDeviceToken, UserProfile
if settings.ZILENCER_ENABLED:
@@ -34,50 +30,6 @@ if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
-class MITNameTest(ZulipTestCase):
- def test_valid_hesiod(self) -> None:
- with mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "starnine.passwd.ns.athena.mit.edu.",
- "starnine:*:84233:101:Athena Consulting Exchange User,,,:/mit/starnine:/bin/bash",
- ),
- ):
- self.assertEqual(
- compute_mit_user_fullname(self.mit_email("starnine")),
- "Athena Consulting Exchange User",
- )
- with mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "sipbexch.passwd.ns.athena.mit.edu.",
- "sipbexch:*:87824:101:Exch Sipb,,,:/mit/sipbexch:/bin/athena/bash",
- ),
- ):
- self.assertEqual(compute_mit_user_fullname("[email protected]"), "Exch Sipb")
-
- def test_invalid_hesiod(self) -> None:
- with mock.patch("dns.resolver.resolve", side_effect=dns.resolver.NXDOMAIN):
- self.assertEqual(compute_mit_user_fullname("[email protected]"), "[email protected]")
- with mock.patch("dns.resolver.resolve", side_effect=dns.resolver.NXDOMAIN):
- self.assertEqual(compute_mit_user_fullname("[email protected]"), "[email protected]")
-
- def test_mailinglist(self) -> None:
- with mock.patch("dns.resolver.resolve", side_effect=dns.resolver.NXDOMAIN):
- self.assertRaises(ValidationError, email_is_not_mit_mailing_list, "[email protected]")
- with mock.patch("dns.resolver.resolve", side_effect=dns.resolver.NXDOMAIN):
- self.assertRaises(ValidationError, email_is_not_mit_mailing_list, "[email protected]")
-
- def test_notmailinglist(self) -> None:
- with mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "starnine.pobox.ns.athena.mit.edu.", "POP IMAP.EXCHANGE.MIT.EDU starnine"
- ),
- ):
- email_is_not_mit_mailing_list("[email protected]")
-
-
class RateLimitTests(ZulipTestCase):
@override
def setUp(self) -> None:
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index 8cda9c65581..af5406bbf6b 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -59,7 +59,6 @@ class HomeTest(ZulipTestCase):
"promote_sponsoring_zulip",
"request_language",
"show_try_zulip_modal",
- "show_webathena",
"state_data",
"test_suite",
"translation_data",
@@ -391,7 +390,6 @@ class HomeTest(ZulipTestCase):
"realm_rendered_description",
"request_language",
"show_try_zulip_modal",
- "show_webathena",
"state_data",
"test_suite",
"translation_data",
diff --git a/zerver/tests/test_invite.py b/zerver/tests/test_invite.py
index 1d72cd65554..0774af566d9 100644
--- a/zerver/tests/test_invite.py
+++ b/zerver/tests/test_invite.py
@@ -636,7 +636,7 @@ class InviteUserTest(InviteUserBase):
"""
A mirror dummy account is a temporary account
that we keep in our system if we are mirroring
- data from something like Zephyr or IRC.
+ data from something like IRC.
We want users to eventually just sign up or
register for Zulip, in which case we will just
diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py
index b20a975f615..3c2280f9dca 100644
--- a/zerver/tests/test_markdown.py
+++ b/zerver/tests/test_markdown.py
@@ -3583,34 +3583,6 @@ class MarkdownStreamTopicMentionTests(ZulipTestCase):
)
-class MarkdownMITTest(ZulipTestCase):
- def test_mit_rendering(self) -> None:
- """Test the Markdown configs for the MIT Zephyr mirroring system;
- verifies almost all inline patterns are disabled, but
- inline_interesting_links is still enabled"""
- msg = "**test**"
- realm = get_realm("zephyr")
- client = get_client("zephyr_mirror")
- message = Message(sending_client=client, sender=self.mit_user("sipbtest"))
- converted = markdown_convert(msg, message_realm=realm, message=message)
- self.assertEqual(
- converted.rendered_content,
- "<p>**test**</p>",
- )
- msg = "* test"
- converted = markdown_convert(msg, message_realm=realm, message=message)
- self.assertEqual(
- converted.rendered_content,
- "<p>* test</p>",
- )
- msg = "https://lists.debian.org/debian-ctte/2014/02/msg00173.html"
- converted = markdown_convert(msg, message_realm=realm, message=message)
- self.assertEqual(
- converted.rendered_content,
- '<p><a href="https://lists.debian.org/debian-ctte/2014/02/msg00173.html">https://lists.debian.org/debian-ctte/2014/02/msg00173.html</a></p>',
- )
-
-
class MarkdownHTMLTest(ZulipTestCase):
def test_html_entity_conversion(self) -> None:
msg = """\
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index 06697be469d..018913900ec 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -2778,104 +2778,6 @@ class GetOldMessagesTest(ZulipTestCase):
narrow = [dict(operator="channel", operand="Scotland")]
self.message_visibility_test(narrow, message_ids, 2)
- def test_get_messages_with_narrow_channel_mit_unicode_regex(self) -> None:
- """
- A request for old messages for a user in the mit.edu relam with Unicode
- channel name should be correctly escaped in the database query.
- """
- user = self.mit_user("starnine")
- self.login_user(user)
- # We need to subscribe to a channel and then send a message to
- # it to ensure that we actually have a channel message in this
- # narrow view.
- lambda_channel_name = "\u03bb-channel"
- channel = self.subscribe(user, lambda_channel_name)
- self.assertTrue(channel.is_in_zephyr_realm)
-
- lambda_channel_d_name = "\u03bb-channel.d"
- self.subscribe(user, lambda_channel_d_name)
-
- self.send_stream_message(user, "\u03bb-channel")
- self.send_stream_message(user, "\u03bb-channel.d")
-
- narrow = [dict(operator="channel", operand="\u03bb-channel")]
- result = self.get_and_check_messages(
- dict(num_after=2, narrow=orjson.dumps(narrow).decode()), subdomain="zephyr"
- )
-
- messages = get_user_messages(self.mit_user("starnine"))
- channel_messages = [msg for msg in messages if msg.is_channel_message]
-
- self.assert_length(result["messages"], 2)
- for i, message in enumerate(result["messages"]):
- self.assertEqual(message["type"], "stream")
- channel_id = channel_messages[i].recipient.id
- self.assertEqual(message["recipient_id"], channel_id)
-
- def test_get_messages_with_narrow_topic_mit_unicode_regex(self) -> None:
- """
- A request for old messages for a user in the mit.edu realm with Unicode
- topic name should be correctly escaped in the database query.
- """
- mit_user_profile = self.mit_user("starnine")
- self.login_user(mit_user_profile)
- # We need to subscribe to a channel and then send a message to
- # it to ensure that we actually have a channel message in this
- # narrow view.
- self.subscribe(mit_user_profile, "Scotland")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="\u03bb-topic")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="\u03bb-topic.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="\u03bb-topic.d.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="\u03bb-topic.d.d.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="\u03bb-topic.d.d.d.d")
-
- narrow = [dict(operator="topic", operand="\u03bb-topic")]
- result = self.get_and_check_messages(
- dict(num_after=100, narrow=orjson.dumps(narrow).decode()), subdomain="zephyr"
- )
-
- messages = get_user_messages(mit_user_profile)
- channel_messages = [msg for msg in messages if msg.is_channel_message]
- self.assert_length(result["messages"], 5)
- for i, message in enumerate(result["messages"]):
- self.assertEqual(message["type"], "stream")
- channel_id = channel_messages[i].recipient.id
- self.assertEqual(message["recipient_id"], channel_id)
-
- def test_get_messages_with_narrow_topic_mit_personal(self) -> None:
- """
- We handle .d grouping for MIT realm personal messages correctly.
- """
- mit_user_profile = self.mit_user("starnine")
-
- # We need to subscribe to a channel and then send a message to
- # it to ensure that we actually have a channel message in this
- # narrow view.
- self.login_user(mit_user_profile)
- self.subscribe(mit_user_profile, "Scotland")
-
- self.send_stream_message(mit_user_profile, "Scotland", topic_name=".d.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="PERSONAL")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name='(instance "").d')
- self.send_stream_message(mit_user_profile, "Scotland", topic_name=".d.d.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name="personal.d")
- self.send_stream_message(mit_user_profile, "Scotland", topic_name='(instance "")')
- self.send_stream_message(mit_user_profile, "Scotland", topic_name=".d.d.d.d")
-
- narrow = [dict(operator="topic", operand="personal.d.d")]
- result = self.get_and_check_messages(
- dict(num_before=50, num_after=50, narrow=orjson.dumps(narrow).decode()),
- subdomain="zephyr",
- )
-
- messages = get_user_messages(mit_user_profile)
- channel_messages = [msg for msg in messages if msg.is_channel_message]
- self.assert_length(result["messages"], 7)
- for i, message in enumerate(result["messages"]):
- self.assertEqual(message["type"], "stream")
- channel_id = channel_messages[i].recipient.id
- self.assertEqual(message["recipient_id"], channel_id)
-
def test_get_messages_with_narrow_sender(self) -> None:
"""
A request for old messages with a narrow by sender only returns
@@ -4792,7 +4694,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND message_id = 0) AS anon_1 ORDER BY message_id ASC\
"""
@@ -4805,7 +4707,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND message_id = 0) AS anon_1 ORDER BY message_id ASC\
"""
@@ -4818,7 +4720,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) ORDER BY message_id ASC \n\
LIMIT 2) AS anon_1 ORDER BY message_id ASC\
@@ -4832,7 +4734,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) ORDER BY message_id ASC \n\
LIMIT 11) AS anon_1 ORDER BY message_id ASC\
@@ -4846,7 +4748,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND message_id <= 100 ORDER BY message_id DESC \n\
LIMIT 11) AS anon_1 ORDER BY message_id ASC\
@@ -4860,14 +4762,14 @@ FROM ((SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND message_id <= 99 ORDER BY message_id DESC \n\
LIMIT 10) UNION ALL (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND message_id >= 100 ORDER BY message_id ASC \n\
LIMIT 11)) AS anon_1 ORDER BY message_id ASC\
@@ -4888,7 +4790,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (flags & 2048) != 0 AND realm_id = {realm_id} AND (sender_id = {othello_id} AND recipient_id = {hamlet_recipient} OR sender_id = {hamlet_id} AND recipient_id = {othello_recipient}) AND message_id = 0) AS anon_1 ORDER BY message_id ASC\
"""
@@ -4909,7 +4811,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (flags & 2048) != 0 AND realm_id = {realm_id} AND (sender_id = {othello_id} AND recipient_id = {hamlet_recipient} OR sender_id = {hamlet_id} AND recipient_id = {othello_recipient}) AND message_id = 0) AS anon_1 ORDER BY message_id ASC\
"""
@@ -4930,7 +4832,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (flags & 2048) != 0 AND realm_id = {realm_id} AND (sender_id = {othello_id} AND recipient_id = {hamlet_recipient} OR sender_id = {hamlet_id} AND recipient_id = {othello_recipient}) ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -4952,7 +4854,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (flags & 2) != 0 ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -4968,7 +4870,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND sender_id = {othello_id} ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5016,7 +4918,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (recipient_id NOT IN ({public_channels_recipients})) ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5038,7 +4940,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND upper(subject) = upper('blah') AND is_channel_message ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5073,7 +4975,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (flags & 2048) != 0 AND realm_id = {realm_id} AND sender_id = {hamlet_id} AND recipient_id = {hamlet_recipient} ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5095,7 +4997,7 @@ FROM (SELECT message_id, flags \n\
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND recipient_id = {scotland_recipient} AND (flags & 2) != 0 ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5125,7 +5027,7 @@ FROM unnest(string_to_array(ts_headline('zulip.english_us_search', escape_html(s
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (search_tsvector @@ plainto_tsquery('zulip.english_us_search', 'jumping')) ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
@@ -5167,7 +5069,7 @@ FROM unnest(string_to_array(ts_headline('zulip.english_us_search', escape_html(s
FROM zerver_usermessage JOIN zerver_message ON zerver_usermessage.message_id = zerver_message.id JOIN zerver_recipient ON zerver_message.recipient_id = zerver_recipient.id \n\
WHERE user_profile_id = {hamlet_id} AND (zerver_recipient.type != 2 OR (EXISTS (SELECT \n\
FROM zerver_stream \n\
-WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only AND NOT zerver_stream.is_in_zephyr_realm OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
+WHERE zerver_stream.recipient_id = zerver_recipient.id AND (NOT zerver_stream.invite_only OR zerver_stream.can_subscribe_group_id IN {hamlet_groups} OR zerver_stream.can_add_subscribers_group_id IN {hamlet_groups}))) OR (EXISTS (SELECT \n\
FROM zerver_subscription \n\
WHERE zerver_subscription.user_profile_id = {hamlet_id} AND zerver_subscription.recipient_id = zerver_recipient.id AND zerver_subscription.active))) AND (content ILIKE '%jumping%' OR subject ILIKE '%jumping%' AND is_channel_message) AND (search_tsvector @@ plainto_tsquery('zulip.english_us_search', '"jumping" quickly')) ORDER BY message_id ASC \n\
LIMIT 10) AS anon_1 ORDER BY message_id ASC\
diff --git a/zerver/tests/test_message_send.py b/zerver/tests/test_message_send.py
index 82dfea54887..fc6589b038b 100644
--- a/zerver/tests/test_message_send.py
+++ b/zerver/tests/test_message_send.py
@@ -54,7 +54,6 @@ from zerver.lib.stream_subscription import create_stream_subscription
from zerver.lib.streams import create_stream_if_needed
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import (
- dns_txt_answer,
get_user_messages,
make_client,
message_stream_count,
@@ -500,19 +499,6 @@ class MessagePOSTTest(ZulipTestCase):
do_change_stream_group_based_setting(
stream, "can_send_message_group", guest_user_group_member_dict, acting_user=othello
)
- do_change_stream_permission(
- stream,
- invite_only=False,
- history_public_to_subscribers=False,
- is_web_public=False,
- acting_user=othello,
- )
- self._send_and_verify_message(
- guest_user,
- stream_name,
- "Not authorized to send to channel 'private_stream",
- allow_unsubscribed_sender=True,
- )
do_change_stream_permission(
stream,
@@ -1000,7 +986,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": orjson.dumps(
[self.mit_email("starnine"), self.mit_email("espuser")]
).decode(),
@@ -1020,7 +1006,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": orjson.dumps([self.mit_email("starnine")]).decode(),
},
subdomain="zephyr",
@@ -1039,7 +1025,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": self.mit_email("starnine"),
},
subdomain="zephyr",
@@ -1057,51 +1043,13 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": self.mit_email("espuser"),
},
subdomain="zephyr",
)
self.assert_json_error(result, "User not authorized for this query")
- def test_duplicated_mirrored_direct_message_group(self) -> None:
- """
- Sending two mirrored direct message groups in the row return the same ID
- """
- msg = {
- "type": "direct",
- "sender": self.mit_email("sipbtest"),
- "content": "Test message",
- "client": "zephyr_mirror",
- "to": orjson.dumps([self.mit_email("espuser"), self.mit_email("starnine")]).decode(),
- }
-
- with mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "starnine.passwd.ns.athena.mit.edu.",
- "starnine:*:84233:101:Athena Consulting Exchange User,,,:/mit/starnine:/bin/bash",
- ),
- ):
- result1 = self.api_post(
- self.mit_user("starnine"), "/api/v1/messages", msg, subdomain="zephyr"
- )
- self.assert_json_success(result1)
-
- with mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- ("espuser.passwd.ns.athena.mit.edu."),
- "espuser:*:95494:101:Esp Classroom,,,:/mit/espuser:/bin/athena/bash",
- ),
- ):
- result2 = self.api_post(
- self.mit_user("espuser"), "/api/v1/messages", msg, subdomain="zephyr"
- )
- self.assert_json_success(result2)
-
- self.assertEqual(orjson.loads(result1.content)["id"], orjson.loads(result2.content)["id"])
-
def test_message_with_null_bytes(self) -> None:
"""
A message with null bytes in it is handled.
@@ -1209,7 +1157,7 @@ class MessagePOSTTest(ZulipTestCase):
{
"type": "direct",
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": self.mit_email("starnine"),
},
subdomain="zephyr",
@@ -1224,7 +1172,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "channel",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": self.mit_email("starnine"),
},
subdomain="zephyr",
@@ -1243,7 +1191,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": self.mit_email("starnine"),
},
subdomain="zephyr",
@@ -1251,29 +1199,7 @@ class MessagePOSTTest(ZulipTestCase):
self.assert_json_error(result, "Invalid mirrored message")
@mock.patch("zerver.views.message_send.create_mirrored_message_users")
- def test_send_message_when_client_is_zephyr_mirror_but_string_id_is_not_zephyr(
- self, create_mirrored_message_users_mock: Any
- ) -> None:
- create_mirrored_message_users_mock.return_value = mock.Mock()
- user = self.mit_user("starnine")
- user.realm.string_id = "notzephyr"
- user.realm.save()
- result = self.api_post(
- user,
- "/api/v1/messages",
- {
- "type": "direct",
- "sender": self.mit_email("sipbtest"),
- "content": "Test message",
- "client": "zephyr_mirror",
- "to": user.email,
- },
- subdomain="notzephyr",
- )
- self.assert_json_error(result, "Zephyr mirroring is not allowed in this organization")
-
- @mock.patch("zerver.views.message_send.create_mirrored_message_users")
- def test_send_message_when_client_is_zephyr_mirror_but_recipient_is_user_id(
+ def test_send_message_when_client_is_mirror_but_recipient_is_user_id(
self, create_mirrored_message_users_mock: Any
) -> None:
create_mirrored_message_users_mock.return_value = mock.Mock()
@@ -1286,7 +1212,7 @@ class MessagePOSTTest(ZulipTestCase):
"type": "direct",
"sender": self.mit_email("sipbtest"),
"content": "Test message",
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"to": orjson.dumps([user.id]).decode(),
},
subdomain="zephyr",
@@ -2442,7 +2368,7 @@ class StreamMessagesTest(ZulipTestCase):
"type": "channel",
"to": orjson.dumps("Verona").decode(),
"sender": self.mit_email("sipbtest"),
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"topic": "announcement",
"content": "Everyone knows Iago rules",
"forged": "true",
@@ -2459,7 +2385,7 @@ class StreamMessagesTest(ZulipTestCase):
"type": "channel",
"to": "Verona",
"sender": self.mit_email("sipbtest"),
- "client": "zephyr_mirror",
+ "client": "irc_mirror",
"topic": "announcement",
"content": "Everyone knows Iago rules",
"forged": "true",
diff --git a/zerver/tests/test_message_topics.py b/zerver/tests/test_message_topics.py
index ace69fa2974..631ea999906 100644
--- a/zerver/tests/test_message_topics.py
+++ b/zerver/tests/test_message_topics.py
@@ -17,24 +17,6 @@ from zerver.tornado.event_queue import allocate_client_descriptor
class TopicHistoryTest(ZulipTestCase):
- def test_topics_history_zephyr_mirror(self) -> None:
- user_profile = self.mit_user("sipbtest")
- stream_name = "new_stream"
-
- # Send a message to this new stream from another user
- self.subscribe(self.mit_user("starnine"), stream_name)
- stream = get_stream(stream_name, user_profile.realm)
- self.send_stream_message(self.mit_user("starnine"), stream_name, topic_name="secret topic")
-
- # Now subscribe this MIT user to the new stream and verify
- # that the new topic is not accessible
- self.login_user(user_profile)
- self.subscribe(user_profile, stream_name)
- endpoint = f"/json/users/me/{stream.id}/topics"
- result = self.client_get(endpoint, {}, subdomain="zephyr")
- history = self.assert_json_success(result)["topics"]
- self.assertEqual(history, [])
-
def test_topics_history(self) -> None:
# verified: int(UserMessage.flags.read) == 1
user_profile = self.example_user("iago")
diff --git a/zerver/tests/test_middleware.py b/zerver/tests/test_middleware.py
index cbc36ac4006..768d8ef1392 100644
--- a/zerver/tests/test_middleware.py
+++ b/zerver/tests/test_middleware.py
@@ -32,8 +32,6 @@ class SlowQueryTest(ZulipTestCase):
self.assertFalse(is_slow_query(2, "/activity"))
self.assertFalse(is_slow_query(2, "/realm_activity/whatever"))
self.assertFalse(is_slow_query(2, "/user_activity/whatever"))
- self.assertFalse(is_slow_query(9, "/accounts/webathena_kerberos_login/"))
- self.assertTrue(is_slow_query(11, "/accounts/webathena_kerberos_login/"))
def test_slow_query_log(self) -> None:
self.log_data["time_started"] = time.time() - self.SLOW_QUERY_TIME
diff --git a/zerver/tests/test_mirror_users.py b/zerver/tests/test_mirror_users.py
index b93987187a6..d0453a65c95 100644
--- a/zerver/tests/test_mirror_users.py
+++ b/zerver/tests/test_mirror_users.py
@@ -7,10 +7,7 @@ from django.utils.timezone import now as timezone_now
from zerver.actions.message_send import create_mirror_user_if_needed
from zerver.lib.create_user import create_user_profile
from zerver.lib.test_classes import ZulipTestCase
-from zerver.lib.test_helpers import (
- dns_txt_answer,
- reset_email_visibility_to_everyone_in_zulip_realm,
-)
+from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
from zerver.models import UserProfile
from zerver.models.clients import get_client
from zerver.models.realms import get_realm
@@ -43,7 +40,7 @@ class MirroredMessageUsersTest(ZulipTestCase):
recipient_type_name = "private"
- for client_name in ["zephyr_mirror", "irc_mirror", "jabber_mirror"]:
+ for client_name in ["irc_mirror", "jabber_mirror"]:
client = get_client(client_name)
with self.assertRaises(InvalidMirrorInputError):
@@ -51,14 +48,7 @@ class MirroredMessageUsersTest(ZulipTestCase):
client, user, recipients, sender.email, recipient_type_name
)
- @mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "sipbtest.passwd.ns.athena.mit.edu.",
- "sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh",
- ),
- )
- def test_zephyr_mirror_new_recipient(self, ignored: object) -> None:
+ def test_mirror_new_recipient(self) -> None:
"""Test mirror dummy user creation for direct message recipients"""
user = self.mit_user("starnine")
sender = self.mit_user("sipbtest")
@@ -68,7 +58,7 @@ class MirroredMessageUsersTest(ZulipTestCase):
recipients = [user.email, new_user_email]
recipient_type_name = "private"
- client = get_client("zephyr_mirror")
+ client = get_client("irc_mirror")
mirror_sender = create_mirrored_message_users(
client, user, recipients, sender.email, recipient_type_name
@@ -84,14 +74,7 @@ class MirroredMessageUsersTest(ZulipTestCase):
bob = get_user(new_user_email, new_user_realm)
self.assertTrue(bob.is_mirror_dummy)
- @mock.patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "sipbtest.passwd.ns.athena.mit.edu.",
- "sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh",
- ),
- )
- def test_zephyr_mirror_new_sender(self, ignored: object) -> None:
+ def test_mirror_new_sender(self) -> None:
"""Test mirror dummy user creation for sender when sending to stream"""
user = self.mit_user("starnine")
sender_email = "[email protected]"
@@ -99,7 +82,7 @@ class MirroredMessageUsersTest(ZulipTestCase):
recipients = ["stream_name"]
recipient_type_name = "stream"
- client = get_client("zephyr_mirror")
+ client = get_client("irc_mirror")
mirror_sender = create_mirrored_message_users(
client, user, recipients, sender_email, recipient_type_name
diff --git a/zerver/tests/test_presence.py b/zerver/tests/test_presence.py
index 446dfa1bd98..3b54262548a 100644
--- a/zerver/tests/test_presence.py
+++ b/zerver/tests/test_presence.py
@@ -14,13 +14,7 @@ from zerver.lib.presence import format_legacy_presence_dict, get_presence_dict_b
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import make_client, reset_email_visibility_to_everyone_in_zulip_realm
from zerver.lib.timestamp import datetime_to_timestamp
-from zerver.models import (
- PushDeviceToken,
- UserActivity,
- UserActivityInterval,
- UserPresence,
- UserProfile,
-)
+from zerver.models import PushDeviceToken, UserActivityInterval, UserPresence, UserProfile
from zerver.models.realms import get_realm
@@ -581,46 +575,6 @@ class UserPresenceTests(ZulipTestCase):
)
self.assertEqual(filter_presence_idle_user_ids({user_profile.id}), [])
- def test_no_mit(self) -> None:
- """Zephyr mirror realms such as MIT never get a list of users"""
- user = self.mit_user("espuser")
- self.login_user(user)
- result = self.client_post("/json/users/me/presence", {"status": "idle"}, subdomain="zephyr")
- response_dict = self.assert_json_success(result)
- self.assertEqual(response_dict["presences"], {})
- self.assertEqual(response_dict["presence_last_update_id"], -1)
-
- def test_mirror_presence(self) -> None:
- """Zephyr mirror realms find out the status of their mirror bot"""
- user_profile = self.mit_user("espuser")
- self.login_user(user_profile)
-
- def post_presence() -> dict[str, Any]:
- result = self.client_post(
- "/json/users/me/presence", {"status": "idle"}, subdomain="zephyr"
- )
- json = self.assert_json_success(result)
- return json
-
- json = post_presence()
- self.assertEqual(json["zephyr_mirror_active"], False)
-
- self._simulate_mirror_activity_for_user(user_profile)
- json = post_presence()
- self.assertEqual(json["zephyr_mirror_active"], True)
-
- def _simulate_mirror_activity_for_user(self, user_profile: UserProfile) -> None:
- last_visit = timezone_now()
- client = make_client("zephyr_mirror")
-
- UserActivity.objects.get_or_create(
- user_profile=user_profile,
- client=client,
- query="get_events",
- count=2,
- last_visit=last_visit,
- )
-
def test_same_realm(self) -> None:
espuser = self.mit_user("espuser")
self.login_user(espuser)
diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py
index a79818804d6..e78220daed7 100644
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -59,7 +59,6 @@ from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import (
HostRequestMock,
avatar_disk_path,
- dns_txt_answer,
find_key_by_email,
get_test_image_file,
load_subdomain_token,
@@ -4359,14 +4358,7 @@ class UserSignUpTest(ZulipTestCase):
mirror_dummy.refresh_from_db()
self.assertEqual(mirror_dummy.role, UserProfile.ROLE_GUEST)
- @patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "sipbtest.passwd.ns.athena.mit.edu.",
- "sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh",
- ),
- )
- def test_registration_of_mirror_dummy_user(self, ignored: Any) -> None:
+ def test_registration_of_mirror_dummy_user(self) -> None:
password = "test"
subdomain = "zephyr"
user_profile = self.mit_user("sipbtest")
@@ -4443,14 +4435,7 @@ class UserSignUpTest(ZulipTestCase):
self.assertEqual(result.status_code, 302)
self.assert_logged_in_user_id(user_profile.id)
- @patch(
- "dns.resolver.resolve",
- return_value=dns_txt_answer(
- "sipbtest.passwd.ns.athena.mit.edu.",
- "sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh",
- ),
- )
- def test_registration_of_active_mirror_dummy_user(self, ignored: Any) -> None:
+ def test_registration_of_active_mirror_dummy_user(self) -> None:
"""
Trying to activate an already-active mirror dummy user should
raise an AssertionError.
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index 7414ae3ed4d..6b7000e1a98 100644
--- a/zerver/tests/test_subs.py
+++ b/zerver/tests/test_subs.py
@@ -239,7 +239,6 @@ class StreamAdminTest(ZulipTestCase):
self.assert_json_error(result, "Channel content access is required.")
stream = self.subscribe(user_profile, "private_stream_1")
- self.assertFalse(stream.is_in_zephyr_realm)
do_change_user_role(user_profile, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)
params = {
@@ -464,44 +463,6 @@ class StreamAdminTest(ZulipTestCase):
for stream in new_streams:
self.assertTrue(stream.is_web_public)
- def test_make_stream_public_zephyr_mirror(self) -> None:
- user_profile = self.mit_user("starnine")
- self.login_user(user_profile)
- realm = user_profile.realm
- self.make_stream("target_stream", realm=realm, invite_only=True)
- self.subscribe(user_profile, "target_stream")
-
- do_change_user_role(user_profile, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)
- params = {
- "is_private": orjson.dumps(False).decode(),
- }
- stream_id = get_stream("target_stream", realm).id
- result = self.client_patch(f"/json/streams/{stream_id}", params, subdomain="zephyr")
- self.assert_json_success(result)
- stream = get_stream("target_stream", realm)
- self.assertFalse(stream.invite_only)
- self.assertFalse(stream.history_public_to_subscribers)
-
- messages = get_topic_messages(user_profile, stream, "channel events")
- self.assert_length(messages, 1)
- expected_notification = (
- f"@_**{user_profile.full_name}|{user_profile.id}** changed the [access permissions](/help/channel-permissions) "
- "for this channel from **Private, protected history** to **Public, protected history**."
- )
- self.assertEqual(messages[0].content, expected_notification)
-
- realm_audit_log = RealmAuditLog.objects.filter(
- event_type=AuditLogEventType.CHANNEL_PROPERTY_CHANGED,
- modified_stream=stream,
- ).last()
- assert realm_audit_log is not None
- expected_extra_data = {
- RealmAuditLog.OLD_VALUE: True,
- RealmAuditLog.NEW_VALUE: False,
- "property": "invite_only",
- }
- self.assertEqual(realm_audit_log.extra_data, expected_extra_data)
-
def test_make_stream_private_with_public_history(self) -> None:
# Convert a public stream to a private stream with shared history
user_profile = self.example_user("hamlet")
@@ -1023,11 +984,9 @@ class StreamAdminTest(ZulipTestCase):
)
def test_try_make_stream_public_with_private_history(self) -> None:
- # We only support public streams with private history if
- # is_zephyr_mirror_realm, and don't allow changing stream
- # permissions in such realms. So changing the
- # history_public_to_subscribers property of a public stream is
- # not possible in Zulip today
+ # We don't support public streams with private history, so
+ # changing the history_public_to_subscribers property of a
+ # public stream is not possible in Zulip today
user_profile = self.example_user("hamlet")
self.login_user(user_profile)
realm = user_profile.realm
@@ -4318,70 +4277,6 @@ class SubscriptionAPITest(ZulipTestCase):
self.assert_length(event_stream_objects, 1)
self.assertEqual(event_stream_objects[0]["stream_id"], private.id)
- def test_bulk_subscribe_MIT(self) -> None:
- mit_user = self.mit_user("starnine")
- num_streams = 15
-
- realm = get_realm("zephyr")
- stream_names = [f"stream_{i}" for i in range(num_streams)]
- streams = [self.make_stream(stream_name, realm=realm) for stream_name in stream_names]
-
- for stream in streams:
- stream.is_in_zephyr_realm = True
- stream.save(update_fields=["is_in_zephyr_realm"])
-
- # Verify that peer_event events are never sent in Zephyr
- # realm. This does generate stream creation events from
- # send_stream_creation_events_for_previously_inaccessible_streams.
- with self.assert_database_query_count(num_streams + 19):
- with self.capture_send_event_calls(expected_num_events=num_streams + 1) as events:
- self.subscribe_via_post(
- mit_user,
- stream_names,
- dict(principals=orjson.dumps([mit_user.id]).decode()),
- subdomain="zephyr",
- )
- # num_streams stream creation events:
- self.assertEqual(
- {(event["event"]["type"], event["event"]["op"]) for event in events[0:num_streams]},
- {("stream", "create")},
- )
- # Followed by one subscription event:
- self.assertEqual(events[num_streams]["event"]["type"], "subscription")
-
- with self.capture_send_event_calls(expected_num_events=2):
- bulk_remove_subscriptions(
- realm,
- users=[mit_user],
- streams=streams,
- acting_user=None,
- )
-
- def test_subscribe_others_to_public_stream_in_zephyr_realm(self) -> None:
- """
- Users cannot be subscribed to public streams by other users in zephyr realm.
- """
- starnine = self.mit_user("starnine")
- espuser = self.mit_user("espuser")
-
- realm = get_realm("zephyr")
- stream = self.make_stream("stream_1", realm=realm)
- stream.is_in_zephyr_realm = True
- stream.save(update_fields=["is_in_zephyr_realm"])
-
- result = self.subscribe_via_post(
- starnine,
- ["stream_1"],
- dict(principals=orjson.dumps([starnine.id, espuser.id]).decode()),
- subdomain="zephyr",
- allow_fail=True,
- )
- self.assert_json_error(
- result,
- "You can only invite other Zephyr mirroring users to private channels.",
- status_code=400,
- )
-
def test_bulk_subscribe_many(self) -> None:
# Create a whole bunch of streams
streams = [f"stream_{i}" for i in range(30)]
diff --git a/zerver/tests/test_zephyr.py b/zerver/tests/test_zephyr.py
deleted file mode 100644
index 5ff9596b240..00000000000
--- a/zerver/tests/test_zephyr.py
+++ /dev/null
@@ -1,108 +0,0 @@
-import subprocess
-from typing import TYPE_CHECKING, Any
-from unittest.mock import patch
-
-import orjson
-
-from zerver.lib.test_classes import ZulipTestCase
-from zerver.models.realms import get_realm
-from zerver.models.users import get_user
-
-if TYPE_CHECKING:
- from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
-
-
-class ZephyrTest(ZulipTestCase):
- def test_webathena_kerberos_login(self) -> None:
- user = self.example_user("hamlet")
- self.login_user(user)
-
- def post(subdomain: Any, **kwargs: Any) -> "TestHttpResponse":
- params = {k: orjson.dumps(v).decode() for k, v in kwargs.items()}
- return self.client_post(
- "/accounts/webathena_kerberos_login/", params, subdomain=subdomain
- )
-
- result = post("zulip")
- self.assert_json_error(result, "Could not find Kerberos credential")
-
- result = post("zulip", cred="whatever")
- self.assert_json_error(result, "Webathena login not enabled")
-
- email = str(self.mit_email("starnine"))
- realm = get_realm("zephyr")
- user = get_user(email, realm)
- api_key = user.api_key
- self.login_user(user)
-
- def ccache_mock(**kwargs: Any) -> Any:
- return patch("zerver.views.zephyr.make_ccache", **kwargs)
-
- def ssh_mock(**kwargs: Any) -> Any:
- return patch("zerver.views.zephyr.subprocess.check_call", **kwargs)
-
- def mirror_mock() -> Any:
- return self.settings(PERSONAL_ZMIRROR_SERVER="server")
-
- cred = dict(cname=dict(nameString=["starnine"]))
-
- with ccache_mock(side_effect=KeyError("foo")):
- result = post("zephyr", cred=cred)
- self.assert_json_error(result, "Invalid Kerberos cache")
-
- with (
- ccache_mock(return_value=b"1234"),
- ssh_mock(side_effect=subprocess.CalledProcessError(1, [])),
- mirror_mock(),
- self.assertLogs(level="ERROR") as log,
- ):
- result = post("zephyr", cred=cred)
-
- self.assert_json_error(result, "We were unable to set up mirroring for you")
- self.assertIn("Error updating the user's ccache", log.output[0])
-
- with ccache_mock(return_value=b"1234"), self.assertLogs(level="ERROR") as log:
- result = post("zephyr", cred=cred)
-
- self.assert_json_error(result, "We were unable to set up mirroring for you")
- self.assertIn("PERSONAL_ZMIRROR_SERVER is not properly configured", log.output[0])
-
- with ccache_mock(return_value=b"1234"), mirror_mock(), ssh_mock() as ssh:
- result = post("zephyr", cred=cred)
-
- self.assert_json_success(result)
- ssh.assert_called_with(
- [
- "ssh",
- "server",
- "--",
- f"/home/zulip/python-zulip-api/zulip/integrations/zephyr/process_ccache starnine {api_key} MTIzNA==",
- ]
- )
-
- # Accounts whose Kerberos usernames are known not to match their
- # zephyr accounts are hardcoded, and should be handled properly.
-
- def kerberos_alter_egos_mock() -> Any:
- return patch(
- "zerver.views.zephyr.kerberos_alter_egos", {"kerberos_alter_ego": "starnine"}
- )
-
- cred = dict(cname=dict(nameString=["kerberos_alter_ego"]))
- with (
- ccache_mock(return_value=b"1234"),
- mirror_mock(),
- ssh_mock() as ssh,
- kerberos_alter_egos_mock(),
- ):
- result = post("zephyr", cred=cred)
-
- self.assert_json_success(result)
- ssh.assert_called_with(
- [
- "ssh",
- "server",
- "--",
- f"/home/zulip/python-zulip-api/zulip/integrations/zephyr/process_ccache starnine {api_key} MTIzNA==",
- ]
- )
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 4bad1ac4130..da8b431b84b 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -1245,7 +1245,7 @@ def process_message_event(
is_incoming_1_to_1=wide_dict["recipient_id"] == client.user_recipient_id,
)
- # Make sure Zephyr mirroring bots know whether stream is invite-only
+ # Make sure mirroring bots know whether stream is invite-only
if "mirror" in client.client_type_name and event_template.get("invite_only"):
message_dict = message_dict.copy()
message_dict["invite_only_stream"] = True
@@ -1262,7 +1262,7 @@ def process_message_event(
if not client.accepts_event(user_event):
continue
- # The below prevents (Zephyr) mirroring loops.
+ # The below prevents mirroring loops.
if "mirror" in sending_client and sending_client.lower() == client.client_type_name.lower():
continue
diff --git a/zerver/views/message_send.py b/zerver/views/message_send.py
index 2ea8fff28ea..6f634cb645f 100644
--- a/zerver/views/message_send.py
+++ b/zerver/views/message_send.py
@@ -27,7 +27,6 @@ from zerver.lib.typed_endpoint import (
typed_endpoint,
)
from zerver.lib.zcommand import process_zcommands
-from zerver.lib.zephyr import compute_mit_user_fullname
from zerver.models import Client, Message, RealmDomain, UserProfile
from zerver.models.users import get_user_including_cross_realm
@@ -48,10 +47,7 @@ def create_mirrored_message_users(
if recipient_type_name == "private":
referenced_users.update(email.lower() for email in recipients)
- if client.name == "zephyr_mirror":
- user_check = same_realm_zephyr_user
- fullname_function = compute_mit_user_fullname
- elif client.name == "irc_mirror":
+ if client.name == "irc_mirror":
user_check = same_realm_irc_user
fullname_function = compute_irc_user_fullname
elif client.name in ("jabber_mirror", "JabberMirror"):
@@ -73,28 +69,6 @@ def create_mirrored_message_users(
return sender_user_profile
-def same_realm_zephyr_user(user_profile: UserProfile, email: str) -> bool:
- #
- # Are the sender and recipient both addresses in the same Zephyr
- # mirroring realm? We have to handle this specially, inferring
- # the domain from the e-mail address, because the recipient may
- # not existing in Zulip and we may need to make a stub Zephyr
- # mirroring user on the fly.
- try:
- validators.validate_email(email)
- except ValidationError:
- return False
-
- domain = Address(addr_spec=email).domain.lower()
-
- # Assumes allow_subdomains=False for all RealmDomain's corresponding to
- # these realms.
- return (
- user_profile.realm.is_zephyr_mirror_realm
- and RealmDomain.objects.filter(realm=user_profile.realm, domain=domain).exists()
- )
-
-
def same_realm_irc_user(user_profile: UserProfile, email: str) -> bool:
# Check whether the target email address is an IRC user in the
# same realm as user_profile, i.e. if the domain were example.com,
@@ -197,7 +171,7 @@ def send_message_backend(
realm = user_profile.realm
- if client.name in ["zephyr_mirror", "irc_mirror", "jabber_mirror", "JabberMirror"]:
+ if client.name in ["irc_mirror", "jabber_mirror", "JabberMirror"]:
# Here's how security works for mirroring:
#
# For direct messages, the message must be (1) both sent and
@@ -233,8 +207,6 @@ def send_message_backend(
except InvalidMirrorInputError:
raise JsonableError(_("Invalid mirrored message"))
- if client.name == "zephyr_mirror" and not user_profile.realm.is_zephyr_mirror_realm:
- raise JsonableError(_("Zephyr mirroring is not allowed in this organization"))
sender = mirror_sender
else:
if req_sender is not None:
diff --git a/zerver/views/presence.py b/zerver/views/presence.py
index 968434f795b..4d76de0f7f1 100644
--- a/zerver/views/presence.py
+++ b/zerver/views/presence.py
@@ -1,4 +1,3 @@
-from datetime import timedelta
from typing import Annotated, Any
from django.conf import settings
@@ -19,7 +18,7 @@ from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.typed_endpoint import ApiParamConfig, PathOnly, typed_endpoint
from zerver.lib.user_status import get_user_status
from zerver.lib.users import access_user_by_id, check_can_access_user
-from zerver.models import UserActivity, UserPresence, UserProfile, UserStatus
+from zerver.models import UserPresence, UserProfile, UserStatus
from zerver.models.users import get_active_user, get_active_user_profile_by_id_in_realm
@@ -208,21 +207,6 @@ def update_active_status_backend(
history_limit_days=history_limit_days,
)
- if user_profile.realm.is_zephyr_mirror_realm:
- # In zephyr mirroring realms, users can't see the presence of other
- # users, but each user **is** interested in whether their mirror bot
- # (running as their user) has been active.
- try:
- activity = UserActivity.objects.get(
- user_profile=user_profile, query="get_events", client__name="zephyr_mirror"
- )
-
- ret["zephyr_mirror_active"] = activity.last_visit > timezone_now() - timedelta(
- minutes=5
- )
- except UserActivity.DoesNotExist:
- ret["zephyr_mirror_active"] = False
-
return json_success(request, data=ret)
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index bb8c2bab989..dec74511e7c 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -86,7 +86,6 @@ from zerver.lib.typed_endpoint_validators import (
from zerver.lib.upload import all_message_attachments
from zerver.lib.url_encoding import append_url_query_string
from zerver.lib.users import get_accounts_for_email
-from zerver.lib.zephyr import compute_mit_user_fullname
from zerver.models import (
Message,
MultiuseInvite,
@@ -562,18 +561,6 @@ def registration_helper(
)
request.session["authenticated_full_name"] = ldap_full_name
name_validated = True
- elif realm is not None and realm.is_zephyr_mirror_realm:
- # For MIT users, we can get an authoritative name from Hesiod.
- # Technically we should check that this is actually an MIT
- # realm, but we can cross that bridge if we ever get a non-MIT
- # zephyr mirroring realm.
- hesiod_name = compute_mit_user_fullname(email)
- form = RegistrationForm(
- initial={"full_name": hesiod_name if "@" not in hesiod_name else ""},
- realm_creation=realm_creation,
- realm=realm,
- )
- name_validated = True
elif prereg_user is not None and prereg_user.full_name:
if prereg_user.full_name_validated:
request.session["authenticated_full_name"] = prereg_user.full_name
diff --git a/zerver/views/streams.py b/zerver/views/streams.py
index 70be4fd3b8b..466eae8dd08 100644
--- a/zerver/views/streams.py
+++ b/zerver/views/streams.py
@@ -76,7 +76,6 @@ from zerver.lib.streams import (
channel_events_topic_name,
check_channel_creation_permissions,
check_stream_name_available,
- check_zephyr_realm_invite_conditions,
create_stream_if_needed,
do_get_streams,
filter_stream_authorization_for_adding_subscribers,
@@ -347,11 +346,7 @@ def update_stream_backend(
default_stream_ids = get_default_stream_ids_for_realm(stream.realm_id)
proposed_is_default_stream = stream.id in default_stream_ids
- if stream.realm.is_zephyr_mirror_realm:
- # In the Zephyr mirroring model, history is unconditionally
- # not public to subscribers, even for public streams.
- proposed_history_public_to_subscribers = False
- elif history_public_to_subscribers is not None:
+ if history_public_to_subscribers is not None:
proposed_history_public_to_subscribers = history_public_to_subscribers
elif is_private is not None:
# By default, private streams have protected history while for
@@ -370,11 +365,7 @@ def update_stream_backend(
# Public streams must be public to subscribers.
if not proposed_is_private and not proposed_history_public_to_subscribers:
- if stream.realm.is_zephyr_mirror_realm:
- # All Zephyr realm streams violate this rule.
- pass
- else:
- raise JsonableError(_("Invalid parameters"))
+ raise JsonableError(_("Invalid parameters"))
# Ensure that a stream cannot be both a default stream for new users and private
if proposed_is_private and proposed_is_default_stream:
@@ -766,8 +757,6 @@ def create_channel(
if len(subscribers) > 0 and not all(user_id == user_profile.id for user_id in subscribers):
is_subscribing_other_users = True
- check_zephyr_realm_invite_conditions(is_subscribing_other_users, realm, invite_only)
-
check_channel_creation_permissions(
user_profile,
is_default_stream=is_default_stream,
@@ -976,9 +965,6 @@ def add_subscriptions_backend(
# Newly created streams are also authorized for the creator
streams = authorized_streams + created_streams
- for stream in streams:
- check_zephyr_realm_invite_conditions(is_subscribing_other_users, realm, stream.invite_only)
-
if is_subscribing_other_users:
subscribers = bulk_principals_to_user_profiles(principals, user_profile)
else:
@@ -1133,7 +1119,7 @@ def send_user_subscribed_and_new_channel_notifications(
)
# Send an initial "channel created" notification to newly created channel events topic.
- if not user_profile.realm.is_zephyr_mirror_realm and len(created_streams) > 0:
+ if len(created_streams) > 0:
sender = get_system_bot(settings.NOTIFICATION_BOT, user_profile.realm_id)
for stream in created_streams:
with override_language(stream.realm.default_language):
@@ -1149,8 +1135,6 @@ def send_user_subscribed_and_new_channel_notifications(
)
new_channel_message = None
- # Policy `public_protected_history` is missing here as those channels don't get
- # channel creation notification.
if policy_key == "web_public":
new_channel_message = _(
"**Web-public** channel created by {user_name}. **Description:**"
diff --git a/zerver/views/zephyr.py b/zerver/views/zephyr.py
deleted file mode 100644
index bd11b59354f..00000000000
--- a/zerver/views/zephyr.py
+++ /dev/null
@@ -1,77 +0,0 @@
-import base64
-import logging
-import re
-import shlex
-import subprocess
-from email.headerregistry import Address
-
-import orjson
-from django.conf import settings
-from django.http import HttpRequest, HttpResponse
-from django.utils.translation import gettext as _
-
-from zerver.decorator import authenticated_json_view
-from zerver.lib.ccache import make_ccache
-from zerver.lib.exceptions import JsonableError
-from zerver.lib.pysa import mark_sanitized
-from zerver.lib.response import json_success
-from zerver.lib.typed_endpoint import typed_endpoint
-from zerver.models import UserProfile
-
-# Hack for mit.edu users whose Kerberos usernames don't match what they zephyr
-# as. The key is for Kerberos and the value is for zephyr.
-kerberos_alter_egos = {
- "golem": "ctl",
-}
-
-
-@authenticated_json_view
-@typed_endpoint
-def webathena_kerberos_login(
- request: HttpRequest, user_profile: UserProfile, *, cred: str | None = None
-) -> HttpResponse:
- if cred is None:
- raise JsonableError(_("Could not find Kerberos credential"))
- if not user_profile.realm.webathena_enabled:
- raise JsonableError(_("Webathena login not enabled"))
-
- try:
- parsed_cred = orjson.loads(cred)
- user = parsed_cred["cname"]["nameString"][0]
- if user in kerberos_alter_egos:
- user = kerberos_alter_egos[user]
- assert user == Address(addr_spec=user_profile.email).username
- # Limit characters in usernames to valid MIT usernames
- # This is important for security since DNS is not secure.
- assert re.match(r"^[a-z0-9_.-]+$", user) is not None
- ccache = make_ccache(parsed_cred)
-
- # 'user' has been verified to contain only benign characters that won't
- # help with shell injection.
- user = mark_sanitized(user)
-
- # 'ccache' is only written to disk by the script and used as a kerberos
- # credential cache file.
- ccache = mark_sanitized(ccache)
- except Exception:
- raise JsonableError(_("Invalid Kerberos cache"))
-
- if settings.PERSONAL_ZMIRROR_SERVER is None:
- logging.error("PERSONAL_ZMIRROR_SERVER is not properly configured", stack_info=True)
- raise JsonableError(_("We were unable to set up mirroring for you"))
-
- # TODO: Send these data via (say) RabbitMQ
- try:
- api_key = user_profile.api_key
- command = [
- "/home/zulip/python-zulip-api/zulip/integrations/zephyr/process_ccache",
- user,
- api_key,
- base64.b64encode(ccache).decode(),
- ]
- subprocess.check_call(["ssh", settings.PERSONAL_ZMIRROR_SERVER, "--", shlex.join(command)])
- except subprocess.CalledProcessError:
- logging.exception("Error updating the user's ccache", stack_info=True)
- raise JsonableError(_("We were unable to set up mirroring for you"))
-
- return json_success(request)
diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py
index 896bff0230d..a5f73effd55 100644
--- a/zilencer/management/commands/populate_db.py
+++ b/zilencer/management/commands/populate_db.py
@@ -974,8 +974,7 @@ class Command(ZulipBaseCommand):
if options["delete"]:
if options["test_suite"]:
- # Create test users; the MIT ones are needed to test
- # the Zephyr mirroring codepaths.
+ # Create test users
event_time = timezone_now()
testsuite_mit_users = [
("Fred Sipb (MIT)", "[email protected]"),
@@ -993,6 +992,7 @@ class Command(ZulipBaseCommand):
"core team": {
"description": "A private channel for core team members",
"invite_only": True,
+ "history_public_to_subscribers": False,
}
},
)
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 59e298be570..8df76668cbe 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -512,10 +512,6 @@ ROOT_DOMAIN_LANDING_PAGE = False
# Subdomain for serving endpoints to users from self-hosted deployments.
SELF_HOSTING_MANAGEMENT_SUBDOMAIN: str | None = None
-# If using the Zephyr mirroring supervisord configuration, the
-# hostname to connect to in order to transfer credentials from webathena.
-PERSONAL_ZMIRROR_SERVER: str | None = None
-
# When security-relevant links in emails expire.
CONFIRMATION_LINK_DEFAULT_VALIDITY_DAYS = 1
INVITATION_LINK_VALIDITY_DAYS = 10
diff --git a/zproject/urls.py b/zproject/urls.py
index 98e56342910..9e0599202bd 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -273,7 +273,6 @@ from zerver.views.video_calls import (
register_zoom_user,
)
from zerver.views.welcome_bot_custom_message import send_test_welcome_bot_custom_message
-from zerver.views.zephyr import webathena_kerberos_login
from zproject import dev_urls
if settings.TWO_FACTOR_AUTHENTICATION_ENABLED: # nocoverage
@@ -629,7 +628,6 @@ i18n_urls = [
path("accounts/login/", login_page, {"template_name": "zerver/login.html"}, name="login_page"),
path("accounts/login/", LoginView.as_view(template_name="zerver/login.html"), name="login"),
path("accounts/logout/", logout_view),
- path("accounts/webathena_kerberos_login/", webathena_kerberos_login),
path("accounts/password/reset/", password_reset, name="password_reset"),
path(
"accounts/password/reset/done/",