Commit Graph

40138 Commits

Author SHA1 Message Date
Anders Kaseorg c1c9a2e8ee docs: Bump copyright year.
Also fix incorrect 2011 copyright years; the original Zulip, Inc. that
was merged into Dropbox, Inc. was incorporated in 2012, not 2011.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:28:15 -08:00
Anders Kaseorg 6ea11b003b license: Move copyright notice from LICENSE to NOTICE.
A LICENSE file is supposed to be an unmodified copy of the license,
and the license appendix explains that the copyright line should be
included with the notice.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:28:12 -08:00
Anders Kaseorg f8d11c6479 compose: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 154fc03fa5 composebox_typeahed: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg dc0972b775 loading: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 56d0d30387 hotspots: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg f8fbae4d8e components: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 64b78ad992 styles: Use range context queries to eliminate *_max variables.
On a high-DPI display or with a non-default zoom level, the browser
viewport may have a width strictly between md_max = 767px and md_min =
768px.  Use only the *_min bounds for consistency.

This requires queries with strict inequalities to express upper
bounds (width < md_min).  Fortunately, that functionality is provided
by range context queries.  Unfortunately, those are not supported in
all browsers.  Fortunately, we can compile them away using
postcss-media-minmax.  Unfortunately, postcss-media-minmax currently
subtracts 1px for strict inequalities anyway to work around a Safari
rounding bug.  Fortunately, 0.02px should be sufficient for that, so I
submitted a PR:

