Commit Graph

27504 Commits

Author SHA1 Message Date
Rhea Parekh 104b2342d9 docs: Update import-from-gitter doc.
The changes here are primarily to better document how to get a Gitter
API token.
2018-07-28 15:43:12 -07:00
Rhea Parekh ddf011c915 requirements: Upgrade mypy to 0.620.
Fixes #9975.
2018-07-28 15:35:32 -07:00
Rhea Parekh 6e7905651f mypy: Fix type errors relate to 'mock'.
1. The type of a mock object should be 'Any'.
2. 'mock' is being imported in the wrong manner.
2018-07-28 15:34:54 -07:00
Shubham Dhama 499a70b01e notifications: Fix leaking of private stream msgs sent before subscribing.
Fixes: #9834.
2018-07-28 15:13:08 -07:00
Shubham Dhama c5d8fdf68c message: Add function to check message access in bulk.
This effectively just calls access_message in a loop.
2018-07-28 15:12:55 -07:00
Tim Abbott 6bbffe0e2e notifications: Extract zerver/lib/url_encoding.py.
Extracting this helper library will help us avoid an import loop
between notifications.py and message.py (with bugdown in between).

But in addition to that, it's a more natural model, since some of the
uses for these functions weren't part of the notifications code
anyway.
2018-07-28 15:12:55 -07:00
Shubham Dhama bd5e39cd9e test_message: Rename StarTests to MessageAccessTests. 2018-07-28 14:58:36 -07:00
Shubham Dhama 605a6ed3d8 message: Extract function for message access by a user. 2018-07-28 14:58:36 -07:00
Shubham Dhama 9cf67a5e71 models: Add function to get UserMessage from message id. 2018-07-28 14:58:36 -07:00
Shubham Padia e276006d8c help: Replace dead link to function support wiki in KaTex.
Fixes #10091.
`https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX` has
been moved from the wiki to the docs at
https://khan.github.io/KaTeX/docs/supported.html in
https://github.com/Khan/KaTeX/pull/1484.
2018-07-28 08:33:59 -07:00
Greg Price 4ba8015002 tools/reset...: Add experimental option to record the PR as a ref.
I often find myself looking manually through the reflog of `master` to
find a commit I previously reset to with tools/reset-to-pull-request .
Sometimes I want to see a previous version of a PR I'm reviewing a
revised version of; sometimes to look at two related PRs together.

So, here's a feature to automate that by saving each PR branch in its
own ref, with a name like `refs/remotes/pr/1234` -- or `pr/1234`, as
you'd normally refer to it.

To enable this, set the new config option:
  $ git config zulip.prPseudoRemote pr
(Or you can pick another name.)

The reason I hesitate to just make this the behavior for everyone
immediately is that the resulting `pr/1234` refs will naturally
accumulate and may clutter up the view -- and because with the
`refs/remotes/` style of name I've chosen, it requires a bit of
Git plumbing to clean them up.  (Use `git update-ref -d`.)
I'll play with it and iterate; comments welcome from other willing
early adopters.
2018-07-27 23:47:32 -07:00
Tim Abbott aa8533a5f7 locale: Update transation data from transifex and repo. 2018-07-27 12:26:10 -07:00
Tim Abbott 3cf55d14a1 settings: Enable custom profile fields in production.
Now that we've fixed the last major bugs, we can turn this on for
everyone.  The main remaining work is updating the documentation to
advertise it.
2018-07-27 12:09:56 -07:00
Steve Howell 441a21fac8 Use jQuery objects in MessageListView._rows.
The values of this dictionary used to be raw DOM elements,
but get_row() wraps them again, so there's not a huge
reason to store them as raw DOM elements internally.  It
is slightly easier to reason about the code if everything
stays at the jQuery level.

To preserve the old behavior here, we have to do something
that is kind of ugly, but at least it's explicit now.  In
the old code, our cache was DOM elements, and if an id
wasn't in the cache, we would sneakily return $(undefined)
with this code in get_row():

    return $(this._rows[id]);

And it turns out that $(undefined) is basically just a
zero-element jQuery object.  A lot of our code depends
on this behavior and just works around the zero-element
objects as needed with checks like this:

    if (this.selected_row()).length === 0) {
        // don't try to get offset
    }

For now we just preserve this behavior.  We could eventually
be more strict here, or at least have aggressive warnings
on cache misses, but we'd need to retrofit code to be
able to call something like `has_rendered_selection()`
and/or deal with `undefined` as the return value for the case
where the selection hasn't been rendered.

