Commit Graph

34434 Commits

Author SHA1 Message Date
Anders Kaseorg 91b57be02e dependencies: Upgrade stacktrace-gps from 3.0.3 to 3.0.4.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 22:13:33 -08:00
Anders Kaseorg e88fac499f dependencies: Upgrade emoji-datasource from 4.0.4 to 5.0.1.
The “Smileys & People” category has been split into “Smilys & Emotion”
and “People & Body”.

Also, fix generate_sha1sum_emoji to read the emoji-datasource-google
version from yarn.lock, since package.json only gives a version range.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 21:30:51 -08:00
Rohitt Vashishtha f4b02ce31e compose: Add fences of unused length in quote-and-reply.
When quoting a message with fenced code blocks without a language,
we used to have ambiguity in which '```' fence terminates the quote.

This commit adds explicitly non-interfering fences, which fixes the
above issue as well as makes the raw message easier to quickly read.

Fixes #12446.
2020-02-04 18:17:47 -08:00
Rohitt Vashishtha f5990ccbff compose: Add message info with quote-and-reply.
This adds the original message's sender name along with a
link to narrow to that message when using quote-and-reply.

Fixes #11568.
2020-02-04 18:17:47 -08:00
Tim Abbott b9853ac1bf subscription_type: Improve wording for full members case.
We have a consistent name for these that we use in documentation.
2020-02-04 17:14:28 -08:00
Ryan Rehman 174b2abcfd settings: Migrate to stream_post_policy structure.
This commit includes a new `stream_post_policy` setting,
by replacing the `is_announcement_only` field from the Stream model,
which is done by mirroring the structure of the existing
`create_stream_policy`.

It includes the necessary schema and database migrations to migrate
the is_announcement_only boolean field to stream_post_policy,
a smallPositiveInteger field similar to many other settings.

This change is done to allow organization administrators to restrict
new members from creating and posting to a stream. However, this does
not affect admins who are new members.

With many tweaks by tabbott to documentation under /help, etc.

Fixes #13616.
2020-02-04 17:08:08 -08:00
Anders Kaseorg 31aecc0abb run-casper: Flush stdout before calling subprocess.
These markers were not getting correctly interleaved with the test
output in the CircleCI logs.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 16:17:37 -08:00
Mateusz Mandera 00de35b28a docs: Typo fixes in testing/philosophy.md. 2020-02-04 13:58:13 -08:00
Anders Kaseorg fa558de6d8 commit-message-lint: Detect the upstream remote name.
My upstream remote is named origin, so commit-message-lint was always
complaining at me.  Detect the right remote name from the output of
`git remote -v`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 13:57:51 -08:00
Pragati Agrawal b975d693bd stream_edit: Fix realm time sync of notifications setting checkbox.
This fixes the buggy behavior for streams which inherits the notification
setting from UserProfile, and are actively opened in "Streams > Stream
settings", if a user has opened two browser windows, and changes the
notification setting from "Settings > Notifications", then the changes
don't reflect such "Streams > Stream settings" notification setting
checkboxes for such stream.

Partially fixes: #12304.
2020-02-04 13:53:27 -08:00
Pragati Agrawal e79c28e13c stream_edit: Use e.currentTarget instead of e.target.
Here we have attached our handler to `.sub_setting_checkbox` so
`e.currentTarget` will return element with class `.sub_setting_checkbox`
but `e.target` will return exactly which element we have clicked, which
could be a child of `.sub_setting_checkbox`. So instead of,

```
$(e.target).closest(".sub_setting_checkbox")
```

we can use

```
$(e.currentTarget)
```

which is more clean and intuitive.

- `e.currentTarget` is less popular which could be the reason behind using
  two step hack to get the targetted element.
2020-02-04 13:53:27 -08:00
Pragati Agrawal 16abd7ec96 subs: Use single jquery-handlers for multiple events.
Rather than defining two different jquery event-handlers for two different
events, we can use a single jquery handler as the function is the same for
both handlers.
2020-02-04 13:53:27 -08:00
Pragati Agrawal 84fd0b0974 stream_edit: Remove separate click handlers from notifications checkboxes.
Rather than looping on each setting checkbox (except "Mute stream"), we can
attach single click handler to `.sub_setting_checkbox` class.
2020-02-04 13:53:27 -08:00
Mateusz Mandera 30d02c2e2c test_fixtures: app_label should be a positional arg in call_command.
We were incorrectly passing it as a kwarg, which would cause an
exception on Django 2.
2020-02-04 12:46:53 -08:00
Mateusz Mandera 5de832283b test_auth_backends: Remove logger mocking that will fail on Django 2.2.
On Django 2.2 there is no longer a logger object in that module, so it's
best to remove this mocking as it's not essential to the tests.
2020-02-04 12:46:53 -08:00
Mateusz Mandera 6a7cdfa2c1 auth: Fix error on startup in django-two-factor-auth in Django 2.1+.
https://github.com/Bouke/django-two-factor-auth/issues/297
This setting was added in 1.9 version of the app and can be used
harmleslly in our current Django 1.11-based code and will prevent an
error on Django 2.1+ when we move there.
2020-02-04 12:46:53 -08:00
Mateusz Mandera 0e7c97378e is_safe_url: Use allowed_hosts instead of depreciated host argument.
Judging by comparing django 1.11 with django 2.2 code of this function,
this shouldn't change any behavior.
2020-02-04 12:46:53 -08:00
Mateusz Mandera bc062e1c4d auth: Give all backend authenticate() optional request argument.
This is required for our migration to Django 2.2. authenticate()
definitions need to have that starting with Django 2.1.
rate_limit_auth needs to be adjusted to expect the request in the first
positional argument instead of a kwarg.
2020-02-04 12:46:53 -08:00
Tim Abbott ceb0879b0d unread: Add a block comment explaining how it works. 2020-02-04 12:39:58 -08:00
Tim Abbott 02bc630881 presence: Document why we no longer need suspect_offline.
Since it took a lot of effort to debug the original issue that caused
us to introduce suspect_offline, it seems worth writing a comment
explaining why we won't see that issue here.
2020-02-04 12:35:51 -08:00
Steve Howell e3ad9baf1d presence: Add process_presence_event.
This lets us conditionally remove the email
field from a presence event if the client
has registered with the slim_presence flag.
2020-02-04 12:30:36 -08:00
Steve Howell 9847d4d9a3 refactor: Use user_id in get_status_dict_by_user.
This avoids a needless user lookup in apply_event.
2020-02-04 12:30:36 -08:00
Steve Howell a672a00677 presence: Add user_id to presence event.
In a later commit, we will eliminate email for
clients who have set slim_presence as their
preference.
2020-02-04 12:30:36 -08:00
Steve Howell 36aee9e69c presence: Remove suspect_offline flag.
We now use user_ids for presence, so we don't need
to worry about races related to unknown emails
being sent to us.  Now we just update the data
structure based on user_id, and
it will be there when we render the presence
widget for that user_id, or else it will
simply be ignored.