https://github.com/postcss/postcss-media-minmax/pull/28

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:23:59 -08:00
Anders Kaseorg d679aa015d scroll_bar: Flip max-width queries for min-width.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:23:59 -08:00
Anders Kaseorg ae0afa2390 markdown: Explode config dict.
Commit 434094e599 (#11321) changed this
from an Extension to a subclass of Markdown, so it no longer has any
reason to use a config dict structured like that of an Extension.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 10:52:31 -05:00
ritik 50b0496a3a bitbucket webhook: Fully deprecate username field. 2021-02-05 09:46:27 -05:00
Vishnu KS 6a9e534a22 help: Clarify the number of invites one can send.
The 100 invite per day restriction is only for the free plan. Also,
the value 100 is configurable using
settings.INVITES_DEFAULT_REALM_DAILY_MAX. On top of this, newly
created realms on free plan combined can only send
INVITES_NEW_REALM_LIMIT_DAYS number of invites. So it's better not
to hardcode 100 in the doc.
2021-02-04 21:08:06 -05:00
marchantia 56bf5f2a50 docs: Fix typo in 'caching in zulip'.
Change 'These days are fetched in' to 'This data is fetched in'.
2021-02-04 21:00:13 -05:00
Anders Kaseorg aa650a4c88 js: Escape strings interpolated into CSS selectors with CSS.escape.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 11:00:06 -08:00
Steve Howell 9fc1adce60 node tests: Clean up subs test.
We start our stream_id sequence at 101, and we
clarify the somewhat strange assertions related
to the "active" class.
2021-02-04 13:55:34 -05:00
Steve Howell c407293577 node tests: Clean up hard coded stream_ids.
I use 101 for the stream_id (so less chance for
false positives) and avoid hard coding it.
2021-02-04 13:55:34 -05:00
Steve Howell 8a8bf636c6 node tests: Remove unnecessary zjquery stubs.
It's not clear to me why this code was necessary,
and I assume it was either originally written
with a bit of misunderstanding of how zjquery
works or it became unnecessary with some refactoring
of the "real" code.
2021-02-04 11:53:46 -05:00
Anders Kaseorg 3560eb90b2 node_tests: Fix #comepose-textarea typo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 09:24:13 -05:00
Anders Kaseorg 08fe6e4a8f blueslip: Pass through the return value in measure_time.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 09:11:04 -05:00
m-e-l-u-h-a-n ccf520ff13 logging: Migrate many backend tests to use assertLogs.
This commit  migrates some of the backend tests to use assertLogs(),
instead of mock.patch() as planned in #15331.

Tweaked by tabbott to avoid tautological assertions.
2021-02-03 17:55:49 -08:00
m-e-l-u-h-a-n 7417ac9165 logging: Remove unncessary logging patches in backend tests.
There were some tests that had mock patches for logging, although no
logging was actually happening there. This commit removes such patches
in `corporate/tests/test_stripe.py`, `zerver/tests/test_cache.py`,
`zerver/tests/test_queue_worker.py`,
and `zerver/tests/test_signup.py`.
2021-02-03 17:47:38 -08:00
Steve Howell c2e3d626e2 node tests: Move data setup to module level for peer_data.
We move some of the data setup to the top of the file.

We also remove some get_sub() calls that aren't really
necessary now that peer_data and stream_data are more
independent.
2021-02-03 15:23:17 -08:00
Steve Howell 17ea215f18 minor: Remove peer_data.clear(). 2021-02-03 15:23:17 -08:00
Steve Howell 58855e8224 refactor: Remove maybe_clear_subscribers().
The maybe_clear_subscribers() function was an artifact of
when we used to attach subscribers to the "sub" records in
stream_data.js.  I think it was basically a refactoring
shim, and due to some other recent cleanup, it was only
used in test code.

We also change how we validate stream ids.

Going forward, peer_data just looks up stream_ids with the
normal stream_data API when it's trying to warn about
rogue stream_ids coming in.  As I alluded to in an earlier
commit, some of the warning code here might be overly
defensive, but at least it's pretty self-contained.
2021-02-03 15:23:17 -08:00
Steve Howell e44e48ef20 minor: Add get_user_set call that I missed earlier.
In my recent commit to introduce get_user_set() I
inadvertently skipped one place to call it.

I also remove a return statement that was made
unnecessary by the new get_user_set() helper.
2021-02-03 15:23:17 -08:00
Steve Howell 016038dcd1 blueslip: Add measure_time wrapper.
Now when we want to measure how long a block
of code takes to execute, we just wrap it with
`blueslip.measure_time`, instead of the awkward
idiom from my original commit of getting a callback
function.

My rationale for the original scheme was that I
wanted to minimize diffs and avoid changing
`const` to `let` in a few cases, but I believe
now that the function wrapper is nicer.

In a few cases I just removed the blueslip timing
code, since I was able to confirm on czo that
the times were pretty minimal.
2021-02-03 15:23:17 -08:00
Anders Kaseorg 4bcf7131c1 push-to-pull-request: Wait for GitHub background update before merge.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-03 14:55:08 -08:00
aditya-mitra b8f57fa6bb provision: Add provision support for KDE Neon 20.04.
PostgreSQL 12 is used for Neon 20.04, which is a fork of Ubuntu 20.04.
2021-02-03 11:51:05 -08:00
Anders Kaseorg 4c09a549c9 release-checklist: Push dev tags to zulip-internal.git too.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-03 10:07:47 -08:00
Aman Agrawal 58a4469896 version: Correct API feature level.
API feature level should have been increased along with #17010
which increased the community topic editing time.
2021-02-03 10:20:59 -05:00
Aditya Mitra aafd9ee2b6
docs: Fix typo in setup-advanced.md.
Fixed the grammatical error by changing long to longer
2021-02-01 08:58:32 -08:00
Ganesh Pawar bc6c83c12e docs: Remove duplicate entry of file in widgets documentation. 2021-01-30 09:01:13 -08:00
Ganesh Pawar f70629ea6c composebox: Add typeahead for /todo. 2021-01-30 09:01:13 -08:00
Ganesh Pawar 632abd45eb ui_report: Migrate ui_report.message to ui_report.client_error. 2021-01-30 07:48:44 -08:00
Ganesh Pawar 5802bbfb98 ui_report: Add ui_report.client_error. 2021-01-30 07:48:44 -08:00
Steve Howell e243af531b refactor: Extract get_user_set in peer_data.
We now use the same code in all places to
get the bucket of user_ids that correspond
to a stream, and we consistently treat
a stream as having zero subscribers, not
an undefined number of subscribers, in
the hypothetical case of us asking about
a stream that we're not tracking.

The behavior for untracked streams has
always been problematic, since if a
stream is untracked, all bets are off.

So now if we don't "track" the stream,
the subscriber count is zero.  None of
our callers distinguish between undefined
and zero.

And we just consider the stream to be subscribed
by a user when add_subscriber is called,
even if we haven't been told by stream_data
to track the stream.  (We also stop
returning true/false from add_subscriber,
since only test code was looking at it.)

We protect against the most likely source
of internal-to-the-frontend bugs by adding
the assert_number() call.

We generally have to assume that the server
is sending us sensible data at page load
time, or all bets are off.

And we have good protections in place
for unknown ids in our dispatch code
for peer_add/peer_remove events.
2021-01-29 15:21:07 -08:00
Steve Howell 52281462e2 zephyr: Close exemption for stream-link warnings.
For the rare case where you're doing a link to a private
stream from a larger private stream that is a superset of
the former, we have bypassed warnings that you are linking
to a private stream.

I'm not sure we need this exemption for any situation
(just let the user bypass the warning), but we definitely
don't want false positives for the exemption.

For now I am closing down this loophole specifically for
Zephyr users.

Zephyr users are special in that we might not get
subscriber info on certain streams.

The current behavior for this edge case is a little
unclear.  The current implementation of
peer_data.is_subscriber_subset returns false if both
streams are untracked, but most streams are tracked if we
have a sub for them and just get treated as having an
empty set of subscribers.  And an empty set is a subset of
itself.  Upcoming changes to our server data are gonna
make this edge case even more annoying to maintain.
2021-01-29 15:21:07 -08:00
Steve Howell 5a27ed6a72 refactor: Change where we initialize scrolling code.
This is a more sensible place to initialize the
the scrolling handler, plus it breaks an annoying
indirect dependency on jQuery for the unit tests.
2021-01-29 15:21:07 -08:00
Steve Howell 6c4b1183f2 node tests: Move peer_data tests to new peer_data.js. 2021-01-29 15:21:07 -08:00
Steve Howell 2edfdb4ff8 refactor: Extract bulk functions to add/remove peers.
We also streamline some of the error handling code
by doing everything up front.  This will prevent
scenarios where a single bad stream_id/user_id causes a
bunch of the same warnings in an inner loop.
2021-01-29 15:21:07 -08:00
Steve Howell e820c43b77 node tests: Verify peer_add/peer_remove save changes. 2021-01-29 15:21:07 -08:00
Steve Howell 805a2b6670 refactor: Remove stream_data.update_subscribers_count.
This removes a bit of complexity.  If a piece of
settings code needs to render a stream with
subscribers, it just asks for it.

We no longer have the brittle, action-at-a-distance
mechanism of mutating the subscriber count on to
the stream_data version of a sub.

Stream subs are pretty small, so making copies of
them is cheap, and the blueslip timings from the
previous commit can help confirm that.

There is some discussion of putting `subscriber_count`
on the Stream model, which may eventually get us
away from tracking it in `peer_data.js`, but we will
cross that bridge when we get there.  See
https://github.com/zulip/zulip/issues/17101 for
more details.
2021-01-29 15:21:07 -08:00
Steve Howell 5bd68b5180 minor: Get blueslip times for stream settings. 2021-01-29 15:21:07 -08:00
Steve Howell dc9b4de05f refactor: Call peer_data.get_subscriber_count().
We are trying to move away from having the
subscriber count on the sub.

This commit handles the easy one-liners
in the JS code.
2021-01-29 15:21:07 -08:00
Steve Howell 5babe54310 typeahead: Use stream_weekly_traffic for tiebreaker.
The weekly stream traffic is a better tiebreaker
for stream typeaheads than subscriber count, as
it's more directly a measure of a stream's current
relevance.

Normally stream traffic and subscriber counts are
closely correlated, but a good example for me is
the #twitter feed on czo, which only has 80 subscribers,
but which gets more traffic than our #integrations
stream (with 16k subscribers).  I would rather
see #twitter win the tiebreaker (if it even got
to the tiebreaker).

