Commit Graph

28007 Commits

Author SHA1 Message Date
Rishi Gupta dc1e1dfcf9 features: Add custom profile fields. 2018-08-17 11:32:05 -07:00
Rishi Gupta e25ac1dd6c user docs: Add custom profile field docs. 2018-08-17 11:32:05 -07:00
Rishi Gupta c3a912f8b6 management commands: Add sleep_forever to lib/management. 2018-08-17 09:20:51 -07:00
zhoufeng1989 d5f752df84 tests: Tests query count when creating stream with subscriptions API.
These test cases are used to test the cost of stream creation.
Three scenarios of stream creation are covered:
1) create a public stream;
2) create a private stream;
3) create a public stream with announce=true when there is a notification stream.

Fix: #4804.
2018-08-17 08:58:38 -07:00
Eeshan Garg f476ec7fac webhooks/freshdesk/doc.md: Render example JSON correctly.
We've been getting reports from users that our Freshdesk webhook
isn't working correctly. It turns out that the issue had nothing
to do with the webhook implementation itself!

In freshdesk/doc.md, we have a JSON template we ask users to
copy/paste into a textbox in the Freshdesk UI. That JSON template
contains "{{" and "}}" characters which we escaped as Unicode
decimals to prevent clashes with Jinja2 syntax in other parts
of the same template. This worked for a while!

But thanks to the changes introduced as part of the
nested_code_blocks extension, such escaped characters were never
decoded, leading users to copy/paste the same template but with
raw escaped unicode representations of "{{" and "}}" inside. And
that eventually broke our webhook implementation.

This commit makes sure that such characters are properly "unescaped",
just for Freshdesk docs.
2018-08-17 08:55:41 -07:00
Rishi Gupta b3a8790c59 plans: Remove question about proration. 2018-08-17 08:50:07 -07:00
Rishi Gupta fa50f68ec5 settings: Rename emoji settings. 2018-08-17 08:49:48 -07:00
Yashashvi Dave 8ef0c6d99a custom profile field: Add length validation on field name and hint.
Add max length validation for custom field name and hint
on create-field and update-field backend views and
frontend forms.

Fixes #10284.
2018-08-17 08:37:27 -07:00
Yashashvi Dave 868362046b zerver/models.py: Change custom field name max length to 40 char. 2018-08-17 08:36:22 -07:00
Steve Howell 948190c9ff tests: Test spam prevention feature for invites.
We have code to prevent newbies on open realms
from inviting users.  This is mostly intended
to hinder spammers.  This commit just adds some
test coverage.
2018-08-17 08:14:42 -07:00
Steve Howell 0e56fecbd9 peformance: Avoid broad StreamCount queries.
Our get_streams_traffic function used to query
all streams in the StreamCount table if you
passed in `None` for `streams`.

Now we require that you pass in a list of
stream_ids.

I don't know how much work this will save
the database, since probably the bulk of
the work is aggregating.  If we need to fine
tune DB performance, we could possibly add
`realm` as an argument and add it to the filter.

What we'll immediately get, for large multi-realm
installations, is less data over the wire and
less work for the ORM.
2018-08-17 08:14:42 -07:00
Steve Howell b05f26c6d1 tests: Add test for get_streams_traffic(). 2018-08-17 08:14:42 -07:00
Steve Howell fb283ac672 tests: Test JsonableError in lookup_default_stream_groups(). 2018-08-17 08:14:42 -07:00
Steve Howell 75e297daf2 tests: Get line coverage for empty streams results.
We have defensive code in functions for combinations
of arguments and/or inputs that doesn't happen
in practice, buts this gets us some line coverage.
2018-08-17 08:14:42 -07:00
Steve Howell 96c6af1249 tests: Test include_default option for /json/streams. 2018-08-17 08:14:42 -07:00
Steve Howell 040dafbfc5 refactor: Streamline subscribed_to_stream().
The prior code uses an awkward idiom that
pre-dates the `exists()` function, and it
had an unreachable line of code.

The new version should be faster, since we
don't create a throwaway heavy Django object
or send needless data over the wire.
2018-08-17 08:14:42 -07:00
Steve Howell c41377aaab Remove _default_stream_permision_check.
This functions appears to be redundant to
`access_stream_by_name`.  The only
meaningful line of code in the function that we're
removing, the code that raises an error,
appears to be unreachable, despite reasonably
extensive tests.

The only thing the function was restricting
was that the case where the bot's owner was
unsubscribed to a private stream, which
is already locked down in
`access_stream_by_name` calls inside of
`patch_bot_backend`.

This commit increases test coverage
by removing unreachable code.

It's possible this function had
some theoretical value before we
introduced the `require_non_guest_human_user`
decorator to the `patch_bot_backend`
view, since in theory the bot itself
could have subscribed to a stream that
the owner didn't subscribe to.  Even
then it's not clear that allowing the
bot to set that as a default stream
would have been harmful, since they
can already access it.
2018-08-17 08:14:42 -07:00
Steve Howell e61565fdf6 tests: Add more testing for patching bots.
This commit adds some more tests related to patching
a bot's `default_sending_stream`.

Unfortunately, this didn't reach the code that I was
intending to add line coverage to, since checks happen
higher up in the stack, but the test code I added
is probably worthwhile.
2018-08-17 08:14:42 -07:00
Steve Howell 93e8798ac7 Extract get_last_message_id().
We want our methodology for extracting the last message
id to be consistent, particularly in terms of how we
handle edge cases.  (I'll concede that the
`bulk_remove_subscriptions` codepath never hits that
corner case in practice, but it's harmless to handle
the theoretical case.)

It may also be nice to have this function show up
clearly in profiling.

This also adds some direct testing to the function.