Here is some example code that would cause tracebacks if
we just returned `undefined` for cache misses:

    rerender_preserving_scrolltop: function () {
        // old_offset is the number of pixels between the top of the
        // viewable window and the selected message
        var old_offset;
        var selected_row = this.selected_row();
        var selected_in_view = selected_row.length > 0;
        if (selected_in_view) {
            old_offset = selected_row.offset().top;
        }
        return this.rerender_with_target_scrolltop(selected_row,
            old_offset);
    },
2018-07-27 11:14:53 -07:00
Steve Howell 69b42a7440 refactor: Extract MessageListView._fix_single_row().
This function is more cohesive and always takes in
a jQuery object containing exactly one DOM element,
and it does all stuff at the jQuery level of
abstraction (no raw DOM).

It's a pretty simple extraction--removing the level
of indentation makes the diff a bit noisy.
2018-07-27 11:14:27 -07:00
Steve Howell 6b2c291b4e refactor: Extract MessageListView._put_row().
Saving row data in `_rows` is a very data-specific task,
unlike the rest of `_post_process`, plus extracting it
will help with unit testing.
2018-07-27 11:10:50 -07:00
Steve Howell 3d853f9bf4 refactor: Pass in jQuery objects to _post_process.
We shorten the name of the function and avoid having
all the callers call `.get()`.  Now we mostly stay
in jQuery "space", which avoids some confusion about
when we're dealing with raw DOM elements and which
will facilitate unit testing.
2018-07-27 11:10:49 -07:00
Tim Abbott eff372da74 mypy: Fix mypy error with optional.
This was missed in a57d337113.
2018-07-27 10:58:08 -07:00
Shubham Padia 5bf6e55778 search pills: Fix visual bugs due to CSS refactoring of input pills.
Changed search pill padding, `.navbar-search` flex-wrap to match with
the CSS refactoring in 66df4e3e84.
The `height: 100%` changes to `.navbar-search` and `.input-append`
make up for the issue in which the pills overflowed in the mobile
view due to `.navbar-search` height being declared 40px explicitly
while the actual heiight in mobile view was shorter.
2018-07-27 10:54:09 -07:00
Rishi Gupta 1710a9070a user docs: Add export-your-organization. 2018-07-27 10:52:27 -07:00
Rishi Gupta 5e7fd3a3cf docs: Move server import and export from /help to readthedocs. 2018-07-27 10:37:50 -07:00
Anupam Dagar c47e71abe0 emails: Fix preheader coming up inside email.
This makes the preheader correctly invisible inside the email.
2018-07-27 10:36:13 -07:00
Tim Abbott a57d337113 bots: Enforce bot creation policy on reactivating bots.
It's sorta an unusual state to get into, to have a user own a
deactivated bot, when they can't create a bot of that type, but
definitely a valid possibility that we should be checking for.

Fixes #10087.
2018-07-27 10:31:38 -07:00
Yashashvi Dave 00f9772ccc stream list: Scroll to opened stream on zoom out from stream-more-topics.
Currently on zoom out from stream topics, scrollbar didn't scroll back
to opened stream. Because call to scroll-to-stream func isn't called
after all streams view is displayed. So wrong stream element is
passed to func.

Fix this by calling scroll-to-stream func after all-stream-list view
is displayed.
2018-07-27 09:09:53 -07:00
Cynthia Lin e9cf545ada scroll_util: Account for element padding in height calculations. 2018-07-27 09:09:52 -07:00
Cynthia Lin ee82f14d04 subs: Use scroll_util to move selected stream rows into view.
This eliminates a bunch of complex logic we previously used when
trying to make keyboard stream row navigation smoother.
2018-07-27 09:08:49 -07:00
Aditya Bansal 8304f0dbec stylelint: Add more stylistic rules to lock down CSS a bit tighter. 2018-07-27 00:15:58 -07:00
Aditya Bansal 5190f4c51a stylesheets: Fix coding style to comply with stylistic rules. 2018-07-27 00:15:58 -07:00
Aditya Bansal 5bca93d147 hotspots.scss: Fix styling to conform to stylistic rules. 2018-07-27 00:15:58 -07:00
Aditya Bansal 4cbe827581 portico.scss: Fix styling to conform to stylistic rules. 2018-07-27 00:15:58 -07:00
Aditya Bansal 92e29db3f5 landing-page.scss: Fix styling to conform to stylistic rules. 2018-07-27 00:15:58 -07:00
Cynthia Lin 3670b480c3 node_tests: Cover a compose PM recipients typeahead corner case . 2018-07-27 00:12:52 -07:00
Robert Hencke 9379f3d317 yarn: Remove duplicate clipboard dependency. 2018-07-27 00:12:05 -07:00
Eeshan Garg 73e8daffbe pypi: Upgrade to release 0.5.2. 2018-07-27 00:11:52 -07:00
Sujeet Kausallya Gholap b5cae68f24 docs: Fix typo: premise -> premises. 2018-07-27 00:11:09 -07:00
Rishi Gupta 8b2cafa111 user docs: Explain streams are similar to channels in stream-permissions. 2018-07-26 21:49:26 -04:00
Eeshan Garg 4a54e8ac17 webhooks/bitbucket2: Include title in message body if not in topic.
This is a follow-up in response to Tim's comments on #9951.