It's not clear to me whether we still need
dont_block here, so I didn't touch that code.

Here is the commit that added the suspect_offline
flag, for easy reference:

f207450cdb
2020-02-04 12:30:36 -08:00
Steve Howell bf9144ff69 presence: Add slim_presence flag.
This flag affects page_params and the
payload you get back from POSTs to this
url:

    users/me/presence

The flag does not yet affect the
presence events that get sent to a
client.
2020-02-04 12:30:34 -08:00
Steve Howell 145c17d9d6 presence: Remove obsolete defensive code.
If you look at info_for, it clearly never returns
`undefined`, so this defensive code isn't preventing
any bugs.

Also, we are doing a better job now of filtering
user_ids in upstream code.
2020-02-04 12:24:53 -08:00
Steve Howell ef84d47d88 presence: Add warning for missing user_id.
This is defensive code for the scenario that we
have a user_id in presence but not people.  This is
unlikely to occur by the time that we actually render
the buddy list, which is the context for this code.

We have previously been reporting an error here via
the people code, but we add an additional warning.
Also, we filter the user_id from the result.
2020-02-04 12:24:53 -08:00
Anders Kaseorg 4480963f5a dict: Remove each method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg fac2c71776 dict: Replace items method with @@iterator method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg 9e1343ff8a dict, lazy_set: Return an iterator from values method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg 45d3be5449 dict, lazy_set: Return an iterator from keys method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg 61de2e8192 dict: Remove is_empty method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg 60fac80c8e dict, lazy_set: Replace num_items method with size property.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg da633e953e lazy_set: Convert LazySet to a real class.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg fe54e73c77 dict, lazy_set: Rename del method to delete, for consistency with Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg 0e657756f1 dict: Make set method return value consistent with Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:03 -08:00
Anders Kaseorg ab61222dd5 dict: Reimplement Dict using Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:02 -08:00
Anders Kaseorg b16222a38b dict: Remove setdefault method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:02 -08:00
Anders Kaseorg 8872aca907 dict: Remove clone method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:02 -08:00
Anders Kaseorg 22555f53ad dict: Remove Dict.from_array.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:02 -08:00
Anders Kaseorg 52765796c2 dict: Remove Dict.from.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:22:02 -08:00
Anders Kaseorg 5b824702b4 unread: Replace key_to_bucket Map with Dict/FoldDict/IntDict.
This reverts commit d84646f091 (which
incorrectly assumed in unread_topic_counter that the messages were
present in the message store), while fixing the type confusion problem
by using IntDict for stream_id keys.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-04 12:21:29 -08:00
Tim Abbott c5af0fccce docs: Fix anchors for using.
We could have just updated the links, but it's probably better the way
it was originally.
2020-02-03 16:55:28 -08:00
Tim Abbott 4e34f672ff docs: Reorganize testing.md and using.md.
This is a fairly involved set of changes, including changes that:

* Delete various legacy or semi-duplicated sections of testing.md.
  Nobody needs to manually delete the postgres datbase anymore, as
  reflected in the fact that the docs still mention postgres 9.1 from
  Ubuntu Precise.
* Simplify the distracting heading section at the top of testing.md.
* Move content on manual testing to docs/development/using.md.
* Moves some content related to managing the database to
  schema-migrations.md. (Resulting in some cleanups to that page as
  well).

I ideally would have split this into smaller pieces.
2020-02-03 16:43:27 -08:00
Tim Abbott 32ff28bf24 docs: Add an article explaining our testing philosophy. 2020-02-03 16:32:35 -08:00
Tim Abbott 2f3a0fb80a devtools: Improve labels and headings for some tools.
It's useful to be a bit more clear about what precisely these tools
are for.
2020-02-03 16:13:34 -08:00
Anders Kaseorg 252910202b poll_widget: Convert votes from object to Map.
Fixes implicity stringification of the user ID keys.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-03 15:59:26 -08:00
Anders Kaseorg 85620df34e poll_widget: Convert key_to_option from object to Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-03 15:59:26 -08:00
Anders Kaseorg 849c7f83a0 blueslip_stacktrace: Handle promises in sourceCache.
Fixes “TypeError: sourceContent.split is not a function” at
blueslip_stacktrace.ts:60 when there’s another error during page load.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-03 15:58:57 -08:00
Vishnu KS df5345705c import: Support importing team icon from slack. 2020-02-03 14:09:05 -08:00