It's not clear to me why we don't use `latest('id')`
in the implementation, but that's outside the scope
of this commit.
2018-08-17 08:14:42 -07:00
Steve Howell 0322dcc6cf tests: Add direct coverage to validate_email().
These direct tests add some line coverage.
2018-08-17 08:14:42 -07:00
Steve Howell 20c4d357cc tests: Add test for sending group mentions in messages. 2018-08-17 08:14:42 -07:00
Tim Abbott 5021f7b76f puppet: Fix accidental conflict on apache2 package.
Apparently, the work to force installation of the Python 3 version of
mod_wsgi was buggy and tried to force uninstall apache2.

Fixes #10318.
2018-08-16 14:15:35 -07:00
Yago González 2f7e4484c8 requirements: Upgrade python-zulip-api/zulip to 7dfecf557. 2018-08-16 14:12:44 -07:00
Puneeth Chaganti 126442a0a8 help: Generate emoticon translations table dynamically.
Closes #8586.
2018-08-16 13:50:42 -07:00
Lyla Fischer c86dc45bf9 user docs: Update change-the-topic-of-a-message. 2018-08-15 16:24:57 -07:00
Lyla Fischer 9ba0aaefa2 user docs: Add community-topic-edits. 2018-08-15 16:24:57 -07:00
Rishi Gupta f7a8a394dc user docs: Update table in configure-message-editing-and-deletion. 2018-08-15 16:24:57 -07:00
Lyla Fischer a71a986548 user docs: Update add-custom-emoji. 2018-08-15 16:24:57 -07:00
Rishi Gupta 4a3aaf5075 user docs: Remove high contrast mode from index. 2018-08-15 14:55:06 -07:00
Lyla Fischer 0c0b9d7de6 user docs: Update language in admin-only. 2018-08-15 12:10:26 -07:00
Harshit Bansal 2c6f57480d node_tests: Fix node tests for recent changes.
Fixes node tests broken in:
	7be7561c68 (lost complete coverage)
	3e5e7a0b19 (broke node tests)
2018-08-14 22:38:28 -07:00
Yago González 9acb98fa53 version: Bump PROVISION_VERSION for Python package updates. 2018-08-14 17:53:34 -07:00
Rishi Gupta b1fcd81fff user docs: Fix spelling of macOS in desktop install guide. 2018-08-14 16:34:34 -07:00
Rishi Gupta 66f7527237 user docs: Update desktop app install guide. 2018-08-14 14:47:08 -07:00
Harshit Bansal 08a0a8ea2e user docs: Update display-emoji-as-text.md. 2018-08-14 13:12:30 -07:00
Harshit Bansal 44694653ae emoji: Remove `display_url` from the context of `admin_emoji_list`.
This attribute seem to be artifact of some refactoring that we did
but forgot to remove it. Just a minor cleanup.
2018-08-14 12:07:56 -07:00
Harshit Bansal 3e5e7a0b19 emoji: Pre-fetch octopus emoji in `emoji.js`.
If we don't prefetch the image then on slow networks it will appear
as if octopus emoji is not present.
2018-08-14 12:01:02 -07:00
Harshit Bansal 7be7561c68 emoji: If current emojiset is text then fallback to google emojiset.
If `TEXT_EMOJISET` is currently selected emojiset then fallback to
`GOOGLE_EMOJISET` for displaying emojis in emoji picker and
composebox typeahead. We should pre-load the spritesheets in`emoji.js`
even in case of text emojiset otherwise on slow networks emoji picker
will appear empty initially.
2018-08-14 12:01:00 -07:00
Tim Abbott c208aff0da i18n: Update translation files. 2018-08-14 11:57:54 -07:00
Shayan Toqraee a4b14b8526 compose.js: Move set rtl logic to keyup event.
This fixes an issue where the ltr/rtl translation lagged one character
behind as a user typed.
2018-08-14 11:41:53 -07:00
Shayan Toqraee 56b031733a rtl.js: Fix support for supplementary planes of unicode characters (>= U+10000). 2018-08-14 11:39:29 -07:00
Steve Howell 6d18fa116e minor: Sort some imports. 2018-08-14 10:34:58 -07:00
Steve Howell 3fce1ec649 tests: Test logging for internally sent messages. 2018-08-14 10:34:58 -07:00
Steve Howell 2dbd11ba9d tests: Test notification bot can send to private streams. 2018-08-14 10:34:58 -07:00
Steve Howell 9a7a93c80b refactor: Extract validate_sender_can_write_to_stream().
This de-clutters check_message a bit and also makes
it easy to audit our rules for who can write to a
stream.

Also, this works around a bug with Python where its
optimizations for the `pass` instruction make them
not appear to run and show up as uncovered in
coverage reports.
2018-08-14 10:34:58 -07:00
Steve Howell 82469b89e5 tests: Tests bots can send to owner's streams. 2018-08-14 10:34:58 -07:00
Steve Howell edd8437c76 tests: Test API super users can send to private streams. 2018-08-14 10:34:58 -07:00
Akash Nimare 321b705591 left-sidebar: Add max-height to private message container.
This fixes a UI bug where if a user had a lot of recent private
message threads, they'd take over the entire left sidebar.

This was caused by not setting the max height of users list in private
message container.

Fixes: #5384.
2018-08-14 10:18:34 -07:00
Yashashvi Dave dc962f8b43 custom profile field: Don't push null values to json request.
This commit add checks in frontend to remove null values of choices
from json data. This allows user to successfully create/edit choice
custom field, even if there is blank input in choices.
2018-08-14 10:17:57 -07:00
Yashashvi Dave f8b6bb6614 custom profile field: Remove add-btn of choices.
This commit
- Remove `add-btn` in choices, to create new input
  for choice
- Add logic which create blank input for choice at
  the bottom if user start typing into above input choice.
2018-08-14 10:17:57 -07:00