Commit Graph

24167 Commits

Author SHA1 Message Date
Steve Howell 6ea2765c9f Add topic_generator.get_next_unread_pm_string().
We will use this for keyboard navigation to cycle through
our unread PM narrows.
2018-02-12 09:34:59 -08:00
Steve Howell 9f8526ce29 Add pm_conversations.recent.get_strings().
We will use this method for hotkey navigation through recent
pms.
2018-02-12 09:34:59 -08:00
Steve Howell 4f52e095e8 refactor: Extract pm_conversations.recent.
This is a pretty pure code move, where we moved stuff from
message_store to pm_conversations:

    insert_recent_private_message() -> recent.insert()
    recent_private_messages -> recent.get()

The object message_store.recent_private_messages was not
encapsulated in a function before this change.  Now it is
hidden in the scope of pm_conversations.recent.

Both of the modules touched here maintain 100% line coverage.
2018-02-12 09:34:59 -08:00
Aman Jain a0b58b1560 activity: Add a link to copy list of realm admins.
Tweaked by tabbott to do the database queries properly.

This should help user to copy realm admin emails in a go.
Fixes: #7885
2018-02-12 08:55:45 -08:00
Rhea Parekh 3ebd30120c slack importer: Remove depreciated test.
This test was added in '/tests/test_slack_importer' in
6addf79edb.
2018-02-12 00:43:02 +05:30
Greg Price 7925e258a2 mypy: Tweak a bit of syntax to avoid a mypy bug.
The error message, in relevant part:
```
zerver/templatetags/app_filters.py: error: INTERNAL ERROR --
  please report a bug at https://github.com/python/mypy/issues version: 0.560
  File ".../site-packages/mypy/nodes.py", line 497, in accept
    return visitor.visit_func_def(self)
  File ".../site-packages/mypy/report.py", line 317, in visit_func_def
    assert start_indent is not None and start_indent > old_indent
AssertionError:
zerver/templatetags/app_filters.py: : note: use --pdb to drop into pdb
```

Seems mypy gets confused by the comment following the decorator.
2018-02-09 19:43:27 -08:00
Greg Price b374ea7357 mypy: Pass --show-traceback.
This saves a bit of debugging in the event that we hit a crash
inside mypy.
2018-02-09 19:42:49 -08:00
Greg Price 8be2dfa81c APNs: Fix a case I broke while working out tests.
I got distracted, came back later to a successful test run in my
terminal, and thought I remembered finishing the change and just
kicking off a final test run to check.

In fact, there was an `assert False` right in the normal case for
production, and I just hadn't finished a test for that path. (m.-)
Definitely the most grateful I've been for our coverage checks,
which highlighted this for me.

Remove the `assert False`, and also finish writing the test it was
there to help me write.  Those lines are covered now.
2018-02-09 18:28:16 -08:00
Umair Khan 59f61c2525 render_markdown_path: Use limited caching.
This results in an almost 50% increase in performance in the slow
test_urls test.

Fixes #6901.
2018-02-09 18:14:17 -08:00
Umair Khan 0eca2e102d cache: Add ignore_unhashable_lru_cache function.
This is a wrapper over lru_cache function. It adds following features on
top of lru_cache:

    * It will not cache result of functions with unhashable arguments.
    * It will clear cache whenever zerver.lib.cache.KEY_PREFIX changes.