The main motivation behind this fix, though, is
to break our dependency on peer_data, which has
some upcoming changes that will introduce some
performance tradeoffs, and I want one less place
to audit.

Also, it will be easier long term to share this
code with mobile if we don't require mobile
to pull in our peer_data dependency.  (The webapp
has different forces than mobile that dicate
our data structures.)
2021-01-29 15:21:07 -08:00
Nikhil Maske aadd42f9e8 design: Adjust the visibility of the spinner icon.
The spinner icon is not visible until the user clicks on topic_edit_save,
so the space alloted to spinner-icon looks empty for rest of the time.
To improve the design, the spinner icon is only shown when the user
clicks on topic_edit_save.
2021-01-29 14:55:06 -08:00
Vishnu KS 03879eec6d email_log: Mark EmailLogBackEnd.log_email as a staticmethod.
We don't access the self attribute in this method.
2021-01-29 14:51:38 -08:00
Vishnu KS 5870de0fa0 dev_settings: Remove email forwarding related settings.
These are now set in dev-secrets.
2021-01-29 14:51:38 -08:00
Vishnu KS 7d8ade3b2a dev_settings: Allow setting the value of EMAIL_USE_TLS from dev-secrets. 2021-01-29 14:51:38 -08:00
Vishnu KS edac24acf1 email_log: Inherit EmailLogBackEnd from smtp.EmailBackend.
EmailLogBackend used to create a new EmailMessage and copy
only certain values from the original EmailMultiAlternatives
object. This resulted in the loss of information and made
it harder to test PRs like
https://github.com/zulip/zulip/pull/17121.

So instead of creating a new EmailMessage, tweak and send the existing
EmailMultiAlternatives object.
2021-01-29 14:51:38 -08:00