commit_id
string | repo
string | commit_message
string | diff
string | label
int64 |
---|---|---|---|---|
370f3aa8d0769af999ffab9e6ebd54d535edb687
|
zulip/zulip
|
tables: Remove remaining padding on sort.
With the sort arrow icons no longer positioned absolutely, this
padding is unnecessary (icons now participate in the width).
|
commit 370f3aa8d0769af999ffab9e6ebd54d535edb687
Author: Karl Stolley <[email protected]>
Date: Fri Mar 7 14:36:12 2025 -0600
tables: Remove remaining padding on sort.
With the sort arrow icons no longer positioned absolutely, this
padding is unnecessary (icons now participate in the width).
diff --git a/web/styles/app_components.css b/web/styles/app_components.css
index d019471c63..988db07f1e 100644
--- a/web/styles/app_components.css
+++ b/web/styles/app_components.css
@@ -775,10 +775,6 @@ input.settings_text_input {
background-color: hsl(0deg 0% 100%);
word-break: normal;
- &[data-sort] {
- padding-right: var(--table-header-sortable-column-padding-right);
- }
-
&.active::after,
&[data-sort]:hover::after {
content: " \f0d8";
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 3be739352e..53217ce337 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -618,13 +618,6 @@
*/
--popover-tippy-arrow-before-offset: -6.5px;
- /*
- Padding used in headers for sortable columns in table to make sure
- that the arrow is visible completely for different screen widths,
- languages and font-size including when hovering over the header.
- */
- --table-header-sortable-column-padding-right: 1em;
-
/* Color picker popover values */
--size-color-swatch: 1em;
--grid-gap-color-swatch: 1em;
| 0 |
74f3189fa57cd09b25840186b3835c55d95c8aff
|
zulip/zulip
|
settings: Add styles for dropdown titles.
|
commit 74f3189fa57cd09b25840186b3835c55d95c8aff
Author: YJDave <[email protected]>
Date: Sat Jan 20 13:01:29 2018 +0530
settings: Add styles for dropdown titles.
diff --git a/static/styles/settings.css b/static/styles/settings.css
index 6daa6ca1dc..d4bb807986 100644
--- a/static/styles/settings.css
+++ b/static/styles/settings.css
@@ -1351,6 +1351,10 @@ thead .actions {
width: 340px;
}
+.dropdown-title {
+ margin-bottom: 3px;
+}
+
.invited-as-admin {
opacity: 0.5;
margin-left: 2px;
diff --git a/static/templates/settings/display-settings.handlebars b/static/templates/settings/display-settings.handlebars
index d5b6a5448a..f7145c23cf 100644
--- a/static/templates/settings/display-settings.handlebars
+++ b/static/templates/settings/display-settings.handlebars
@@ -69,7 +69,7 @@
</div>
<div class="input-group">
- <label for="timezone">{{t "Time zone" }}:</label>
+ <label for="timezone" class="dropdown-title">{{t "Time zone" }}:</label>
<select name="timezone" id="user_timezone">
{{#unless page_params.timezone}}
<option></option>
diff --git a/static/templates/settings/organization-permissions-admin.handlebars b/static/templates/settings/organization-permissions-admin.handlebars
index 6821cfa72a..33ef78b4ab 100644
--- a/static/templates/settings/organization-permissions-admin.handlebars
+++ b/static/templates/settings/organization-permissions-admin.handlebars
@@ -76,7 +76,7 @@
<h3 class="light">{{t "Streams" }}</h3>
<div class="m-10 inline-block organization-permissions-parent">
<div class="inline-block create-stream-dropdown">
- <label for="realm_create_stream_permission">{{t "Who can create streams" }}</label>
+ <label for="realm_create_stream_permission" class="dropdown-title">{{t "Who can create streams" }}</label>
<select name="realm_create_stream_permission" id="id_realm_create_stream_permission">
<option value="by_admins_only">{{t "Admins only" }}</option>
<option value="by_anyone">{{t "Everyone" }}</option>
diff --git a/static/templates/settings/organization-settings-admin.handlebars b/static/templates/settings/organization-settings-admin.handlebars
index 65456aeb56..20679a774a 100644
--- a/static/templates/settings/organization-settings-admin.handlebars
+++ b/static/templates/settings/organization-settings-admin.handlebars
@@ -126,7 +126,7 @@
<div class="m-10 inline-block organization-settings-parent">
<div class="input-group">
- <label for="realm_default_language">{{t "Default language" }}:</label>
+ <label for="realm_default_language" class="dropdown-title">{{t "Default language" }}:</label>
<select name="realm_default_language" id="id_realm_default_language">
{{#each language_list}}
<option value='{{this.code}}'>{{this.name}}</option>
| 0 |
750b8326d7feba5f73d3542e7e76be5a00cd8011
|
zulip/zulip
|
subs: fix incorrect stream_info re-initialization.
Using [] doesn't cause incorrect behavior, but it's a mismatch with
how stream_info is initially declared and gives you a confusing
representation at the console.
(imported from commit c03d9e6a29ff990659f41ee478f631a019a5ac25)
|
commit 750b8326d7feba5f73d3542e7e76be5a00cd8011
Author: Jessica McKellar <[email protected]>
Date: Sun Apr 14 16:58:33 2013 -0400
subs: fix incorrect stream_info re-initialization.
Using [] doesn't cause incorrect behavior, but it's a mismatch with
how stream_info is initially declared and gives you a confusing
representation at the console.
(imported from commit c03d9e6a29ff990659f41ee478f631a019a5ac25)
diff --git a/zephyr/static/js/subs.js b/zephyr/static/js/subs.js
index c3773fcf30..324f81ef6e 100644
--- a/zephyr/static/js/subs.js
+++ b/zephyr/static/js/subs.js
@@ -474,7 +474,7 @@ exports.reload_subscriptions = function (opts) {
}
if (opts.clear_first) {
- stream_info = [];
+ stream_info = {};
ui.remove_all_narrow_filters();
}
| 0 |
d58e5b8c16b88079e95d1557c1c8a6bc28954ba1
|
zulip/zulip
|
requirements: Use a forked version of libthumbor for performance.
This optimizes the import performance of Zulip by using a fork of
pkgresources. The fork just has a single commit, which replaces
libthumbor's use of pkgresources (which is really slow to import) with
a direct query to the version number.
This fixes part of #9953.
|
commit d58e5b8c16b88079e95d1557c1c8a6bc28954ba1
Author: Tim Abbott <[email protected]>
Date: Wed Oct 17 11:15:02 2018 -0700
requirements: Use a forked version of libthumbor for performance.
This optimizes the import performance of Zulip by using a fork of
pkgresources. The fork just has a single commit, which replaces
libthumbor's use of pkgresources (which is really slow to import) with
a direct query to the version number.
This fixes part of #9953.
diff --git a/requirements/common.in b/requirements/common.in
index 65c9939b54..9c696d74af 100644
--- a/requirements/common.in
+++ b/requirements/common.in
@@ -201,5 +201,5 @@ disposable-email-domains==0.0.30
yamole==2.1.5
# Needed for signing thumbnail requests so that they can be authenticated on the
-# other end.
-libthumbor==1.3.2
+# other end. Using a fork to eliminate a really slow pkgresources import.
+-e "git+https://github.com/zulip/libthumbor.git@60ed2431c07686a12f2770b2d852c5650f3ccfc6#egg=libthumbor==1.3.2zulip"
diff --git a/requirements/dev.txt b/requirements/dev.txt
index 5142657b52..b7702ba05d 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -10,6 +10,7 @@
--no-binary psycopg2
git+https://github.com/zulip/django-bitfield@0d2b15cdb5af5ddec88d41cac19c0f2ce1b1ad38#egg=django-bitfield==1.9.3+dev.0d2b15cdb5af5ddec88d41cac19c0f2ce1b1ad38
+git+https://github.com/zulip/libthumbor.git@60ed2431c07686a12f2770b2d852c5650f3ccfc6#egg=libthumbor==1.3.2zulip
git+https://github.com/zulip/talon.git@7d8bdc4dbcfcc5a73298747293b99fe53da55315#egg=talon==1.2.10.zulip1
git+https://github.com/zulip/ultrajson@70ac02bec#egg=ujson==1.35+git
git+https://github.com/zulip/[email protected]#egg=zulip==0.5.5_git&subdirectory=zulip
@@ -88,7 +89,6 @@ jinja2==2.10
jmespath==0.9.3 # via boto3, botocore
jsondiff==1.1.1 # via moto
jsonpickle==0.9.5 # via aws-xray-sdk, python-digitalocean
-libthumbor==1.3.2
lxml==4.2.3
markdown-include==0.5.1
markdown==2.6.11
diff --git a/requirements/prod.txt b/requirements/prod.txt
index 29cacf93e5..06498e56a0 100644
--- a/requirements/prod.txt
+++ b/requirements/prod.txt
@@ -10,6 +10,7 @@
--no-binary psycopg2
git+https://github.com/zulip/django-bitfield@0d2b15cdb5af5ddec88d41cac19c0f2ce1b1ad38#egg=django-bitfield==1.9.3+dev.0d2b15cdb5af5ddec88d41cac19c0f2ce1b1ad38
+git+https://github.com/zulip/libthumbor.git@60ed2431c07686a12f2770b2d852c5650f3ccfc6#egg=libthumbor==1.3.2zulip
git+https://github.com/zulip/talon.git@7d8bdc4dbcfcc5a73298747293b99fe53da55315#egg=talon==1.2.10.zulip1
git+https://github.com/zulip/ultrajson@70ac02bec#egg=ujson==1.35+git
git+https://github.com/zulip/[email protected]#egg=zulip==0.5.5_git&subdirectory=zulip
@@ -62,7 +63,6 @@ ipython-genutils==0.2.0 # via traitlets
ipython==6.5.0
jedi==0.11.0 # via ipython
jinja2==2.10
-libthumbor==1.3.2
lxml==4.2.3
markdown-include==0.5.1
markdown==2.6.11
| 0 |
dbae28683cc431e016f072a9c64fcd4b7281ef1a
|
zulip/zulip
|
stream_popover: Use data-stream-id when building popover.
|
commit dbae28683cc431e016f072a9c64fcd4b7281ef1a
Author: Tim Abbott <[email protected]>
Date: Wed Aug 16 16:41:40 2017 -0700
stream_popover: Use data-stream-id when building popover.
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index f67bd15c86..0274270dcf 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -83,11 +83,11 @@ function build_stream_popover(e) {
popovers.hide_all();
exports.show_streamlist_sidebar();
- var stream = $(elt).parents('li').attr('data-name');
+ var stream_id = $(elt).parents('li').attr('data-stream-id');
var content = templates.render(
'stream_sidebar_actions',
- {stream: stream_data.get_sub(stream)}
+ {stream: stream_data.get_sub_by_id(stream_id)}
);
$(elt).popover({
@@ -97,8 +97,7 @@ function build_stream_popover(e) {
});
$(elt).popover("show");
- var data_id = stream_data.get_sub(stream).stream_id;
- var popover = $('.streams_popover[data-stream-id=' + data_id + ']');
+ var popover = $('.streams_popover[data-stream-id=' + stream_id + ']');
update_spectrum(popover, function (colorpicker) {
colorpicker.spectrum(stream_color.sidebar_popover_colorpicker_options);
| 0 |
ca144b5297d647413b15d18f01cdc2a4003ce7c3
|
zulip/zulip
|
Eliminate MyResult class by calling test method directly.
Instead of calling test(result), we emulate the behavior of
calling SimpleTestCase.__call__, minus the results protocol.
(imported from commit e12e3d5caa8726c050a2a7cfa583ca4d571d6cbb)
|
commit ca144b5297d647413b15d18f01cdc2a4003ce7c3
Author: Steve Howell <[email protected]>
Date: Thu Jun 20 13:42:32 2013 -0400
Eliminate MyResult class by calling test method directly.
Instead of calling test(result), we emulate the behavior of
calling SimpleTestCase.__call__, minus the results protocol.
(imported from commit e12e3d5caa8726c050a2a7cfa583ca4d571d6cbb)
diff --git a/zephyr/tests.py b/zephyr/tests.py
index 43e55ef349..5797f78a75 100644
--- a/zephyr/tests.py
+++ b/zephyr/tests.py
@@ -2910,48 +2910,23 @@ class RateLimitTests(AuthedTestCase):
self.assert_json_success(result)
-class MyResult:
- def startTest(self, test):
- pass
-
- def stopTest(self, *args):
- pass
-
- def addSuccess(self, test):
- pass
-
- def addFailure(self, obj, err):
- self._die('Failure', err)
-
- def addError(self, obj, err):
- self._die('Error', err)
-
- def _die(self, failure_type, err):
- print
- print failure_type
- exctype, value, tb = err
- print ''.join(traceback.format_exception(exctype, value, tb))
- sys.exit(1)
-
- def __getattr__(self, attr):
- print
- print 'Attribute %s not supported' % attr
- print '''
- We have our own implementation of a result class that
- may no longer be playing nice with the latest Django.
- '''
- sys.exit(1)
-
def full_test_name(test):
test_class = test.__class__.__name__
test_method = test._testMethodName
return '%s/%s' % (test_class, test_method)
+def get_test_method(test):
+ return getattr(test, test._testMethodName)
+
def run_test(test):
- result = MyResult()
+ test_method = get_test_method(test)
test_name = full_test_name(test)
print 'Running %s' % (test_name,)
- test(result)
+ test._pre_setup()
+ test.setUp()
+ test_method()
+ test.tearDown()
+ test._post_teardown()
class Runner(DjangoTestSuiteRunner):
option_list = ()
| 0 |
38ecc35cd9c75df448d117dd270a7d41b8ac18c9
|
zulip/zulip
|
push_notifications: Catch IOError while pushing to GCM.
|
commit 38ecc35cd9c75df448d117dd270a7d41b8ac18c9
Author: Umair Khan <[email protected]>
Date: Wed May 17 12:58:27 2017 +0500
push_notifications: Catch IOError while pushing to GCM.
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index e7f8a61fd7..7816f3e65f 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -242,7 +242,11 @@ def send_android_push_notification(devices, data, remote=False):
else:
DeviceTokenClass = PushDeviceToken
- res = gcm.json_request(registration_ids=reg_ids, data=data)
+ try:
+ res = gcm.json_request(registration_ids=reg_ids, data=data)
+ except IOError as e:
+ logging.warning(str(e))
+ return
if res and 'success' in res:
for reg_id, msg_id in res['success'].items():
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py
index 552f4d547e..a9ecb23a6a 100644
--- a/zerver/tests/test_push_notifications.py
+++ b/zerver/tests/test_push_notifications.py
@@ -790,6 +790,15 @@ class GCMNotSetTest(GCMTest):
"notification, but no API key was "
"configured")
+class GCMIOErrorTest(GCMTest):
+ @mock.patch('zerver.lib.push_notifications.gcm.json_request')
+ @mock.patch('logging.warning')
+ def test_json_request_raises_ioerror(self, mock_warn, mock_json_request):
+ # type: (mock.MagicMock, mock.MagicMock) -> None
+ mock_json_request.side_effect = IOError('error')
+ apn.send_android_push_notification_to_user(self.user_profile, {})
+ mock_warn.assert_called_with('error')
+
class GCMSuccessTest(GCMTest):
@mock.patch('logging.warning')
@mock.patch('logging.info')
| 0 |
da2744812fbc41c94249cfa78907b04584168c96
|
zulip/zulip
|
Don't use force_bytes() in decorator.py.
In python3 base64.b64decode() can take an ASCII string, and any
legit data will be ASCII. If you pass in non-ASCII data, the
function will properly throw a ValueError (verified in python3 shell).
>>> s = 'μλ
νμΈμ'
>>> import base64
>>> base64.b64decode(s)
Traceback (most recent call last):
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 37, in _bytes_from_decode_data
return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 83, in b64decode
s = _bytes_from_decode_data(s)
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 39, in _bytes_from_decode_data
raise ValueError('string argument should contain only ASCII characters')
ValueError: string argument should contain only ASCII characters
|
commit da2744812fbc41c94249cfa78907b04584168c96
Author: Steve Howell <[email protected]>
Date: Sat Nov 4 08:53:23 2017 -0700
Don't use force_bytes() in decorator.py.
In python3 base64.b64decode() can take an ASCII string, and any
legit data will be ASCII. If you pass in non-ASCII data, the
function will properly throw a ValueError (verified in python3 shell).
>>> s = 'μλ
νμΈμ'
>>> import base64
>>> base64.b64decode(s)
Traceback (most recent call last):
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 37, in _bytes_from_decode_data
return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 83, in b64decode
s = _bytes_from_decode_data(s)
File "/srv/zulip-py3-venv/lib/python3.4/base64.py", line 39, in _bytes_from_decode_data
raise ValueError('string argument should contain only ASCII characters')
ValueError: string argument should contain only ASCII characters
diff --git a/zerver/decorator.py b/zerver/decorator.py
index 87d09acd17..aa3ecba1fb 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -31,7 +31,6 @@ from io import BytesIO
import urllib
from typing import Union, Any, Callable, Sequence, Dict, Optional, TypeVar, Text, Tuple, cast
-from zerver.lib.str_utils import force_bytes
from zerver.lib.logging_util import create_logger
# This is a hack to ensure that RemoteZulipServer always exists even
@@ -491,7 +490,7 @@ def authenticated_rest_api_view(is_webhook=False):
# case insensitive per RFC 1945
if auth_type.lower() != "basic":
return json_error(_("This endpoint requires HTTP basic authentication."))
- role, api_key = base64.b64decode(force_bytes(credentials)).decode('utf-8').split(":")
+ role, api_key = base64.b64decode(credentials).decode('utf-8').split(":")
except ValueError:
return json_unauthorized(_("Invalid authorization header for basic auth"))
except KeyError:
| 0 |
5ff4d9f88ac73899c1bc09d6658c083bf684147f
|
zulip/zulip
|
integrations: Generate avatars using pyvips.
|
commit 5ff4d9f88ac73899c1bc09d6658c083bf684147f
Author: Alex Vandiver <[email protected]>
Date: Thu Jun 13 03:23:00 2024 +0000
integrations: Generate avatars using pyvips.
diff --git a/static/images/integrations/bot_avatars/GIPHY_big_logo.png b/static/images/integrations/bot_avatars/GIPHY_big_logo.png
index 94307ff402..4a6affd027 100644
Binary files a/static/images/integrations/bot_avatars/GIPHY_big_logo.png and b/static/images/integrations/bot_avatars/GIPHY_big_logo.png differ
diff --git a/static/images/integrations/bot_avatars/airbrake.png b/static/images/integrations/bot_avatars/airbrake.png
index eb53ec6e42..1af36ec5f2 100644
Binary files a/static/images/integrations/bot_avatars/airbrake.png and b/static/images/integrations/bot_avatars/airbrake.png differ
diff --git a/static/images/integrations/bot_avatars/ansibletower.png b/static/images/integrations/bot_avatars/ansibletower.png
index e05d3ce943..be8093fbd4 100644
Binary files a/static/images/integrations/bot_avatars/ansibletower.png and b/static/images/integrations/bot_avatars/ansibletower.png differ
diff --git a/static/images/integrations/bot_avatars/appfollow.png b/static/images/integrations/bot_avatars/appfollow.png
index b16fff75dd..921d73a394 100644
Binary files a/static/images/integrations/bot_avatars/appfollow.png and b/static/images/integrations/bot_avatars/appfollow.png differ
diff --git a/static/images/integrations/bot_avatars/appveyor.png b/static/images/integrations/bot_avatars/appveyor.png
index 6cdaf21831..eabd42c483 100644
Binary files a/static/images/integrations/bot_avatars/appveyor.png and b/static/images/integrations/bot_avatars/appveyor.png differ
diff --git a/static/images/integrations/bot_avatars/asana.png b/static/images/integrations/bot_avatars/asana.png
index b1788cb63a..46119d4e2e 100644
Binary files a/static/images/integrations/bot_avatars/asana.png and b/static/images/integrations/bot_avatars/asana.png differ
diff --git a/static/images/integrations/bot_avatars/assembla.png b/static/images/integrations/bot_avatars/assembla.png
index 8566c9f927..abb30acd00 100644
Binary files a/static/images/integrations/bot_avatars/assembla.png and b/static/images/integrations/bot_avatars/assembla.png differ
diff --git a/static/images/integrations/bot_avatars/azuredevops.png b/static/images/integrations/bot_avatars/azuredevops.png
index 019e9ee0ec..ad62218811 100644
Binary files a/static/images/integrations/bot_avatars/azuredevops.png and b/static/images/integrations/bot_avatars/azuredevops.png differ
diff --git a/static/images/integrations/bot_avatars/basecamp.png b/static/images/integrations/bot_avatars/basecamp.png
index 05527114c1..365b575890 100644
Binary files a/static/images/integrations/bot_avatars/basecamp.png and b/static/images/integrations/bot_avatars/basecamp.png differ
diff --git a/static/images/integrations/bot_avatars/beanstalk.png b/static/images/integrations/bot_avatars/beanstalk.png
index 333a7a3356..dc555e9e9a 100644
Binary files a/static/images/integrations/bot_avatars/beanstalk.png and b/static/images/integrations/bot_avatars/beanstalk.png differ
diff --git a/static/images/integrations/bot_avatars/beeminder.png b/static/images/integrations/bot_avatars/beeminder.png
index 20f86565ba..24546d70a0 100644
Binary files a/static/images/integrations/bot_avatars/beeminder.png and b/static/images/integrations/bot_avatars/beeminder.png differ
diff --git a/static/images/integrations/bot_avatars/bigbluebutton.png b/static/images/integrations/bot_avatars/bigbluebutton.png
index 56eda4c6ea..c579464bc2 100644
Binary files a/static/images/integrations/bot_avatars/bigbluebutton.png and b/static/images/integrations/bot_avatars/bigbluebutton.png differ
diff --git a/static/images/integrations/bot_avatars/bitbucket.png b/static/images/integrations/bot_avatars/bitbucket.png
index a36d9626a6..42170da71e 100644
Binary files a/static/images/integrations/bot_avatars/bitbucket.png and b/static/images/integrations/bot_avatars/bitbucket.png differ
diff --git a/static/images/integrations/bot_avatars/bonusly.png b/static/images/integrations/bot_avatars/bonusly.png
index 29663cdefc..cf4be02e84 100644
Binary files a/static/images/integrations/bot_avatars/bonusly.png and b/static/images/integrations/bot_avatars/bonusly.png differ
diff --git a/static/images/integrations/bot_avatars/buildbot.png b/static/images/integrations/bot_avatars/buildbot.png
index 59e9baf256..eec70a1288 100644
Binary files a/static/images/integrations/bot_avatars/buildbot.png and b/static/images/integrations/bot_avatars/buildbot.png differ
diff --git a/static/images/integrations/bot_avatars/canarytoken.png b/static/images/integrations/bot_avatars/canarytoken.png
index 2b47be8b28..623107a436 100644
Binary files a/static/images/integrations/bot_avatars/canarytoken.png and b/static/images/integrations/bot_avatars/canarytoken.png differ
diff --git a/static/images/integrations/bot_avatars/capistrano.png b/static/images/integrations/bot_avatars/capistrano.png
index 3244f46eb8..a7019aa65d 100644
Binary files a/static/images/integrations/bot_avatars/capistrano.png and b/static/images/integrations/bot_avatars/capistrano.png differ
diff --git a/static/images/integrations/bot_avatars/chartbeat.png b/static/images/integrations/bot_avatars/chartbeat.png
index 28fb5a0994..201bcfc3d1 100644
Binary files a/static/images/integrations/bot_avatars/chartbeat.png and b/static/images/integrations/bot_avatars/chartbeat.png differ
diff --git a/static/images/integrations/bot_avatars/circleci.png b/static/images/integrations/bot_avatars/circleci.png
index 42f1a2db0a..853ba7cde0 100644
Binary files a/static/images/integrations/bot_avatars/circleci.png and b/static/images/integrations/bot_avatars/circleci.png differ
diff --git a/static/images/integrations/bot_avatars/clubhouse.png b/static/images/integrations/bot_avatars/clubhouse.png
index 7f1475f5be..af85333b18 100644
Binary files a/static/images/integrations/bot_avatars/clubhouse.png and b/static/images/integrations/bot_avatars/clubhouse.png differ
diff --git a/static/images/integrations/bot_avatars/codebase.png b/static/images/integrations/bot_avatars/codebase.png
index 86b895daf8..2f7ba9568c 100644
Binary files a/static/images/integrations/bot_avatars/codebase.png and b/static/images/integrations/bot_avatars/codebase.png differ
diff --git a/static/images/integrations/bot_avatars/codeship.png b/static/images/integrations/bot_avatars/codeship.png
index 31089312c7..fb4fa84ef9 100644
Binary files a/static/images/integrations/bot_avatars/codeship.png and b/static/images/integrations/bot_avatars/codeship.png differ
diff --git a/static/images/integrations/bot_avatars/crashlytics.png b/static/images/integrations/bot_avatars/crashlytics.png
index 4acda8c2e3..e6675d5e87 100644
Binary files a/static/images/integrations/bot_avatars/crashlytics.png and b/static/images/integrations/bot_avatars/crashlytics.png differ
diff --git a/static/images/integrations/bot_avatars/darksky.png b/static/images/integrations/bot_avatars/darksky.png
index 2b5125ff31..39a74ae159 100644
Binary files a/static/images/integrations/bot_avatars/darksky.png and b/static/images/integrations/bot_avatars/darksky.png differ
diff --git a/static/images/integrations/bot_avatars/delighted.png b/static/images/integrations/bot_avatars/delighted.png
index f63762eb0f..0159857cae 100644
Binary files a/static/images/integrations/bot_avatars/delighted.png and b/static/images/integrations/bot_avatars/delighted.png differ
diff --git a/static/images/integrations/bot_avatars/deskcom.png b/static/images/integrations/bot_avatars/deskcom.png
index 3eb0fcbe33..6e4a703cb9 100644
Binary files a/static/images/integrations/bot_avatars/deskcom.png and b/static/images/integrations/bot_avatars/deskcom.png differ
diff --git a/static/images/integrations/bot_avatars/dialogflow.png b/static/images/integrations/bot_avatars/dialogflow.png
index 330f24ef75..1f0217e02e 100644
Binary files a/static/images/integrations/bot_avatars/dialogflow.png and b/static/images/integrations/bot_avatars/dialogflow.png differ
diff --git a/static/images/integrations/bot_avatars/discourse.png b/static/images/integrations/bot_avatars/discourse.png
index e08bf0372a..1653f567ab 100644
Binary files a/static/images/integrations/bot_avatars/discourse.png and b/static/images/integrations/bot_avatars/discourse.png differ
diff --git a/static/images/integrations/bot_avatars/dropbox.png b/static/images/integrations/bot_avatars/dropbox.png
index 15c9004270..24256d2283 100644
Binary files a/static/images/integrations/bot_avatars/dropbox.png and b/static/images/integrations/bot_avatars/dropbox.png differ
diff --git a/static/images/integrations/bot_avatars/email.png b/static/images/integrations/bot_avatars/email.png
index 9e6e2768d4..aaa8172f1f 100644
Binary files a/static/images/integrations/bot_avatars/email.png and b/static/images/integrations/bot_avatars/email.png differ
diff --git a/static/images/integrations/bot_avatars/errbit.png b/static/images/integrations/bot_avatars/errbit.png
index 9d4d271f6f..a40b45d56f 100644
Binary files a/static/images/integrations/bot_avatars/errbit.png and b/static/images/integrations/bot_avatars/errbit.png differ
diff --git a/static/images/integrations/bot_avatars/errbot.png b/static/images/integrations/bot_avatars/errbot.png
index 4263421530..3d3ad12f0e 100644
Binary files a/static/images/integrations/bot_avatars/errbot.png and b/static/images/integrations/bot_avatars/errbot.png differ
diff --git a/static/images/integrations/bot_avatars/flock.png b/static/images/integrations/bot_avatars/flock.png
index 10a5fcdaa7..4812aba112 100644
Binary files a/static/images/integrations/bot_avatars/flock.png and b/static/images/integrations/bot_avatars/flock.png differ
diff --git a/static/images/integrations/bot_avatars/freshdesk.png b/static/images/integrations/bot_avatars/freshdesk.png
index a8db49308f..6d3547d1da 100644
Binary files a/static/images/integrations/bot_avatars/freshdesk.png and b/static/images/integrations/bot_avatars/freshdesk.png differ
diff --git a/static/images/integrations/bot_avatars/freshping.png b/static/images/integrations/bot_avatars/freshping.png
index c7d9779e53..10290e1ad9 100644
Binary files a/static/images/integrations/bot_avatars/freshping.png and b/static/images/integrations/bot_avatars/freshping.png differ
diff --git a/static/images/integrations/bot_avatars/freshstatus.png b/static/images/integrations/bot_avatars/freshstatus.png
index c0fa1507a8..88068ec3e5 100644
Binary files a/static/images/integrations/bot_avatars/freshstatus.png and b/static/images/integrations/bot_avatars/freshstatus.png differ
diff --git a/static/images/integrations/bot_avatars/front.png b/static/images/integrations/bot_avatars/front.png
index 2f58af5d8e..ddad544d4c 100644
Binary files a/static/images/integrations/bot_avatars/front.png and b/static/images/integrations/bot_avatars/front.png differ
diff --git a/static/images/integrations/bot_avatars/gci.png b/static/images/integrations/bot_avatars/gci.png
index 01eb62cb66..7b335dceb0 100644
Binary files a/static/images/integrations/bot_avatars/gci.png and b/static/images/integrations/bot_avatars/gci.png differ
diff --git a/static/images/integrations/bot_avatars/git.png b/static/images/integrations/bot_avatars/git.png
index 158824e42e..340ecd676d 100644
Binary files a/static/images/integrations/bot_avatars/git.png and b/static/images/integrations/bot_avatars/git.png differ
diff --git a/static/images/integrations/bot_avatars/gitea.png b/static/images/integrations/bot_avatars/gitea.png
index a7ffb64532..9a0aacef65 100644
Binary files a/static/images/integrations/bot_avatars/gitea.png and b/static/images/integrations/bot_avatars/gitea.png differ
diff --git a/static/images/integrations/bot_avatars/github-actions.png b/static/images/integrations/bot_avatars/github-actions.png
index f751fc0426..b7759b2f66 100644
Binary files a/static/images/integrations/bot_avatars/github-actions.png and b/static/images/integrations/bot_avatars/github-actions.png differ
diff --git a/static/images/integrations/bot_avatars/github.png b/static/images/integrations/bot_avatars/github.png
index f751fc0426..b7759b2f66 100644
Binary files a/static/images/integrations/bot_avatars/github.png and b/static/images/integrations/bot_avatars/github.png differ
diff --git a/static/images/integrations/bot_avatars/gitlab.png b/static/images/integrations/bot_avatars/gitlab.png
index ff9d58ecd2..2adf6c1870 100644
Binary files a/static/images/integrations/bot_avatars/gitlab.png and b/static/images/integrations/bot_avatars/gitlab.png differ
diff --git a/static/images/integrations/bot_avatars/gocd.png b/static/images/integrations/bot_avatars/gocd.png
index 85302edc17..986da867f9 100644
Binary files a/static/images/integrations/bot_avatars/gocd.png and b/static/images/integrations/bot_avatars/gocd.png differ
diff --git a/static/images/integrations/bot_avatars/gogs.png b/static/images/integrations/bot_avatars/gogs.png
index 6a5eb26033..3eec7ad409 100644
Binary files a/static/images/integrations/bot_avatars/gogs.png and b/static/images/integrations/bot_avatars/gogs.png differ
diff --git a/static/images/integrations/bot_avatars/google-calendar.png b/static/images/integrations/bot_avatars/google-calendar.png
index f0790650aa..a76775c2f8 100644
Binary files a/static/images/integrations/bot_avatars/google-calendar.png and b/static/images/integrations/bot_avatars/google-calendar.png differ
diff --git a/static/images/integrations/bot_avatars/google-translate.png b/static/images/integrations/bot_avatars/google-translate.png
index b48fd00593..a633e1f4b2 100644
Binary files a/static/images/integrations/bot_avatars/google-translate.png and b/static/images/integrations/bot_avatars/google-translate.png differ
diff --git a/static/images/integrations/bot_avatars/gosquared.png b/static/images/integrations/bot_avatars/gosquared.png
index 9f1951f7e7..59900f1ba2 100644
Binary files a/static/images/integrations/bot_avatars/gosquared.png and b/static/images/integrations/bot_avatars/gosquared.png differ
diff --git a/static/images/integrations/bot_avatars/grafana.png b/static/images/integrations/bot_avatars/grafana.png
index 199a30ea4d..14eacced12 100644
Binary files a/static/images/integrations/bot_avatars/grafana.png and b/static/images/integrations/bot_avatars/grafana.png differ
diff --git a/static/images/integrations/bot_avatars/greenhouse.png b/static/images/integrations/bot_avatars/greenhouse.png
index 54cda4dd91..f6d466d497 100644
Binary files a/static/images/integrations/bot_avatars/greenhouse.png and b/static/images/integrations/bot_avatars/greenhouse.png differ
diff --git a/static/images/integrations/bot_avatars/groove.png b/static/images/integrations/bot_avatars/groove.png
index 11c891b455..b60db2aaca 100644
Binary files a/static/images/integrations/bot_avatars/groove.png and b/static/images/integrations/bot_avatars/groove.png differ
diff --git a/static/images/integrations/bot_avatars/harbor.png b/static/images/integrations/bot_avatars/harbor.png
index 428ad7f391..d0c30098b8 100644
Binary files a/static/images/integrations/bot_avatars/harbor.png and b/static/images/integrations/bot_avatars/harbor.png differ
diff --git a/static/images/integrations/bot_avatars/hellosign.png b/static/images/integrations/bot_avatars/hellosign.png
index 45277435f7..a0c24716b4 100644
Binary files a/static/images/integrations/bot_avatars/hellosign.png and b/static/images/integrations/bot_avatars/hellosign.png differ
diff --git a/static/images/integrations/bot_avatars/helloworld.png b/static/images/integrations/bot_avatars/helloworld.png
index e3fe01a029..ce07008722 100644
Binary files a/static/images/integrations/bot_avatars/helloworld.png and b/static/images/integrations/bot_avatars/helloworld.png differ
diff --git a/static/images/integrations/bot_avatars/heroku.png b/static/images/integrations/bot_avatars/heroku.png
index 4af75484b4..c37dde70dc 100644
Binary files a/static/images/integrations/bot_avatars/heroku.png and b/static/images/integrations/bot_avatars/heroku.png differ
diff --git a/static/images/integrations/bot_avatars/homeassistant.png b/static/images/integrations/bot_avatars/homeassistant.png
index 3ef1985026..52ef0676ff 100644
Binary files a/static/images/integrations/bot_avatars/homeassistant.png and b/static/images/integrations/bot_avatars/homeassistant.png differ
diff --git a/static/images/integrations/bot_avatars/hubot.png b/static/images/integrations/bot_avatars/hubot.png
index 4180792caa..b1f1366beb 100644
Binary files a/static/images/integrations/bot_avatars/hubot.png and b/static/images/integrations/bot_avatars/hubot.png differ
diff --git a/static/images/integrations/bot_avatars/ifttt.png b/static/images/integrations/bot_avatars/ifttt.png
index 418ff31e04..ff0a78e1db 100644
Binary files a/static/images/integrations/bot_avatars/ifttt.png and b/static/images/integrations/bot_avatars/ifttt.png differ
diff --git a/static/images/integrations/bot_avatars/insping.png b/static/images/integrations/bot_avatars/insping.png
index 1ec2c133ad..9e998c43d9 100644
Binary files a/static/images/integrations/bot_avatars/insping.png and b/static/images/integrations/bot_avatars/insping.png differ
diff --git a/static/images/integrations/bot_avatars/instagra_m.png b/static/images/integrations/bot_avatars/instagra_m.png
index a467331a22..218cab287a 100644
Binary files a/static/images/integrations/bot_avatars/instagra_m.png and b/static/images/integrations/bot_avatars/instagra_m.png differ
diff --git a/static/images/integrations/bot_avatars/intercom.png b/static/images/integrations/bot_avatars/intercom.png
index 8106e93865..e89d999428 100644
Binary files a/static/images/integrations/bot_avatars/intercom.png and b/static/images/integrations/bot_avatars/intercom.png differ
diff --git a/static/images/integrations/bot_avatars/irc.png b/static/images/integrations/bot_avatars/irc.png
index 63f79a123b..0610d8fa8e 100644
Binary files a/static/images/integrations/bot_avatars/irc.png and b/static/images/integrations/bot_avatars/irc.png differ
diff --git a/static/images/integrations/bot_avatars/jenkins.png b/static/images/integrations/bot_avatars/jenkins.png
index 5a74e008c2..812b184de7 100644
Binary files a/static/images/integrations/bot_avatars/jenkins.png and b/static/images/integrations/bot_avatars/jenkins.png differ
diff --git a/static/images/integrations/bot_avatars/jira.png b/static/images/integrations/bot_avatars/jira.png
index da92be26f1..16e69df41f 100644
Binary files a/static/images/integrations/bot_avatars/jira.png and b/static/images/integrations/bot_avatars/jira.png differ
diff --git a/static/images/integrations/bot_avatars/jitsi.png b/static/images/integrations/bot_avatars/jitsi.png
index c07e4592dd..9f5deb9cd6 100644
Binary files a/static/images/integrations/bot_avatars/jitsi.png and b/static/images/integrations/bot_avatars/jitsi.png differ
diff --git a/static/images/integrations/bot_avatars/jotform.png b/static/images/integrations/bot_avatars/jotform.png
index 155ec5dead..4bf3bb726b 100644
Binary files a/static/images/integrations/bot_avatars/jotform.png and b/static/images/integrations/bot_avatars/jotform.png differ
diff --git a/static/images/integrations/bot_avatars/json.png b/static/images/integrations/bot_avatars/json.png
index 2f1a2b2553..b0c731257b 100644
Binary files a/static/images/integrations/bot_avatars/json.png and b/static/images/integrations/bot_avatars/json.png differ
diff --git a/static/images/integrations/bot_avatars/librato.png b/static/images/integrations/bot_avatars/librato.png
index 55aded87a5..3df6d91e0c 100644
Binary files a/static/images/integrations/bot_avatars/librato.png and b/static/images/integrations/bot_avatars/librato.png differ
diff --git a/static/images/integrations/bot_avatars/lidarr.png b/static/images/integrations/bot_avatars/lidarr.png
index 63921bb27b..2af8533808 100644
Binary files a/static/images/integrations/bot_avatars/lidarr.png and b/static/images/integrations/bot_avatars/lidarr.png differ
diff --git a/static/images/integrations/bot_avatars/linear.png b/static/images/integrations/bot_avatars/linear.png
index d79b9c06ac..b38c404a72 100644
Binary files a/static/images/integrations/bot_avatars/linear.png and b/static/images/integrations/bot_avatars/linear.png differ
diff --git a/static/images/integrations/bot_avatars/logo.png b/static/images/integrations/bot_avatars/logo.png
index 863620ee29..5ebf8a5751 100644
Binary files a/static/images/integrations/bot_avatars/logo.png and b/static/images/integrations/bot_avatars/logo.png differ
diff --git a/static/images/integrations/bot_avatars/mailchimp.png b/static/images/integrations/bot_avatars/mailchimp.png
index bcb027efff..3af1ee96b5 100644
Binary files a/static/images/integrations/bot_avatars/mailchimp.png and b/static/images/integrations/bot_avatars/mailchimp.png differ
diff --git a/static/images/integrations/bot_avatars/mastodon.png b/static/images/integrations/bot_avatars/mastodon.png
index a875d7783c..7098b06185 100644
Binary files a/static/images/integrations/bot_avatars/mastodon.png and b/static/images/integrations/bot_avatars/mastodon.png differ
diff --git a/static/images/integrations/bot_avatars/matrix.png b/static/images/integrations/bot_avatars/matrix.png
index a1eed8f931..1a231384f4 100644
Binary files a/static/images/integrations/bot_avatars/matrix.png and b/static/images/integrations/bot_avatars/matrix.png differ
diff --git a/static/images/integrations/bot_avatars/mention.png b/static/images/integrations/bot_avatars/mention.png
index fbebd50985..bd8da71869 100644
Binary files a/static/images/integrations/bot_avatars/mention.png and b/static/images/integrations/bot_avatars/mention.png differ
diff --git a/static/images/integrations/bot_avatars/mercurial.png b/static/images/integrations/bot_avatars/mercurial.png
index 888dba110e..17f15b600b 100644
Binary files a/static/images/integrations/bot_avatars/mercurial.png and b/static/images/integrations/bot_avatars/mercurial.png differ
diff --git a/static/images/integrations/bot_avatars/nagios.png b/static/images/integrations/bot_avatars/nagios.png
index a6078c09a1..cb1dc932a2 100644
Binary files a/static/images/integrations/bot_avatars/nagios.png and b/static/images/integrations/bot_avatars/nagios.png differ
diff --git a/static/images/integrations/bot_avatars/netlify.png b/static/images/integrations/bot_avatars/netlify.png
index ca1350a51d..24ecc651d3 100644
Binary files a/static/images/integrations/bot_avatars/netlify.png and b/static/images/integrations/bot_avatars/netlify.png differ
diff --git a/static/images/integrations/bot_avatars/newrelic.png b/static/images/integrations/bot_avatars/newrelic.png
index d3a752722f..1c6f41a245 100644
Binary files a/static/images/integrations/bot_avatars/newrelic.png and b/static/images/integrations/bot_avatars/newrelic.png differ
diff --git a/static/images/integrations/bot_avatars/notion.png b/static/images/integrations/bot_avatars/notion.png
index 2b6d22b401..de794cfdaf 100644
Binary files a/static/images/integrations/bot_avatars/notion.png and b/static/images/integrations/bot_avatars/notion.png differ
diff --git a/static/images/integrations/bot_avatars/opbeat.png b/static/images/integrations/bot_avatars/opbeat.png
index fc77c9b877..bd004dec91 100644
Binary files a/static/images/integrations/bot_avatars/opbeat.png and b/static/images/integrations/bot_avatars/opbeat.png differ
diff --git a/static/images/integrations/bot_avatars/opencollective.png b/static/images/integrations/bot_avatars/opencollective.png
index 839e43b315..e206503c6e 100644
Binary files a/static/images/integrations/bot_avatars/opencollective.png and b/static/images/integrations/bot_avatars/opencollective.png differ
diff --git a/static/images/integrations/bot_avatars/openshift.png b/static/images/integrations/bot_avatars/openshift.png
index 86e7e10ac8..7444246249 100644
Binary files a/static/images/integrations/bot_avatars/openshift.png and b/static/images/integrations/bot_avatars/openshift.png differ
diff --git a/static/images/integrations/bot_avatars/opsgenie.png b/static/images/integrations/bot_avatars/opsgenie.png
index 251d39ec14..f8bdb8bca6 100644
Binary files a/static/images/integrations/bot_avatars/opsgenie.png and b/static/images/integrations/bot_avatars/opsgenie.png differ
diff --git a/static/images/integrations/bot_avatars/pagerduty.png b/static/images/integrations/bot_avatars/pagerduty.png
index 87feb1ad57..6c52dd46e6 100644
Binary files a/static/images/integrations/bot_avatars/pagerduty.png and b/static/images/integrations/bot_avatars/pagerduty.png differ
diff --git a/static/images/integrations/bot_avatars/papertrail.png b/static/images/integrations/bot_avatars/papertrail.png
index 4a71bf9033..312fb263bb 100644
Binary files a/static/images/integrations/bot_avatars/papertrail.png and b/static/images/integrations/bot_avatars/papertrail.png differ
diff --git a/static/images/integrations/bot_avatars/patreon.png b/static/images/integrations/bot_avatars/patreon.png
index 7d60e973a8..a3317c0cc8 100644
Binary files a/static/images/integrations/bot_avatars/patreon.png and b/static/images/integrations/bot_avatars/patreon.png differ
diff --git a/static/images/integrations/bot_avatars/perforce.png b/static/images/integrations/bot_avatars/perforce.png
index 87ae678897..13e4896818 100644
Binary files a/static/images/integrations/bot_avatars/perforce.png and b/static/images/integrations/bot_avatars/perforce.png differ
diff --git a/static/images/integrations/bot_avatars/phabricator.png b/static/images/integrations/bot_avatars/phabricator.png
index d56d195da2..38202fa951 100644
Binary files a/static/images/integrations/bot_avatars/phabricator.png and b/static/images/integrations/bot_avatars/phabricator.png differ
diff --git a/static/images/integrations/bot_avatars/pingdom.png b/static/images/integrations/bot_avatars/pingdom.png
index 6d0aa723df..2e5a0b0ab5 100644
Binary files a/static/images/integrations/bot_avatars/pingdom.png and b/static/images/integrations/bot_avatars/pingdom.png differ
diff --git a/static/images/integrations/bot_avatars/pivotal.png b/static/images/integrations/bot_avatars/pivotal.png
index fda955b9a0..01a2c4f4f7 100644
Binary files a/static/images/integrations/bot_avatars/pivotal.png and b/static/images/integrations/bot_avatars/pivotal.png differ
diff --git a/static/images/integrations/bot_avatars/prometheus.png b/static/images/integrations/bot_avatars/prometheus.png
index 9371d64ff3..5f3c6b6219 100644
Binary files a/static/images/integrations/bot_avatars/prometheus.png and b/static/images/integrations/bot_avatars/prometheus.png differ
diff --git a/static/images/integrations/bot_avatars/puppet.png b/static/images/integrations/bot_avatars/puppet.png
index e7a24720eb..1b1de2d0ed 100644
Binary files a/static/images/integrations/bot_avatars/puppet.png and b/static/images/integrations/bot_avatars/puppet.png differ
diff --git a/static/images/integrations/bot_avatars/radarr.png b/static/images/integrations/bot_avatars/radarr.png
index f5970fd814..69f208187e 100644
Binary files a/static/images/integrations/bot_avatars/radarr.png and b/static/images/integrations/bot_avatars/radarr.png differ
diff --git a/static/images/integrations/bot_avatars/raygun.png b/static/images/integrations/bot_avatars/raygun.png
index 46feb1b1b2..b569881af5 100644
Binary files a/static/images/integrations/bot_avatars/raygun.png and b/static/images/integrations/bot_avatars/raygun.png differ
diff --git a/static/images/integrations/bot_avatars/redmine.png b/static/images/integrations/bot_avatars/redmine.png
index 7063b73d16..7d21991b52 100644
Binary files a/static/images/integrations/bot_avatars/redmine.png and b/static/images/integrations/bot_avatars/redmine.png differ
diff --git a/static/images/integrations/bot_avatars/reviewboard.png b/static/images/integrations/bot_avatars/reviewboard.png
index 82f2e9e739..76654f42cd 100644
Binary files a/static/images/integrations/bot_avatars/reviewboard.png and b/static/images/integrations/bot_avatars/reviewboard.png differ
diff --git a/static/images/integrations/bot_avatars/rhodecode.png b/static/images/integrations/bot_avatars/rhodecode.png
index dd5b4b2cf0..63ca9318be 100644
Binary files a/static/images/integrations/bot_avatars/rhodecode.png and b/static/images/integrations/bot_avatars/rhodecode.png differ
diff --git a/static/images/integrations/bot_avatars/rss.png b/static/images/integrations/bot_avatars/rss.png
index 48aa83a528..8897b62f1e 100644
Binary files a/static/images/integrations/bot_avatars/rss.png and b/static/images/integrations/bot_avatars/rss.png differ
diff --git a/static/images/integrations/bot_avatars/rundeck.png b/static/images/integrations/bot_avatars/rundeck.png
index b9996e045f..07ddaf9020 100644
Binary files a/static/images/integrations/bot_avatars/rundeck.png and b/static/images/integrations/bot_avatars/rundeck.png differ
diff --git a/static/images/integrations/bot_avatars/semaphore.png b/static/images/integrations/bot_avatars/semaphore.png
index fda66196fc..a4ced805ce 100644
Binary files a/static/images/integrations/bot_avatars/semaphore.png and b/static/images/integrations/bot_avatars/semaphore.png differ
diff --git a/static/images/integrations/bot_avatars/sentry.png b/static/images/integrations/bot_avatars/sentry.png
index a85422f404..5f06764404 100644
Binary files a/static/images/integrations/bot_avatars/sentry.png and b/static/images/integrations/bot_avatars/sentry.png differ
diff --git a/static/images/integrations/bot_avatars/slack.png b/static/images/integrations/bot_avatars/slack.png
index 6c40242994..6c3fda28db 100644
Binary files a/static/images/integrations/bot_avatars/slack.png and b/static/images/integrations/bot_avatars/slack.png differ
diff --git a/static/images/integrations/bot_avatars/solano.png b/static/images/integrations/bot_avatars/solano.png
index 15c905106e..fb2fe45740 100644
Binary files a/static/images/integrations/bot_avatars/solano.png and b/static/images/integrations/bot_avatars/solano.png differ
diff --git a/static/images/integrations/bot_avatars/sonarqube.png b/static/images/integrations/bot_avatars/sonarqube.png
index ac18fa0d18..73f054d057 100644
Binary files a/static/images/integrations/bot_avatars/sonarqube.png and b/static/images/integrations/bot_avatars/sonarqube.png differ
diff --git a/static/images/integrations/bot_avatars/sonarr.png b/static/images/integrations/bot_avatars/sonarr.png
index 56bfd8a27e..25f1309d01 100644
Binary files a/static/images/integrations/bot_avatars/sonarr.png and b/static/images/integrations/bot_avatars/sonarr.png differ
diff --git a/static/images/integrations/bot_avatars/splunk.png b/static/images/integrations/bot_avatars/splunk.png
index ce0c34d0ac..9c8e5fc6c8 100644
Binary files a/static/images/integrations/bot_avatars/splunk.png and b/static/images/integrations/bot_avatars/splunk.png differ
diff --git a/static/images/integrations/bot_avatars/statuspage.png b/static/images/integrations/bot_avatars/statuspage.png
index a6669df96b..5b5c61dfaf 100644
Binary files a/static/images/integrations/bot_avatars/statuspage.png and b/static/images/integrations/bot_avatars/statuspage.png differ
diff --git a/static/images/integrations/bot_avatars/stripe.png b/static/images/integrations/bot_avatars/stripe.png
index 9c9b81a6f9..a26fd46f6d 100644
Binary files a/static/images/integrations/bot_avatars/stripe.png and b/static/images/integrations/bot_avatars/stripe.png differ
diff --git a/static/images/integrations/bot_avatars/svn.png b/static/images/integrations/bot_avatars/svn.png
index 2f95b4d208..bd7cae2112 100644
Binary files a/static/images/integrations/bot_avatars/svn.png and b/static/images/integrations/bot_avatars/svn.png differ
diff --git a/static/images/integrations/bot_avatars/taiga.png b/static/images/integrations/bot_avatars/taiga.png
index 7d98683b39..9959bb5609 100644
Binary files a/static/images/integrations/bot_avatars/taiga.png and b/static/images/integrations/bot_avatars/taiga.png differ
diff --git a/static/images/integrations/bot_avatars/teamcity.png b/static/images/integrations/bot_avatars/teamcity.png
index 19e6fdc610..8d28ca85ab 100644
Binary files a/static/images/integrations/bot_avatars/teamcity.png and b/static/images/integrations/bot_avatars/teamcity.png differ
diff --git a/static/images/integrations/bot_avatars/thinkst.png b/static/images/integrations/bot_avatars/thinkst.png
index 36161c57f2..bddfafe54d 100644
Binary files a/static/images/integrations/bot_avatars/thinkst.png and b/static/images/integrations/bot_avatars/thinkst.png differ
diff --git a/static/images/integrations/bot_avatars/trac.png b/static/images/integrations/bot_avatars/trac.png
index 18aabc13ac..a41849cb95 100644
Binary files a/static/images/integrations/bot_avatars/trac.png and b/static/images/integrations/bot_avatars/trac.png differ
diff --git a/static/images/integrations/bot_avatars/transifex.png b/static/images/integrations/bot_avatars/transifex.png
index cdcd0f99e0..8ce5f6fbd5 100644
Binary files a/static/images/integrations/bot_avatars/transifex.png and b/static/images/integrations/bot_avatars/transifex.png differ
diff --git a/static/images/integrations/bot_avatars/travis.png b/static/images/integrations/bot_avatars/travis.png
index 1345acddaa..c5511239ec 100644
Binary files a/static/images/integrations/bot_avatars/travis.png and b/static/images/integrations/bot_avatars/travis.png differ
diff --git a/static/images/integrations/bot_avatars/trello.png b/static/images/integrations/bot_avatars/trello.png
index a915b8b8ef..3090398a54 100644
Binary files a/static/images/integrations/bot_avatars/trello.png and b/static/images/integrations/bot_avatars/trello.png differ
diff --git a/static/images/integrations/bot_avatars/twitte_r.png b/static/images/integrations/bot_avatars/twitte_r.png
index cb4dceaba1..c7c372eab8 100644
Binary files a/static/images/integrations/bot_avatars/twitte_r.png and b/static/images/integrations/bot_avatars/twitte_r.png differ
diff --git a/static/images/integrations/bot_avatars/updown.png b/static/images/integrations/bot_avatars/updown.png
index e0a09a8aca..d89748765f 100644
Binary files a/static/images/integrations/bot_avatars/updown.png and b/static/images/integrations/bot_avatars/updown.png differ
diff --git a/static/images/integrations/bot_avatars/uptimerobot.png b/static/images/integrations/bot_avatars/uptimerobot.png
index 9e8030e38b..523b785bef 100644
Binary files a/static/images/integrations/bot_avatars/uptimerobot.png and b/static/images/integrations/bot_avatars/uptimerobot.png differ
diff --git a/static/images/integrations/bot_avatars/wekan.png b/static/images/integrations/bot_avatars/wekan.png
index f3e1f7af52..878c542193 100644
Binary files a/static/images/integrations/bot_avatars/wekan.png and b/static/images/integrations/bot_avatars/wekan.png differ
diff --git a/static/images/integrations/bot_avatars/wordpress.png b/static/images/integrations/bot_avatars/wordpress.png
index 4ca69646b9..d80f4897ba 100644
Binary files a/static/images/integrations/bot_avatars/wordpress.png and b/static/images/integrations/bot_avatars/wordpress.png differ
diff --git a/static/images/integrations/bot_avatars/yo.png b/static/images/integrations/bot_avatars/yo.png
deleted file mode 100644
index 704e4c5330..0000000000
Binary files a/static/images/integrations/bot_avatars/yo.png and /dev/null differ
diff --git a/static/images/integrations/bot_avatars/youtub_e.png b/static/images/integrations/bot_avatars/youtub_e.png
index d84eb028e9..83affbf0ca 100644
Binary files a/static/images/integrations/bot_avatars/youtub_e.png and b/static/images/integrations/bot_avatars/youtub_e.png differ
diff --git a/static/images/integrations/bot_avatars/zabbix.png b/static/images/integrations/bot_avatars/zabbix.png
index cfa484c5f9..c3cdf7df5e 100644
Binary files a/static/images/integrations/bot_avatars/zabbix.png and b/static/images/integrations/bot_avatars/zabbix.png differ
diff --git a/static/images/integrations/bot_avatars/zapier.png b/static/images/integrations/bot_avatars/zapier.png
index c54ff998a1..2a67e74cb8 100644
Binary files a/static/images/integrations/bot_avatars/zapier.png and b/static/images/integrations/bot_avatars/zapier.png differ
diff --git a/static/images/integrations/bot_avatars/zendesk.png b/static/images/integrations/bot_avatars/zendesk.png
index eb9c406f31..e1646030b4 100644
Binary files a/static/images/integrations/bot_avatars/zendesk.png and b/static/images/integrations/bot_avatars/zendesk.png differ
diff --git a/static/images/integrations/bot_avatars/zoom.png b/static/images/integrations/bot_avatars/zoom.png
index 8022fc91a5..468b8f252d 100644
Binary files a/static/images/integrations/bot_avatars/zoom.png and b/static/images/integrations/bot_avatars/zoom.png differ
diff --git a/tools/setup/generate_integration_bots_avatars.py b/tools/setup/generate_integration_bots_avatars.py
index 9f1600e6c1..805269bb06 100755
--- a/tools/setup/generate_integration_bots_avatars.py
+++ b/tools/setup/generate_integration_bots_avatars.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
import argparse
-import io
import os
import sys
@@ -16,43 +15,21 @@ import django
django.setup()
-import cairosvg
-from PIL import Image
+import pyvips
from zerver.lib.integrations import INTEGRATIONS
from zerver.lib.storage import static_path
-from zerver.lib.thumbnail import DEFAULT_AVATAR_SIZE, resize_avatar
-
-
-def create_square_image(png: bytes) -> bytes:
- img = Image.open(io.BytesIO(png))
- if img.height == img.width:
- return png
-
- size = max(img.height, img.width)
- new_img = Image.new("RGBA", (size, size), color=(0, 0, 0, 0))
- padding = int(abs(img.height - img.width) / 2)
- position = (0, padding) if img.height < img.width else (padding, 0)
- new_img.paste(img, position)
- out = io.BytesIO()
- new_img.save(out, format="png")
- return out.getvalue()
+from zerver.lib.thumbnail import DEFAULT_AVATAR_SIZE
def create_integration_bot_avatar(logo_path: str, bot_avatar_path: str) -> None:
- if logo_path.endswith(".svg"):
- avatar = cairosvg.svg2png(
- url=logo_path, output_width=DEFAULT_AVATAR_SIZE, output_height=DEFAULT_AVATAR_SIZE
- )
- else:
- with open(logo_path, "rb") as f:
- image = f.read()
- square_image = create_square_image(image)
- avatar = resize_avatar(square_image)
-
os.makedirs(os.path.dirname(bot_avatar_path), exist_ok=True)
- with open(bot_avatar_path, "wb") as f:
- f.write(avatar)
+ avatar = pyvips.Image.thumbnail(logo_path, DEFAULT_AVATAR_SIZE, height=DEFAULT_AVATAR_SIZE)
+ if avatar.height != avatar.width:
+ avatar = avatar.gravity(
+ pyvips.CompassDirection.CENTRE, DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_SIZE
+ )
+ avatar.write_to_file(bot_avatar_path)
def generate_integration_bots_avatars(check_missing: bool = False) -> None:
| 0 |
fc41d6085ba72341023fb8d7ddd5b7f0413292f4
|
zulip/zulip
|
tornado: Split server restart events from web client reload events.
|
commit fc41d6085ba72341023fb8d7ddd5b7f0413292f4
Author: Alex Vandiver <[email protected]>
Date: Sat Feb 10 03:19:08 2024 +0000
tornado: Split server restart events from web client reload events.
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index c01622b33b..6825abc7d8 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 9.0
+**Feature level 240**
+
+* [`GET /events`](/api/get-events): The `restart` event no longer contains an
+ optional `immediate` flag.
+* [`GET /events`](/api/get-events): A new `web_reload_client` event has been
+ added; it is used to signal to website-based clients that they should reload
+ their code. This was previously implied by the `restart` event.
+
Feature levels 238-239 are reserved for future use in 8.x maintenance
releases.
diff --git a/version.py b/version.py
index ebcc908499..8384e52b96 100644
--- a/version.py
+++ b/version.py
@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# Changes should be accompanied by documentation explaining what the
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 237
+API_FEATURE_LEVEL = 240
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 05c328bcfd..a1639c46f1 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -165,7 +165,12 @@ export function dispatch_normal_event(event) {
activity_ui.update_presence_info(event.user_id, event.presence, event.server_timestamp);
break;
- case "restart": {
+ case "restart":
+ realm.zulip_version = event.zulip_version;
+ realm.zulip_merge_base = event.zulip_merge_base;
+ break;
+
+ case "web_reload_client": {
const reload_options = {
save_pointer: true,
save_narrow: true,
diff --git a/web/tests/dispatch.test.js b/web/tests/dispatch.test.js
index 99c6fabb3e..3de9ecad23 100644
--- a/web/tests/dispatch.test.js
+++ b/web/tests/dispatch.test.js
@@ -747,8 +747,15 @@ run_test("realm_user", ({override}) => {
assert.equal(removed_person.full_name, "translated: Unknown user");
});
-run_test("restart", ({override}) => {
+run_test("restart", ({_override}) => {
const event = event_fixtures.restart;
+ dispatch(event);
+ assert_same(realm.zulip_version, event.zulip_version);
+ assert_same(realm.zulip_merge_base, event.zulip_merge_base);
+});
+
+run_test("web_reload_client", ({override}) => {
+ const event = event_fixtures.web_reload_client;
const stub = make_stub();
override(reload, "initiate", stub.f);
dispatch(event);
diff --git a/web/tests/lib/events.js b/web/tests/lib/events.js
index 269b6e9187..747aca1bd5 100644
--- a/web/tests/lib/events.js
+++ b/web/tests/lib/events.js
@@ -604,11 +604,10 @@ exports.fixtures = {
restart: {
type: "restart",
- zulip_version: "4.0-dev+git",
- zulip_merge_base: "",
- zulip_feature_level: 55,
- server_generation: 2,
- immediate: true,
+ zulip_version: "9.0-dev-753-gced3e85da9",
+ zulip_merge_base: "9.0-dev-743-g54053c1d28",
+ zulip_feature_level: 237,
+ server_generation: 1707511515,
},
scheduled_messages__add: {
@@ -1084,4 +1083,9 @@ exports.fixtures = {
last_updated: fake_now,
visibility_policy: 1,
},
+
+ web_reload_client: {
+ type: "web_reload_client",
+ immediate: true,
+ },
};
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py
index b54a008353..a64c4e2074 100644
--- a/zerver/lib/event_schema.py
+++ b/zerver/lib/event_schema.py
@@ -1253,11 +1253,18 @@ restart_event = event_dict_type(
("zulip_merge_base", str),
("zulip_feature_level", int),
("server_generation", int),
- ("immediate", bool),
]
)
check_restart_event = make_checker(restart_event)
+web_reload_client_event = event_dict_type(
+ required_keys=[
+ ("type", Equals("web_reload_client")),
+ ("immediate", bool),
+ ]
+)
+check_web_reload_client_event = make_checker(web_reload_client_event)
+
scheduled_message_fields = DictType(
required_keys=[
("scheduled_message_id", int),
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index 487a895a62..c984dceb81 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -91,9 +91,10 @@ from zerver.tornado.django_api import get_user_events, request_event_queue
from zproject.backends import email_auth_enabled, password_auth_enabled
-class RestartEventError(Exception):
- """
- Special error for handling restart events in apply_events.
+class WebReloadClientError(Exception):
+ """Special error for handling web_reload_client events in
+ apply_events.
+
"""
@@ -711,8 +712,8 @@ def apply_events(
user_list_incomplete: bool,
) -> None:
for event in events:
- if event["type"] == "restart":
- raise RestartEventError
+ if event["type"] == "web_reload_client":
+ raise WebReloadClientError
if fetch_event_types is not None and event["type"] not in fetch_event_types:
# TODO: continuing here is not, most precisely, correct.
# In theory, an event of one type, e.g. `realm_user`,
@@ -1652,7 +1653,7 @@ def do_events_register(
linkifier_url_template=linkifier_url_template,
user_list_incomplete=user_list_incomplete,
)
- except RestartEventError:
+ except WebReloadClientError:
# This represents a rare race condition, where Tornado
# restarted (and sent `restart` events) while we were waiting
# for fetch_initial_state_data to return. To avoid the client
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 1a3f2576d0..89f4a8c11f 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -4000,10 +4000,15 @@ paths:
for the user is restarted; in particular, this will always happen
when the Zulip server is upgraded.
- Clients can use this event to know when they should get a new
- event queue after a server upgrade. Clients doing so must implement
- a random delay strategy to spread such restarts over 10 minutes or
- more to avoid creating a synchronized thundering herd effect.
+ Clients should use this event to update their tracking of the
+ server's capabilities, and to decide if they wish to get a new
+ event queue after a server upgrade. Clients doing so must
+ implement a random delay strategy to spread such restarts over 5
+ minutes or more to avoid creating a synchronized thundering herd
+ effect.
+
+ **Changes**: Removed the `immediate` flag, which was only used by
+ web clients in development, in Zulip 9.0 (feature level 240).
properties:
id:
$ref: "#/components/schemas/EventIdSchema"
@@ -4034,20 +4039,15 @@ paths:
The [Zulip feature level](/api/changelog) of the server
after the restart.
- Clients can safely avoid refetching their state and
- creating a new event queue when the API feature level has not
- changed, or when they know the specific feature level change
- is not relevant to the client (E.g. it just adds a new endpoint
- that the client doesn't use).
+ Clients should use this to update their tracking of the
+ server's capabilities, and may choose to refetch their state
+ and create a new event queue when the API feature level has
+ changed in a way that the client finds significant. Clients
+ choosing to do so must implement a random delay strategy to
+ spread such restarts over 5 or more minutes to avoid creating
+ a synchronized thundering herd effect.
**Changes**: New in Zulip 4.0 (feature level 59).
- immediate:
- type: boolean
- description: |
- Whether the client should fetch a new event queue immediately,
- rather than using a backoff strategy to avoid thundering herds.
- A Zulip development server uses this parameter to reload
- clients immediately.
server_generation:
type: integer
description: |
@@ -4056,13 +4056,47 @@ paths:
example:
{
"id": 0,
- "immediate": true,
"server_generation": 1619334181,
"type": "restart",
"zulip_feature_level": 57,
"zulip_version": "5.0-dev-1650-gc3fd37755f",
"zulip_merge_base": "5.0-dev-1646-gea6b21cd8c",
}
+ - type: object
+ description: |
+ An event which signals the official Zulip web/desktop app to update,
+ by reloading the page and fetching a new queue; this will generally
+ follow a `restart` event. Clients which do not obtain their code
+ from the server (e.g. mobile and terminal clients, which store their
+ code locally) should ignore this event.
+
+ Clients choosing to reload the application must implement a random
+ delay strategy to spread such restarts over 5 or more minutes to
+ avoid creating a synchronized thundering herd effect.
+
+ **Changes**: New in Zulip 9.0 (feature level 240).
+ properties:
+ id:
+ $ref: "#/components/schemas/EventIdSchema"
+ type:
+ allOf:
+ - $ref: "#/components/schemas/EventTypeSchema"
+ - enum:
+ - web_reload_client
+ immediate:
+ type: boolean
+ description: |
+ Whether the client should fetch a new event queue immediately,
+ rather than using a backoff strategy to avoid thundering herds.
+ A Zulip development server uses this parameter to reload
+ clients immediately.
+ additionalProperties: false
+ example:
+ {
+ "id": 0,
+ "type": "web_reload_client",
+ "immediate": true,
+ }
- type: object
additionalProperties: false
description: |
diff --git a/zerver/tests/test_event_system.py b/zerver/tests/test_event_system.py
index ea58f0a8ea..924a524662 100644
--- a/zerver/tests/test_event_system.py
+++ b/zerver/tests/test_event_system.py
@@ -10,13 +10,12 @@ from django.test import override_settings
from django.utils.timezone import now as timezone_now
from typing_extensions import override
-from version import API_FEATURE_LEVEL, ZULIP_MERGE_BASE, ZULIP_VERSION
from zerver.actions.custom_profile_fields import try_update_realm_custom_profile_field
from zerver.actions.message_send import check_send_message
from zerver.actions.presence import do_update_user_presence
from zerver.actions.user_settings import do_change_user_setting
from zerver.actions.users import do_change_user_role
-from zerver.lib.event_schema import check_restart_event
+from zerver.lib.event_schema import check_web_reload_client_event
from zerver.lib.events import fetch_initial_state_data
from zerver.lib.exceptions import AccessDeniedError
from zerver.lib.request import RequestVariableMissingError
@@ -38,7 +37,7 @@ from zerver.tornado.event_queue import (
clear_client_event_queues_for_testing,
get_client_info_for_message_event,
process_message_event,
- send_restart_events,
+ send_web_reload_client_events,
)
from zerver.tornado.exceptions import BadEventQueueIdError
from zerver.tornado.views import get_events, get_events_backend
@@ -1100,7 +1099,7 @@ class ClientDescriptorsTest(ZulipTestCase):
)
-class RestartEventsTest(ZulipTestCase):
+class WebReloadClientsTest(ZulipTestCase):
def tornado_call(
self,
view_func: Callable[[HttpRequest, UserProfile], HttpResponse],
@@ -1122,7 +1121,7 @@ class RestartEventsTest(ZulipTestCase):
)
return view_func(request, user_profile)
- def test_restart(self) -> None:
+ def test_web_reload_clients(self) -> None:
hamlet = self.example_user("hamlet")
realm = hamlet.realm
@@ -1141,28 +1140,24 @@ class RestartEventsTest(ZulipTestCase):
)
client = allocate_client_descriptor(queue_data)
- send_restart_events(immediate=True)
+ send_web_reload_client_events()
self.assert_length(client.event_queue.queue, 1)
- restart_event = client.event_queue.queue[0]
+ reload_event = client.event_queue.queue[0]
- check_restart_event("restart_event", restart_event)
+ check_web_reload_client_event("web_reload_client_event", reload_event)
self.assertEqual(
- restart_event,
+ reload_event,
dict(
- type="restart",
- zulip_version=ZULIP_VERSION,
- zulip_merge_base=ZULIP_MERGE_BASE,
- zulip_feature_level=API_FEATURE_LEVEL,
- server_generation=settings.SERVER_GENERATION,
- immediate=True,
+ type="web_reload_client",
+ immediate=False,
id=0,
),
)
- def test_restart_event_recursive_call_logic(self) -> None:
+ def test_web_reload_client_event_recursive_call_logic(self) -> None:
# This is a test for a subtle corner case; see the comments
- # around RestartEventError for details.
+ # around WebReloadClientError for details.
hamlet = self.example_user("hamlet")
realm = hamlet.realm
@@ -1182,16 +1177,16 @@ class RestartEventsTest(ZulipTestCase):
)
client = allocate_client_descriptor(queue_data)
- # Add a restart event to it.
- send_restart_events(immediate=True)
+ # Add a reload event to it.
+ send_web_reload_client_events()
- # Make a second queue after the restart events were sent.
+ # Make a second queue after the reload events were sent.
second_client = allocate_client_descriptor(queue_data)
- # Fetch the restart event just sent above, without removing it
+ # Fetch the reload event just sent above, without removing it
# from the queue. We will use this as a mock return value in
# get_user_events.
- restart_event = orjson.loads(
+ reload_event = orjson.loads(
self.tornado_call(
get_events_backend,
hamlet,
@@ -1209,7 +1204,7 @@ class RestartEventsTest(ZulipTestCase):
# Now the tricky part: We call events_register_backend,
# arranging it so that the first `get_user_events` call
- # returns our restart event (triggering the recursive
+ # returns our reload event (triggering the recursive
# behavior), but the second (with a new queue) returns no
# events.
#
@@ -1219,7 +1214,7 @@ class RestartEventsTest(ZulipTestCase):
with mock.patch(
"zerver.lib.events.request_event_queue",
side_effect=[client.event_queue.id, second_client.event_queue.id],
- ), mock.patch("zerver.lib.events.get_user_events", side_effect=[restart_event, []]):
+ ), mock.patch("zerver.lib.events.get_user_events", side_effect=[reload_event, []]):
self.tornado_call(
events_register_backend,
hamlet,
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 30462754e3..533fec669e 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -201,7 +201,7 @@ from zerver.lib.event_schema import (
check_user_topic,
)
from zerver.lib.events import (
- RestartEventError,
+ WebReloadClientError,
apply_events,
fetch_initial_state_data,
post_process_state,
@@ -251,7 +251,7 @@ from zerver.tornado.event_queue import (
allocate_client_descriptor,
clear_client_event_queues_for_testing,
create_heartbeat_event,
- send_restart_events,
+ send_web_reload_client_events,
)
from zerver.views.realm_playgrounds import access_playground_by_id
@@ -3456,9 +3456,9 @@ class NormalActionsTest(BaseAction):
events = self.verify_action(lambda: do_set_zoom_token(self.user_profile, None))
check_has_zoom_token("events[0]", events[0], value=False)
- def test_restart_event(self) -> None:
- with self.assertRaises(RestartEventError):
- self.verify_action(lambda: send_restart_events(immediate=True))
+ def test_web_reload_client_event(self) -> None:
+ with self.assertRaises(WebReloadClientError):
+ self.verify_action(lambda: send_web_reload_client_events())
def test_display_setting_event_not_sent(self) -> None:
events = self.verify_action(
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 20aea8f6c4..e7c9d38fdf 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -629,7 +629,7 @@ def load_event_queues(port: int) -> None:
)
-def send_restart_events(immediate: bool = False) -> None:
+def send_restart_events() -> None:
event: Dict[str, Any] = dict(
type="restart",
zulip_version=ZULIP_VERSION,
@@ -637,8 +637,16 @@ def send_restart_events(immediate: bool = False) -> None:
zulip_feature_level=API_FEATURE_LEVEL,
server_generation=settings.SERVER_GENERATION,
)
- if immediate:
- event["immediate"] = True
+ for client in clients.values():
+ if client.accepts_event(event):
+ client.add_event(event)
+
+
+def send_web_reload_client_events(immediate: bool = False) -> None:
+ event: Dict[str, Any] = dict(
+ type="web_reload_client",
+ immediate=immediate,
+ )
for client in clients.values():
if client.accepts_event(event):
client.add_event(event)
@@ -656,7 +664,8 @@ async def setup_event_queue(server: tornado.httpserver.HTTPServer, port: int) ->
pc = tornado.ioloop.PeriodicCallback(lambda: gc_event_queues(port), EVENT_QUEUE_GC_FREQ_MSECS)
pc.start()
- send_restart_events(immediate=settings.DEVELOPMENT)
+ send_restart_events()
+ send_web_reload_client_events(immediate=settings.DEVELOPMENT)
def fetch_events(
| 0 |
d37f309a3cd1dd59b77fc92a6059d32fb0736c79
|
zulip/zulip
|
test_user_groups: Extract user memberships helper.
We extract the checks needed for user membership changes into a method,
verifying that the members of the user group are matching the expected
values exactly.
|
commit d37f309a3cd1dd59b77fc92a6059d32fb0736c79
Author: Zixuan James Li <[email protected]>
Date: Tue Jun 27 18:33:20 2023 -0400
test_user_groups: Extract user memberships helper.
We extract the checks needed for user membership changes into a method,
verifying that the members of the user group are matching the expected
values exactly.
diff --git a/zerver/tests/test_user_groups.py b/zerver/tests/test_user_groups.py
index f2cfcdef8f..5711100cc9 100644
--- a/zerver/tests/test_user_groups.py
+++ b/zerver/tests/test_user_groups.py
@@ -1,5 +1,5 @@
from datetime import timedelta
-from typing import Optional
+from typing import Iterable, Optional
from unittest import mock
import orjson
@@ -13,11 +13,11 @@ from zerver.lib.streams import ensure_stream
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_usermessage
from zerver.lib.user_groups import (
- get_direct_memberships_of_users,
get_direct_user_groups,
get_recursive_group_members,
get_recursive_membership_groups,
get_recursive_subgroups,
+ get_user_group_member_ids,
is_user_in_group,
user_groups_in_realm_serialized,
)
@@ -32,6 +32,10 @@ from zerver.models import (
class UserGroupTestCase(ZulipTestCase):
+ def assert_user_membership(self, user_group: UserGroup, members: Iterable[UserProfile]) -> None:
+ user_ids = get_user_group_member_ids(user_group, direct_member_only=True)
+ self.assertSetEqual(set(user_ids), {member.id for member in members})
+
def create_user_group_for_test(
self, group_name: str, realm: Realm = get_realm("zulip")
) -> UserGroup:
@@ -360,7 +364,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
self.client_post("/json/user_groups/create", info=params)
user_group = UserGroup.objects.get(name="support")
# Test add members
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 1)
+ self.assert_user_membership(user_group, [hamlet])
othello = self.example_user("othello")
# A bot
@@ -373,9 +377,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
initial_last_message = self.get_last_message()
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_success(result)
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 2)
- members = get_direct_memberships_of_users(user_group, [hamlet, othello])
- self.assert_length(members, 2)
+ self.assert_user_membership(user_group, [hamlet, othello])
# A notification message is sent for adding to user group.
self.assertNotEqual(self.get_last_message(), initial_last_message)
@@ -387,9 +389,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
# Test adding a member already there.
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_error(result, f"User {othello.id} is already a member of this group")
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 2)
- members = get_direct_memberships_of_users(user_group, [hamlet, othello])
- self.assert_length(members, 2)
+ self.assert_user_membership(user_group, [hamlet, othello])
# Test user adding itself, bot and deactivated user to user group.
desdemona = self.example_user("desdemona")
@@ -399,18 +399,11 @@ class UserGroupAPITestCase(UserGroupTestCase):
initial_last_message = self.get_last_message()
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_success(result)
-
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 5)
- members = get_direct_memberships_of_users(
- user_group, [hamlet, othello, desdemona, iago, webhook_bot]
- )
- self.assert_length(members, 5)
+ self.assert_user_membership(user_group, [hamlet, othello, desdemona, iago, webhook_bot])
# No notification message is sent for adding to user group.
self.assertEqual(self.get_last_message(), initial_last_message)
- aaron = self.example_user("aaron")
-
# For normal testing we again log in with hamlet
self.logout()
self.login_user(hamlet)
@@ -419,12 +412,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
initial_last_message = self.get_last_message()
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_success(result)
-
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 4)
- members = get_direct_memberships_of_users(
- user_group, [hamlet, othello, aaron, desdemona, webhook_bot, iago]
- )
- self.assert_length(members, 4)
+ self.assert_user_membership(user_group, [hamlet, desdemona, iago, webhook_bot])
# A notification message is sent for removing from user group.
self.assertNotEqual(self.get_last_message(), initial_last_message)
@@ -437,6 +425,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
params = {"delete": orjson.dumps([othello.id]).decode()}
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_error(result, f"There is no member '{othello.id}' in this user group")
+ self.assert_user_membership(user_group, [hamlet, desdemona, iago, webhook_bot])
# Test user remove itself,bot and deactivated user from user group.
desdemona = self.example_user("desdemona")
@@ -446,10 +435,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
initial_last_message = self.get_last_message()
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
self.assert_json_success(result)
-
- self.assertEqual(UserGroupMembership.objects.filter(user_group=user_group).count(), 1)
- members = get_direct_memberships_of_users(user_group, [hamlet, othello, desdemona])
- self.assert_length(members, 1)
+ self.assert_user_membership(user_group, [hamlet])
# No notification message is sent for removing from user group.
self.assertEqual(self.get_last_message(), initial_last_message)
@@ -458,6 +444,7 @@ class UserGroupAPITestCase(UserGroupTestCase):
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info={})
msg = 'Nothing to do. Specify at least one of "add" or "delete".'
self.assert_json_error(result, msg)
+ self.assert_user_membership(user_group, [hamlet])
def test_mentions(self) -> None:
cordelia = self.example_user("cordelia")
@@ -713,14 +700,11 @@ class UserGroupAPITestCase(UserGroupTestCase):
) -> None:
self.login(acting_user)
params = {"add": orjson.dumps([aaron.id]).decode()}
+ self.assert_user_membership(user_group, [othello])
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
if error_msg is None:
self.assert_json_success(result)
- self.assertEqual(
- UserGroupMembership.objects.filter(user_group=user_group).count(), 2
- )
- members = get_direct_memberships_of_users(user_group, [aaron, othello])
- self.assert_length(members, 2)
+ self.assert_user_membership(user_group, [aaron, othello])
else:
self.assert_json_error(result, error_msg)
@@ -729,14 +713,11 @@ class UserGroupAPITestCase(UserGroupTestCase):
) -> None:
self.login(acting_user)
params = {"delete": orjson.dumps([aaron.id]).decode()}
+ self.assert_user_membership(user_group, [aaron, othello])
result = self.client_post(f"/json/user_groups/{user_group.id}/members", info=params)
if error_msg is None:
self.assert_json_success(result)
- self.assertEqual(
- UserGroupMembership.objects.filter(user_group=user_group).count(), 1
- )
- members = get_direct_memberships_of_users(user_group, [aaron, othello])
- self.assert_length(members, 1)
+ self.assert_user_membership(user_group, [othello])
else:
self.assert_json_error(result, error_msg)
| 0 |
a4cf77e5dce00c9333901ee95d10aebae952b55c
|
zulip/zulip
|
openapi_responses: Fix get_message_history.
|
commit a4cf77e5dce00c9333901ee95d10aebae952b55c
Author: orientor <[email protected]>
Date: Wed May 27 20:29:01 2020 +0530
openapi_responses: Fix get_message_history.
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index fe3ce497c5..864998e967 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -812,6 +812,41 @@ paths:
type: array
items:
type: object
+ properties:
+ topic:
+ type: string
+ description: |
+ the topic for the message.
+ content:
+ type: string
+ description: |
+ the body of the message.
+ rendered_content:
+ type: string
+ description: |
+ the already rendered, HTML version of `content`.
+ prev_content:
+ type: string
+ description: |
+ the body of the message before being edited.
+ prev_rendered_content:
+ type: string
+ description: |
+ the already rendered, HTML version of
+ `prev_content`.
+ user_id:
+ type: integer
+ description: |
+ the ID of the user that made the edit.
+ content_html_diff:
+ type: string
+ description: |
+ an HTML diff between this version of the message
+ and the previous one.
+ timestamp:
+ type: integer
+ description: |
+ the UNIX timestamp for this editing.
description: |
A chronologically sorted array of `snapshot`
objects, each one with the values of the
| 0 |
420b84e79c5168a0bcd5208a8c6eba251c926413
|
zulip/zulip
|
migration: Prepare for backporting of migration 0700.
This follows our usual backporting scheme, occurring e.g.
in #31468. We make the migration depend on the last migration in 10.x,
and create a merge migration to avoid having multiple leafs.
|
commit 420b84e79c5168a0bcd5208a8c6eba251c926413
Author: Mateusz Mandera <[email protected]>
Date: Wed May 7 19:57:43 2025 +0200
migration: Prepare for backporting of migration 0700.
This follows our usual backporting scheme, occurring e.g.
in #31468. We make the migration depend on the last migration in 10.x,
and create a merge migration to avoid having multiple leafs.
diff --git a/zerver/migrations/0700_fix_user_role_system_groups.py b/zerver/migrations/0700_fix_user_role_system_groups.py
index a662c1ac66..62931f9b1d 100644
--- a/zerver/migrations/0700_fix_user_role_system_groups.py
+++ b/zerver/migrations/0700_fix_user_role_system_groups.py
@@ -257,7 +257,8 @@ class Migration(migrations.Migration):
atomic = False
dependencies = [
- ("zerver", "0699_scheduledmessage_reminder_target_message_id"),
+ # Because this will be backported to 10.x, we only depend on the last migration in 10.x
+ ("zerver", "0697_empty_topic_name_for_dms_from_third_party_imports"),
]
operations = [
diff --git a/zerver/migrations/0701_merge.py b/zerver/migrations/0701_merge.py
new file mode 100644
index 0000000000..9b826b0e7b
--- /dev/null
+++ b/zerver/migrations/0701_merge.py
@@ -0,0 +1,10 @@
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zerver", "0699_scheduledmessage_reminder_target_message_id"),
+ ("zerver", "0700_fix_user_role_system_groups"),
+ ]
+
+ operations = []
| 0 |
6139e8948a250f6ceb415abd3c12a353e1754692
|
zulip/zulip
|
travis: User REQ framework for extracting JSON payload.
|
commit 6139e8948a250f6ceb415abd3c12a353e1754692
Author: Tim Abbott <[email protected]>
Date: Sat May 7 11:22:01 2016 -0700
travis: User REQ framework for extracting JSON payload.
diff --git a/zerver/views/webhooks/travis.py b/zerver/views/webhooks/travis.py
index 9dbe3d5697..5f624b3ff2 100644
--- a/zerver/views/webhooks/travis.py
+++ b/zerver/views/webhooks/travis.py
@@ -4,15 +4,19 @@ from zerver.models import get_client
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
-
+from zerver.lib.validator import check_dict, check_string
import ujson
@api_key_only_webhook_view
@has_request_variables
-def api_travis_webhook(request, user_profile, stream=REQ(default='travis'), topic=REQ(default=None)):
- message = ujson.loads(request.POST['payload'])
-
+def api_travis_webhook(request, user_profile, stream=REQ(default='travis'),
+ topic=REQ(default=None),
+ message=REQ('payload', validator=check_dict([
+ ['author_name', check_string],
+ ['status_message', check_string],
+ ['compare_url', check_string],
+ ]))):
author = message['author_name']
message_type = message['status_message']
changes = message['compare_url']
| 0 |
470ff676e60e56cd4310544b9fe4e229225b4fd1
|
zulip/zulip
|
zephyr_mirror: Fix insecure temporary file for log.
This is probably a lot more annoying to use, in that e.g. there are
separate log files for the two directions of the mirror, but we
haven't used these logs for much, so whatever.
(imported from commit d3bc407d90099214d242526c01cd3d3cd9d9d9bd)
|
commit 470ff676e60e56cd4310544b9fe4e229225b4fd1
Author: Tim Abbott <[email protected]>
Date: Thu Dec 20 14:10:12 2012 -0500
zephyr_mirror: Fix insecure temporary file for log.
This is probably a lot more annoying to use, in that e.g. there are
separate log files for the two directions of the mirror, but we
haven't used these logs for much, so whatever.
(imported from commit d3bc407d90099214d242526c01cd3d3cd9d9d9bd)
diff --git a/api/bots/zephyr_mirror_backend.py b/api/bots/zephyr_mirror_backend.py
index 804c625bc0..b7d65ac05f 100755
--- a/api/bots/zephyr_mirror_backend.py
+++ b/api/bots/zephyr_mirror_backend.py
@@ -35,6 +35,7 @@ import signal
import logging
import hashlib
import unicodedata
+import tempfile
DEFAULT_SITE = "https://humbughq.com"
@@ -711,7 +712,12 @@ def configure_logger(direction_name):
else:
log_file = "/home/humbug/mirror-log"
else:
- log_file = "/tmp/humbug-log." + options.user
+ f = tempfile.NamedTemporaryFile(prefix="humbug-log.%s." % (options.user,),
+ delete=False)
+ log_file = f.name
+ # Close the file descriptor, since the logging system will
+ # reopen it anyway.
+ f.close()
logger = logging.getLogger(__name__)
log_format = "%(asctime)s " + direction_name + ": %(message)s"
formatter = logging.Formatter(log_format)
| 0 |
157cbca1e043d938b74aaffad66e63a95315e3ca
|
zulip/zulip
|
corporate: Fix links for move in c4eede68d684.
|
commit 157cbca1e043d938b74aaffad66e63a95315e3ca
Author: Alex Vandiver <[email protected]>
Date: Tue Jan 25 19:00:44 2022 -0800
corporate: Fix links for move in c4eede68d684.
diff --git a/templates/corporate/jobs.html b/templates/corporate/jobs.html
index bab73b10ea..f648d85f98 100644
--- a/templates/corporate/jobs.html
+++ b/templates/corporate/jobs.html
@@ -414,7 +414,7 @@
<li>You have excellent attention to
detail. Instructions you write are clear,
well-tested, and in accordance with
- our <a href="https://zulip.readthedocs.io/en/latest/documentation/user.html#writing-documentation">style
+ our <a href="https://zulip.readthedocs.io/en/latest/documentation/helpcenter.html#writing-documentation">style
guidelines</a>; there are no typos or broken
links.
</li>
@@ -439,7 +439,7 @@
</li>
<li>
Extend
- our <a href="https://zulip.readthedocs.io/en/latest/documentation/user.html#writing-documentation">style
+ our <a href="https://zulip.readthedocs.io/en/latest/documentation/helpcenter.html#writing-documentation">style
guide</a> to help developers document the
features they build effectively.
</li>
| 0 |
633ae45f1d95ccbb4e2c77b6e65dfea39491feef
|
zulip/zulip
|
navbar: Make login button focusable.
This commit allows login button in navbar draw focus to
them.
Fixes part of zulip#28037.
|
commit 633ae45f1d95ccbb4e2c77b6e65dfea39491feef
Author: Pratik Chanda <[email protected]>
Date: Fri Jun 21 02:54:13 2024 +0530
navbar: Make login button focusable.
This commit allows login button in navbar draw focus to
them.
Fixes part of zulip#28037.
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index e75cdf6994..6029a52fe9 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -462,7 +462,8 @@ body.has-overlay-scrollbar {
--color-navbar-spectator-medium-attention-brand-button-background
);
- &:hover {
+ &:hover,
+ &:focus {
color: var(
--color-navbar-spectator-medium-attention-brand-button-text
);
diff --git a/web/templates/navbar.hbs b/web/templates/navbar.hbs
index cd54ab43b8..43c489c6d8 100644
--- a/web/templates/navbar.hbs
+++ b/web/templates/navbar.hbs
@@ -37,7 +37,7 @@
</div>
<div class="column-right">
<div class="spectator_login_buttons only-visible-for-spectators">
- <a class="login_button">
+ <a class="login_button" tabindex="0">
{{t 'Log in' }}
</a>
</div>
@@ -62,7 +62,7 @@
</a>
</div>
<div class="spectator_narrow_login_button only-visible-for-spectators" data-tippy-content="{{t 'Log in' }}" data-tippy-placement="bottom">
- <a class="header-button login_button">
+ <a class="header-button login_button" tabindex="0">
<i class="zulip-icon zulip-icon-log-in"></i>
</a>
</div>
| 0 |
1a148f5d9a2d2ede1f795d5a3892fa1ca3a29aff
|
zulip/zulip
|
scroll_bar: Fix incorrectly converted breakpoint.
Commit e941ee4a15a0d5e2514882cce24770a02e02829d (#16680) incorrectly
converted this from 775px to xl-max = 1199px instead of md-max =
767px, causing misplacement of the FRB for browser widths between
these values.
Signed-off-by: Anders Kaseorg <[email protected]>
|
commit 1a148f5d9a2d2ede1f795d5a3892fa1ca3a29aff
Author: Anders Kaseorg <[email protected]>
Date: Wed Jan 27 09:28:58 2021 -0800
scroll_bar: Fix incorrectly converted breakpoint.
Commit e941ee4a15a0d5e2514882cce24770a02e02829d (#16680) incorrectly
converted this from 775px to xl-max = 1199px instead of md-max =
767px, causing misplacement of the FRB for browser widths between
these values.
Signed-off-by: Anders Kaseorg <[email protected]>
diff --git a/static/js/scroll_bar.js b/static/js/scroll_bar.js
index 20a0748548..701f492752 100644
--- a/static/js/scroll_bar.js
+++ b/static/js/scroll_bar.js
@@ -64,7 +64,7 @@ exports.initialize = function () {
(7 + sbWidth) +
"px !important; } } " +
"@media (max-width: " +
- media_breakpoints.xl_max +
+ media_breakpoints.md_max +
") { .fixed-app .column-middle { margin-left: " +
(7 + sbWidth) +
"px !important; } } " +
| 0 |
16328732d405f83bddf5792f3b09173146764b7a
|
zulip/zulip
|
refactor: Remove "subject" from stream_topic.py.
|
commit 16328732d405f83bddf5792f3b09173146764b7a
Author: Steve Howell <[email protected]>
Date: Sun Dec 23 17:45:18 2018 +0000
refactor: Remove "subject" from stream_topic.py.
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index a6849cf4fe..3339013db4 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -37,11 +37,6 @@ FILES_WITH_LEGACY_SUBJECT = {
# These are tied more to our API than our DB model.
'zerver/lib/api_test_helpers.py',
- # TRY TO FIX THESE! If you can't fix them, try to
- # add comments here and/or in the file itself about
- # why sweeping subject is tricky.
- 'zerver/lib/stream_topic.py',
-
# This has lots of query data embedded, so it's hard
# to fix everything until we migrate the DB to "topic".
'zerver/tests/test_narrow.py',
diff --git a/zerver/lib/stream_topic.py b/zerver/lib/stream_topic.py
index bce20ed51a..c3540599de 100644
--- a/zerver/lib/stream_topic.py
+++ b/zerver/lib/stream_topic.py
@@ -13,8 +13,8 @@ class StreamTopicTarget:
'''
This class is designed to help us move to a
StreamTopic table or something similar. It isolates
- places where we are are still using `subject` or
- `topic_name` as a key into tables.
+ places where we are are still using `topic_name` as
+ a key into tables.
'''
def __init__(self, stream_id: int, topic_name: str) -> None:
self.stream_id = stream_id
| 0 |
36532e91806036ac1a8142ad78db7db8eccc4f64
|
zulip/zulip
|
models: Rename tiers to pass stripe 22 character limit.
|
commit 36532e91806036ac1a8142ad78db7db8eccc4f64
Author: Aman Agrawal <[email protected]>
Date: Sat Dec 2 03:19:59 2023 +0000
models: Rename tiers to pass stripe 22 character limit.
diff --git a/corporate/models.py b/corporate/models.py
index cf8a08dbd2..33858a096d 100644
--- a/corporate/models.py
+++ b/corporate/models.py
@@ -289,11 +289,14 @@ class CustomerPlan(models.Model):
@staticmethod
def name_from_tier(tier: int) -> str:
+ # NOTE: Check `statement_descriptor` values after updating this.
+ # Stripe has a 22 character limit on the statement descriptor length.
+ # https://stripe.com/docs/payments/account/statement-descriptors
return {
CustomerPlan.TIER_CLOUD_STANDARD: "Zulip Cloud Standard",
- CustomerPlan.TIER_CLOUD_PLUS: "Zulip Plus",
+ CustomerPlan.TIER_CLOUD_PLUS: "Zulip Cloud Plus",
CustomerPlan.TIER_CLOUD_ENTERPRISE: "Zulip Enterprise",
- CustomerPlan.TIER_SELF_HOSTED_BUSINESS: "Zulip Self-Hosted Business",
+ CustomerPlan.TIER_SELF_HOSTED_BUSINESS: "Zulip Business",
}[tier]
@property
diff --git a/corporate/tests/test_remote_billing.py b/corporate/tests/test_remote_billing.py
index d24f425d43..a8bdaa49a2 100644
--- a/corporate/tests/test_remote_billing.py
+++ b/corporate/tests/test_remote_billing.py
@@ -348,7 +348,7 @@ class LegacyServerLoginTest(BouncerTestCase):
# Access on the upgrade page is granted, assert a basic string proving that.
result = self.client_get(result["Location"], subdomain="selfhosting")
self.assert_in_success_response(
- [f"Upgrade {self.server.hostname} to Zulip Self-Hosted Business"], result
+ [f"Upgrade {self.server.hostname} to Zulip Business"], result
)
def test_server_login_success_with_next_page(self) -> None:
@@ -427,7 +427,7 @@ class LegacyServerLoginTest(BouncerTestCase):
# Sanity check: access on the upgrade page is granted.
result = self.client_get(result["Location"], subdomain="selfhosting")
self.assert_in_success_response(
- [f"Upgrade {self.server.hostname} to Zulip Self-Hosted Business"], result
+ [f"Upgrade {self.server.hostname} to Zulip Business"], result
)
# Now we can simulate an expired identity dict in the session.
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 9dde56482d..6da41291ae 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -5300,7 +5300,7 @@ class TestSupportBillingHelpers(StripeTestCase):
new_plan_tier=CustomerPlan.TIER_CLOUD_PLUS,
)
success_message = billing_session.process_support_view_request(support_request)
- self.assertEqual(success_message, "zulip upgraded to Zulip Plus")
+ self.assertEqual(success_message, "zulip upgraded to Zulip Cloud Plus")
customer.refresh_from_db()
new_plan = get_current_plan_by_customer(customer)
assert new_plan is not None
| 0 |
66c2ca9a2a268fdf3e3de1defdfab51d3b70063e
|
zulip/zulip
|
unread: Add make_bucketer().
This class encapsulates reverse lookups to make deletions
O(1). It is also a bit smarter about not creating
throwaway objects, by avoiding setdefault.
|
commit 66c2ca9a2a268fdf3e3de1defdfab51d3b70063e
Author: Steve Howell <[email protected]>
Date: Wed Aug 2 22:32:21 2017 -0400
unread: Add make_bucketer().
This class encapsulates reverse lookups to make deletions
O(1). It is also a bit smarter about not creating
throwaway objects, by avoiding setdefault.
diff --git a/static/js/unread.js b/static/js/unread.js
index c254f74430..b1d342703a 100644
--- a/static/js/unread.js
+++ b/static/js/unread.js
@@ -41,37 +41,84 @@ function make_id_set() {
return self;
}
+function make_bucketer(options) {
+ var self = {};
+
+ var key_to_bucket = new Dict({fold_case: options.fold_case});
+ var reverse_lookup = new Dict();
+
+ self.clear = function () {
+ key_to_bucket.clear();
+ reverse_lookup.clear();
+ };
+
+ self.add = function (opts) {
+ var bucket_key = opts.bucket_key;
+ var item_id = opts.item_id;
+ var add_callback = opts.add_callback;
+
+ var bucket = key_to_bucket.get(bucket_key);
+ if (!bucket) {
+ bucket = options.make_bucket();
+ key_to_bucket.set(bucket_key, bucket);
+ }
+ if (add_callback) {
+ add_callback(bucket, item_id);
+ } else {
+ bucket.add(item_id);
+ }
+ reverse_lookup.set(item_id, bucket);
+ };
+
+ self.del = function (item_id) {
+ var bucket = reverse_lookup.get(item_id);
+ if (bucket) {
+ bucket.del(item_id);
+ reverse_lookup.del(item_id);
+ }
+ };
+
+ self.get_bucket = function (bucket_key) {
+ return key_to_bucket.get(bucket_key);
+ };
+
+ self.each = function (callback) {
+ key_to_bucket.each(callback);
+ };
+
+ return self;
+}
+
exports.unread_pm_counter = (function () {
var self = {};
- var unread_privates = new Dict(); // indexed by user_ids_string like 5,7,9
- var reverse_lookup = new Dict(); // msg_id -> enclosing dict
+
+ var bucketer = make_bucketer({
+ fold_case: false,
+ make_bucket: make_id_set,
+ });
self.clear = function () {
- unread_privates = new Dict();
- reverse_lookup = new Dict();
+ bucketer.clear();
};
self.add = function (message) {
var user_ids_string = people.pm_reply_user_string(message);
if (user_ids_string) {
- var id_set = unread_privates.setdefault(user_ids_string, make_id_set());
- id_set.add(message.id);
- reverse_lookup.set(message.id, id_set);
+ bucketer.add({
+ bucket_key: user_ids_string,
+ item_id: message.id,
+ });
}
};
self.del = function (message_id) {
- var id_set = reverse_lookup.get(message_id);
- if (id_set) {
- id_set.del(message_id);
- reverse_lookup.del(message_id);
- }
+ bucketer.del(message_id);
};
self.get_counts = function () {
var pm_dict = new Dict(); // Hash by user_ids_string -> count
var total_count = 0;
- unread_privates.each(function (id_set, user_ids_string) {
+ bucketer.each(function (id_set, user_ids_string) {
var count = id_set.count();
pm_dict.set(user_ids_string, count);
total_count += count;
@@ -87,10 +134,12 @@ exports.unread_pm_counter = (function () {
return 0;
}
- if (!unread_privates.has(user_ids_string)) {
+ var bucket = bucketer.get_bucket(user_ids_string);
+
+ if (!bucket) {
return 0;
}
- return unread_privates.get(user_ids_string).count();
+ return bucket.count();
};
return self;
| 0 |
260085b59a21b78d7548833ca667a10a6d982214
|
zulip/zulip
|
user_events: Fix confusing variant name for event object.
|
commit 260085b59a21b78d7548833ca667a10a6d982214
Author: Tim Abbott <[email protected]>
Date: Fri Mar 14 10:19:46 2025 -0700
user_events: Fix confusing variant name for event object.
diff --git a/web/src/user_events.ts b/web/src/user_events.ts
index b6ee389e43..91e7cac1dd 100644
--- a/web/src/user_events.ts
+++ b/web/src/user_events.ts
@@ -57,32 +57,32 @@ export const user_update_schema = z.object({user_id: z.number()}).and(
type UserUpdate = z.output<typeof user_update_schema>;
-export const update_person = function update(person: UserUpdate): void {
- const user = people.maybe_get_user_by_id(person.user_id);
+export const update_person = function update(event: UserUpdate): void {
+ const user = people.maybe_get_user_by_id(event.user_id);
if (!user) {
- blueslip.error("Got update_person event for unexpected user", {user_id: person.user_id});
+ blueslip.error("Got update_person event for unexpected user", {user_id: event.user_id});
return;
}
- if ("new_email" in person) {
- const user_id = person.user_id;
- const new_email = person.new_email;
+ if ("new_email" in event) {
+ const user_id = event.user_id;
+ const new_email = event.new_email;
people.update_email(user_id, new_email);
narrow_state.update_email(user_id, new_email);
compose_state.update_email(user_id, new_email);
- if (people.is_my_user_id(person.user_id)) {
+ if (people.is_my_user_id(event.user_id)) {
current_user.email = new_email;
}
}
- if ("delivery_email" in person) {
- const delivery_email = person.delivery_email;
+ if ("delivery_email" in event) {
+ const delivery_email = event.delivery_email;
user.delivery_email = delivery_email;
- user_profile.update_profile_modal_ui(user, person);
- if (people.is_my_user_id(person.user_id)) {
+ user_profile.update_profile_modal_ui(user, event);
+ if (people.is_my_user_id(event.user_id)) {
assert(delivery_email !== null);
settings_account.update_email(delivery_email);
current_user.delivery_email = delivery_email;
@@ -90,38 +90,37 @@ export const update_person = function update(person: UserUpdate): void {
}
}
- if ("full_name" in person) {
- people.set_full_name(user, person.full_name);
+ if ("full_name" in event) {
+ people.set_full_name(user, event.full_name);
- settings_users.update_user_data(person.user_id, person);
+ settings_users.update_user_data(event.user_id, event);
activity_ui.redraw();
- message_live_update.update_user_full_name(person.user_id, person.full_name);
+ message_live_update.update_user_full_name(event.user_id, event.full_name);
pm_list.update_private_messages();
- user_profile.update_profile_modal_ui(user, person);
- if (people.is_my_user_id(person.user_id)) {
- current_user.full_name = person.full_name;
- settings_account.update_full_name(person.full_name);
+ user_profile.update_profile_modal_ui(user, event);
+ if (people.is_my_user_id(event.user_id)) {
+ current_user.full_name = event.full_name;
+ settings_account.update_full_name(event.full_name);
}
}
- if ("role" in person) {
- user.role = person.role;
- user.is_owner = person.role === settings_config.user_role_values.owner.code;
- user.is_admin =
- person.role === settings_config.user_role_values.admin.code || user.is_owner;
- user.is_guest = person.role === settings_config.user_role_values.guest.code;
- user.is_moderator = person.role === settings_config.user_role_values.moderator.code;
- settings_users.update_user_data(person.user_id, person);
- user_profile.update_profile_modal_ui(user, person);
-
- if (people.is_my_user_id(person.user_id) && current_user.is_owner !== user.is_owner) {
+ if ("role" in event) {
+ user.role = event.role;
+ user.is_owner = event.role === settings_config.user_role_values.owner.code;
+ user.is_admin = event.role === settings_config.user_role_values.admin.code || user.is_owner;
+ user.is_guest = event.role === settings_config.user_role_values.guest.code;
+ user.is_moderator = event.role === settings_config.user_role_values.moderator.code;
+ settings_users.update_user_data(event.user_id, event);
+ user_profile.update_profile_modal_ui(user, event);
+
+ if (people.is_my_user_id(event.user_id) && current_user.is_owner !== user.is_owner) {
current_user.is_owner = user.is_owner;
settings_org.maybe_disable_widgets();
settings_org.enable_or_disable_group_permission_settings();
settings.update_lock_icon_in_sidebar();
}
- if (people.is_my_user_id(person.user_id) && current_user.is_admin !== user.is_admin) {
+ if (people.is_my_user_id(event.user_id) && current_user.is_admin !== user.is_admin) {
current_user.is_admin = user.is_admin;
settings_linkifiers.maybe_disable_widgets();
settings_org.maybe_disable_widgets();
@@ -134,38 +133,38 @@ export const update_person = function update(person: UserUpdate): void {
}
if (
- people.is_my_user_id(person.user_id) &&
+ people.is_my_user_id(event.user_id) &&
current_user.is_moderator !== user.is_moderator
) {
current_user.is_moderator = user.is_moderator;
}
}
- if ("avatar_url" in person) {
- const url = person.avatar_url;
+ if ("avatar_url" in event) {
+ const url = event.avatar_url;
user.avatar_url = url;
- user.avatar_version = person.avatar_version;
+ user.avatar_version = event.avatar_version;
- if (people.is_my_user_id(person.user_id)) {
- current_user.avatar_source = person.avatar_source;
+ if (people.is_my_user_id(event.user_id)) {
+ current_user.avatar_source = event.avatar_source;
current_user.avatar_url = url;
- current_user.avatar_url_medium = person.avatar_url_medium;
- $("#user-avatar-upload-widget .image-block").attr("src", person.avatar_url_medium);
- $("#personal-menu .header-button-avatar").attr("src", `${person.avatar_url_medium}`);
+ current_user.avatar_url_medium = event.avatar_url_medium;
+ $("#user-avatar-upload-widget .image-block").attr("src", event.avatar_url_medium);
+ $("#personal-menu .header-button-avatar").attr("src", `${event.avatar_url_medium}`);
}
- message_live_update.update_avatar(user.user_id, person.avatar_url);
- user_profile.update_profile_modal_ui(user, person);
+ message_live_update.update_avatar(user.user_id, event.avatar_url);
+ user_profile.update_profile_modal_ui(user, event);
}
- if ("custom_profile_field" in person) {
- people.set_custom_profile_field_data(person.user_id, person.custom_profile_field);
+ if ("custom_profile_field" in event) {
+ people.set_custom_profile_field_data(event.user_id, event.custom_profile_field);
user_profile.update_user_custom_profile_fields(user);
- if (person.user_id === people.my_current_user_id()) {
+ if (event.user_id === people.my_current_user_id()) {
navbar_alerts.maybe_toggle_empty_required_profile_fields_banner();
- const field_id = person.custom_profile_field.id;
- const field_value = people.get_custom_profile_data(person.user_id, field_id)?.value;
+ const field_id = event.custom_profile_field.id;
+ const field_value = people.get_custom_profile_data(event.user_id, field_id)?.value;
const is_field_required = realm.custom_profile_fields?.find(
(f) => field_id === f.id,
)?.required;
@@ -190,34 +189,34 @@ export const update_person = function update(person: UserUpdate): void {
}
}
- if ("timezone" in person) {
- user.timezone = person.timezone;
+ if ("timezone" in event) {
+ user.timezone = event.timezone;
}
- if ("bot_owner_id" in person) {
+ if ("bot_owner_id" in event) {
assert(user.is_bot);
- user.bot_owner_id = person.bot_owner_id;
- user_profile.update_profile_modal_ui(user, person);
+ user.bot_owner_id = event.bot_owner_id;
+ user_profile.update_profile_modal_ui(user, event);
}
- if ("is_active" in person) {
+ if ("is_active" in event) {
const is_bot_user = user.is_bot;
- if (person.is_active) {
+ if (event.is_active) {
people.add_active_user(user);
- settings_users.update_view_on_reactivate(person.user_id, is_bot_user);
+ settings_users.update_view_on_reactivate(event.user_id, is_bot_user);
} else {
people.deactivate(user);
- stream_events.remove_deactivated_user_from_all_streams(person.user_id);
- user_group_edit.remove_deactivated_user_from_all_groups(person.user_id);
- settings_users.update_view_on_deactivate(person.user_id, is_bot_user);
+ stream_events.remove_deactivated_user_from_all_streams(event.user_id);
+ user_group_edit.remove_deactivated_user_from_all_groups(event.user_id);
+ settings_users.update_view_on_deactivate(event.user_id, is_bot_user);
}
- buddy_list.insert_or_move([person.user_id]);
+ buddy_list.insert_or_move([event.user_id]);
settings_account.maybe_update_deactivate_account_button();
if (is_bot_user) {
- settings_users.update_bot_data(person.user_id);
- } else if (!person.is_active) {
+ settings_users.update_bot_data(event.user_id);
+ } else if (!event.is_active) {
// A human user deactivated, update 'Export permissions' table.
- settings_exports.remove_export_consent_data_and_redraw(person.user_id);
+ settings_exports.remove_export_consent_data_and_redraw(event.user_id);
}
}
};
| 0 |
734d1848c0fbfa61e3fda746b73b34056ef3f159
|
zulip/zulip
|
server_events_dispatch: Update bots list only if needed.
After b21f533af, we now update the organization bots
list on receiving realm_user events since non-admins
can also see bots not owned by them in the list.
But the functions to update bot list should be called
only for bot users and not for others, otherwise it
results in an error.
This can be reproduced by first opening the organization
bots list and then just updating the name of the user.
Calling `redraw_bots_list` on receiving "realm_user/add"
event for non bot users will not raise any error but
still we avoid redrawing the whole list when not required.
This commit fixes the code to call functions to update
bot list only when the event is received for a bot.
|
commit 734d1848c0fbfa61e3fda746b73b34056ef3f159
Author: Sahil Batra <[email protected]>
Date: Thu Mar 2 16:51:13 2023 +0530
server_events_dispatch: Update bots list only if needed.
After b21f533af, we now update the organization bots
list on receiving realm_user events since non-admins
can also see bots not owned by them in the list.
But the functions to update bot list should be called
only for bot users and not for others, otherwise it
results in an error.
This can be reproduced by first opening the organization
bots list and then just updating the name of the user.
Calling `redraw_bots_list` on receiving "realm_user/add"
event for non bot users will not raise any error but
still we avoid redrawing the whole list when not required.
This commit fixes the code to call functions to update
bot list only when the event is received for a bot.
diff --git a/web/src/people.js b/web/src/people.js
index 3bbf0409e2..a9ae6edd01 100644
--- a/web/src/people.js
+++ b/web/src/people.js
@@ -678,6 +678,11 @@ export function sender_is_guest(message) {
return false;
}
+export function user_is_bot(user_id) {
+ const user = get_by_user_id(user_id);
+ return user.is_bot;
+}
+
function gravatar_url_for_email(email) {
const hash = md5(email.toLowerCase());
const avatar_url = "https://secure.gravatar.com/avatar/" + hash + "?d=identicon";
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 670fbfa1a1..0ff5b4dd19 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -435,7 +435,9 @@ export function dispatch_normal_event(event) {
case "add":
people.add_active_user(event.person);
settings_account.maybe_update_deactivate_account_button();
- settings_users.redraw_bots_list();
+ if (event.person.is_bot) {
+ settings_users.redraw_bots_list();
+ }
break;
case "remove":
people.deactivate(event.person);
@@ -443,12 +445,16 @@ export function dispatch_normal_event(event) {
settings_users.update_view_on_deactivate(event.person.user_id);
buddy_list.maybe_remove_key({key: event.person.user_id});
settings_account.maybe_update_deactivate_account_button();
- settings_users.update_bot_data(event.person.user_id);
+ if (people.user_is_bot(event.person.user_id)) {
+ settings_users.update_bot_data(event.person.user_id);
+ }
break;
case "update":
user_events.update_person(event.person);
settings_account.maybe_update_deactivate_account_button();
- settings_users.update_bot_data(event.person.user_id);
+ if (people.user_is_bot(event.person.user_id)) {
+ settings_users.update_bot_data(event.person.user_id);
+ }
break;
default:
blueslip.error("Unexpected event type realm_user/" + event.op);
diff --git a/web/tests/dispatch.test.js b/web/tests/dispatch.test.js
index a75e35dcdd..1139fe5edf 100644
--- a/web/tests/dispatch.test.js
+++ b/web/tests/dispatch.test.js
@@ -661,14 +661,11 @@ run_test("realm_domains", ({override}) => {
run_test("realm_user", ({override}) => {
override(settings_account, "maybe_update_deactivate_account_button", noop);
let event = event_fixtures.realm_user__add;
- const add_admin_stub = make_stub();
- override(settings_users, "redraw_bots_list", add_admin_stub.f);
dispatch({...event});
const added_person = people.get_by_user_id(event.person.user_id);
// sanity check a few individual fields
assert.equal(added_person.full_name, "Test User");
assert.equal(added_person.timezone, "America/New_York");
- assert.equal(add_admin_stub.num_calls, 1);
// ...but really the whole struct gets copied without any
// manipulation
@@ -676,30 +673,43 @@ run_test("realm_user", ({override}) => {
assert.ok(people.is_active_user_for_popover(event.person.user_id));
- const remove_admin_stub = make_stub();
event = event_fixtures.realm_user__remove;
override(stream_events, "remove_deactivated_user_from_all_streams", noop);
override(settings_users, "update_view_on_deactivate", noop);
- override(settings_users, "update_bot_data", remove_admin_stub.f);
dispatch(event);
// We don't actually remove the person, we just deactivate them.
const removed_person = people.get_by_user_id(event.person.user_id);
assert.equal(removed_person.full_name, "Test User");
assert.ok(!people.is_active_user_for_popover(event.person.user_id));
- assert.equal(remove_admin_stub.num_calls, 1);
event = event_fixtures.realm_user__update;
const stub = make_stub();
- const update_admin_stub = make_stub();
override(user_events, "update_person", stub.f);
- override(settings_users, "update_bot_data", update_admin_stub.f);
dispatch(event);
assert.equal(stub.num_calls, 1);
- assert.equal(update_admin_stub.num_calls, 1);
let args = stub.get_args("person");
assert_same(args.person, event.person);
- args = update_admin_stub.get_args("update_user_id", "update_bot_data");
+
+ // Test bot related functions are being called.
+ const add_bot_stub = make_stub();
+ event = event_fixtures.realm_user__add_bot;
+ override(settings_users, "redraw_bots_list", add_bot_stub.f);
+ dispatch({...event});
+ assert.equal(add_bot_stub.num_calls, 1);
+
+ const remove_bot_stub = make_stub();
+ event = event_fixtures.realm_user__remove;
+ override(settings_users, "update_bot_data", remove_bot_stub.f);
+ dispatch(event);
+ assert.equal(remove_bot_stub.num_calls, 1);
+
+ const update_bot_stub = make_stub();
+ event = event_fixtures.realm_user__update;
+ override(settings_users, "update_bot_data", update_bot_stub.f);
+ dispatch(event);
+ assert.equal(update_bot_stub.num_calls, 1);
+ args = update_bot_stub.get_args("update_user_id", "update_bot_data");
assert_same(args.update_user_id, event.person.user_id);
});
diff --git a/web/tests/example4.test.js b/web/tests/example4.test.js
index cee4d695a1..ba8bd0fb6a 100644
--- a/web/tests/example4.test.js
+++ b/web/tests/example4.test.js
@@ -68,6 +68,7 @@ const bob = {
email: "[email protected]",
user_id: 33,
full_name: "Bob Roberts",
+ is_bot: true,
};
run_test("add users with event", ({override}) => {
@@ -117,6 +118,7 @@ run_test("update user with event", ({override}) => {
email: "[email protected]",
user_id: bob.user_id,
full_name: "The Artist Formerly Known as Bob",
+ is_bot: true,
};
const event = {
diff --git a/web/tests/lib/events.js b/web/tests/lib/events.js
index f8a135e71c..52331c94b0 100644
--- a/web/tests/lib/events.js
+++ b/web/tests/lib/events.js
@@ -544,6 +544,27 @@ exports.fixtures = {
},
},
+ realm_user__add_bot: {
+ type: "realm_user",
+ op: "add",
+ person: {
+ ...test_user,
+ avatar_url: "/some/path/to/avatar",
+ avatar_version: 1,
+ is_admin: false,
+ is_active: true,
+ is_owner: false,
+ is_billing_admin: false,
+ role: 400,
+ is_bot: true,
+ is_guest: false,
+ profile_data: {},
+ timezone: "America/New_York",
+ date_joined: "2020-01-01",
+ delivery_email: "[email protected]",
+ },
+ },
+
realm_user__remove: {
type: "realm_user",
op: "remove",
| 0 |
862515b7a43c8f015edaf7ef7d34d8c8d90549f8
|
zulip/zulip
|
presence: Avoid failures with obsolete events.
We only recently added `user_id` to presence
events.
|
commit 862515b7a43c8f015edaf7ef7d34d8c8d90549f8
Author: Steve Howell <[email protected]>
Date: Tue Mar 3 12:05:09 2020 +0000
presence: Avoid failures with obsolete events.
We only recently added `user_id` to presence
events.
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 24b131fd1b..ef75c5c132 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -916,6 +916,12 @@ def process_message_event(event_template: Mapping[str, Any], users: Iterable[Map
client.add_event(user_event)
def process_presence_event(event: Mapping[str, Any], users: Iterable[int]) -> None:
+ if 'user_id' not in event:
+ # We only recently added `user_id` to presence data.
+ # Any old events in our queue can just be dropped,
+ # since presence events are pretty ephemeral in nature.
+ logging.warning('Dropping some obsolete presence events after upgrade.')
+
slim_event = dict(
type='presence',
user_id=event['user_id'],
| 0 |
09d0652bddd69c7e7ae0227dae2e769fd6d6a682
|
zulip/zulip
|
refactor: Use user_ids_string more internally.
We want to avoid passing opaque messages around to
low-level functions that only need certain fields.
This sets us up to handle mark-as-unread messages
that aren't necessarily full messages.
|
commit 09d0652bddd69c7e7ae0227dae2e769fd6d6a682
Author: Steve Howell <[email protected]>
Date: Wed Aug 4 17:16:50 2021 +0000
refactor: Use user_ids_string more internally.
We want to avoid passing opaque messages around to
low-level functions that only need certain fields.
This sets us up to handle mark-as-unread messages
that aren't necessarily full messages.
diff --git a/static/js/unread.js b/static/js/unread.js
index 817f030c51..bf390491eb 100644
--- a/static/js/unread.js
+++ b/static/js/unread.js
@@ -119,12 +119,11 @@ class UnreadPMCounter {
}
}
- add(message) {
- const user_ids_string = people.pm_reply_user_string(message);
+ add({message_id, user_ids_string}) {
if (user_ids_string) {
this.bucketer.add({
bucket_key: user_ids_string,
- item_id: message.id,
+ item_id: message_id,
});
}
}
@@ -426,8 +425,10 @@ export function update_unread_topics(msg, event) {
export function process_loaded_messages(messages) {
for (const message of messages) {
if (message.unread) {
+ const user_ids_string =
+ message.type === "private" ? people.pm_reply_user_string(message) : undefined;
+
process_unread_message({
- display_recipient: message.display_recipient,
id: message.id,
mentioned: message.mentioned,
mentioned_me_directly: message.mentioned_me_directly,
@@ -435,6 +436,7 @@ export function process_loaded_messages(messages) {
topic: message.topic,
type: message.type,
unread: true,
+ user_ids_string,
});
}
}
@@ -448,7 +450,10 @@ function process_unread_message(message) {
unread_messages.add(message.id);
if (message.type === "private") {
- unread_pm_counter.add(message);
+ unread_pm_counter.add({
+ message_id: message.id,
+ user_ids_string: message.user_ids_string,
+ });
}
if (message.type === "stream") {
| 0 |
de74d2fd7c736adf65755d589e91978d2141a130
|
zulip/zulip
|
settings: Use HTML table for "Alert Words" for better icon alignment.
"Alert Words" is one of Zulip's oldest settings UI elements, and as a
result is buggy. This commit converts it to use our standard
progressive-table-wrapper system used for settings tables, which has
the side effect of fixing a bug that mad ethe tables look pretty bad
if one adds a very long word.
Fixes #17172.
|
commit de74d2fd7c736adf65755d589e91978d2141a130
Author: Josh Gilley <[email protected]>
Date: Mon Feb 1 19:35:51 2021 -0500
settings: Use HTML table for "Alert Words" for better icon alignment.
"Alert Words" is one of Zulip's oldest settings UI elements, and as a
result is buggy. This commit converts it to use our standard
progressive-table-wrapper system used for settings tables, which has
the side effect of fixing a bug that mad ethe tables look pretty bad
if one adds a very long word.
Fixes #17172.
diff --git a/frontend_tests/node_tests/alert_words_ui.js b/frontend_tests/node_tests/alert_words_ui.js
index e623c0999a..fdc5d5cf05 100644
--- a/frontend_tests/node_tests/alert_words_ui.js
+++ b/frontend_tests/node_tests/alert_words_ui.js
@@ -136,11 +136,11 @@ run_test("remove_alert_word", (override) => {
const remove_func = word_list.get_on_handler("click", ".remove-alert-word");
const remove_alert_word = $(".remove-alert-word");
- const list_item = $("li.alert-word-item");
+ const list_item = $("tr.alert-word-item");
const val_item = $("span.value");
val_item.text(i18n.t("zot"));
- remove_alert_word.set_parents_result("li", list_item);
+ remove_alert_word.set_parents_result("tr", list_item);
list_item.set_find_results(".value", val_item);
const event = {
diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.js
index 1fb36a4baf..d542814e7c 100644
--- a/static/js/alert_words_ui.js
+++ b/static/js/alert_words_ui.js
@@ -62,7 +62,6 @@ function add_alert_word(alert_word) {
function remove_alert_word(alert_word) {
const words_to_be_removed = [alert_word];
-
channel.del({
url: "/json/users/me/alert_words",
data: {alert_words: JSON.stringify(words_to_be_removed)},
@@ -86,7 +85,7 @@ export function set_up_alert_words() {
});
$("#alert_words_list").on("click", ".remove-alert-word", (event) => {
- const word = $(event.currentTarget).parents("li").find(".value").text();
+ const word = $(event.currentTarget).parents("tr").find(".value").text().trim();
remove_alert_word(word);
});
@@ -95,7 +94,6 @@ export function set_up_alert_words() {
// Handle Enter (13) as "add".
if (key === 13) {
event.preventDefault();
-
const word = $(event.target).val();
add_alert_word(word);
}
diff --git a/static/styles/settings.css b/static/styles/settings.css
index 8ce946e846..32a28646f4 100644
--- a/static/styles/settings.css
+++ b/static/styles/settings.css
@@ -486,13 +486,6 @@ input[type="checkbox"] {
border-left: 0;
}
-.alert-word-information-box {
- position: relative;
- padding: 7px;
- margin: 2px;
- width: 50%;
-}
-
.green-bg {
background-color: hsl(120, 29%, 84%);
}
@@ -910,7 +903,6 @@ input[type="checkbox"] {
li {
list-style-type: none;
-
&.alert-word-item:first-child {
background: none;
margin-top: 8px;
@@ -918,7 +910,6 @@ input[type="checkbox"] {
}
.alert_word_listing .value {
- display: block;
word-wrap: break-word;
word-break: break-all;
white-space: normal;
diff --git a/static/templates/settings/alert_word_settings.hbs b/static/templates/settings/alert_word_settings.hbs
index bf80098907..e8464cf9d2 100644
--- a/static/templates/settings/alert_word_settings.hbs
+++ b/static/templates/settings/alert_word_settings.hbs
@@ -27,5 +27,14 @@
</div>
</div>
</form>
- <ul id="alert_words_list"></ul>
+ <div class="progressive-table-wrapper" data-simplebar>
+ <table class="table table-condensed table-striped wrapped-table">
+ <thead>
+ <th class="active">{{t "Word" }}</th>
+ <th>{{t "Delete" }}</th>
+ </thead>
+ <tbody id="alert_words_list" class="alert_words_list required-text thick"
+ data-empty="{{t 'There are no current alert words.' }}"></tbody>
+ </table>
+ </div>
</div>
diff --git a/static/templates/settings/alert_word_settings_item.hbs b/static/templates/settings/alert_word_settings_item.hbs
index 89513ba878..e0554705d7 100644
--- a/static/templates/settings/alert_word_settings_item.hbs
+++ b/static/templates/settings/alert_word_settings_item.hbs
@@ -1,13 +1,14 @@
{{! Alert word in the settings page that can be removed }}
-<li class="alert-word-item" data-word='{{word}}'>
- <div class="alert-word-information-box grey-box">
+
+<tr class="alert-word-item" data-word='{{word}}'>
+ <td>
<div class="alert_word_listing">
<span class="value">{{word}}</span>
</div>
- <div class="edit-alert-word-buttons">
- <button type="submit" class="button small btn-danger remove-alert-word" title="{{t 'Delete alert word' }}" data-word="{{word}}">
- <i class="fa fa-trash-o" aria-hidden="true"></i>
- </button>
- </div>
- </div>
-</li>
+ </td>
+ <td>
+ <button type="submit" class="button rounded small delete btn-danger remove-alert-word" title="{{t 'Delete alert word' }}" data-word="{{word}}">
+ <i class="fa fa-trash-o" aria-hidden="true"></i>
+ </button>
+ </td>
+</tr>
| 0 |
fc0f73c1db54f1870eba03a1df3814ab8af8fcf7
|
zulip/zulip
|
docs: Link to new PR review process doc from /contributing/reviewable-prs.md.
|
commit fc0f73c1db54f1870eba03a1df3814ab8af8fcf7
Author: Alya Abbott <[email protected]>
Date: Wed May 24 15:33:55 2023 -0700
docs: Link to new PR review process doc from /contributing/reviewable-prs.md.
diff --git a/docs/contributing/reviewable-prs.md b/docs/contributing/reviewable-prs.md
index 32236da223..b8702bd242 100644
--- a/docs/contributing/reviewable-prs.md
+++ b/docs/contributing/reviewable-prs.md
@@ -3,7 +3,9 @@
This page offers some tips for making your pull requests easy to review.
Following this advice will help the whole Zulip project move more quickly by
saving maintainers time when they review your code. It will also make a big
-difference for getting your work integrated without delay.
+difference for getting your work integrated without delay. For a detailed
+overview of Zulip's PR review process, see the [pull request review
+process](../contributing/review-process.md) guide.
## Posting a pull request
| 0 |
e40731574acd0326fbf8d9bcb90957b00bd0f7aa
|
zulip/zulip
|
integrations: Fix missing logo for trello.
Fixes regression from 6f8481c.
|
commit e40731574acd0326fbf8d9bcb90957b00bd0f7aa
Author: Rishi Gupta <[email protected]>
Date: Tue Feb 19 15:39:02 2019 -0800
integrations: Fix missing logo for trello.
Fixes regression from 6f8481c.
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index 5e3f250b2f..10c6abc73f 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -449,6 +449,7 @@ INTEGRATIONS = {
'trello-plugin',
'trello-plugin',
['project-management'],
+ logo='static/images/integrations/logos/trello.svg',
secondary_line_text='(legacy)',
display_name='Trello',
doc='zerver/integrations/trello-plugin.md',
| 0 |
07180432835973f65a50fa75a6797762c9ea2d9d
|
zulip/zulip
|
bot_settings: Remove "#bot_table_error" element.
We do not use "#bot_table_error" element to show any errors
anymore. It was previously used to show the error if bot
creation failed but since 6db88f0d394fc8 moved bot creation
to a modal, we now show error, if any, inside the modal
itself. This commit also removes the hide_errors function
since the error element itself is removed.
|
commit 07180432835973f65a50fa75a6797762c9ea2d9d
Author: Sahil Batra <[email protected]>
Date: Fri Jan 13 20:10:03 2023 +0530
bot_settings: Remove "#bot_table_error" element.
We do not use "#bot_table_error" element to show any errors
anymore. It was previously used to show the error if bot
creation failed but since 6db88f0d394fc8 moved bot creation
to a modal, we now show error, if any, inside the modal
itself. This commit also removes the hide_errors function
since the error element itself is removed.
diff --git a/static/js/settings_bots.js b/static/js/settings_bots.js
index 564440f1dd..ac4ceeb6c2 100644
--- a/static/js/settings_bots.js
+++ b/static/js/settings_bots.js
@@ -26,24 +26,18 @@ import * as user_profile from "./user_profile";
const OUTGOING_WEBHOOK_BOT_TYPE = "3";
const EMBEDDED_BOT_TYPE = "4";
-export function hide_errors() {
- $("#bot_table_error").hide();
-}
-
const focus_tab = {
active_bots_tab() {
$("#bots_lists_navbar .active").removeClass("active");
$("#bots_lists_navbar .active-bots-tab").addClass("active");
$("#active_bots_list").show();
$("#inactive_bots_list").hide();
- hide_errors();
},
inactive_bots_tab() {
$("#bots_lists_navbar .active").removeClass("active");
$("#bots_lists_navbar .inactive-bots-tab").addClass("active");
$("#active_bots_list").hide();
$("#inactive_bots_list").show();
- hide_errors();
},
};
@@ -190,7 +184,6 @@ function update_add_bot_button() {
export function update_bot_permissions_ui() {
update_bot_settings_tip();
- hide_errors();
update_add_bot_button();
$("#id_realm_bot_creation_policy").val(page_params.realm_bot_creation_policy);
}
@@ -243,7 +236,6 @@ export function add_a_new_bot() {
processData: false,
contentType: false,
success() {
- hide_errors();
create_avatar_widget.clear();
dialog_widget.close_modal();
},
diff --git a/static/templates/settings/bot_settings.hbs b/static/templates/settings/bot_settings.hbs
index 3b14566482..beafdb1c44 100644
--- a/static/templates/settings/bot_settings.hbs
+++ b/static/templates/settings/bot_settings.hbs
@@ -31,6 +31,5 @@
<ol class="bots_list required-text" id="inactive_bots_list" data-empty="{{t 'You have no inactive bots.' }}">
</ol>
- <div id="bot_table_error" class="alert alert-error hide"></div>
</div>
</div>
| 0 |
6f42b90d23916e18745656ba4b44ab956a12b366
|
zulip/zulip
|
casper: Increase wait_for_receive timeout again.
We're still failing frontend tests randomly due to this timeout being
too short. Ultimately we should fix this by making the
wait_for_receive check smarter, but this will do for now.
(imported from commit ff4b18beb88b957c705fd98cd9064902c9985f62)
|
commit 6f42b90d23916e18745656ba4b44ab956a12b366
Author: Tim Abbott <[email protected]>
Date: Tue May 21 13:38:41 2013 -0400
casper: Increase wait_for_receive timeout again.
We're still failing frontend tests randomly due to this timeout being
too short. Ultimately we should fix this by making the
wait_for_receive check smarter, but this will do for now.
(imported from commit ff4b18beb88b957c705fd98cd9064902c9985f62)
diff --git a/zephyr/tests/frontend/common.js b/zephyr/tests/frontend/common.js
index 29308a2fcb..466d75f780 100644
--- a/zephyr/tests/frontend/common.js
+++ b/zephyr/tests/frontend/common.js
@@ -158,9 +158,9 @@ exports.send_many = function (msgs) {
// Wait to receive queued messages.
exports.wait_for_receive = function (step) {
- // Wait until the last send or get_events result was more than 500 ms ago.
+ // Wait until the last send or get_events result was more than 1000 ms ago.
casper.waitFor(function () {
- return (timestamp() - last_send_or_update) > 500;
+ return (timestamp() - last_send_or_update) > 1000;
}, step);
};
| 0 |
7709e6c4209b46c88a66506d0cbecb2231d0bd80
|
zulip/zulip
|
requirements: Upgrade cffi from 1.11.5 to 1.12.2.
|
commit 7709e6c4209b46c88a66506d0cbecb2231d0bd80
Author: Vishnu KS <[email protected]>
Date: Wed Mar 6 10:43:08 2019 +0000
requirements: Upgrade cffi from 1.11.5 to 1.12.2.
diff --git a/requirements/common.in b/requirements/common.in
index 4b2876e09a..f39c9bbe02 100644
--- a/requirements/common.in
+++ b/requirements/common.in
@@ -40,7 +40,7 @@ boto==2.49.0
certifi==2018.11.29
# Used for scrapy as well as argon2
-cffi==1.11.5
+cffi==1.12.2
chardet==3.0.4
diff --git a/requirements/dev.txt b/requirements/dev.txt
index f0f42b2e27..bd3215426c 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -34,7 +34,7 @@ botocore==1.12.108 # via boto3, moto, s3transfer
cachetools==3.1.0 # via google-auth
cchardet==2.1.4
certifi==2018.11.29
-cffi==1.11.5
+cffi==1.12.2
chardet==3.0.4
click==6.6 # via gitlint, pip-tools
commonmark==0.8.1
diff --git a/requirements/prod.txt b/requirements/prod.txt
index a7e1319e82..9c62309cf0 100644
--- a/requirements/prod.txt
+++ b/requirements/prod.txt
@@ -27,7 +27,7 @@ boto==2.49.0
cachetools==3.1.0 # via google-auth
cchardet==2.1.4
certifi==2018.11.29
-cffi==1.11.5
+cffi==1.12.2
chardet==3.0.4
cryptography==2.5
cssselect==1.0.3 # via premailer
| 0 |
7ff699cd67780e9fd8a437c01b9386fdc44337c4
|
zulip/zulip
|
app_filters.py: Accept context in render_markdown_path.
|
commit 7ff699cd67780e9fd8a437c01b9386fdc44337c4
Author: Umair Khan <[email protected]>
Date: Wed Apr 5 10:14:51 2017 +0500
app_filters.py: Accept context in render_markdown_path.
diff --git a/zerver/templatetags/app_filters.py b/zerver/templatetags/app_filters.py
index 855b37ee72..aebe8be71e 100644
--- a/zerver/templatetags/app_filters.py
+++ b/zerver/templatetags/app_filters.py
@@ -58,8 +58,8 @@ md_extensions = None
@lru_cache(512 if settings.PRODUCTION else 0)
@register.filter(name='render_markdown_path', is_safe=True)
-def render_markdown_path(markdown_file_path):
- # type: (str) -> str
+def render_markdown_path(markdown_file_path, context=None):
+ # type: (str, Optional[Dict[Any, Any]]) -> str
"""Given a path to a markdown file, return the rendered html.
Note that this assumes that any HTML in the markdown file is
@@ -80,7 +80,10 @@ def render_markdown_path(markdown_file_path):
md_engine = markdown.Markdown(extensions=md_extensions)
md_engine.reset()
+ if context is None:
+ context = {}
+
template = loader.get_template(markdown_file_path)
- markdown_string = template.render()
+ markdown_string = template.render(context)
html = md_engine.convert(markdown_string)
return mark_safe(html)
| 0 |
1af84c1231ceb4ec2ad9a891e3901e85fd022131
|
zulip/zulip
|
zilencer: Extract BaseRemoteCount class.
|
commit 1af84c1231ceb4ec2ad9a891e3901e85fd022131
Author: Mateusz Mandera <[email protected]>
Date: Fri Oct 20 02:16:38 2023 +0200
zilencer: Extract BaseRemoteCount class.
diff --git a/zilencer/models.py b/zilencer/models.py
index f2571039f3..9b69107b08 100644
--- a/zilencer/models.py
+++ b/zilencer/models.py
@@ -130,11 +130,16 @@ class RemoteRealmAuditLog(AbstractRealmAuditLog):
]
-class RemoteInstallationCount(BaseCount):
+class BaseRemoteCount(BaseCount):
server = models.ForeignKey(RemoteZulipServer, on_delete=models.CASCADE)
# The remote_id field lets us deduplicate data from the remote server
remote_id = models.IntegerField()
+ class Meta:
+ abstract = True
+
+
+class RemoteInstallationCount(BaseRemoteCount):
class Meta:
unique_together = ("server", "property", "subgroup", "end_time")
indexes = [
@@ -150,11 +155,8 @@ class RemoteInstallationCount(BaseCount):
# We can't subclass RealmCount because we only have a realm_id here, not a foreign key.
-class RemoteRealmCount(BaseCount):
- server = models.ForeignKey(RemoteZulipServer, on_delete=models.CASCADE)
+class RemoteRealmCount(BaseRemoteCount):
realm_id = models.IntegerField()
- # The remote_id field lets us deduplicate data from the remote server
- remote_id = models.IntegerField()
class Meta:
unique_together = ("server", "realm_id", "property", "subgroup", "end_time")
| 0 |
55b26da82badc6aae8147e1926addec74468b42e
|
zulip/zulip
|
run-dev: Rewrite development proxy with aiohttp.
This allows request cancellation to be propagated to the server.
Signed-off-by: Anders Kaseorg <[email protected]>
|
commit 55b26da82badc6aae8147e1926addec74468b42e
Author: Anders Kaseorg <[email protected]>
Date: Mon Dec 11 13:44:55 2023 -0800
run-dev: Rewrite development proxy with aiohttp.
This allows request cancellation to be propagated to the server.
Signed-off-by: Anders Kaseorg <[email protected]>
diff --git a/requirements/dev.in b/requirements/dev.in
index 73fd80e732..3fb3f73137 100644
--- a/requirements/dev.in
+++ b/requirements/dev.in
@@ -8,6 +8,9 @@
# moto s3 mock
moto[s3]
+# For tools/run-dev
+aiohttp
+
# Needed for documentation links test
Scrapy
diff --git a/requirements/dev.txt b/requirements/dev.txt
index 604661392a..1e53348c99 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -88,6 +88,7 @@ aiohttp==3.9.1 \
--hash=sha256:f800164276eec54e0af5c99feb9494c295118fc10a11b997bbb1348ba1a52065 \
--hash=sha256:ffcd828e37dc219a72c9012ec44ad2e7e3066bec6ff3aaa19e7d435dbf4032ca
# via
+ # -r requirements/dev.in
# aiohttp-retry
# twilio
aiohttp-retry==2.8.3 \
diff --git a/tools/run-dev b/tools/run-dev
index d6231ded6c..9963e4ac3d 100755
--- a/tools/run-dev
+++ b/tools/run-dev
@@ -2,13 +2,13 @@
import argparse
import asyncio
import errno
+import logging
import os
import pwd
import signal
import subprocess
import sys
-from typing import List, Sequence
-from urllib.parse import urlunsplit
+from typing import List
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
@@ -18,9 +18,9 @@ from tools.lib import sanity_check
sanity_check.check_venv(__file__)
-from tornado import httpclient, httputil, web
-from tornado.platform.asyncio import AsyncIOMainLoop
-from typing_extensions import override
+import aiohttp
+from aiohttp import hdrs, web
+from returns.curry import partial
from tools.lib.test_script import add_provision_check_override_param, assert_provisioning_status_ok
@@ -54,11 +54,6 @@ parser.add_argument(
help="Do not clear memcached on startup",
)
parser.add_argument("--streamlined", action="store_true", help="Avoid process_queue, etc.")
-parser.add_argument(
- "--enable-tornado-logging",
- action="store_true",
- help="Enable access logs from tornado proxy server.",
-)
parser.add_argument(
"--behind-https-proxy",
action="store_true",
@@ -204,135 +199,81 @@ def start_webpack_watcher() -> "subprocess.Popen[bytes]":
return subprocess.Popen(webpack_cmd)
-def transform_url(protocol: str, path: str, query: str, target_port: int, target_host: str) -> str:
- # generate url with target host
- host = ":".join((target_host, str(target_port)))
- # Here we are going to rewrite the path a bit so that it is in parity with
- # what we will have for production
- newpath = urlunsplit((protocol, host, path, query, ""))
- return newpath
-
-
-client: httpclient.AsyncHTTPClient
-
-
-class BaseHandler(web.RequestHandler):
- # target server ip
- target_host: str = "127.0.0.1"
- # target server port
- target_port: int
-
- def _add_request_headers(
- self,
- exclude_lower_headers_list: Sequence[str] = [],
- ) -> httputil.HTTPHeaders:
- headers = httputil.HTTPHeaders()
- for header, v in self.request.headers.get_all():
- if header.lower() not in exclude_lower_headers_list:
- headers.add(header, v)
- return headers
-
- @override
- def get(self) -> None:
- pass
-
- @override
- def head(self) -> None:
- pass
-
- @override
- def post(self) -> None:
- pass
-
- @override
- def put(self) -> None:
- pass
-
- @override
- def patch(self) -> None:
- pass
-
- @override
- def options(self) -> None:
- pass
-
- @override
- def delete(self) -> None:
- pass
-
- @override
- async def prepare(self) -> None:
- assert self.request.method is not None
- assert self.request.remote_ip is not None
- if "X-REAL-IP" not in self.request.headers:
- self.request.headers["X-REAL-IP"] = self.request.remote_ip
- if "X-FORWARDED_PORT" not in self.request.headers:
- self.request.headers["X-FORWARDED-PORT"] = str(proxy_port)
- url = transform_url(
- self.request.protocol,
- self.request.path,
- self.request.query,
- self.target_port,
- self.target_host,
- )
- try:
- request = httpclient.HTTPRequest(
- url=url,
- method=self.request.method,
- headers=self._add_request_headers(["upgrade-insecure-requests"]),
- follow_redirects=False,
- body=self.request.body,
- allow_nonstandard_methods=True,
- # use large timeouts to handle polling requests
- connect_timeout=240.0,
- request_timeout=240.0,
- # https://github.com/tornadoweb/tornado/issues/2743
- decompress_response=False,
- )
- response = await client.fetch(request, raise_error=False)
-
- self.set_status(response.code, response.reason)
- self._headers = httputil.HTTPHeaders() # clear tornado default header
-
- for header, v in response.headers.get_all():
- # some header appear multiple times, eg 'Set-Cookie'
- if header.lower() != "transfer-encoding":
- self.add_header(header, v)
- if response.body:
- self.write(response.body)
- except (ConnectionError, httpclient.HTTPError) as e:
- self.set_status(500)
- self.write("Internal server error:\n" + str(e))
-
-
-class WebPackHandler(BaseHandler):
- target_port = webpack_port
-
-
-class DjangoHandler(BaseHandler):
- target_port = django_port
-
-
-class TornadoHandler(BaseHandler):
- target_port = tornado_port
-
-
-class Application(web.Application):
- def __init__(self, enable_logging: bool = False) -> None:
- super().__init__(
- [
- (r"/json/events.*", TornadoHandler),
- (r"/api/v1/events.*", TornadoHandler),
- (r"/webpack.*", WebPackHandler),
- (r"/.*", DjangoHandler),
+session: aiohttp.ClientSession
+
+# https://datatracker.ietf.org/doc/html/rfc2616#section-13.5.1
+HOP_BY_HOP_HEADERS = {
+ hdrs.CONNECTION,
+ hdrs.KEEP_ALIVE,
+ hdrs.PROXY_AUTHENTICATE,
+ hdrs.PROXY_AUTHORIZATION,
+ hdrs.TE,
+ hdrs.TRAILER,
+ hdrs.TRANSFER_ENCODING,
+ hdrs.UPGRADE,
+}
+
+# Headers that aiohttp would otherwise generate by default
+SKIP_AUTO_HEADERS = {
+ hdrs.ACCEPT,
+ hdrs.ACCEPT_ENCODING,
+ hdrs.CONTENT_TYPE,
+ hdrs.USER_AGENT,
+}
+
+
+async def forward(upstream_port: int, request: web.Request) -> web.StreamResponse:
+ try:
+ upstream_response = await session.request(
+ request.method,
+ request.url.with_host("127.0.0.1").with_port(upstream_port),
+ headers=[
+ (key, value)
+ for key, value in request.headers.items()
+ if key not in HOP_BY_HOP_HEADERS
],
- enable_logging=enable_logging,
+ data=request.content.iter_any() if request.body_exists else None,
+ allow_redirects=False,
+ auto_decompress=False,
+ compress=False,
+ skip_auto_headers=SKIP_AUTO_HEADERS,
+ )
+ except aiohttp.ClientError as error:
+ logging.error(
+ "Failed to forward %s %s to port %d: %s",
+ request.method,
+ request.url.path,
+ upstream_port,
+ error,
)
+ raise web.HTTPBadGateway from error
- @override
- def log_request(self, handler: web.RequestHandler) -> None:
- if self.settings["enable_logging"]:
- super().log_request(handler)
+ response = web.StreamResponse(status=upstream_response.status, reason=upstream_response.reason)
+ response.headers.extend(
+ (key, value)
+ for key, value in upstream_response.headers.items()
+ if key not in HOP_BY_HOP_HEADERS
+ )
+ assert request.remote is not None
+ response.headers["X-Real-IP"] = request.remote
+ response.headers["X-Forwarded-Port"] = str(proxy_port)
+ await response.prepare(request)
+ async for data in upstream_response.content.iter_any():
+ await response.write(data)
+ await response.write_eof()
+ return response
+
+
+app = web.Application()
+app.add_routes(
+ [
+ web.route(
+ hdrs.METH_ANY, r"/{path:json/events|api/v1/events}", partial(forward, tornado_port)
+ ),
+ web.route(hdrs.METH_ANY, r"/{path:webpack/.*}", partial(forward, webpack_port)),
+ web.route(hdrs.METH_ANY, r"/{path:.*}", partial(forward, django_port)),
+ ]
+)
def print_listeners() -> None:
@@ -365,13 +306,12 @@ def print_listeners() -> None:
print()
+runner: web.AppRunner
children: List["subprocess.Popen[bytes]"] = []
async def serve() -> None:
- global client
-
- AsyncIOMainLoop().install()
+ global runner, session
if options.test:
do_one_time_webpack_compile()
@@ -380,10 +320,12 @@ async def serve() -> None:
children.extend(subprocess.Popen(cmd) for cmd in server_processes())
- client = httpclient.AsyncHTTPClient()
- app = Application(enable_logging=options.enable_tornado_logging)
+ session = aiohttp.ClientSession()
+ runner = web.AppRunner(app, auto_decompress=False, handler_cancellation=True)
+ await runner.setup()
+ site = web.TCPSite(runner, host=options.interface, port=proxy_port)
try:
- app.listen(proxy_port, address=options.interface)
+ await site.start()
except OSError as e:
if e.errno == errno.EADDRINUSE:
print("\n\nERROR: You probably have another server running!!!\n\n")
@@ -400,6 +342,9 @@ try:
loop.add_signal_handler(s, loop.stop)
loop.run_forever()
finally:
+ loop.run_until_complete(runner.cleanup())
+ loop.run_until_complete(session.close())
+
for child in children:
child.terminate()
diff --git a/zerver/tornado/handlers.py b/zerver/tornado/handlers.py
index 00a1f9694e..70180939f5 100644
--- a/zerver/tornado/handlers.py
+++ b/zerver/tornado/handlers.py
@@ -214,11 +214,6 @@ class AsyncDjangoHandler(tornado.web.RequestHandler):
def on_connection_close(self) -> None:
# Register a Tornado handler that runs when client-side
# connections are closed to notify the events system.
- #
- # Note that in the development environment, the development
- # proxy does not correctly close connections to Tornado when
- # its clients (e.g. `curl`) close their connections. This
- # code path is thus _unreachable except in production_.
# If the client goes away, garbage collect the handler (with
# attached request information).
| 0 |
7a930afa07be2e2676c277a6a2e1b04b22d60410
|
zulip/zulip
|
events_register: Don't include subscribers in API data by default.
There's a new option, `include_subscribers`, that controls whether the
API sends down subscriber data for the various streams you are
subscribed to.
This has significant performance savings for large realms with naive
clients, and saves a bunch of bandwidth as well.
|
commit 7a930afa07be2e2676c277a6a2e1b04b22d60410
Author: Tim Abbott <[email protected]>
Date: Sun Feb 19 22:52:37 2017 -0800
events_register: Don't include subscribers in API data by default.
There's a new option, `include_subscribers`, that controls whether the
API sends down subscriber data for the various streams you are
subscribed to.
This has significant performance savings for large realms with naive
clients, and saves a bunch of bandwidth as well.
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index 555210ec18..0f774629b3 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -2856,8 +2856,8 @@ def decode_email_address(email):
# the code pretty ugly, but in this case, it has significant
# performance impact for loading / for users with large numbers of
# subscriptions, so it's worth optimizing.
-def gather_subscriptions_helper(user_profile):
- # type: (UserProfile) -> Tuple[List[Dict[str, Any]], List[Dict[str, Any]], List[Dict[str, Any]]]
+def gather_subscriptions_helper(user_profile, include_subscribers=True):
+ # type: (UserProfile, bool) -> Tuple[List[Dict[str, Any]], List[Dict[str, Any]], List[Dict[str, Any]]]
sub_dicts = Subscription.objects.select_related("recipient").filter(
user_profile = user_profile,
recipient__type = Recipient.STREAM).values(
@@ -2888,7 +2888,12 @@ def gather_subscriptions_helper(user_profile):
# Add never subscribed streams to streams_subscribed_map
streams_subscribed_map.update({stream['id']: False for stream in all_streams if stream not in streams})
- subscriber_map = bulk_get_subscriber_user_ids(all_streams, user_profile, streams_subscribed_map)
+ if include_subscribers:
+ subscriber_map = bulk_get_subscriber_user_ids(all_streams, user_profile, streams_subscribed_map)
+ else:
+ # If we're not including subscribers, always return None,
+ # which the below code needs to check for anyway.
+ subscriber_map = defaultdict(lambda: None)
sub_unsub_stream_ids = set()
for sub in sub_dicts:
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index 8b7dc3cf17..70265b0900 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -43,8 +43,9 @@ def get_realm_user_dicts(user_profile):
# all event types. Whenever you add new code to this function, you
# should also add corresponding events for changes in the data
# structures and new code to apply_events (and add a test in EventsRegisterTest).
-def fetch_initial_state_data(user_profile, event_types, queue_id):
- # type: (UserProfile, Optional[Iterable[str]], str) -> Dict[str, Any]
+def fetch_initial_state_data(user_profile, event_types, queue_id,
+ include_subscribers=True):
+ # type: (UserProfile, Optional[Iterable[str]], str, bool) -> Dict[str, Any]
state = {'queue_id': queue_id} # type: Dict[str, Any]
if event_types is None:
@@ -113,7 +114,8 @@ def fetch_initial_state_data(user_profile, event_types, queue_id):
'used': user_profile.invites_used}
if want('subscription'):
- subscriptions, unsubscribed, never_subscribed = gather_subscriptions_helper(user_profile)
+ subscriptions, unsubscribed, never_subscribed = gather_subscriptions_helper(
+ user_profile, include_subscribers=include_subscribers)
state['subscriptions'] = subscriptions
state['unsubscribed'] = unsubscribed
state['never_subscribed'] = never_subscribed
@@ -355,8 +357,8 @@ def apply_events(state, events, user_profile):
def do_events_register(user_profile, user_client, apply_markdown=True,
event_types=None, queue_lifespan_secs=0, all_public_streams=False,
- narrow=[]):
- # type: (UserProfile, Client, bool, Optional[Iterable[str]], int, bool, Iterable[Sequence[Text]]) -> Dict[str, Any]
+ include_subscribers=True, narrow=[]):
+ # type: (UserProfile, Client, bool, Optional[Iterable[str]], int, bool, bool, Iterable[Sequence[Text]]) -> Dict[str, Any]
# Technically we don't need to check this here because
# build_narrow_filter will check it, but it's nicer from an error
# handling perspective to do it before contacting Tornado
@@ -372,7 +374,8 @@ def do_events_register(user_profile, user_client, apply_markdown=True,
else:
event_types_set = None
- ret = fetch_initial_state_data(user_profile, event_types_set, queue_id)
+ ret = fetch_initial_state_data(user_profile, event_types_set, queue_id,
+ include_subscribers=include_subscribers)
# Apply events that came in while we were fetching initial data
events = get_user_events(user_profile, queue_id, -1)
diff --git a/zerver/views/events_register.py b/zerver/views/events_register.py
index 96ecbdf0ff..341d9df01f 100644
--- a/zerver/views/events_register.py
+++ b/zerver/views/events_register.py
@@ -28,14 +28,15 @@ def _default_narrow(user_profile, narrow):
def events_register_backend(request, user_profile,
apply_markdown=REQ(default=False, validator=check_bool),
all_public_streams=REQ(default=None, validator=check_bool),
+ include_subscribers=REQ(default=False, validator=check_bool),
event_types=REQ(validator=check_list(check_string), default=None),
narrow=REQ(validator=check_list(check_list(check_string, length=2)), default=[]),
queue_lifespan_secs=REQ(converter=int, default=0)):
- # type: (HttpRequest, UserProfile, bool, Optional[bool], Optional[Iterable[str]], Iterable[Sequence[Text]], int) -> HttpResponse
+ # type: (HttpRequest, UserProfile, bool, Optional[bool], bool, Optional[Iterable[str]], Iterable[Sequence[Text]], int) -> HttpResponse
all_public_streams = _default_all_public_streams(user_profile, all_public_streams)
narrow = _default_narrow(user_profile, narrow)
ret = do_events_register(user_profile, request.client, apply_markdown,
event_types, queue_lifespan_secs, all_public_streams,
- narrow=narrow)
+ narrow=narrow, include_subscribers=include_subscribers)
return json_success(ret)
| 0 |
88c1a3dcde8fb87b3c8fbaa4d7e5138cb743f84e
|
zulip/zulip
|
help: Remove single use macro self-hosted-billing.md.
Having these single use macros exist was not intentional.
|
commit 88c1a3dcde8fb87b3c8fbaa4d7e5138cb743f84e
Author: Shubham Padia <[email protected]>
Date: Thu May 22 06:26:02 2025 +0000
help: Remove single use macro self-hosted-billing.md.
Having these single use macros exist was not intentional.
diff --git a/help/include/legacy-log-in.md b/help/include/legacy-log-in.md
deleted file mode 100644
index 2e62616234..0000000000
--- a/help/include/legacy-log-in.md
+++ /dev/null
@@ -1,15 +0,0 @@
-1. Go to [https://selfhosting.zulip.com/serverlogin/](https://selfhosting.zulip.com/serverlogin/).
-
-1. Fill out the requested server information, and click **Continue**.
-
-1. Enter the email address of the billing contact for your organization,
- and click **Confirm email**.
-
-**Billing administrator steps:**
-
-1. In your email account, open the email you received
- (Subject: Log in to Zulip plan management), and click **Log in**.
-
-1. Verify your information, and click **Continue**. If you are logging in for
- the first time, you will need to enter your name and accept the [Terms of
- Service](https://zulip.com/policies/terms).
diff --git a/help/self-hosted-billing.md b/help/self-hosted-billing.md
index 759be30738..944613cd0e 100644
--- a/help/self-hosted-billing.md
+++ b/help/self-hosted-billing.md
@@ -100,7 +100,21 @@ discount](#apply-for-a-paid-plan-discount).
{!register-server-legacy.md!}
-{!legacy-log-in.md!}
+1. Go to [https://selfhosting.zulip.com/serverlogin/](https://selfhosting.zulip.com/serverlogin/).
+
+1. Fill out the requested server information, and click **Continue**.
+
+1. Enter the email address of the billing contact for your organization,
+ and click **Confirm email**.
+
+**Billing administrator steps:**
+
+1. In your email account, open the email you received
+ (Subject: Log in to Zulip plan management), and click **Log in**.
+
+1. Verify your information, and click **Continue**. If you are logging in for
+ the first time, you will need to enter your name and accept the [Terms of
+ Service](https://zulip.com/policies/terms).
{end_tabs}
| 0 |
75fc5d41c9eff5d6449ed663a6425f20f9366c9d
|
zulip/zulip
|
hipchat import: Refactor write_message_data.
The goal here is to make it easier to handle other
message types by moving the key-specific stuff
to the top of the file.
|
commit 75fc5d41c9eff5d6449ed663a6425f20f9366c9d
Author: Steve Howell <[email protected]>
Date: Fri Oct 12 23:17:19 2018 +0000
hipchat import: Refactor write_message_data.
The goal here is to make it easier to handle other
message types by moving the key-specific stuff
to the top of the file.
diff --git a/zerver/data_import/hipchat.py b/zerver/data_import/hipchat.py
index ba3a8c8709..13c92c373d 100755
--- a/zerver/data_import/hipchat.py
+++ b/zerver/data_import/hipchat.py
@@ -354,13 +354,31 @@ def write_emoticon_data(realm_id: int,
return realmemoji
def write_message_data(realm_id: int,
+ message_key: str,
zerver_recipient: List[ZerverFieldsT],
zerver_subscription: List[ZerverFieldsT],
zerver_userprofile: List[ZerverFieldsT],
data_dir: str,
output_dir: str) -> None:
- room_dir_glob = os.path.join(data_dir, 'rooms', '*', 'history.json')
- history_files = glob.glob(room_dir_glob)
+
+ stream_id_to_recipient_id = {
+ d['type_id']: d['id']
+ for d in zerver_recipient
+ if d['type'] == Recipient.STREAM
+ }
+
+ def get_stream_recipient_id(raw_message: ZerverFieldsT) -> int:
+ fn_id = raw_message['fn_id']
+ recipient_id = stream_id_to_recipient_id[fn_id]
+ return recipient_id
+
+
+ if message_key == 'UserMessage':
+ dir_glob = os.path.join(data_dir, 'rooms', '*', 'history.json')
+ get_recipient_id = get_stream_recipient_id
+
+ else:
+ raise Exception('programming error: invalid message_key: ' + message_key)
user_map = {
user['id']: user
@@ -379,24 +397,19 @@ def write_message_data(realm_id: int,
return content
def process(fn: str) -> List[ZerverFieldsT]:
- rooms_dir = os.path.dirname(fn)
- room_id = os.path.basename(rooms_dir)
- stream_id = int(room_id)
+ dir = os.path.dirname(fn)
+ fn_id = int(os.path.basename(dir))
data = json.load(open(fn))
- data = [
- d for d in data
- if 'UserMessage' in d
- ]
-
flat_data = [
- d['UserMessage']
+ d[message_key]
for d in data
+ if message_key in d
]
return [
dict(
- stream_id=stream_id,
+ fn_id=fn_id,
sender_id=d['sender']['id'],
content=d['message'],
mention_user_ids=d['mentions'],
@@ -405,18 +418,13 @@ def write_message_data(realm_id: int,
for d in flat_data
]
+ history_files = glob.glob(dir_glob)
raw_messages = [
message
for fn in history_files
for message in process(fn)
]
- stream_id_to_recipient_id = {
- d['type_id']: d['id']
- for d in zerver_recipient
- if d['type'] == Recipient.STREAM
- }
-
mention_map = dict() # type: Dict[int, Set[int]]
def make_message(message_id: int, raw_message: ZerverFieldsT) -> ZerverFieldsT:
@@ -428,8 +436,7 @@ def write_message_data(realm_id: int,
mention_user_ids=raw_message['mention_user_ids'],
)
pub_date = raw_message['pub_date']
- stream_id = raw_message['stream_id']
- recipient_id = stream_id_to_recipient_id[stream_id]
+ recipient_id = get_recipient_id(raw_message)
rendered_content = None
subject = 'archived'
user_id = raw_message['sender_id']
@@ -530,14 +537,16 @@ def do_convert_data(input_tar_file: str, output_dir: str) -> None:
create_converted_data_files(realm, output_dir, '/realm.json')
- write_message_data(
- realm_id=realm_id,
- zerver_recipient=zerver_recipient,
- zerver_subscription=zerver_subscription,
- zerver_userprofile=zerver_userprofile,
- data_dir=input_data_dir,
- output_dir=output_dir,
- )
+ for message_key in ['UserMessage']:
+ write_message_data(
+ realm_id=realm_id,
+ message_key=message_key,
+ zerver_recipient=zerver_recipient,
+ zerver_subscription=zerver_subscription,
+ zerver_userprofile=zerver_userprofile,
+ data_dir=input_data_dir,
+ output_dir=output_dir,
+ )
write_avatar_data(
raw_user_data=raw_user_data,
| 0 |
5e4980400437b2b4546cac12b19e2b282b642690
|
zulip/zulip
|
puppet_ops: Include Akamai log parser on prometheus server.
|
commit 5e4980400437b2b4546cac12b19e2b282b642690
Author: Alex Vandiver <[email protected]>
Date: Mon Nov 13 14:35:39 2023 -0500
puppet_ops: Include Akamai log parser on prometheus server.
diff --git a/puppet/zulip_ops/manifests/profile/prometheus_server.pp b/puppet/zulip_ops/manifests/profile/prometheus_server.pp
index 5997e8d585..68c5c41b05 100644
--- a/puppet/zulip_ops/manifests/profile/prometheus_server.pp
+++ b/puppet/zulip_ops/manifests/profile/prometheus_server.pp
@@ -9,6 +9,9 @@ class zulip_ops::profile::prometheus_server {
# This blackbox monitoring of the backup system runs locally
include zulip_ops::prometheus::wal_g
+ # Ditto the Akamai logs
+ include zulip_ops::prometheus::akamai
+
$version = $zulip::common::versions['prometheus']['version']
$dir = "/srv/zulip-prometheus-${version}"
$bin = "${dir}/prometheus"
| 0 |
85a7325757d2a5c12945e62e7b75b9466578ac7e
|
zulip/zulip
|
css: Delete orphaned starred messages CSS.
This CSS stopped being used in
84afc67369b2a832887167899603f51cdefec518.
|
commit 85a7325757d2a5c12945e62e7b75b9466578ac7e
Author: Tim Abbott <[email protected]>
Date: Wed Apr 14 11:50:07 2021 -0700
css: Delete orphaned starred messages CSS.
This CSS stopped being used in
84afc67369b2a832887167899603f51cdefec518.
diff --git a/static/styles/left_sidebar.css b/static/styles/left_sidebar.css
index 87b2efba71..60304e2a9d 100644
--- a/static/styles/left_sidebar.css
+++ b/static/styles/left_sidebar.css
@@ -304,16 +304,6 @@ li.top_left_recent_topics {
font-size: 13px;
}
-/* Starred messaged counts aren't really unread
- counts, so we style them differently.
-*/
-.top_left_starred_messages .count {
- background-color: transparent;
- color: inherit;
- padding: 2px 1px 0 3px;
- border-color: hsl(105, 2%, 50%);
-}
-
.topic-box {
padding-left: 5px;
margin-right: 30px;
| 0 |
9c614531fb4f81adcd173c1cd32cce2bbc75fad8
|
zulip/zulip
|
test_subs: Use 'common_subscribe_to_streams' helper function.
In 'test_subs' we were making POST request to add
subscrption using 'self.api_post'.
This commit updates the code to use the test helper
function 'common_subscribe_to_streams' instead.
This prep commit will also help us to avoid adding
'transaction.atomic' context manager to these API calls
individually in the case of error response in the next commit.
|
commit 9c614531fb4f81adcd173c1cd32cce2bbc75fad8
Author: Prakhar Pratyush <[email protected]>
Date: Tue Jul 9 16:57:16 2024 +0530
test_subs: Use 'common_subscribe_to_streams' helper function.
In 'test_subs' we were making POST request to add
subscrption using 'self.api_post'.
This commit updates the code to use the test helper
function 'common_subscribe_to_streams' instead.
This prep commit will also help us to avoid adding
'transaction.atomic' context manager to these API calls
individually in the case of error response in the next commit.
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index 31b73d1268..5684cd2af0 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -12,7 +12,6 @@ from typing import (
Callable,
Collection,
Dict,
- Iterable,
Iterator,
List,
Mapping,
@@ -1439,15 +1438,22 @@ Output:
def common_subscribe_to_streams(
self,
user: UserProfile,
- streams: Iterable[str],
+ subscriptions_raw: List[str] | List[Dict[str, str]],
extra_post_data: Mapping[str, Any] = {},
invite_only: bool = False,
is_web_public: bool = False,
allow_fail: bool = False,
**extra: str,
) -> "TestHttpResponse":
+ subscriptions: List[Dict[str, str]] = []
+ for entry in subscriptions_raw:
+ if isinstance(entry, str):
+ subscriptions.append({"name": entry})
+ else:
+ subscriptions.append(entry)
+
post_data = {
- "subscriptions": orjson.dumps([{"name": stream} for stream in streams]).decode(),
+ "subscriptions": orjson.dumps(subscriptions).decode(),
"is_web_public": orjson.dumps(is_web_public).decode(),
"invite_only": orjson.dumps(invite_only).decode(),
}
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index 036ca0e86a..0737e40da7 100644
--- a/zerver/tests/test_subs.py
+++ b/zerver/tests/test_subs.py
@@ -342,13 +342,8 @@ class TestCreateStreams(ZulipTestCase):
user = self.example_user("hamlet")
realm = user.realm
self.login_user(user)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream", "description": "multi\nline\ndescription"}]
- ).decode(),
- "invite_only": orjson.dumps(False).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ subscriptions = [{"name": "new_stream", "description": "multi\nline\ndescription"}]
+ result = self.common_subscribe_to_streams(user, subscriptions, subdomain="zulip")
self.assert_json_success(result)
stream = get_stream("new_stream", realm)
self.assertEqual(stream.description, "multi line description")
@@ -401,39 +396,39 @@ class TestCreateStreams(ZulipTestCase):
self.login_user(user_profile)
realm = user_profile.realm
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "default_stream", "description": "This stream is default for new users"}]
- ).decode(),
- "is_default_stream": orjson.dumps(True).decode(),
- }
- result = self.api_post(
- user_profile, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip"
+ subscriptions = [
+ {"name": "default_stream", "description": "This stream is default for new users"}
+ ]
+ result = self.common_subscribe_to_streams(
+ user_profile,
+ subscriptions,
+ {"is_default_stream": "true"},
+ allow_fail=True,
+ subdomain="zulip",
)
self.assert_json_error(result, "Insufficient permission")
do_change_user_role(user_profile, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)
- result = self.api_post(
- user_profile, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip"
+ result = self.common_subscribe_to_streams(
+ user_profile, subscriptions, {"is_default_stream": "true"}, subdomain="zulip"
)
self.assert_json_success(result)
default_stream = get_stream("default_stream", realm)
self.assertTrue(default_stream.id in get_default_stream_ids_for_realm(realm.id))
- post_data = {
- "subscriptions": orjson.dumps(
- [
- {
- "name": "private_default_stream",
- "description": "This stream is private and default for new users",
- }
- ]
- ).decode(),
- "invite_only": orjson.dumps(True).decode(),
- "is_default_stream": orjson.dumps(True).decode(),
- }
- result = self.api_post(
- user_profile, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip"
+ subscriptions = [
+ {
+ "name": "private_default_stream",
+ "description": "This stream is private and default for new users",
+ }
+ ]
+ result = self.common_subscribe_to_streams(
+ user_profile,
+ subscriptions,
+ {"is_default_stream": "true"},
+ invite_only=True,
+ allow_fail=True,
+ subdomain="zulip",
)
self.assert_json_error(result, "A default channel cannot be private.")
@@ -543,35 +538,32 @@ class TestCreateStreams(ZulipTestCase):
name="role:administrators", realm=realm, is_system_group=True
)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream1", "description": "First new stream"}]
- ).decode(),
- "can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ subscriptions = [{"name": "new_stream1", "description": "First new stream"}]
+ result = self.common_subscribe_to_streams(
+ user,
+ subscriptions,
+ {"can_remove_subscribers_group": orjson.dumps(moderators_system_group.id).decode()},
+ subdomain="zulip",
+ )
self.assert_json_success(result)
stream = get_stream("new_stream1", realm)
self.assertEqual(stream.can_remove_subscribers_group.id, moderators_system_group.id)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream2", "description": "Second new stream"}]
- ).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ subscriptions = [{"name": "new_stream2", "description": "Second new stream"}]
+ result = self.common_subscribe_to_streams(user, subscriptions, subdomain="zulip")
self.assert_json_success(result)
stream = get_stream("new_stream2", realm)
self.assertEqual(stream.can_remove_subscribers_group.id, admins_system_group.id)
hamletcharacters_group = NamedUserGroup.objects.get(name="hamletcharacters", realm=realm)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream3", "description": "Third new stream"}]
- ).decode(),
- "can_remove_subscribers_group": orjson.dumps(hamletcharacters_group.id).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ subscriptions = [{"name": "new_stream3", "description": "Third new stream"}]
+ result = self.common_subscribe_to_streams(
+ user,
+ subscriptions,
+ {"can_remove_subscribers_group": orjson.dumps(hamletcharacters_group.id).decode()},
+ allow_fail=True,
+ subdomain="zulip",
+ )
self.assert_json_error(
result, "'can_remove_subscribers_group' must be a system user group."
)
@@ -579,13 +571,13 @@ class TestCreateStreams(ZulipTestCase):
internet_group = NamedUserGroup.objects.get(
name="role:internet", is_system_group=True, realm=realm
)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream3", "description": "Third new stream"}]
- ).decode(),
- "can_remove_subscribers_group": orjson.dumps(internet_group.id).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ result = self.common_subscribe_to_streams(
+ user,
+ subscriptions,
+ {"can_remove_subscribers_group": orjson.dumps(internet_group.id).decode()},
+ allow_fail=True,
+ subdomain="zulip",
+ )
self.assert_json_error(
result,
"'can_remove_subscribers_group' setting cannot be set to 'role:internet' group.",
@@ -594,13 +586,13 @@ class TestCreateStreams(ZulipTestCase):
owners_group = NamedUserGroup.objects.get(
name="role:owners", is_system_group=True, realm=realm
)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream3", "description": "Third new stream"}]
- ).decode(),
- "can_remove_subscribers_group": orjson.dumps(owners_group.id).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ result = self.common_subscribe_to_streams(
+ user,
+ subscriptions,
+ {"can_remove_subscribers_group": orjson.dumps(owners_group.id).decode()},
+ allow_fail=True,
+ subdomain="zulip",
+ )
self.assert_json_error(
result,
"'can_remove_subscribers_group' setting cannot be set to 'role:owners' group.",
@@ -609,13 +601,13 @@ class TestCreateStreams(ZulipTestCase):
nobody_group = NamedUserGroup.objects.get(
name="role:nobody", is_system_group=True, realm=realm
)
- post_data = {
- "subscriptions": orjson.dumps(
- [{"name": "new_stream3", "description": "Third new stream"}]
- ).decode(),
- "can_remove_subscribers_group": orjson.dumps(nobody_group.id).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data, subdomain="zulip")
+ result = self.common_subscribe_to_streams(
+ user,
+ subscriptions,
+ {"can_remove_subscribers_group": orjson.dumps(nobody_group.id).decode()},
+ allow_fail=True,
+ subdomain="zulip",
+ )
self.assert_json_error(
result,
"'can_remove_subscribers_group' setting cannot be set to 'role:nobody' group.",
@@ -2512,9 +2504,8 @@ class StreamAdminTest(ZulipTestCase):
self.assertNotIn(deactivated_stream_name, public_streams)
# Even if you could guess the new name, you can't subscribe to it.
- result = self.client_post(
- "/json/users/me/subscriptions",
- {"subscriptions": orjson.dumps([{"name": deactivated_stream_name}]).decode()},
+ result = self.common_subscribe_to_streams(
+ self.example_user("hamlet"), [deactivated_stream_name], allow_fail=True
)
self.assert_json_error(result, f"Unable to access channel ({deactivated_stream_name}).")
@@ -3836,12 +3827,8 @@ class SubscriptionRestApiTest(ZulipTestCase):
self.assert_json_success(result)
# incorrect color format
- request = {
- "subscriptions": orjson.dumps(
- [{"name": "my_test_stream_3", "color": "#0g0g0g"}]
- ).decode(),
- }
- result = self.api_post(user, "/api/v1/users/me/subscriptions", request)
+ subscriptions = [{"name": "my_test_stream_3", "color": "#0g0g0g"}]
+ result = self.common_subscribe_to_streams(user, subscriptions, allow_fail=True)
self.assert_json_error(result, 'subscriptions[0]["color"] is not a valid hex color code')
def test_api_valid_property(self) -> None:
@@ -4033,26 +4020,16 @@ class SubscriptionAPITest(ZulipTestCase):
self.login_user(user)
# For Cc category
- post_data_cc = {
- "subscriptions": orjson.dumps(
- [{"name": "new\n\rstream", "description": "this is description"}]
- ).decode(),
- "invite_only": orjson.dumps(False).decode(),
- }
- result = self.api_post(
- user, "/api/v1/users/me/subscriptions", post_data_cc, subdomain="zulip"
+ subscriptions = [{"name": "new\n\rstream", "description": "this is description"}]
+ result = self.common_subscribe_to_streams(
+ user, subscriptions, allow_fail=True, subdomain="zulip"
)
self.assert_json_error(result, "Invalid character in channel name, at position 4.")
# For Cn category
- post_data_cn = {
- "subscriptions": orjson.dumps(
- [{"name": "new\ufffestream", "description": "this is description"}]
- ).decode(),
- "invite_only": orjson.dumps(False).decode(),
- }
- result = self.api_post(
- user, "/api/v1/users/me/subscriptions", post_data_cn, subdomain="zulip"
+ subscriptions = [{"name": "new\ufffestream", "description": "this is description"}]
+ result = self.common_subscribe_to_streams(
+ user, subscriptions, allow_fail=True, subdomain="zulip"
)
self.assert_json_error(result, "Invalid character in channel name, at position 4.")
@@ -5266,11 +5243,11 @@ class SubscriptionAPITest(ZulipTestCase):
post_data = dict(
principals=orjson.dumps([target_profile.id]).decode(),
)
- self.common_subscribe_to_streams(self.test_user, "Verona", post_data)
+ self.common_subscribe_to_streams(self.test_user, ["Verona"], post_data)
do_deactivate_user(target_profile, acting_user=None)
result = self.common_subscribe_to_streams(
- self.test_user, "Denmark", post_data, allow_fail=True
+ self.test_user, ["Denmark"], post_data, allow_fail=True
)
self.assert_json_error(result, "User is deactivated", status_code=400)
| 0 |
1cf18cfbeb4cc5170d3a28dea1dd4aa25e9ee988
|
zulip/zulip
|
compose: Avoid render for duplicate mentions.
There is no reason to render the template for compose mention
warnings if the user is already in the widget.
This commit also restructures the unit test significantly to more
carefully exercise each case, particularly in regard to when
templates get rendered.
|
commit 1cf18cfbeb4cc5170d3a28dea1dd4aa25e9ee988
Author: Steve Howell <[email protected]>
Date: Sun Jul 9 08:13:42 2017 -0400
compose: Avoid render for duplicate mentions.
There is no reason to render the template for compose mention
warnings if the user is already in the widget.
This commit also restructures the unit test significantly to more
carefully exercise each case, particularly in regard to when
templates get rendered.
diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js
index b84f084a9e..221a0c3f37 100644
--- a/frontend_tests/node_tests/compose.js
+++ b/frontend_tests/node_tests/compose.js
@@ -874,38 +874,93 @@ function test_with_mock_socket(test_params) {
},
};
- function setup(msg_type, is_zephyr_mirror, mentioned_full_name) {
- compose_fade.would_receive_message = function (email) {
- assert.equal(email, '[email protected]');
- return false;
- };
- templates.render = function (template_name, context) {
- assert.equal(template_name, 'compose-invite-users');
- assert.equal(context.email, '[email protected]');
- assert.equal(context.name, 'foobar');
- return 'fake-compose-invite-user-template';
- };
- $("#compose_invite_users").append = function (html) {
- assert.equal(html, 'fake-compose-invite-user-template');
- };
- $("#compose_invite_users").hide();
+ $('#compose_invite_users .compose_invite_user').length = 0;
+
+ function test_noop_case(msg_type, is_zephyr_mirror, mentioned_full_name) {
compose_state.set_message_type(msg_type);
page_params.realm_is_zephyr_mirror_realm = is_zephyr_mirror;
data.mentioned.full_name = mentioned_full_name;
- }
-
- function test(msg_type, is_zephyr_mirror, mentioned_full_name,
- compose_invite_users_visible) {
- setup(msg_type, is_zephyr_mirror, mentioned_full_name);
handler({}, data);
- assert.equal($('#compose_invite_users').visible(),
- compose_invite_users_visible);
+ assert.equal($('#compose_invite_users').visible(), false);
}
- test('private', true, 'everyone', false);
- test('stream', true, 'everyone', false);
- test('stream', false, 'everyone', false);
- test('stream', false, 'foobar', true);
+ test_noop_case('private', true, 'everyone');
+ test_noop_case('stream', true, 'everyone');
+ test_noop_case('stream', false, 'everyone');
+
+ // Test mentioning a user that should gets a warning.
+
+ $("#compose_invite_users").hide();
+ compose_state.set_message_type('stream');
+ page_params.realm_is_zephyr_mirror_realm = false;
+
+ var checks = [
+ (function () {
+ var called;
+ compose_fade.would_receive_message = function (email) {
+ called = true;
+ assert.equal(email, '[email protected]');
+ return false;
+ };
+ return function () { assert(called); };
+ }()),
+
+
+ (function () {
+ var called;
+ templates.render = function (template_name, context) {
+ called = true;
+ assert.equal(template_name, 'compose-invite-users');
+ assert.equal(context.email, '[email protected]');
+ assert.equal(context.name, 'Foo Barson');
+ return 'fake-compose-invite-user-template';
+ };
+ return function () { assert(called); };
+ }()),
+
+ (function () {
+ var called;
+ $("#compose_invite_users").append = function (html) {
+ called = true;
+ assert.equal(html, 'fake-compose-invite-user-template');
+ };
+ return function () { assert(called); };
+ }()),
+ ];
+
+ data = {
+ mentioned: {
+ email: '[email protected]',
+ full_name: 'Foo Barson',
+ },
+ };
+
+ handler({}, data);
+ assert.equal($('#compose_invite_users').visible(), true);
+
+ _.each(checks, function (f) { f(); });
+
+
+ // Simulate that the row was added to the DOM.
+ var warning_row = $('<warning row>');
+
+ var looked_for_existing;
+ warning_row.data = function (field) {
+ assert.equal(field, 'useremail');
+ looked_for_existing = true;
+ return '[email protected]';
+ };
+
+ var previous_users = $('#compose_invite_users .compose_invite_user');
+ previous_users.length = 1;
+ previous_users[0] = warning_row;
+
+ // Now try to mention the same person again. The template should
+ // not render.
+ templates.render = noop;
+ handler({}, data);
+ assert.equal($('#compose_invite_users').visible(), true);
+ assert(looked_for_existing);
}());
(function test_compose_all_everyone_confirm_clicked() {
diff --git a/static/js/compose.js b/static/js/compose.js
index 673419b142..8f45ab46bc 100644
--- a/static/js/compose.js
+++ b/static/js/compose.js
@@ -653,8 +653,6 @@ exports.initialize = function () {
}
if (compose_fade.would_receive_message(email) === false) {
- var new_row = templates.render("compose-invite-users",
- {email: email, name: data.mentioned.full_name});
var error_area = $("#compose_invite_users");
var existing_invites_area = $('#compose_invite_users .compose_invite_user');
@@ -663,6 +661,8 @@ exports.initialize = function () {
});
if (existing_invites.indexOf(email) === -1) {
+ var context = {email: email, name: data.mentioned.full_name};
+ var new_row = templates.render("compose-invite-users", context);
error_area.append(new_row);
}
| 0 |
b1fd86c5c762575f3c0e2b3b19d5dfd7d758bc79
|
zulip/zulip
|
node tests: Add coverage to hashchange.js.
|
commit b1fd86c5c762575f3c0e2b3b19d5dfd7d758bc79
Author: Steve Howell <[email protected]>
Date: Wed Apr 11 11:14:39 2018 +0000
node tests: Add coverage to hashchange.js.
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js
index e3c9e68dfa..bd03516a8f 100644
--- a/frontend_tests/node_tests/hashchange.js
+++ b/frontend_tests/node_tests/hashchange.js
@@ -3,6 +3,36 @@ zrequire('hash_util');
zrequire('hashchange');
zrequire('stream_data');
+set_global('document', 'document-stub');
+set_global('history', {});
+set_global('window', {
+ location: {
+ protocol: 'http:',
+ host: 'example.com',
+ },
+});
+
+set_global('admin', {});
+set_global('drafts', {});
+set_global('favicon', {});
+set_global('floating_recipient_bar', {});
+set_global('info_overlay', {});
+set_global('narrow', {});
+set_global('overlays', {});
+set_global('settings', {});
+set_global('subs', {});
+set_global('ui_util', {});
+
+function blueslip_wrap(f) {
+ return function (e) {
+ return f(e);
+ };
+}
+
+set_global('blueslip', {
+ wrap_function: blueslip_wrap,
+});
+
(function test_operators_round_trip() {
var operators;
var hash;
@@ -79,3 +109,229 @@ zrequire('stream_data');
hash = hashchange.operators_to_hash(operators);
assert.equal(hash, '#narrow/pm-with/42-alice');
}());
+
+function stub_trigger(f) {
+ set_global('$', () => {
+ return {
+ trigger: f,
+ };
+ });
+ $.Event = (name) => {
+ assert.equal(name, 'zuliphashchange.zulip');
+ };
+}
+
+function test_helper() {
+ var events = [];
+ var narrow_terms;
+
+ function stub(module_name, func_name) {
+ global[module_name][func_name] = () => {
+ events.push(module_name + '.' + func_name);
+ };
+ }
+
+ stub('admin', 'setup_page');
+ stub('drafts', 'launch');
+ stub('favicon', 'reset');
+ stub('floating_recipient_bar', 'update');
+ stub('narrow', 'deactivate');
+ stub('overlays', 'close_for_hash_change');
+ stub('settings', 'setup_page');
+ stub('subs', 'launch');
+ stub('ui_util', 'blur_active_element');
+
+ stub_trigger(() => { events.push('trigger event'); });
+
+ ui_util.change_tab_to = (hash) => {
+ events.push('change_tab_to ' + hash);
+ };
+
+ narrow.activate = (terms) => {
+ narrow_terms = terms;
+ events.push('narrow.activate');
+ };
+
+ info_overlay.show = (name) => {
+ events.push('info: ' + name);
+ };
+
+ return {
+ clear_events: () => {
+ events = [];
+ },
+ assert_events: (expected_events) => {
+ assert.deepEqual(expected_events, events);
+ },
+ get_narrow_terms: () => {
+ return narrow_terms;
+ },
+ };
+}
+
+(function test_hash_interactions() {
+ var helper = test_helper();
+
+ window.location.hash = '#';
+
+ helper.clear_events();
+ hashchange.initialize();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'change_tab_to #home',
+ 'narrow.deactivate',
+ 'floating_recipient_bar.update',
+ ]);
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'change_tab_to #home',
+ 'narrow.deactivate',
+ 'floating_recipient_bar.update',
+ ]);
+
+ window.location.hash = '#narrow/stream/Denmark';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'change_tab_to #home',
+ 'narrow.activate',
+ 'floating_recipient_bar.update',
+ ]);
+ var terms = helper.get_narrow_terms();
+ assert.equal(terms[0].operand, 'Denmark');
+
+ window.location.hash = '#narrow';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'change_tab_to #home',
+ 'narrow.activate',
+ 'floating_recipient_bar.update',
+ ]);
+ terms = helper.get_narrow_terms();
+ assert.equal(terms.length, 0);
+
+ window.location.hash = '#streams/whatever';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'subs.launch',
+ ]);
+
+ window.location.hash = '#keyboard-shortcuts/whatever';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'info: keyboard-shortcuts',
+ ]);
+
+ window.location.hash = '#markdown-help/whatever';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'info: markdown-help',
+ ]);
+
+ window.location.hash = '#search-operators/whatever';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'trigger event',
+ 'info: search-operators',
+ ]);
+
+ window.location.hash = '#drafts';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'drafts.launch',
+ ]);
+
+ window.location.hash = '#settings/alert-words';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'overlays.close_for_hash_change',
+ 'settings.setup_page',
+ 'admin.setup_page',
+ ]);
+
+ window.location.hash = '#organization/user-list-admin';
+
+ helper.clear_events();
+ window.onhashchange();
+ helper.assert_events([
+ 'settings.setup_page',
+ 'admin.setup_page',
+ ]);
+
+ var called_back;
+
+ helper.clear_events();
+ hashchange.exit_overlay(() => {
+ called_back = true;
+ });
+
+ helper.assert_events([
+ 'ui_util.blur_active_element',
+ ]);
+ assert(called_back);
+
+}());
+
+(function test_save_narrow() {
+ var helper = test_helper();
+
+ var operators = [
+ {operator: 'is', operand: 'private'},
+ ];
+
+ hashchange.save_narrow(operators);
+ helper.assert_events([
+ 'trigger event',
+ 'favicon.reset',
+ ]);
+ assert.equal(window.location.hash, '#narrow/is/private');
+
+ var url_pushed;
+ global.history.pushState = (state, title, url) => {
+ url_pushed = url;
+ };
+
+ operators = [
+ {operator: 'is', operand: 'starred'},
+ ];
+
+ helper.clear_events();
+ hashchange.save_narrow(operators);
+ helper.assert_events([
+ 'trigger event',
+ 'favicon.reset',
+ ]);
+ assert.equal(url_pushed, 'http://example.com/#narrow/is/starred');
+}());
+
| 0 |
a91358e186367ef90e11f836cad080a3f8c2fd20
|
zulip/zulip
|
webhooks: Fix hellosign webhook.
Hellosign now posts their callback as form/multipart, which Django only
permits to be read once. Attempts to access request.body after the
initial read throw "django.http.request.RawPostDataException: You
cannot access body after reading from request's data stream".
Fixes #13847.
|
commit a91358e186367ef90e11f836cad080a3f8c2fd20
Author: Chris Heald <[email protected]>
Date: Fri Feb 7 16:24:39 2020 -0700
webhooks: Fix hellosign webhook.
Hellosign now posts their callback as form/multipart, which Django only
permits to be read once. Attempts to access request.body after the
initial read throw "django.http.request.RawPostDataException: You
cannot access body after reading from request's data stream".
Fixes #13847.
diff --git a/zerver/webhooks/hellosign/tests.py b/zerver/webhooks/hellosign/tests.py
index c0c96b78e6..71583f74b3 100644
--- a/zerver/webhooks/hellosign/tests.py
+++ b/zerver/webhooks/hellosign/tests.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from zerver.lib.test_classes import WebhookTestCase
-
+from typing import Dict
class HelloSignHookTests(WebhookTestCase):
STREAM_NAME = 'hellosign'
@@ -12,21 +12,21 @@ class HelloSignHookTests(WebhookTestCase):
expected_message = ("The `NDA with Acme Co.` document is awaiting the signature of "
"Jack, and was just signed by Jill.")
self.send_and_test_stream_message('signatures', expected_topic, expected_message,
- content_type="application/x-www-form-urlencoded")
+ content_type=None)
def test_signatures_message_signed_by_one(self) -> None:
expected_topic = "NDA with Acme Co."
expected_message = ("The `NDA with Acme Co.` document was just signed by Jill.")
self.send_and_test_stream_message('signatures_signed_by_one_signatory',
expected_topic, expected_message,
- content_type="application/x-www-form-urlencoded")
+ content_type=None)
def test_signatures_message_with_four_signatories(self) -> None:
expected_topic = "Signature doc"
expected_message = ("The `Signature doc` document is awaiting the signature of "
"Eeshan Garg, John Smith, Jane Doe, and Stephen Strange.")
self.send_and_test_stream_message('signatures_with_four_signatories', expected_topic, expected_message,
- content_type="application/x-www-form-urlencoded")
+ content_type=None)
def test_signatures_message_with_own_subject(self) -> None:
expected_topic = "Our own subject."
@@ -34,7 +34,7 @@ class HelloSignHookTests(WebhookTestCase):
expected_message = ("The `NDA with Acme Co.` document is awaiting the signature of "
"Jack, and was just signed by Jill.")
self.send_and_test_stream_message('signatures_with_own_subject', expected_topic, expected_message,
- content_type="application/x-www-form-urlencoded", topic=expected_topic)
+ content_type=None, topic=expected_topic)
- def get_body(self, fixture_name: str) -> str:
- return self.webhook_fixture_data("hellosign", fixture_name, file_type="json")
+ def get_body(self, fixture_name: str) -> Dict[str, str]:
+ return {"json": self.webhook_fixture_data("hellosign", fixture_name, file_type="json")}
diff --git a/zerver/webhooks/hellosign/view.py b/zerver/webhooks/hellosign/view.py
index 7a89208e35..d455d01263 100644
--- a/zerver/webhooks/hellosign/view.py
+++ b/zerver/webhooks/hellosign/view.py
@@ -7,6 +7,7 @@ from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile
+import ujson
IS_AWAITING_SIGNATURE = "is awaiting the signature of {awaiting_recipients}"
WAS_JUST_SIGNED_BY = "was just signed by {signed_recipients}"
@@ -54,8 +55,11 @@ def get_recipients_text(recipients: List[str]) -> str:
@api_key_only_webhook_view('HelloSign')
@has_request_variables
def api_hellosign_webhook(request: HttpRequest, user_profile: UserProfile,
- payload: Dict[str, Dict[str, Any]]=REQ(argument_type='body')) -> HttpResponse:
- body = get_message_body(payload)
- topic = payload['signature_request']['title']
- check_send_webhook_message(request, user_profile, topic, body)
- return json_success()
+ payload: Dict[str, Dict[str, Any]]=REQ(
+ whence='json', converter=ujson.loads)) -> HttpResponse:
+ if "signature_request" in payload:
+ body = get_message_body(payload)
+ topic = payload['signature_request']['title']
+ check_send_webhook_message(request, user_profile, topic, body)
+
+ return json_success({"msg": "Hello API Event Received"})
| 0 |
cc8353f8b146b1e0bd5a8ca4181df737905179c4
|
zulip/zulip
|
github: Enable new codeql-analysis feature.
This file was generated by GitHub's code analysis tutorial; we were
just approved from their waitlist.
I deleted the part to run compilers as it is not relevant for us.
|
commit cc8353f8b146b1e0bd5a8ca4181df737905179c4
Author: Tim Abbott <[email protected]>
Date: Thu Jun 25 11:29:26 2020 -0700
github: Enable new codeql-analysis feature.
This file was generated by GitHub's code analysis tutorial; we were
just approved from their waitlist.
I deleted the part to run compilers as it is not relevant for us.
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
new file mode 100644
index 0000000000..f6149cb4e4
--- /dev/null
+++ b/.github/workflows/codeql-analysis.yml
@@ -0,0 +1,34 @@
+name: "Code scanning - action"
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 5 * * 1'
+
+jobs:
+ CodeQL-Build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ with:
+ # We must fetch at least the immediate parents so that if this is
+ # a pull request then we can checkout the head.
+ fetch-depth: 2
+
+ # If this run was triggered by a pull request event, then checkout
+ # the head of the pull request instead of the merge commit.
+ - run: git checkout HEAD^2
+ if: ${{ github.event_name == 'pull_request' }}
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v1
+ # Override language selection by uncommenting this and choosing your languages
+ # with:
+ # languages: go, javascript, csharp, python, cpp, java
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v1
| 0 |
63643c9d9d92d34b8b57a46cffb7eaa8e3a1fa45
|
zulip/zulip
|
search: Fix blur event handler for `search_query_box`.
A main change is that we now display the navbar if the search box
is not focused. This was already present in the search pills version
but adding it to the legacy version is an improvement.
We sufficiently increase the timeout so that the pills are actually
deleted. This was required when `filter.is_common_narrow()` is true,
as then only we render the narrow description and close the search bar.
This commit also matches another behaviour of the legacy search.
i.e. We narrow every time a search suggestion is clicked.
The now redundant "focusin" and "focusout" event handler tests are
also removed.
|
commit 63643c9d9d92d34b8b57a46cffb7eaa8e3a1fa45
Author: Ryan Rehman <[email protected]>
Date: Thu Jun 18 19:17:17 2020 +0530
search: Fix blur event handler for `search_query_box`.
A main change is that we now display the navbar if the search box
is not focused. This was already present in the search pills version
but adding it to the legacy version is an improvement.
We sufficiently increase the timeout so that the pills are actually
deleted. This was required when `filter.is_common_narrow()` is true,
as then only we render the narrow description and close the search bar.
This commit also matches another behaviour of the legacy search.
i.e. We narrow every time a search suggestion is clicked.
The now redundant "focusin" and "focusout" event handler tests are
also removed.
diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.js
index cb9acc73ff..cde906762f 100644
--- a/frontend_tests/node_tests/search.js
+++ b/frontend_tests/node_tests/search.js
@@ -74,7 +74,6 @@ run_test('initialize', () => {
const search_query_box = $('#search_query');
const searchbox_form = $('#searchbox_form');
const search_button = $('.search_button');
- const searchbox = $('#searchbox');
searchbox_form.on = (event, func) => {
assert.equal(event, 'compositionend');
@@ -181,6 +180,7 @@ run_test('initialize', () => {
search.is_using_input_method = true;
_setup('stream:Verona');
+ search_query_box.is = return_true;
assert.equal(opts.updater('stream:Verona'), 'stream:Verona');
assert(!is_blurred);
@@ -285,18 +285,6 @@ run_test('initialize', () => {
}
};
- searchbox.on = (event, callback) => {
- if (event === 'focusin') {
- searchbox.css({"box-shadow": "unset"});
- callback();
- assert.deepEqual(searchbox.css(), {"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});
- } else if (event === 'focusout') {
- searchbox.css({"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});
- callback();
- assert.deepEqual(searchbox.css(), {"box-shadow": "unset"});
- }
- };
-
search.initialize();
});
diff --git a/frontend_tests/node_tests/search_legacy.js b/frontend_tests/node_tests/search_legacy.js
index c32eadfd3c..5ebd1169c6 100644
--- a/frontend_tests/node_tests/search_legacy.js
+++ b/frontend_tests/node_tests/search_legacy.js
@@ -9,7 +9,7 @@ const return_true = () => true;
const return_false = () => false;
set_global('$', global.make_zjquery());
-set_global('narrow_state', {});
+set_global('narrow_state', {filter: return_false});
set_global('search_suggestion', {});
set_global('ui_util', {
change_tab_to: noop,
diff --git a/static/js/search.js b/static/js/search.js
index 93fb179477..a8cd7b4fdb 100644
--- a/static/js/search.js
+++ b/static/js/search.js
@@ -91,7 +91,15 @@ exports.initialize = function () {
if (page_params.search_pills_enabled) {
search_pill.append_search_string(search_string,
search_pill_widget.widget);
- return search_query_box.val();
+ if (search_query_box.is(':focus')) {
+ // We usually allow the user to continue
+ // typing until the enter key is pressed.
+ // But we narrow when the user clicks on a
+ // typeahead suggestion. This change in behaviour
+ // is a workaround to be able to display the
+ // navbar every time search_query_box loses focus.
+ return search_query_box.val();
+ }
}
return exports.narrow_or_search_for_term(search_string);
},
@@ -167,25 +175,17 @@ exports.initialize = function () {
// selecting something in the typeahead menu causes
// the box to lose focus a moment before.
//
- // The workaround is to check 100ms later -- long
+ // The workaround is to check 300ms later -- long
// enough for the search to have gone through, but
// short enough that the user won't notice (though
// really it would be OK if they did).
setTimeout(function () {
exports.update_button_visibility();
- }, 100);
- });
-
- if (page_params.search_pills_enabled) {
- // Uses jquery instead of pure css as the `:focus` event occurs on `#search_query`,
- // while we want to add box-shadow to `#searchbox`. This could have been done
- // with `:focus-within` CSS selector, but it is not supported in IE or Opera.
- searchbox.on('focusout', function () {
tab_bar.close_search_bar_and_open_narrow_description();
searchbox.css({"box-shadow": "unset"});
- });
- }
+ }, 300);
+ });
};
exports.focus_search = function () {
| 0 |
43a3a73a0d56798f0d54bb28f8ac7c11a99bec7e
|
zulip/zulip
|
widgets: Avoid adding the widget_elem if it already exists.
Fixes #18631
|
commit 43a3a73a0d56798f0d54bb28f8ac7c11a99bec7e
Author: Ganesh Pawar <[email protected]>
Date: Sat Jul 24 13:12:04 2021 +0530
widgets: Avoid adding the widget_elem if it already exists.
Fixes #18631
diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js
index e057cbed0f..b51d23826e 100644
--- a/frontend_tests/node_tests/widgetize.js
+++ b/frontend_tests/node_tests/widgetize.js
@@ -111,6 +111,7 @@ test("activate", ({override}) => {
is_event_handled = false;
assert.ok(!widgetize.widget_contents.has(opts.message.id));
+ message_content.set_find_results(".widget-content", false);
widgetize.activate(opts);
assert.ok(is_widget_elem_inserted);
@@ -122,6 +123,7 @@ test("activate", ({override}) => {
is_widget_activated = false;
is_event_handled = false;
+ message_content.set_find_results(".widget-content", false);
widgetize.activate(opts);
assert.ok(is_widget_elem_inserted);
@@ -133,6 +135,7 @@ test("activate", ({override}) => {
is_widget_activated = false;
is_event_handled = false;
+ message_content.set_find_results(".widget-content", false);
widgetize.activate(opts);
assert.ok(!is_widget_elem_inserted);
diff --git a/static/js/widgetize.js b/static/js/widgetize.js
index 9d69cbe769..8121dc2943 100644
--- a/static/js/widgetize.js
+++ b/static/js/widgetize.js
@@ -21,7 +21,15 @@ export function clear_for_testing() {
function set_widget_in_message(row, widget_elem) {
const content_holder = row.find(".message_content");
- content_holder.empty().append(widget_elem);
+
+ // Avoid adding the widget_elem if it already exists.
+ // This can happen when the app loads in the "Recent topics"
+ // view and the user changes the view to "All messages".
+ // This is important since jQuery removes all the event handlers
+ // on `empty()`ing an element.
+ if (content_holder.find(".widget-content").length === 0) {
+ content_holder.empty().append(widget_elem);
+ }
}
export function activate(in_opts) {
| 0 |
3a87b467e94bb62bc5b3fca28974055c03dab7cc
|
zulip/zulip
|
demo-orgs: Enable admin of auth methods for owner without email.
There is no technical reason to block updating the authentication
methods for the demo organization when the owner has not yet set
an email.
If they get locked out of the demo organization when they set an
email address for their account, they can just create another demo
organization. These organizations are primarily intended to be
temporary sandboxes for trying out Zulip.
Co-authored-by: Maneesh Shukla <[email protected]>
|
commit 3a87b467e94bb62bc5b3fca28974055c03dab7cc
Author: Lauryn Menard <[email protected]>
Date: Mon May 12 16:00:27 2025 +0200
demo-orgs: Enable admin of auth methods for owner without email.
There is no technical reason to block updating the authentication
methods for the demo organization when the owner has not yet set
an email.
If they get locked out of the demo organization when they set an
email address for their account, they can just create another demo
organization. These organizations are primarily intended to be
temporary sandboxes for trying out Zulip.
Co-authored-by: Maneesh Shukla <[email protected]>
diff --git a/web/src/settings_org.ts b/web/src/settings_org.ts
index 32b049d08a..6dab846db3 100644
--- a/web/src/settings_org.ts
+++ b/web/src/settings_org.ts
@@ -33,7 +33,6 @@ import {
} from "./settings_components.ts";
import * as settings_components from "./settings_components.ts";
import * as settings_config from "./settings_config.ts";
-import * as settings_data from "./settings_data.ts";
import * as settings_notifications from "./settings_notifications.ts";
import * as settings_realm_domains from "./settings_realm_domains.ts";
import * as settings_ui from "./settings_ui.ts";
@@ -402,16 +401,6 @@ export function populate_realm_domains_label(
$("#allowed_domains_label").text($t({defaultMessage: "Allowed domains: {domains}"}, {domains}));
}
-function can_configure_auth_methods(): boolean {
- if (settings_data.user_email_not_configured()) {
- return false;
- }
- if (current_user.is_owner) {
- return true;
- }
- return false;
-}
-
export function populate_auth_methods(auth_method_to_bool_map: Record<string, boolean>): void {
if (!meta.loaded) {
return;
@@ -433,7 +422,7 @@ export function populate_auth_methods(auth_method_to_bool_map: Record<string, bo
const render_args = {
method: auth_method,
enabled: value,
- disable_configure_auth_method: !can_configure_auth_methods() || cant_be_enabled,
+ disable_configure_auth_method: !current_user.is_owner || cant_be_enabled,
// The negated character class regexp serves as an allowlist - the replace() will
// remove *all* symbols *but* digits (\d) and lowercase letters (a-z),
// so that we can make assumptions on this string elsewhere in the code.
diff --git a/web/templates/settings/auth_methods_settings_admin.hbs b/web/templates/settings/auth_methods_settings_admin.hbs
index 32296e6a57..a65e11ecc8 100644
--- a/web/templates/settings/auth_methods_settings_admin.hbs
+++ b/web/templates/settings/auth_methods_settings_admin.hbs
@@ -2,14 +2,6 @@
{{#unless is_owner}}
<div class='tip'>{{t "Only organization owners can edit these settings."}}</div>
{{/unless}}
- {{#unless user_has_email_set}}
- <div class="tip">
- {{#tr}}
- You must <z-link>configure your email</z-link> to access this feature.
- {{#*inline "z-link"}}<a href="/help/demo-organizations#configure-email-for-demo-organization-owner" target="_blank" rel="noopener noreferrer">{{> @partial-block }}</a>{{/inline}}
- {{/tr}}
- </div>
- {{/unless}}
<form class="admin-realm-form org-authentications-form">
<div id="org-auth_settings" class="settings-subsection-parent">
<div class ="subsection-header">
| 0 |
47c8da28ff13e0ba8a60f2bfa1469ec15135e708
|
zulip/zulip
|
bots: Simplify automated testing library.
|
commit 47c8da28ff13e0ba8a60f2bfa1469ec15135e708
Author: Tim Abbott <[email protected]>
Date: Wed May 24 20:12:57 2017 -0700
bots: Simplify automated testing library.
diff --git a/contrib_bots/bots/define/test_define.py b/contrib_bots/bots/define/test_define.py
index 1d38af2ff9..449d0a2a26 100644
--- a/contrib_bots/bots/define/test_define.py
+++ b/contrib_bots/bots/define/test_define.py
@@ -5,36 +5,25 @@ from __future__ import print_function
import os
import sys
-import unittest
-from unittest import TestCase
our_dir = os.path.dirname(os.path.abspath(__file__))
-
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..')
from bots_test_lib import BotTestCase
-class TestDefineBot(TestCase):
- def setUp(self):
- # Messages to be sent to bot for testing.
- self.request_messages = [
+class TestDefineBot(BotTestCase):
+ bot_name = "define"
+
+ def test_bot(self):
+ self.assert_bot_output(
{'content': "foo", 'type': "private", 'sender_email': "foo"},
+ "**foo**:\nDefinition not available."
+ )
+ self.assert_bot_output(
{'content': "cat", 'type': "stream", 'display_recipient': "foo", 'subject': "foo"},
- ]
- # Reply messages from the test bot.
- self.bot_response_messages = [
- "**foo**:\nDefinition not available.",
("**cat**:\n\n* (**noun**) a small domesticated carnivorous mammal "
- "with soft fur, a short snout, and retractile claws. It is widely "
- "kept as a pet or for catching mice, and many breeds have been "
- "developed.\n their pet cat\n\n"),
- ]
-
- def runTest(self):
- # type: None -> None
- # Edit bot_module to test different bots, the below code can be looped for all the bots.
- bot_module = os.path.join(our_dir, "define.py")
- test_case = BotTestCase()
- test_case.bot_test(messages=self.request_messages, bot_module=bot_module,
- bot_response=self.bot_response_messages)
+ "with soft fur, a short snout, and retractile claws. It is widely "
+ "kept as a pet or for catching mice, and many breeds have been "
+ "developed.\n their pet cat\n\n"),
+ )
diff --git a/contrib_bots/bots_test_lib.py b/contrib_bots/bots_test_lib.py
index 14c5186a3e..f99547b2d5 100644
--- a/contrib_bots/bots_test_lib.py
+++ b/contrib_bots/bots_test_lib.py
@@ -14,7 +14,19 @@ from bot_lib import StateHandler
from contrib_bots import bot_lib
from six.moves import zip
-class BotTestCase():
+from unittest import TestCase
+
+current_dir = os.path.dirname(os.path.abspath(__file__))
+
+class BotTestCase(TestCase):
+ bot_name = None
+
+ def assert_bot_output(self, request, response):
+ # type: (str, str) -> None
+ bot_module = os.path.join(current_dir, "bots",
+ self.bot_name, self.bot_name + ".py")
+ self.bot_test(messages=[request], bot_module=bot_module,
+ bot_response=[response])
def mock_test(self, messages, message_handler, bot_response):
# type: (List[Dict[str, str]], Function) -> None
@@ -37,6 +49,5 @@ class BotTestCase():
return message_handler
def bot_test(self, messages, bot_module, bot_response):
-
message_handler = self.bot_to_run(bot_module)
self.mock_test(messages=messages, message_handler=message_handler, bot_response=bot_response)
| 0 |
ade32137ebcb6c6ba30e5ed185c9e51e9c942915
|
zulip/zulip
|
help: Improve documentation for starred messages.
* Add mobile app instructions for interacting with them.
* Fix inconsistent headings.
* Document the new state that starred message counts are the deafult,
and mention the "come back to" workflow for them.
|
commit ade32137ebcb6c6ba30e5ed185c9e51e9c942915
Author: Tim Abbott <[email protected]>
Date: Sat May 1 07:33:03 2021 -0700
help: Improve documentation for starred messages.
* Add mobile app instructions for interacting with them.
* Fix inconsistent headings.
* Document the new state that starred message counts are the deafult,
and mention the "come back to" workflow for them.
diff --git a/templates/zerver/help/star-a-message.md b/templates/zerver/help/star-a-message.md
index 6e1b1a71ec..c16d24fa84 100644
--- a/templates/zerver/help/star-a-message.md
+++ b/templates/zerver/help/star-a-message.md
@@ -3,33 +3,42 @@
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
-### Star a message
+## Star a message
{start_tabs}
+{tab|desktop}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
+{tab|mobile}
+
+1. Long press on a message.
+
+1. Select **Star message** in the menu that appears.
+
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
-their right. Click on it to unstar the message.
+their right. You can unstar a message using the same instructions
+used to star it.
## Access your starred messages
-You can access your starred messages by clicking **Starred Messages** in the
+You can access your starred messages by clicking **Starred messages** in the
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
-## Display the number of starred messages
+By default, Zulip displays the number of starred messages in the left
+sidebar; this allows you to use them as an inbox of messages you'd
+like to come back to. If you are using starred messages for something
+else and would prefer not to see the count in your left sidebar, you
+can disable that feature.
{start_tabs}
{settings_tab|display-settings}
-1. Under **Display settings**, select **Show counts for starred messages**.
+1. Under **Display settings**, toggle **Show counts for starred messages**.
{end_tabs}
-
-Zulip will add a number to the right of **Starred messages** in the left
-sidebar.
| 0 |
dac56b4d08a96a95f3d81c5e8748490a8dce9748
|
zulip/zulip
|
compose: Paste content into the compose box without adding any space.
We replace the call to `insert_syntax_and_focus` with a direct call to
`insert_and_scroll_into_view` when pasting content into the compose box,
which fixes the bug where leading and trailing spaces were added to any
pasted content.
|
commit dac56b4d08a96a95f3d81c5e8748490a8dce9748
Author: Nehal Sharma <[email protected]>
Date: Tue Nov 7 13:54:56 2023 +0530
compose: Paste content into the compose box without adding any space.
We replace the call to `insert_syntax_and_focus` with a direct call to
`insert_and_scroll_into_view` when pasting content into the compose box,
which fixes the bug where leading and trailing spaces were added to any
pasted content.
diff --git a/web/src/copy_and_paste.js b/web/src/copy_and_paste.js
index 038a078b10..08e0a9c22e 100644
--- a/web/src/copy_and_paste.js
+++ b/web/src/copy_and_paste.js
@@ -547,7 +547,7 @@ export function paste_handler(event) {
event.preventDefault();
event.stopPropagation();
const text = paste_handler_converter(paste_html);
- compose_ui.insert_syntax_and_focus(text, $textarea);
+ compose_ui.insert_and_scroll_into_view(text, $textarea);
}
}
}
| 0 |
926716d9f22cb04175e81e35ca010f815dc870f0
|
zulip/zulip
|
custom-profile-fields: Fix handling manual date input.
This commit fixes the behavior when manually changing
the date input instead of selecting from the picker.
Changes done are-
- Users can enter date in various formats including the
one showed in the input like "June 20, 1999", "MM-DD-YYY",
and basically the formats which can be parsed by "Date".
- Fixed handling of invalid strings where we show
"Invalid date value" error message for some time without
sending the request to server.
Fixes #19936.
|
commit 926716d9f22cb04175e81e35ca010f815dc870f0
Author: Sahil Batra <[email protected]>
Date: Thu May 8 21:29:30 2025 +0530
custom-profile-fields: Fix handling manual date input.
This commit fixes the behavior when manually changing
the date input instead of selecting from the picker.
Changes done are-
- Users can enter date in various formats including the
one showed in the input like "June 20, 1999", "MM-DD-YYY",
and basically the formats which can be parsed by "Date".
- Fixed handling of invalid strings where we show
"Invalid date value" error message for some time without
sending the request to server.
Fixes #19936.
diff --git a/web/e2e-tests/settings.test.ts b/web/e2e-tests/settings.test.ts
index 1afa0bd03a..9b84018a91 100644
--- a/web/e2e-tests/settings.test.ts
+++ b/web/e2e-tests/settings.test.ts
@@ -34,7 +34,7 @@ async function open_settings(page: Page): Promise<void> {
}
async function close_settings_and_date_picker(page: Page): Promise<void> {
- const date_picker_selector = ".custom_user_field_value.datepicker.form-control";
+ const date_picker_selector = ".date-field-alt-input";
await page.click(date_picker_selector);
await page.waitForSelector(".flatpickr-calendar", {visible: true});
diff --git a/web/src/custom_profile_fields_ui.ts b/web/src/custom_profile_fields_ui.ts
index 3cc24a21c9..c26c449161 100644
--- a/web/src/custom_profile_fields_ui.ts
+++ b/web/src/custom_profile_fields_ui.ts
@@ -14,6 +14,7 @@ import * as settings_components from "./settings_components.ts";
import * as settings_ui from "./settings_ui.ts";
import {current_user, realm} from "./state_data.ts";
import * as typeahead_helper from "./typeahead_helper.ts";
+import * as ui_report from "./ui_report.ts";
import type {UserPillWidget} from "./user_pill.ts";
import * as user_pill from "./user_pill.ts";
@@ -200,19 +201,131 @@ export function initialize_custom_user_type_fields(
return user_pills;
}
-export function initialize_custom_date_type_fields(element_id: string): void {
+export function format_date(date: Date | undefined, format: string): string {
+ if (date === undefined || date.toString() === "Invalid Date") {
+ return "Invalid Date";
+ }
+
+ return flatpickr.formatDate(date, format);
+}
+
+export function initialize_custom_date_type_fields(element_id: string, user_id: number): void {
const $date_picker_elements = $(element_id).find(".custom_user_field .datepicker");
if ($date_picker_elements.length === 0) {
return;
}
+ function update_date(instance: flatpickr.Instance, date_str: string): void {
+ const $input_elem = $(instance.element);
+ const field_id = Number.parseInt($input_elem.attr("data-field-id")!, 10);
+
+ if (date_str === "Invalid Date") {
+ // Date parses empty string to an invalid value but in
+ // our case it is a valid value when user does not want
+ // to set any value for the custom profile field.
+ if ($input_elem.parent().find(".date-field-alt-input").val() === "") {
+ if (user_id !== people.my_current_user_id()) {
+ // For "Manage user" modal, API request is made after
+ // clicking on "Save changes" button.
+ return;
+ }
+ update_user_custom_profile_fields([{id: field_id}], channel.del);
+ return;
+ }
+
+ // Show "Invalid date value" message briefly and set
+ // the input to original value.
+ const $spinner_element = $input_elem
+ .closest(".custom_user_field")
+ .find(".custom-field-status");
+ ui_report.error(
+ $t({defaultMessage: "Invalid date value"}),
+ undefined,
+ $spinner_element,
+ 1200,
+ );
+ const original_value = people.get_custom_profile_data(user_id, field_id)?.value ?? "";
+ instance.setDate(original_value);
+ if (user_id !== people.my_current_user_id()) {
+ // Trigger "input" event so that save button state can
+ // be toggled in "Manage user" modal.
+ $input_elem
+ .closest(".custom_user_field")
+ .find(".date-field-alt-input")
+ .trigger("input");
+ }
+ return;
+ }
+
+ if (user_id !== people.my_current_user_id()) {
+ // For "Manage user" modal, API request is made after
+ // clicking on "Save changes" button.
+ return;
+ }
+
+ const fields = [];
+ if (date_str) {
+ fields.push({id: field_id, value: date_str});
+ update_user_custom_profile_fields(fields, channel.patch);
+ } else {
+ fields.push({id: field_id});
+ update_user_custom_profile_fields(fields, channel.del);
+ }
+ }
+
flatpickr($date_picker_elements, {
altInput: true,
+ // We would need to handle the altInput separately
+ // than ".custom_user_field_value" elements to handle
+ // invalid values typed in the input.
+ altInputClass: "date-field-alt-input settings_text_input",
altFormat: "F j, Y",
allowInput: true,
static: true,
+ // This helps us in accepting inputs in other formats
+ // like MM/DD/YYYY and basically any other format
+ // which is accepted by Date.
+ parseDate: (date_str) => new Date(date_str),
+ // We pass allowInvalidPreload as true because we handle
+ // invalid values typed in the input ourselves. Also,
+ // formatDate function is customized to handle "undefined"
+ // values, which are returned by parseDate for invalid
+ // values.
+ formatDate: format_date,
+ allowInvalidPreload: true,
+ onChange(_selected_dates, date_str, instance) {
+ update_date(instance, date_str);
+ },
});
+ // This "change" event handler is needed to make sure that
+ // the date is successfully changed when typing a new value
+ // in the input and blurring the input by clicking outside
+ // while the calendar popover is opened, because onChange
+ // callback is not executed in such a scenario.
+ //
+ // https://github.com/flatpickr/flatpickr/issues/1551#issuecomment-1601830680
+ // has explanation on why that happens.
+ //
+ // However, this leads to a problem in a couple of cases
+ // where both onChange callback and this "change" handlers
+ // are executed when changing the date by typing in the
+ // input. This occurs when pressing Enter while the input
+ // is focused, and also when blurring the input by clicking
+ // outside while the calendar popover is closed.
+ $(element_id)
+ .find<HTMLInputElement>("input.date-field-alt-input")
+ .on("change", function (this: HTMLInputElement) {
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
+ const $datepicker = $(this).parent().find(".datepicker")[0] as HTMLInputElement & {
+ _flatpickr: flatpickr.Instance;
+ };
+ const instance = $datepicker._flatpickr;
+ const date = new Date($(this).val()!);
+ const date_str = format_date(date, "Y-m-d");
+ update_date(instance, date_str);
+ });
+
// Enable the label associated to this field to open the datepicker when clicked.
$(element_id)
.find(".custom_user_field label.settings-field-label")
@@ -234,6 +347,8 @@ export function initialize_custom_date_type_fields(element_id: string): void {
.find(".custom_user_field .remove_date")
.on("click", function () {
const $custom_user_field = $(this).parent().find(".custom_user_field_value");
+ const $displayed_input = $(this).parent().find(".date-field-alt-input");
+ $displayed_input.val("");
$custom_user_field.val("");
$custom_user_field.trigger("input");
});
diff --git a/web/src/dialog_widget.ts b/web/src/dialog_widget.ts
index 50f05855b4..cc388a0f5f 100644
--- a/web/src/dialog_widget.ts
+++ b/web/src/dialog_widget.ts
@@ -1,9 +1,11 @@
import $ from "jquery";
import _ from "lodash";
+import assert from "minimalistic-assert";
import render_dialog_widget from "../templates/dialog_widget.hbs";
import type {AjaxRequestHandler} from "./channel.ts";
+import * as custom_profile_fields_ui from "./custom_profile_fields_ui.ts";
import {$t_html} from "./i18n.ts";
import * as loading from "./loading.ts";
import * as modals from "./modals.ts";
@@ -135,6 +137,24 @@ export function get_current_values($inputs: JQuery): Record<string, unknown> {
current_values[property_name] = $(this).val();
}
}
+
+ if ($(this).hasClass("date-field-alt-input")) {
+ // For date type custom profile fields, we convert the
+ // input to the date format passed to the API.
+ const value = $(this).val()!;
+ const name = $(this).parent().find(".custom_user_field_value").attr("name")!;
+
+ if (value === "") {
+ // This case is handled separately, because it will
+ // otherwise be parsed as an invalid date.
+ current_values[name] = value;
+ return;
+ }
+
+ assert(typeof value === "string");
+ const date_str = new Date(value);
+ current_values[name] = custom_profile_fields_ui.format_date(date_str, "Y-m-d");
+ }
});
return current_values;
}
diff --git a/web/src/settings_account.ts b/web/src/settings_account.ts
index a0c565128f..b1dc45a4f6 100644
--- a/web/src/settings_account.ts
+++ b/web/src/settings_account.ts
@@ -233,7 +233,10 @@ export function add_custom_profile_fields_to_settings(): void {
true,
pill_update_handler,
);
- custom_profile_fields_ui.initialize_custom_date_type_fields(element_id);
+ custom_profile_fields_ui.initialize_custom_date_type_fields(
+ element_id,
+ people.my_current_user_id(),
+ );
custom_profile_fields_ui.initialize_custom_pronouns_type_fields(element_id);
}
@@ -724,22 +727,26 @@ export function set_up(): void {
},
);
- $("#profile-settings").on("change", ".custom_user_field_value", function (this: HTMLElement) {
- const fields: CustomProfileFieldData[] = [];
- const value = $(this).val()!;
- assert(typeof value === "string");
- const field_id = Number.parseInt(
- $(this).closest(".custom_user_field").attr("data-field-id")!,
- 10,
- );
- if (value) {
- fields.push({id: field_id, value});
- custom_profile_fields_ui.update_user_custom_profile_fields(fields, channel.patch);
- } else {
- fields.push({id: field_id});
- custom_profile_fields_ui.update_user_custom_profile_fields(fields, channel.del);
- }
- });
+ $("#profile-settings").on(
+ "change",
+ ".custom_user_field_value:not(.datepicker)",
+ function (this: HTMLElement) {
+ const fields: CustomProfileFieldData[] = [];
+ const value = $(this).val()!;
+ assert(typeof value === "string");
+ const field_id = Number.parseInt(
+ $(this).closest(".custom_user_field").attr("data-field-id")!,
+ 10,
+ );
+ if (value) {
+ fields.push({id: field_id, value});
+ custom_profile_fields_ui.update_user_custom_profile_fields(fields, channel.patch);
+ } else {
+ fields.push({id: field_id});
+ custom_profile_fields_ui.update_user_custom_profile_fields(fields, channel.del);
+ }
+ },
+ );
$("#account-settings .deactivate_realm_button").on(
"click",
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index c99bde195a..628a3156e3 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -1054,16 +1054,10 @@ function get_human_profile_data(fields_user_pills: Map<number, user_pill.UserPil
*/
const new_profile_data = [];
$("#edit-user-form .custom_user_field_value").each(function () {
- // Remove duplicate datepicker input element generated flatpickr library
- if (!$(this).hasClass("form-control")) {
- new_profile_data.push({
- id: Number.parseInt(
- $(this).closest(".custom_user_field").attr("data-field-id")!,
- 10,
- ),
- value: $(this).val(),
- });
- }
+ new_profile_data.push({
+ id: Number.parseInt($(this).closest(".custom_user_field").attr("data-field-id")!, 10),
+ value: $(this).val(),
+ });
});
// Append user type field values also
for (const [field_id, field_pills] of fields_user_pills) {
@@ -1083,7 +1077,7 @@ function get_current_values(
$edit_form: JQuery,
): Record<string, unknown> & {user_id?: string | undefined} {
const raw_current_values = dialog_widget.get_current_values(
- $edit_form.find("input, select, textarea, button, .pill-container"),
+ $edit_form.find("input:not(.datepicker), select, textarea, button, .pill-container"),
);
const schema = z.intersection(
z.object({
@@ -1150,7 +1144,10 @@ export function show_edit_user_info_modal(user_id: number, $container: JQuery):
custom_profile_field_form_selector,
user_id,
);
- custom_profile_fields_ui.initialize_custom_date_type_fields(custom_profile_field_form_selector);
+ custom_profile_fields_ui.initialize_custom_date_type_fields(
+ custom_profile_field_form_selector,
+ user_id,
+ );
custom_profile_fields_ui.initialize_custom_pronouns_type_fields(
custom_profile_field_form_selector,
);
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 174087e36c..23b9c77058 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -740,6 +740,18 @@ input[type="checkbox"] {
}
}
+#edit-user-form .alert-notification.custom-field-status,
+#profile-settings .alert-notification.custom-field-status,
+#profile-settings .alert-notification.full-name-status,
+#profile-settings .alert-notification.timezone-setting-status {
+ padding-top: 0;
+ padding-bottom: 0;
+ margin-top: 0;
+ padding-left: 0;
+ margin-left: 5px;
+ border: none;
+}
+
#profile-settings {
.custom-profile-fields-form .custom_user_field label,
.full-name-change-container label,
@@ -747,17 +759,6 @@ input[type="checkbox"] {
min-width: fit-content;
}
- .alert-notification.custom-field-status,
- .alert-notification.full-name-status,
- .alert-notification.timezone-setting-status {
- padding-top: 0;
- padding-bottom: 0;
- margin-top: 0;
- padding-left: 0;
- margin-left: 5px;
- border: none;
- }
-
.person_picker {
/* Subtract 2 * (2px padding) + 2 * (1px border) */
min-width: calc(var(--modal-input-width) - 6px);
| 0 |
4d055a66957c05432d3983f3f1ad205ecf7c6625
|
zulip/zulip
|
push_notifications: Truncate overly large remove events.
Fixes #19224.
|
commit 4d055a66957c05432d3983f3f1ad205ecf7c6625
Author: Tim Abbott <[email protected]>
Date: Tue Nov 2 15:16:10 2021 -0700
push_notifications: Truncate overly large remove events.
Fixes #19224.
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index 02434803d8..384bb8c862 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -889,8 +889,28 @@ def handle_remove_push_notification(user_profile_id: int, message_ids: List[int]
"""
user_profile = get_user_profile_by_id(user_profile_id)
message_ids = bulk_access_messages_expect_usermessage(user_profile_id, message_ids)
- gcm_payload, gcm_options = get_remove_payload_gcm(user_profile, message_ids)
- apns_payload = get_remove_payload_apns(user_profile, message_ids)
+
+ # APNs has a 4KB limit on the maximum size of messages, which
+ # translated to several hundred message IDs in one of these
+ # notifications. In rare cases, it's possible for someone to mark
+ # thousands of push notification eligible messages as read at
+ # once. We could handle this situation with a loop, but we choose
+ # to truncate instead to avoid extra network traffic, because it's
+ # very likely the user has manually cleared the notifications in
+ # their mobile device's UI anyway.
+ #
+ # When truncating, we keep only the newest N messages in this
+ # remove event. This is optimal because older messages are the
+ # ones most likely to have already been manually cleared at some
+ # point in the past.
+ #
+ # We choose 200 here because a 10-digit message ID plus a comma and
+ # space consume 12 bytes, and 12 x 200 = 2400 bytes is still well
+ # below the 4KB limit (leaving plenty of space for metadata).
+ MAX_APNS_MESSAGE_IDS = 200
+ truncated_message_ids = list(sorted(message_ids))[-MAX_APNS_MESSAGE_IDS:]
+ gcm_payload, gcm_options = get_remove_payload_gcm(user_profile, truncated_message_ids)
+ apns_payload = get_remove_payload_apns(user_profile, truncated_message_ids)
if uses_notification_bouncer():
send_notifications_to_bouncer(user_profile_id, apns_payload, gcm_payload, gcm_options)
@@ -908,6 +928,10 @@ def handle_remove_push_notification(user_profile_id: int, message_ids: List[int]
if apple_devices:
send_apple_push_notification(user_profile_id, apple_devices, apns_payload)
+ # We intentionally use the non-truncated message_ids here. We are
+ # assuming in this very rare case that the user has manually
+ # dismissed these notifications on the device side, and the server
+ # should no longer track them as outstanding notifications.
UserMessage.objects.filter(
user_profile_id=user_profile_id,
message_id__in=message_ids,
| 0 |
6f6795f607666016d107a8a5bc30f38c65697f60
|
zulip/zulip
|
ts: Migrate `message_viewport` to typescript.
Used function overloading for methods - `make_dimen_wrapper`
and `scrollTop`.
|
commit 6f6795f607666016d107a8a5bc30f38c65697f60
Author: Lalit Kumar Singh <[email protected]>
Date: Sat Jan 20 14:57:51 2024 +0530
ts: Migrate `message_viewport` to typescript.
Used function overloading for methods - `make_dimen_wrapper`
and `scrollTop`.
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index c6a007c921..a21cb4bb48 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -144,7 +144,7 @@ EXEMPT_FILES = make_set(
"web/src/message_scroll_state.ts",
"web/src/message_util.ts",
"web/src/message_view_header.js",
- "web/src/message_viewport.js",
+ "web/src/message_viewport.ts",
"web/src/messages_overlay_ui.ts",
"web/src/modals.ts",
"web/src/muted_users_ui.js",
diff --git a/web/src/message_viewport.js b/web/src/message_viewport.ts
similarity index 77%
rename from web/src/message_viewport.js
rename to web/src/message_viewport.ts
index 787ec88e57..beec3ba069 100644
--- a/web/src/message_viewport.js
+++ b/web/src/message_viewport.ts
@@ -1,30 +1,54 @@
import $ from "jquery";
+import assert from "minimalistic-assert";
import * as blueslip from "./blueslip";
import * as message_lists from "./message_lists";
import * as message_scroll_state from "./message_scroll_state";
+import type {Message} from "./message_store";
import * as rows from "./rows";
import * as util from "./util";
+import type {CachedValue} from "./util";
+
+type MessageViewportInfo = {
+ visible_top: number;
+ visible_bottom: number;
+ visible_height: number;
+};
+
+type DimenFunc = JQuery["height"] | JQuery["width"];
+type DimenWrapper = {
+ (): number;
+ (val: string | number): JQuery;
+};
export const $scroll_container = $("html");
-let $jwindow;
-const dimensions = {};
+let $jwindow: JQuery<Window & typeof globalThis>;
+const dimensions: Record<string, CachedValue<number>> = {};
let in_stoppable_autoscroll = false;
-function make_dimen_wrapper(dimen_name, dimen_func) {
+function make_dimen_wrapper(dimen_name: string, dimen_func: DimenFunc): DimenWrapper {
dimensions[dimen_name] = new util.CachedValue({
compute_value() {
- return dimen_func();
+ return dimen_func() ?? 0;
},
});
- return function viewport_dimension_wrapper(val) {
+
+ // Inner function overload for the case when dimen_func is () => number | undefined
+ function viewport_dimension_wrapper(): number;
+
+ // Inner function overload for the case when dimen_func is (val: string | number) => JQuery
+ function viewport_dimension_wrapper(val: string | number): JQuery;
+
+ function viewport_dimension_wrapper(val?: string | number): number | JQuery {
if (val !== undefined) {
dimensions[dimen_name].reset();
return dimen_func(val);
}
return dimensions[dimen_name].get();
- };
+ }
+
+ return viewport_dimension_wrapper;
}
export const height = make_dimen_wrapper("height", $.fn.height.bind($scroll_container));
@@ -33,23 +57,23 @@ export const width = make_dimen_wrapper("width", $.fn.width.bind($scroll_contain
// TODO: This function lets us use the DOM API instead of jquery
// (<10x faster) for condense.js, but we want to eventually do a
// bigger of refactor `height` and `width` above to do the same.
-export function max_message_height() {
- return document.querySelector("html").offsetHeight * 0.65;
+export function max_message_height(): number {
+ return document.querySelector("html")!.offsetHeight * 0.65;
}
// Includes both scroll and arrow events. Negative means scroll up,
// positive means scroll down.
export let last_movement_direction = 1;
-export function set_last_movement_direction(value) {
+export function set_last_movement_direction(value: number): void {
last_movement_direction = value;
}
-export function at_top() {
+export function at_top(): boolean {
return scrollTop() <= 0;
}
-export function message_viewport_info() {
+export function message_viewport_info(): MessageViewportInfo {
// Return a structure that tells us details of the viewport
// accounting for fixed elements like the top navbar.
//
@@ -78,7 +102,7 @@ export function message_viewport_info() {
};
}
-export function at_bottom() {
+export function at_bottom(): boolean {
const bottom = scrollTop() + height();
const full_height = $scroll_container.prop("scrollHeight");
@@ -91,7 +115,7 @@ export function at_bottom() {
// This differs from at_bottom in that it only requires the bottom message to
// be visible, but you may be able to scroll down further.
-export function bottom_message_visible() {
+export function bottom_message_visible(): boolean {
const $last_row = rows.last_visible();
if ($last_row.length) {
const message_bottom = $last_row[0].getBoundingClientRect().bottom;
@@ -101,11 +125,11 @@ export function bottom_message_visible() {
return false;
}
-export function is_below_visible_bottom(offset) {
- return offset > scrollTop() + height() - $("#compose").height();
+export function is_below_visible_bottom(offset: number): boolean {
+ return offset > scrollTop() + height() - ($("#compose").height() ?? 0);
}
-export function is_scrolled_up() {
+export function is_scrolled_up(): boolean {
// Let's determine whether the user was already dealing
// with messages off the screen, which can guide auto
// scrolling decisions.
@@ -119,7 +143,7 @@ export function is_scrolled_up() {
return offset > 0;
}
-export function offset_from_bottom($last_row) {
+export function offset_from_bottom($last_row: JQuery): number {
// A positive return value here means the last row is
// below the bottom of the feed (i.e. obscured by the compose
// box or even further below the bottom).
@@ -129,7 +153,12 @@ export function offset_from_bottom($last_row) {
return message_bottom - info.visible_bottom;
}
-export function set_message_position(message_top, message_height, viewport_info, ratio) {
+export function set_message_position(
+ message_top: number,
+ message_height: number,
+ viewport_info: MessageViewportInfo,
+ ratio: number,
+): void {
// message_top = offset of the top of a message that you are positioning
// message_height = height of the message that you are positioning
// viewport_info = result of calling message_viewport.message_viewport_info
@@ -160,7 +189,12 @@ export function set_message_position(message_top, message_height, viewport_info,
scrollTop(new_scroll_top);
}
-function in_viewport_or_tall(rect, top_of_feed, bottom_of_feed, require_fully_visible) {
+function in_viewport_or_tall(
+ rect: DOMRect,
+ top_of_feed: number,
+ bottom_of_feed: number,
+ require_fully_visible: boolean,
+): boolean {
if (require_fully_visible) {
return (
rect.top > top_of_feed && // Message top is in view and
@@ -171,14 +205,14 @@ function in_viewport_or_tall(rect, top_of_feed, bottom_of_feed, require_fully_vi
return rect.bottom > top_of_feed && rect.top < bottom_of_feed;
}
-function add_to_visible(
- $candidates,
- visible,
- top_of_feed,
- bottom_of_feed,
- require_fully_visible,
- row_to_id,
-) {
+function add_to_visible<T>(
+ $candidates: JQuery,
+ visible: T[],
+ top_of_feed: number,
+ bottom_of_feed: number,
+ require_fully_visible: boolean,
+ row_to_id: ($row: HTMLElement) => T,
+): void {
for (const row of $candidates) {
const row_rect = row.getBoundingClientRect();
// Mark very tall messages as read once we've gotten past them
@@ -209,13 +243,13 @@ const bottom_of_feed = new util.CachedValue({
},
});
-function _visible_divs(
- $selected_row,
- row_min_height,
- row_to_output,
- div_class,
- require_fully_visible,
-) {
+function _visible_divs<T>(
+ $selected_row: JQuery,
+ row_min_height: number,
+ row_to_output: ($row: HTMLElement) => T,
+ div_class: string,
+ require_fully_visible: boolean,
+): T[] {
// Note that when using getBoundingClientRect() we are getting offsets
// relative to the visible window, but when using jQuery's offset() we are
// getting offsets relative to the full scrollable window. You can't try to
@@ -225,7 +259,7 @@ function _visible_divs(
// We do this explicitly without merges and without recalculating
// the feed bounds to keep this computation as cheap as possible.
- const visible = [];
+ const visible: T[] = [];
const $above_pointer = $selected_row
.prevAll(`div.${CSS.escape(div_class)}`)
.slice(0, num_neighbors);
@@ -260,7 +294,8 @@ function _visible_divs(
return visible;
}
-export function visible_groups(require_fully_visible) {
+export function visible_groups(require_fully_visible: boolean): HTMLElement[] {
+ assert(message_lists.current !== undefined);
const $selected_row = message_lists.current.selected_row();
if ($selected_row === undefined || $selected_row.length === 0) {
return [];
@@ -268,29 +303,45 @@ export function visible_groups(require_fully_visible) {
const $selected_group = rows.get_message_recipient_row($selected_row);
- function get_row(row) {
+ function get_row(row: HTMLElement): HTMLElement {
return row;
}
// Being simplistic about this, the smallest group is about 75 px high.
- return _visible_divs($selected_group, 75, get_row, "recipient_row", require_fully_visible);
+ return _visible_divs<HTMLElement>(
+ $selected_group,
+ 75,
+ get_row,
+ "recipient_row",
+ require_fully_visible,
+ );
}
-export function visible_messages(require_fully_visible) {
+export function visible_messages(require_fully_visible: boolean): Message[] {
+ assert(message_lists.current !== undefined);
const $selected_row = message_lists.current.selected_row();
- function row_to_id(row) {
- return message_lists.current.get(rows.id($(row)));
+ function row_to_id(row: HTMLElement): Message {
+ assert(message_lists.current !== undefined);
+ return message_lists.current.get(rows.id($(row))!)!;
}
// Being simplistic about this, the smallest message is 25 px high.
- return _visible_divs($selected_row, 25, row_to_id, "message_row", require_fully_visible);
+ return _visible_divs<Message>(
+ $selected_row,
+ 25,
+ row_to_id,
+ "message_row",
+ require_fully_visible,
+ );
}
-export function scrollTop(target_scrollTop) {
+export function scrollTop(): number;
+export function scrollTop(target_scrollTop: number): JQuery;
+export function scrollTop(target_scrollTop?: number): JQuery | number {
const orig_scrollTop = $scroll_container.scrollTop();
if (target_scrollTop === undefined) {
- return orig_scrollTop;
+ return orig_scrollTop ?? 0;
}
let $ret = $scroll_container.scrollTop(target_scrollTop);
const new_scrollTop = $scroll_container.scrollTop();
@@ -327,13 +378,13 @@ export function scrollTop(target_scrollTop) {
return $ret;
}
-export function stop_auto_scrolling() {
+export function stop_auto_scrolling(): void {
if (in_stoppable_autoscroll) {
$scroll_container.stop();
}
}
-export function system_initiated_animate_scroll(scroll_amount) {
+export function system_initiated_animate_scroll(scroll_amount: number): void {
message_scroll_state.set_update_selection_on_next_scroll(false);
const viewport_offset = scrollTop();
in_stoppable_autoscroll = true;
@@ -345,7 +396,7 @@ export function system_initiated_animate_scroll(scroll_amount) {
});
}
-export function user_initiated_animate_scroll(scroll_amount) {
+export function user_initiated_animate_scroll(scroll_amount: number): void {
message_scroll_state.set_update_selection_on_next_scroll(false);
in_stoppable_autoscroll = false; // defensive
@@ -356,7 +407,10 @@ export function user_initiated_animate_scroll(scroll_amount) {
});
}
-export function recenter_view($message, {from_scroll = false, force_center = false} = {}) {
+export function recenter_view(
+ $message: JQuery,
+ {from_scroll = false, force_center = false} = {},
+): void {
// BarnOwl-style recentering: if the pointer is too high, move it to
// the 1/2 marks. If the pointer is too low, move it to the 1/7 mark.
// See keep_pointer_in_view() for related logic to keep the pointer onscreen.
@@ -394,7 +448,8 @@ export function recenter_view($message, {from_scroll = false, force_center = fal
}
}
-export function maybe_scroll_to_show_message_top() {
+export function maybe_scroll_to_show_message_top(): void {
+ assert(message_lists.current !== undefined);
// Sets the top of the message to the top of the viewport.
// Only applies if the top of the message is out of view above the visible area.
const $selected_message = message_lists.current.selected_row();
@@ -406,13 +461,14 @@ export function maybe_scroll_to_show_message_top() {
}
}
-export function is_message_below_viewport($message_row) {
+export function is_message_below_viewport($message_row: JQuery): boolean {
const info = message_viewport_info();
const offset = $message_row.get_offset_to_window();
return offset.top >= info.visible_bottom;
}
-export function keep_pointer_in_view() {
+export function keep_pointer_in_view(): void {
+ assert(message_lists.current !== undefined);
// See message_viewport.recenter_view() for related logic to keep the pointer onscreen.
// This function mostly comes into place for mouse scrollers, and it
// keeps the pointer in view. For people who purely scroll with the
@@ -430,7 +486,7 @@ export function keep_pointer_in_view() {
const top_threshold = info.visible_top + (1 / 10) * info.visible_height;
const bottom_threshold = info.visible_top + (9 / 10) * info.visible_height;
- function message_is_far_enough_down() {
+ function message_is_far_enough_down(): boolean {
if (at_top()) {
return true;
}
@@ -455,11 +511,14 @@ export function keep_pointer_in_view() {
return false;
}
- function message_is_far_enough_up() {
+ function message_is_far_enough_up(): boolean {
return at_bottom() || $next_row.get_offset_to_window().top <= bottom_threshold;
}
- function adjust(in_view, get_next_row) {
+ function adjust(
+ in_view: () => boolean,
+ get_next_row: ($message_row: JQuery) => JQuery,
+ ): boolean {
// return true only if we make an actual adjustment, so
// that we know to short circuit the other direction
if (in_view()) {
@@ -479,10 +538,11 @@ export function keep_pointer_in_view() {
adjust(message_is_far_enough_up, rows.prev_visible);
}
- message_lists.current.select_id(rows.id($next_row), {from_scroll: true});
+ message_lists.current.select_id(rows.id($next_row)!, {from_scroll: true});
}
-export function scroll_to_selected() {
+export function scroll_to_selected(): void {
+ assert(message_lists.current !== undefined);
const $selected_row = message_lists.current.selected_row();
if ($selected_row && $selected_row.length !== 0) {
recenter_view($selected_row);
@@ -491,11 +551,11 @@ export function scroll_to_selected() {
export let scroll_to_selected_planned = false;
-export function plan_scroll_to_selected() {
+export function plan_scroll_to_selected(): void {
scroll_to_selected_planned = true;
}
-export function maybe_scroll_to_selected() {
+export function maybe_scroll_to_selected(): void {
// If we have made a plan to scroll to the selected message but
// deferred doing so, do so here.
if (scroll_to_selected_planned) {
@@ -504,9 +564,8 @@ export function maybe_scroll_to_selected() {
}
}
-export function initialize() {
+export function initialize(): void {
$jwindow = $(window);
-
// This handler must be placed before all resize handlers in our application
$jwindow.on("resize", () => {
dimensions.height.reset();
| 0 |
6321ab54ce3b5e9d82c8837159e99b7dd8cddcb0
|
zulip/zulip
|
dropdown_widget: Show empty list text without initiating search.
Fixes #26649
If there are no items for dropdown widget to display, show empty
search result text.
|
commit 6321ab54ce3b5e9d82c8837159e99b7dd8cddcb0
Author: Aman Agrawal <[email protected]>
Date: Thu Sep 7 04:10:37 2023 +0000
dropdown_widget: Show empty list text without initiating search.
Fixes #26649
If there are no items for dropdown widget to display, show empty
search result text.
diff --git a/web/src/dropdown_widget.js b/web/src/dropdown_widget.js
index b30862480f..070ff761a3 100644
--- a/web/src/dropdown_widget.js
+++ b/web/src/dropdown_widget.js
@@ -86,6 +86,16 @@ export class DropdownWidget {
);
}
+ show_empty_if_no_items($popper) {
+ const list_items = this.list_widget.get_current_list();
+ const $no_search_results = $popper.find(".no-dropdown-items");
+ if (list_items.length === 0) {
+ $no_search_results.show();
+ } else {
+ $no_search_results.hide();
+ }
+ }
+
setup() {
this.init();
const delegate_container = this.$events_container.get(0);
@@ -123,13 +133,7 @@ export class DropdownWidget {
});
$search_input.on("input.list_widget_filter", () => {
- const list_items = this.list_widget.get_current_list();
- const $no_search_results = $popper.find(".no-dropdown-items");
- if (list_items.length === 0) {
- $no_search_results.show();
- } else {
- $no_search_results.hide();
- }
+ this.show_empty_if_no_items($popper);
});
// Keyboard handler
@@ -232,6 +236,7 @@ export class DropdownWidget {
this.on_show_callback(instance);
}.bind(this),
onMount: function (instance) {
+ this.show_empty_if_no_items($(instance.popper));
this.on_mount_callback(instance);
}.bind(this),
onHidden: function (instance) {
diff --git a/web/templates/dropdown_list_container.hbs b/web/templates/dropdown_list_container.hbs
index d7d1cca63e..5a03cdaeaa 100644
--- a/web/templates/dropdown_list_container.hbs
+++ b/web/templates/dropdown_list_container.hbs
@@ -6,6 +6,6 @@
<ul class="dropdown-list"></ul>
</div>
<div class="no-dropdown-items dropdown-list-item-common-styles">
- {{t 'No search results'}}
+ {{t 'No matching results'}}
</div>
</div>
| 0 |
26690adc4749a79ddb0fa8c50acb9db6c41ee2d0
|
zulip/zulip
|
Save the correct-from-dom rerendered message in _rows when rerendering
(imported from commit c021beef3106148a6d085ca16f34a1c4bb4fc7af)
|
commit 26690adc4749a79ddb0fa8c50acb9db6c41ee2d0
Author: Leo Franchi <[email protected]>
Date: Fri Mar 7 16:12:31 2014 -0500
Save the correct-from-dom rerendered message in _rows when rerendering
(imported from commit c021beef3106148a6d085ca16f34a1c4bb4fc7af)
diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js
index db9fd25767..d3ebb69f3e 100644
--- a/static/js/message_list_view.js
+++ b/static/js/message_list_view.js
@@ -623,8 +623,8 @@ MessageListView.prototype = {
// Re-render just this one message
this._add_msg_timestring(message);
var rendered_msg = $(templates.render('single_message', message));
- this._rows[message.id] = rendered_msg;
row.replaceWith(rendered_msg);
+ this._rows[message.id] = document.getElementById(message.dom_id);
if (was_selected) {
this.list.select_id(message.id);
}
| 0 |
649235cfec17b2b6f7addf18eb3fccc3c53f824d
|
zulip/zulip
|
python: Remove unused imports.
Signed-off-by: Anders Kaseorg <[email protected]>
|
commit 649235cfec17b2b6f7addf18eb3fccc3c53f824d
Author: Anders Kaseorg <[email protected]>
Date: Fri Feb 22 15:47:38 2019 -0800
python: Remove unused imports.
Signed-off-by: Anders Kaseorg <[email protected]>
diff --git a/puppet/zulip_ops/files/zulip-ec2-configure-interfaces b/puppet/zulip_ops/files/zulip-ec2-configure-interfaces
index 4ddc733d07..6fc45dbb95 100755
--- a/puppet/zulip_ops/files/zulip-ec2-configure-interfaces
+++ b/puppet/zulip_ops/files/zulip-ec2-configure-interfaces
@@ -48,8 +48,6 @@ import logging
import logging.handlers
import subprocess
-import sys
-
import boto.utils
import netifaces
if False:
diff --git a/zerver/apps.py b/zerver/apps.py
index 3556fcb319..6a9c92b6e7 100644
--- a/zerver/apps.py
+++ b/zerver/apps.py
@@ -1,6 +1,6 @@
import logging
-from typing import Any, Dict
+from typing import Any
from django.apps import AppConfig
from django.conf import settings
diff --git a/zerver/lib/export.py b/zerver/lib/export.py
index e57fdfeefd..31b6a18488 100644
--- a/zerver/lib/export.py
+++ b/zerver/lib/export.py
@@ -13,7 +13,6 @@ import ujson
import subprocess
import tempfile
import shutil
-import sys
from scripts.lib.zulip_tools import overwrite_symlink
from zerver.lib.avatar_hash import user_avatar_path_from_ids
from analytics.models import RealmCount, UserCount, StreamCount
diff --git a/zerver/lib/transfer.py b/zerver/lib/transfer.py
index 3abc667e26..f7a2ad5d2f 100644
--- a/zerver/lib/transfer.py
+++ b/zerver/lib/transfer.py
@@ -7,7 +7,7 @@ from mimetypes import guess_type
from zerver.models import UserProfile, Attachment, RealmEmoji
from zerver.lib.avatar_hash import user_avatar_path
-from zerver.lib.upload import read_local_file, S3UploadBackend, upload_image_to_s3
+from zerver.lib.upload import S3UploadBackend, upload_image_to_s3
from zerver.lib.parallel import run_parallel
s3backend = S3UploadBackend()
diff --git a/zerver/lib/url_preview/preview.py b/zerver/lib/url_preview/preview.py
index 590178e8c7..23e5c222ce 100644
--- a/zerver/lib/url_preview/preview.py
+++ b/zerver/lib/url_preview/preview.py
@@ -1,6 +1,4 @@
import re
-import logging
-import traceback
from typing import Any, Optional, Dict
from typing.re import Match
import requests
diff --git a/zerver/management/commands/generate_invite_links.py b/zerver/management/commands/generate_invite_links.py
index b484ed77a5..7cf5ee4945 100644
--- a/zerver/management/commands/generate_invite_links.py
+++ b/zerver/management/commands/generate_invite_links.py
@@ -7,7 +7,7 @@ from django.core.management.base import CommandError
from confirmation.models import Confirmation, create_confirmation_link
from zerver.lib.management import ZulipBaseCommand
from zerver.models import PreregistrationUser, email_allowed_for_realm, \
- email_allowed_for_realm, DomainNotAllowedForRealmError
+ DomainNotAllowedForRealmError
class Command(ZulipBaseCommand):
help = "Generate activation links for users and print them to stdout."
diff --git a/zerver/management/commands/transfer_uploads_to_s3.py b/zerver/management/commands/transfer_uploads_to_s3.py
index 470172fbf0..60d211b031 100644
--- a/zerver/management/commands/transfer_uploads_to_s3.py
+++ b/zerver/management/commands/transfer_uploads_to_s3.py
@@ -1,7 +1,3 @@
-
-import argparse
-import os
-import tempfile
from typing import Any
from django.core.management.base import BaseCommand, CommandParser, CommandError
diff --git a/zerver/migrations/0182_set_initial_value_is_private_flag.py b/zerver/migrations/0182_set_initial_value_is_private_flag.py
index 98af207f06..91d125ce6d 100644
--- a/zerver/migrations/0182_set_initial_value_is_private_flag.py
+++ b/zerver/migrations/0182_set_initial_value_is_private_flag.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import sys
-from django.db import migrations
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
diff --git a/zerver/tests/test_custom_profile_data.py b/zerver/tests/test_custom_profile_data.py
index d7e115d246..fba7c5437b 100644
--- a/zerver/tests/test_custom_profile_data.py
+++ b/zerver/tests/test_custom_profile_data.py
@@ -8,7 +8,7 @@ from zerver.lib.actions import get_realm, try_add_realm_custom_profile_field, \
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.bugdown import convert as bugdown_convert
from zerver.models import CustomProfileField, \
- custom_profile_fields_for_realm, get_realm, CustomProfileFieldValue
+ custom_profile_fields_for_realm, CustomProfileFieldValue
import ujson
class CustomProfileFieldTest(ZulipTestCase):
diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py
index 5b75a5d4e8..fc2f0170f4 100644
--- a/zerver/tests/test_push_notifications.py
+++ b/zerver/tests/test_push_notifications.py
@@ -8,7 +8,6 @@ from mock import call
from typing import Any, Dict, List, Optional
import base64
-import gcm
import os
import ujson
import uuid
diff --git a/zerver/tests/test_unread.py b/zerver/tests/test_unread.py
index 4ce6642675..48d371faf4 100644
--- a/zerver/tests/test_unread.py
+++ b/zerver/tests/test_unread.py
@@ -3,7 +3,6 @@
from typing import Any, List, Mapping
from django.db import connection
-from django.test import override_settings
from zerver.models import (
get_realm,
diff --git a/zerver/views/invite.py b/zerver/views/invite.py
index 390b0c257d..03a8fad94b 100644
--- a/zerver/views/invite.py
+++ b/zerver/views/invite.py
@@ -5,11 +5,11 @@ from typing import List, Optional, Set
from zerver.decorator import require_realm_admin, require_non_guest_human_user
from zerver.lib.actions import do_invite_users, do_revoke_user_invite, \
do_revoke_multi_use_invite, do_resend_user_invite_email, \
- get_default_subs, do_get_user_invites, do_create_multiuse_invite_link
+ do_get_user_invites, do_create_multiuse_invite_link
from zerver.lib.request import REQ, has_request_variables, JsonableError
-from zerver.lib.response import json_success, json_error, json_response
+from zerver.lib.response import json_success, json_error
from zerver.lib.streams import access_stream_by_id
-from zerver.lib.validator import check_string, check_list, check_bool, check_int
+from zerver.lib.validator import check_list, check_int
from zerver.models import PreregistrationUser, Stream, UserProfile, MultiuseInvite
import re
diff --git a/zerver/views/realm_logo.py b/zerver/views/realm_logo.py
index 506d8f0922..28428f61f3 100644
--- a/zerver/views/realm_logo.py
+++ b/zerver/views/realm_logo.py
@@ -2,10 +2,8 @@ from django.conf import settings
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.http import HttpResponse, HttpRequest
-from typing import Optional, Callable, Any
-from zerver.lib.validator import check_string, check_int, check_list, check_dict, \
- check_bool, check_variable_type, check_capped_string, check_color
+from zerver.lib.validator import check_bool
from zerver.lib.request import REQ, has_request_variables
from zerver.decorator import require_realm_admin
from zerver.lib.actions import do_change_logo_source
| 0 |
83e517fcf9c9aba6e9f3d6da3c221f0216ff1a25
|
zulip/zulip
|
Flush cache on all user presence updates.
(imported from commit 130eac36f9932350a29ed88f11dd3e2f6bf3f979)
|
commit 83e517fcf9c9aba6e9f3d6da3c221f0216ff1a25
Author: Steve Howell <[email protected]>
Date: Sun Sep 15 14:20:33 2013 -0400
Flush cache on all user presence updates.
(imported from commit 130eac36f9932350a29ed88f11dd3e2f6bf3f979)
diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py
index 9093bd1413..eb0dbe84cf 100644
--- a/zerver/lib/cache.py
+++ b/zerver/lib/cache.py
@@ -257,11 +257,14 @@ def status_dict_cache_key(user_profile):
return status_dict_cache_key_for_realm_id(user_profile.realm_id)
def update_user_presence_cache(sender, **kwargs):
+ # For any status update, flush the user's realm's entry in the
+ # UserPresence cache to avoid giving out stale state. Since we
+ # get a lot of presence updates, we are likely to get cache misses
+ # when new messages come in, but the query is pretty quick, and we
+ # no longer have the issue of Tornado needing to go the cache or DB
+ # to get presence info.
user_profile = kwargs['instance'].user_profile
- if kwargs['update_fields'] is None or "status" in kwargs['update_fields']:
- # If the status of the user changed, flush the user's realm's
- # entry in the UserPresence cache to avoid giving out stale state
- djcache.delete(KEY_PREFIX + status_dict_cache_key(user_profile))
+ djcache.delete(KEY_PREFIX + status_dict_cache_key(user_profile))
def realm_alert_words_cache_key(realm):
return "realm_alert_words:%s" % (realm.domain,)
| 0 |
1e625bc43bd975a2e7cbe7967d7abb375a16cb16
|
zulip/zulip
|
setting_ui: Fix sorting by "Expires at" column.
Previously, the sorting was broken due to
incorrect referencing of the property.
The code has been updated to use the "expiry_date"
property instead of "expires_at".
Fixes #29005.
|
commit 1e625bc43bd975a2e7cbe7967d7abb375a16cb16
Author: Sujal Shah <[email protected]>
Date: Fri Feb 23 16:52:48 2024 +0530
setting_ui: Fix sorting by "Expires at" column.
Previously, the sorting was broken due to
incorrect referencing of the property.
The code has been updated to use the "expiry_date"
property instead of "expires_at".
Fixes #29005.
diff --git a/web/src/settings_invites.ts b/web/src/settings_invites.ts
index 3763bd4dba..085a966644 100644
--- a/web/src/settings_invites.ts
+++ b/web/src/settings_invites.ts
@@ -127,7 +127,7 @@ function populate_invites(invites_data: {invites: Invite[]}): void {
...ListWidget.generic_sort_functions("alphabetic", ["ref"]),
...ListWidget.generic_sort_functions("numeric", [
"invited",
- "expires_at",
+ "expiry_date",
"invited_as",
]),
},
diff --git a/web/templates/settings/invites_list_admin.hbs b/web/templates/settings/invites_list_admin.hbs
index 11726cee56..455ff17fd3 100644
--- a/web/templates/settings/invites_list_admin.hbs
+++ b/web/templates/settings/invites_list_admin.hbs
@@ -19,7 +19,7 @@
<th data-sort="alphabetic" data-sort-prop="ref">{{t "Invited by" }}</th>
{{/if}}
<th data-sort="numeric" data-sort-prop="invited">{{t "Invited at" }}</th>
- <th data-sort="numeric" data-sort-prop="expires_at">{{t "Expires at" }}</th>
+ <th data-sort="numeric" data-sort-prop="expiry_date">{{t "Expires at" }}</th>
<th data-sort="numeric" data-sort-prop="invited_as">{{t "Invited as" }}</th>
<th class="actions">{{t "Actions" }}</th>
</thead>
| 0 |
f0e49e6cbb6f3277f9b30ad91747066093054e02
|
zulip/zulip
|
Updated webpack-bundle-tracker to 0.3.0.
|
commit f0e49e6cbb6f3277f9b30ad91747066093054e02
Author: Gooca <[email protected]>
Date: Thu Mar 22 00:08:03 2018 +0000
Updated webpack-bundle-tracker to 0.3.0.
diff --git a/package.json b/package.json
index b313eea5ce..8cd4771daf 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"underscore": "1.8.3",
"webfonts-generator": "0.4.0",
"webpack": "2.5.1",
- "webpack-bundle-tracker": "0.2.0",
+ "webpack-bundle-tracker": "0.3.0",
"winchan": "0.2.0",
"xdate": "0.8.2",
"zxcvbn": "4.4.2"
diff --git a/version.py b/version.py
index 6669c8dd75..0d79baa58a 100644
--- a/version.py
+++ b/version.py
@@ -8,4 +8,4 @@ ZULIP_VERSION = "1.7.1+git"
# Typically, adding a dependency only requires a minor version bump, and
# removing a dependency requires a major version bump.
-PROVISION_VERSION = '17.0'
+PROVISION_VERSION = '17.1'
diff --git a/yarn.lock b/yarn.lock
index e8e220fbbf..2e9fe4f8b4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6873,9 +6873,9 @@ webidl-conversions@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
[email protected]:
- version "0.2.0"
- resolved "https://registry.yarnpkg.com/webpack-bundle-tracker/-/webpack-bundle-tracker-0.2.0.tgz#291198b374f040a9c52046ecd26df45f00a073c3"
+webpack-bundle-tracker@^0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/webpack-bundle-tracker/-/webpack-bundle-tracker-0.3.0.tgz#c900e9ecb54b639bec1b3bb8c0e9cd9400984c0c"
dependencies:
deep-extend "^0.4.1"
mkdirp "^0.5.1"
| 0 |
a98b0cf35df7ea855a13207b8cb3cb3bc8a300dd
|
zulip/zulip
|
travis: Workaround postgres 9.1 conflict issues on trusty.
We ran into a bug with the Travis CI infrastructure where it postgres
9.1 is installed on the system, and so when we'd do an apt upgrade
with a new version of 9.1, the 9.1 daemon would end up getting started
and conflict with the 9.3 daemon we were trying to run.
|
commit a98b0cf35df7ea855a13207b8cb3cb3bc8a300dd
Author: Tim Abbott <[email protected]>
Date: Sat Jan 9 15:13:12 2016 -0800
travis: Workaround postgres 9.1 conflict issues on trusty.
We ran into a bug with the Travis CI infrastructure where it postgres
9.1 is installed on the system, and so when we'd do an apt upgrade
with a new version of 9.1, the 9.1 daemon would end up getting started
and conflict with the 9.3 daemon we were trying to run.
diff --git a/tools/travis/production-helper b/tools/travis/production-helper
index 9eeb329fd0..c691531f70 100755
--- a/tools/travis/production-helper
+++ b/tools/travis/production-helper
@@ -10,6 +10,14 @@ tar -xf zulip-server-travis.tar.gz
mv zulip-server-travis /root/zulip
export APT_OPTIONS="-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold"
+
+# Make sure we've done an apt upgrade and then stop postgres to
+# workaround problems with Travis CI having multiple postgres versions
+# installed on the system and 9.1 starting up and conflicting with
+# running 9.3 later.
+apt-get upgrade -y $APT_OPTIONS
+service postgresql stop
+# Install Zulip
/root/zulip/scripts/setup/install
cat >>/etc/zulip/settings.py <<EOF
| 0 |
4bf8c19b32eef460dd0b4780608c305b5c4ddab1
|
zulip/zulip
|
message_view_header: Fix misleading variable name.
It never contained only icon data.
|
commit 4bf8c19b32eef460dd0b4780608c305b5c4ddab1
Author: Tim Abbott <[email protected]>
Date: Mon May 13 17:30:47 2024 -0700
message_view_header: Fix misleading variable name.
It never contained only icon data.
diff --git a/web/src/message_view_header.ts b/web/src/message_view_header.ts
index 450d0f175c..843a038f4a 100644
--- a/web/src/message_view_header.ts
+++ b/web/src/message_view_header.ts
@@ -84,7 +84,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVie
const description = filter.get_description()?.description;
const link = filter.get_description()?.link;
assert(title !== undefined);
- const icon_data = filter.add_icon_data({
+ const context = filter.add_icon_data({
title,
description,
link,
@@ -93,7 +93,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVie
if (filter.has_operator("channel") && !filter._sub) {
return {
- ...icon_data,
+ ...context,
sub_count: "0",
formatted_sub_count: "0",
rendered_narrow_description: $t({
@@ -109,7 +109,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVie
const current_stream = filter._sub;
const sub_count = peer_data.get_subscriber_count(current_stream.stream_id);
return {
- ...icon_data,
+ ...context,
is_admin: current_user.is_admin,
rendered_narrow_description: current_stream.rendered_description,
sub_count,
@@ -118,7 +118,7 @@ function get_message_view_header_context(filter: Filter | undefined): MessageVie
};
}
- return icon_data;
+ return context;
}
export function colorize_message_view_header(): void {
| 0 |
7867830e14df9b8287a1c6b28c9446135d5f5579
|
zulip/zulip
|
settings: Adjust styling of ? icons.
|
commit 7867830e14df9b8287a1c6b28c9446135d5f5579
Author: Yash RE <[email protected]>
Date: Sat Jun 22 00:30:06 2019 +0530
settings: Adjust styling of ? icons.
diff --git a/static/styles/settings.scss b/static/styles/settings.scss
index 23e506c273..9f85c63902 100644
--- a/static/styles/settings.scss
+++ b/static/styles/settings.scss
@@ -236,6 +236,13 @@ td .button {
opacity: 0.9;
}
+.email-change-form .settings-info-icon,
+.user-name-section .settings-info-icon {
+ position: relative;
+ top: 2px;
+ left: 1px;
+}
+
.settings-section {
display: none;
| 0 |
62136d0c8ea4a61440f3bf17a0b924983be45c0f
|
zulip/zulip
|
[manual] Add the new digest_emails queue processor to the supervisor config.
This commit needs a puppet apply to take effect.
(imported from commit 0b26c385bad7c928912411ba85b70512b84be643)
|
commit 62136d0c8ea4a61440f3bf17a0b924983be45c0f
Author: Jessica McKellar <[email protected]>
Date: Mon Oct 21 16:40:04 2013 -0400
[manual] Add the new digest_emails queue processor to the supervisor config.
This commit needs a puppet apply to take effect.
(imported from commit 0b26c385bad7c928912411ba85b70512b84be643)
diff --git a/servers/puppet/modules/zulip/files/supervisor/conf.d/zulip.conf b/servers/puppet/modules/zulip/files/supervisor/conf.d/zulip.conf
index 13ea04b4bf..2727312790 100644
--- a/servers/puppet/modules/zulip/files/supervisor/conf.d/zulip.conf
+++ b/servers/puppet/modules/zulip/files/supervisor/conf.d/zulip.conf
@@ -164,12 +164,24 @@ redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-feedback_messages.log ; stdout log path, NONE for none; default AUTO
directory=/home/zulip/deployments/current/
+[program:zulip-events-digest_emails]
+command=python /home/zulip/deployments/current/manage.py process_queue digest_emails
+priority=600 ; the relative start priority (default 999)
+autostart=true ; start at supervisord start (default: true)
+autorestart=true ; whether/when to restart (default: unexpected)
+stopsignal=TERM ; signal used to kill process (default TERM)
+stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10)
+user=zulip ; setuid to this UNIX account to run the program
+redirect_stderr=true ; redirect proc stderr to stdout (default false)
+stdout_logfile=/var/log/zulip/events-digest_emails.log ; stdout log path, NONE for none; default AUTO
+directory=/home/zulip/deployments/current/
+
; The below sample group section shows all possible group values,
; create one or more 'real' group: sections to create "heterogeneous"
; process groups.
[group:zulip-workers]
-programs=zulip-events-user-activity,zulip-events-user-activity-interval,zulip-events-user-presence,zulip-events-signups,zulip-events-confirmation-emails,zulip-events-missedmessage_reminders,zulip-events-slowqueries,zulip-events-message_sender,zulip-events-feedback_messages ; each refers to 'x' in [program:x] definitions
+programs=zulip-events-user-activity,zulip-events-user-activity-interval,zulip-events-user-presence,zulip-events-signups,zulip-events-confirmation-emails,zulip-events-missedmessage_reminders,zulip-events-slowqueries,zulip-events-message_sender,zulip-events-feedback_messages,zulip-events-digest_emails ; each refers to 'x' in [program:x] definitions
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.