2018-02-09 18:14:08 -08:00
Umair Khan 91ce455ac3 app_filters: Remove unused lru_cache import. 2018-02-09 18:12:55 -08:00
Priscilla 6badac5d33 docs: Add v shortcut to the lightbox article. 2018-02-09 18:02:24 -08:00
Greg Price 20c734c90a puppet: Fix type error in new Nagios check for analytics state. 2018-02-09 17:46:46 -08:00
Brock Whittaker 6028e79440 subs: Remove call to go to "all-streams" on stream creation.
This will essentially run the code paths to go from whatever you were
at before to /all and back in the case of /new, which will call the
render function three times (!!), so remove this call because it isn’t
really necessary anyways.
2018-02-09 17:29:59 -08:00
Brock Whittaker ad4e976406 streams: Have new streams list only populate once.
Currently the new streams user list will populate twice when you click
the new stream button (or “+”), because it is triggered once directly
by the button click and then once by the hash change to /new, so we
want to ignore the changes by the hash change.
2018-02-09 17:29:59 -08:00
Greg Price 7f6a1714aa APNs: Don't try to send anything when not configured. 2018-02-09 17:16:21 -08:00
Greg Price 12d878c785 APNs: Drop disused setting from old implementation. 2018-02-09 17:16:21 -08:00
Tim Abbott 005b0fb566 puppet: Clean up ssh authorized_keys configuration rules. 2018-02-09 16:37:03 -08:00
Tim Abbott aca25b6f0a puppet: Move ssh configuration to use notify.
This handles more correctly the case where we're using the upstream
sshd_config file.
2018-02-09 16:37:03 -08:00
Tim Abbott 486de8abfc puppet: Edit some rules to support chat.zulip.org.
This should make it possible to use the zulip_ops base rules
successfully on chat.zulip.org.  Many of the changes in this commit
are hacks and probably can be cleaned up later, but given that we plan
to drop trusty support soon, it's likely that most of them will simply
be deleted then.
2018-02-09 16:37:03 -08:00
Rishi Gupta 1d581a9c6e nagios: Add nagios check for analytics state.
This should help us detect issues where the analytics cron jobs aren't
running properly.