In instances where all messages from a BitBucket integration are
grouped under one user specified topic (specified in the URL), we
should include the title of the PR in the message body, since
the availability of a user-specified topic precludes us from
including it in the topic itself (which was the default behaviour).
2018-07-26 16:35:09 -07:00
Eeshan Garg 85b555b1a8 webhooks/gogs: Include title in message body if not in topic.
This is a follow-up in response to Tim's comments on #9951.

In instances where all messages from a Gogs integration are
grouped under one user specified topic (specified in the URL), we
should include the title of the PR in the message body, since
the availability of a user-specified topic precludes us from
including it in the topic itself (which was the default behaviour).
2018-07-26 16:35:09 -07:00
Eeshan Garg e1df70f61f webhooks/github: Include title in message body if not in topic.
This is a follow-up in response to Tim's comments on #9951.

In instances where all messages from a GitHub integration are
grouped under one user specified topic (specified in the URL), we
should include the title of the issue/PR in the message body, since
the availability of a user-specified topic precludes us from
including it in the topic itself (which was the default behaviour).
2018-07-26 16:35:09 -07:00
Eeshan Garg a9a0d63a54 webhooks/gitlab: Include title in message body if not in topic.
This is a follow-up in response to Tim's comments on #9951.

In instances where all messages from a Gitlab integration are
grouped under one user specified topic (specified in the URL), we
should include the title of the issue/MR in the message body, since
the availability of a user-specified topic precludes us from
including it in the topic itself (which was the default behaviour).
2018-07-26 16:35:09 -07:00
Abhigyan Khaund 40540d4312 user docs: Add "Using a custom certificate". 2018-07-26 16:32:45 -07:00
Abhigyan Khaund 82770a636f user docs: Add connect through a proxy. 2018-07-26 16:32:45 -07:00
Vishnu Ks abf485bfcb billing: Add mypy stubs to stripe imports.
Tweaked by tabbott to add an extra type: ignore.
2018-07-26 16:31:32 -07:00
Tim Abbott 38dd9e49de import_realm: Add comments for update_model_ids.
This basically explains why in these cases we delay doing
bulk_import_model.
2018-07-26 16:13:14 -07:00
Rhea Parekh fca6bc91aa import: Add 'get_db_table' function.
Implement this function in 'bulk_import_model'
and 'update_model_ids'.

This lets us save on redundant-feeling arguments in these
frequently-called helper functions.
2018-07-26 16:07:31 -07:00
Roman Godov 34ae3dfd44 models: Delete unused Subscription.notifications field.
This deletes the unused Subscription.notifications field and removes
it from some testing and analytics code (which should not have been
using it in the first place).

Fixes #10042.
2018-07-26 15:54:57 -07:00
Roman Godov 064fca5b76 import: Fix use of unused Subscription.notifications.
This code should have been interacting with the specific sub-fields
for notifications.
2018-07-26 15:53:29 -07:00
Tim Abbott 879aa130ad api docs: Move "Get stream ID" to end of the streams endpoint section.
This seemed overally emphasized in the previous order.
2018-07-26 15:42:58 -07:00
Yago González db81726bcb api docs: Use method from our Python bindings in the example.
One of the code examples for GET /users was using the raw call_endpoint
method from our Python bindings, rather than get_members, which has been
specifically designed to interact with this endpoint.

Now all the examples here use the appropiate method.
2018-07-26 15:34:31 -07:00
Yago González 40a21f6077 api docs: Migrate GET /users to OpenAPI. 2018-07-26 15:34:31 -07:00