The cron/nagios part of the implementation done by tabbott.
2018-02-09 16:36:05 -08:00
Priyank Patel dcec2e3a4d dark-mode: Make all modals compatible with night mode.
This should cover the remaining modals that didn't already support this.
2018-02-09 14:21:13 -08:00
Robert Hönig 3e1b817376 bot settings: Move config item generation from js to handlebars. 2018-02-09 12:30:24 -08:00
Robert Hönig c0a0e6fd70 Set add_bot_backend() config_data param default to {}.
Previously, the default was None. This caused 500s when
adding a bot without adding a config_data argument.
2018-02-09 12:30:24 -08:00
Robert Hönig 02bc506518 bot_data.js: Fix dict indentation. 2018-02-09 12:30:24 -08:00
Robert Hönig 0abb0315f3 test_events.py: Properly check the bot added event dict.
Previously, the 'services' entry in the bot added event dict,
did not get verified, because the test didn't include a service bot.
2018-02-09 12:30:24 -08:00
Robert Hönig 760cbcc98e test_events.py: Use create_test_bot(). 2018-02-09 12:30:24 -08:00
Robert Hönig 323284e0b6 backend: Call real endpoint in create_test_bot().
This allows tests to be more realistical and to
directly test payload added to add_bot_backend().
2018-02-09 12:30:24 -08:00
Robert Hönig 33322fed51 bot_settings.js: Narrow config item selector.
Needed to avoid selector conflicts with the future
config items in the edit sidebar.
2018-02-09 12:30:24 -08:00
Robert Hönig 561e0ffe3b frontend: Delete page_params.realm_bots after first usage.
The data in page_params.realm_bots is parsed and captured
in bot_data. bot_data provides a safe system for accessing
this data.
2018-02-09 12:30:24 -08:00
Robert Hönig 7539512af8 settings-bots.js: Restructure bot edit event handler.
Shift and unify some variables to make the code more
logical and concise.
2018-02-09 12:30:03 -08:00
Robert Hönig f371c79c22 settings-bots.js: Fully generate bot owner list in handlebars. 2018-02-09 12:30:03 -08:00
Robert Hönig f57d592d88 edit-outgoing-webhook-service.handlebars: Fix typo. 2018-02-09 12:30:03 -08:00
Robert Hönig 273f62f8cd settings-bots.js: Remove redundant sidebar close event handler.
All the event handler did was resetting some entries in the edit
bot form. This is unnecessary, because the whole form gets
destroyed anyway when closed.
2018-02-09 12:30:03 -08:00
Robert Hönig 338bba7a0f edit_bot.handlebars: Extract outgoing webhook form.
This removes ugly .show() .hide() constructions that
were previously used to dynamically display the form.
2018-02-09 12:30:03 -08:00
Robert Hönig 1ec9932aec settings_bots.js: Clean up bot edit event handler.
This is done by rewriting JS manipulations of the DOM tree
in the bot-settings.handlebars template. Dead code involving
the affected JS variables is removed.
2018-02-09 12:30:03 -08:00
Robert Hönig 032cc8497f settings sidebar: Extract bot edit form.
This is the first step in cleaning up the bot edit code.
Since the bot edit form appears dynamically, we remove
it from the static HTML scaffold, of which settings_sidebar
is a part of.
2018-02-09 12:30:03 -08:00
Rhea Parekh 721a241901 slack importer: Update doc about slack user's skype and phone data. 2018-02-09 12:17:10 -08:00
Rhea Parekh fbc11b141b slack importer: Add 'realm_name_in_notifications' field in zerver_userprofile.
This was recently added in b875fe07eb and
hence should be updated here.
2018-02-09 12:17:10 -08:00
Rhea Parekh 6addf79edb slack importer: Test import in existing database with fixtures.
Check in sample slack dataset fixtures, test data conversion and import of
this converted data into an existing database.
2018-02-09 12:17:10 -08:00
Rhea Parekh be05bccb5b slack importer: optimize allocation of id range before import. 2018-02-09 12:17:10 -08:00
Rhea Parekh a0b7976f77 slack importer: Fix output_dir path and remove sys.exit(0).
Also, as the exception is being handled in 'slack_data_to_zulip_data'
remove it from the manage.py command 'convert_slack_data'.
2018-02-09 12:17:10 -08:00
Rhea Parekh 699021e7d8 slack importer: Update Documentation with slack's legacy token method. 2018-02-09 12:17:10 -08:00
Rhea Parekh c0e30079f6 slack importer: Get user data from a get request to slack users api.
The fresh imported data shows that the users emails are not included
in the data. However, the data received from the older method of slack
(which is using legacy tokens) contains the email data of the users.
2018-02-09 12:17:10 -08:00
Sumana Harihareswara 6e30da9f92 doc: Add blog link to CONTRIBUTING. 2018-02-09 12:04:28 -08:00
YJDave 1f8b6938a7 stream settings: Fix error in updates of stream description.
When removing the description from a stream (i.e. setting it to ""),
the UI was not correctly updating the description.  This is because we
were checking incorrectly for a falsey value, rather than the specific
value undefined (which means the description wasn't changed).
2018-02-09 12:02:22 -08:00
YJDave 08533ba787 stream settings: Show message in case of no stream description.
Show "No description." message if stream doesn't have any
description in stream settings.
2018-02-09 12:00:45 -08:00
Tim Abbott afda05adc4 rate limiting: Increase default rate limits.
It's too easy to go over the rate limits when using the webapp.

The correct fix for this probably involves some changes to which
routes get covered by what sort of rate limit, but for now, just
increase the limits.
2018-02-09 11:55:08 -08:00
Sumana Harihareswara ea0fe90367 webhooks/beeminder/doc.md: Use better macros. 2018-02-09 11:53:32 -08:00
Tim Abbott 77addc5456 bugdown: Fix handling of ultra-long renderings.
If some bug in Bugdown results in a rendered message content that is
bigger than twice the message size, we now just throw an exception
from Bugdown.  This is considerably better than the old behavior,
which might result in an enormous message being placed in the database
(potentially, bigger than the 1MB limit to store in memcached), which
would in turn result in tragic consequences.

This fixes #8322, in that it prevents the super bad outcome seen there
(where basically Zulip became unusable for everyone on the stream
where the message is posted).  Now, the failure mode is just the
message failing to send.  Still not ideal (and requires further work
on the URL embed feature), but not a minor problem, not a major one.
2018-02-09 10:57:55 -08:00