Commit Graph

1343 Commits

Author SHA1 Message Date
Tim Abbott fa0fb9e299 casper: Switch to use a newer casper off master.
Newer casper should fix some problems we've had with contenteditable.
2017-11-16 22:20:38 -08:00
David Rosa Tamsen 7072fa5b37 docs: Reorganize developer docs to improve navigation.
This commit helps reduce clutter on the navigation sidebar.
Creates new directories and moves relevant files into them.
Modifies index.rst, symlinks, and image paths accordingly.

This commit also enables expandable/collapsible navigation items,
renames files in docs/development and docs/production,
modifies /tools/test-documentation so that it overrides a theme setting,
Also updates links to other docs, file paths in the codebase that point
to developer documents, and files that should be excluded from lint tests.

Note that this commit does not update direct links to
zulip.readthedocs.io in the codebase; those will be resolved in an
upcoming follow-up commit (it'll be easier to verify all the links
once this is merged and ReadTheDocs is updated).

Fixes #5265.
2017-11-16 09:45:08 -08:00
Brock Whittaker ce62abce73 dark-mode: Add "T" hotkey for dark mode theme. 2017-11-15 16:45:34 -08:00
Florian Jüngermann b31917be1d frontend: Remove redundant stream separator in the left sidebar.
In the case of no 'normal' streams (only pinned and dormant ones) there are two separators
between the groups of streams. My commit removes one.
2017-11-15 10:06:25 -08:00
Cynthia Lin 940ca17c46 hotkeys: Expand collapsed sidebars when sidebar searches are initiated.
Fixes #7351.
2017-11-14 11:12:13 -08:00
Umair Khan 7e2b452f6a user-groups: Add composebox_typeahead tests. 2017-11-13 11:43:16 -08:00
Umair Khan 597a6e6c74 user-groups: Add user groups in typeahead code. 2017-11-13 11:42:17 -08:00
Cynthia Lin 0b800b0a7d icons: Create framework for custom icons and add new bot icon. 2017-11-10 11:18:42 -08:00
Steve Howell d7254a0556 Append space as needed in compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00
Steve Howell f935afa241 Prepend space as needed in compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00
Steve Howell 1b1858aa64 node tests: Test compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00
Steve Howell 12dc567a89 Move insert_syntax_and_focus() to compose_ui.js.
This change also removes a couple lines of test code that
weren't really testing anything.
2017-11-09 09:49:20 -08:00
derAnfaenger 19bc55aa45 Fix various typos.
The typos and their corrections were found with the
aid of https://github.com/lucasdemarchi/codespell.
2017-11-09 16:26:38 +01:00
Steve Howell c3b89845c9 node tests: Use zrequire in typing_status.js. 2017-11-08 12:24:17 -08:00
Steve Howell 0fc20bf943 node tests: Use zrequire in typing_data.js. 2017-11-08 12:24:17 -08:00
Steve Howell c32f69bef6 node tests: Use zrequire in topic_data.js. 2017-11-08 12:24:17 -08:00
Steve Howell 1dc5218ef5 node tests: Use zrequire in rtl.js. 2017-11-08 12:24:17 -08:00
Steve Howell f65d3316e0 node tests: Use zrequire in recent_senders.js. 2017-11-08 12:24:17 -08:00
Steve Howell 34bddd26d8 node tests: Use zrequire in pm_conversations.js. 2017-11-08 12:24:17 -08:00
Steve Howell 99695da799 node tests: Use zrequire in people.js. 2017-11-08 12:24:17 -08:00
Steve Howell 6304aea4bc node tests: Use zrequire in hotkey.js. 2017-11-08 12:24:17 -08:00
Steve Howell bf0ed5915c node tests: Use zrequire in common.js. 2017-11-08 12:24:17 -08:00
Steve Howell adb02b37ce node tests: Use zrequire in colorspace.js. 2017-11-08 12:24:17 -08:00
Steve Howell e0fa317be1 node_tests: Remove unneeded var statements.
Variables like Dict/_/assert are already globally defined.
2017-11-08 12:24:17 -08:00
Steve Howell bef176f5f6 node tests: Use zrequire in channel.js. 2017-11-08 12:24:17 -08:00
Steve Howell 7a68add9a4 Remove unneeded requires in activity.js. 2017-11-08 12:24:17 -08:00
Steve Howell cdc1bf3d5e node test: Remove add_dependencies(). 2017-11-08 12:24:17 -08:00
Steve Howell a1c5b0928e node tests: Use zrequire in util.js. 2017-11-08 12:24:17 -08:00
Steve Howell 8cdd08a02a node tests: Use zrequire in user_events.js. 2017-11-08 12:24:17 -08:00
Steve Howell 9b9ff5cce3 node tests: Use zrequire in unread.js. 2017-11-08 12:24:17 -08:00
Steve Howell c233bb53fd node tests: Use zrequire in typeahead_helper.js. 2017-11-08 12:24:17 -08:00
Steve Howell c38081b528 node tests: Use zrequire in topic_generator.js. 2017-11-08 12:24:17 -08:00
Steve Howell de341e88c5 node tests: Use zrequire in timerender.js. 2017-11-08 12:24:17 -08:00
Steve Howell 83c9b1134e node tests: Use zrequire in templates.js. 2017-11-08 12:24:17 -08:00
Steve Howell 4ef8df15c9 node tests: Use zrequire in subs.js. 2017-11-08 12:24:17 -08:00
Steve Howell b3bfca9c2e node tests: Use zrequire in stream_sort.js. 2017-11-08 12:24:17 -08:00
Steve Howell c12d46284f node tests: Use zrequire in stream_events.js. 2017-11-08 12:24:17 -08:00
Steve Howell 2c1a855cae node tests: Use zrequire in settings_org.js. 2017-11-08 12:24:17 -08:00
Steve Howell 9489c5d0a8 node tests: Use zrequire in settings_bots.js. 2017-11-08 12:24:17 -08:00
Steve Howell f720aad260 node tests: Use zrequire in server_events.js. 2017-11-08 12:24:17 -08:00
Steve Howell 19ca4bff82 node tests: Use zrequire in search_suggestion.js. 2017-11-08 12:24:17 -08:00
Steve Howell 5db2f3e087 node tests: Use zrequire in reactions.js. 2017-11-08 12:24:17 -08:00
Steve Howell 23313f2ddf node tests: Use zrequire in presence.js. 2017-11-08 12:24:17 -08:00
Steve Howell 14631b8748 node tests: Use zrequire in password.js. 2017-11-08 12:24:17 -08:00
Steve Howell 65dc6a0975 node tests: Use zrequire in narrow_state.js. 2017-11-08 12:24:17 -08:00
Steve Howell 2fac1fe6c9 node tests: Use zrequire in muting.js. 2017-11-08 12:24:17 -08:00
Steve Howell 8f0b396140 node tests: Use zrequire in message_store.js. 2017-11-08 12:24:17 -08:00
Steve Howell 180f910764 node tests: Use zrequire in message_list_view.js. 2017-11-08 12:24:17 -08:00
Steve Howell 98c4ee3175 node tests: Use zrequire in message_list.js. 2017-11-08 12:24:17 -08:00
Steve Howell 84f547004c node tests: Use zrequire in message_edit.js. 2017-11-08 12:24:17 -08:00
Steve Howell ba79558257 node tests: Use zrequire in markdown.js. 2017-11-08 12:24:17 -08:00
Steve Howell 914cf175c0 node tests: Use zrequire in i18n.js. 2017-11-08 12:24:17 -08:00
Steve Howell 1ba0315aad node tests: Use zrequire in hashchange.js. 2017-11-08 12:24:17 -08:00
Steve Howell b2775506a4 node tests: Use zrequire in filter.js. 2017-11-08 12:24:17 -08:00
Steve Howell ad59600062 node tests: Use zrequire in emoji_picker.js. 2017-11-08 12:24:17 -08:00
Steve Howell c307356d33 node tests: Use zrequire in emoji.js. 2017-11-08 12:24:17 -08:00
Steve Howell f6f227d089 node tests: Use zrequire in drafts.js. 2017-11-08 12:24:17 -08:00
Steve Howell 15e21f0cd1 node tests: Use zrequire in dispatch.js. 2017-11-08 12:24:17 -08:00
Steve Howell 2ea4a20bc5 node tests: Use zrequire in composebox_typeahead.js. 2017-11-08 12:24:17 -08:00
Steve Howell 3aa2c22370 node tests: Use zrequire in compose_fade.js. 2017-11-08 12:24:17 -08:00
Steve Howell a7a6f68c98 node tests: Use zrequire in compose_actions.js. 2017-11-08 12:24:17 -08:00
Steve Howell 4d814c03d4 node tests: Use zrequire in compose.js. 2017-11-08 12:24:17 -08:00
Steve Howell e63dd59065 node tests: Use zrequire in bot_data.js. 2017-11-08 12:24:17 -08:00
Steve Howell 640b0d5653 node tests: Use zrequire in alert_words.js. 2017-11-08 12:24:17 -08:00
Steve Howell b0665815d2 Use stub_i18n in templates.js. 2017-11-08 12:24:17 -08:00
Steve Howell eff9f617ef node tests: Use stubbed i18n in message_list.js. 2017-11-08 12:24:17 -08:00
Tim Abbott 417f92c8e1 markdown: Remove now-obsolete bugdown_matches_marked.
Fixes #7099.
2017-11-07 12:01:57 -08:00
Steve Howell f105c480b3 Calculate gravatar hashes on the webapp client.
This change prepares us to have the server send avatar_url
of None when somebody wants a gravatar avatar (as opposed
to a user-uploaded one).

Subsequent commits will change behavior on both the server
and client to have this happen.  So this commit has no-op
code for now, but it will soon use the fallback-to-gravatar
logic.
2017-11-07 10:36:02 -08:00
Steve Howell aa61db9301 Change warn -> error in people.report_late_add().
This commit is easy to revert if we want to tone down errors
to warnings for the short term, while our codepath still does
proper handling for adding users when they come in messages.
2017-11-07 09:51:10 -08:00
Steve Howell 02a011d627 Add people.report_late_add().
We want to know when users are added after page load, as it can
be a symptom of stray messages leaking in or live-update problems,
etc.

Fixes #7120
2017-11-07 09:51:10 -08:00
Steve Howell aebfdaa8ed refactor: Use early-return in extract_people_from_message(). 2017-11-07 09:51:10 -08:00
Steve Howell 294a1fb8f8 refactor: Extract people.maybe_incr_recipient_count().
This logic used to be in extract_people_from_message(), but
we are deprecating extract_people_from_message(), whereas
the maybe_incr_recipient_count() function has logic that we
want to keep.
2017-11-07 09:51:10 -08:00
Steve Howell 5271241b24 Read page_params.realm_non_active_users() at page load.
This change is the first step in making it so that we load
non-active users at page load time in the webapp.

Before this change, we would reactively handle deactivated
users when we saw them as senders in messages.  Subsequent
changes will make it a warning if we see unknown senders
in messages.
2017-11-07 09:51:10 -08:00
Steve Howell b492f3569a tests: Extract node_tests/people_errors.js.
This is mostly a pure extraction, but we needed to duplicate
a bit of setup from people.js, and I added an assertion
for warning about "No user_id provided".
2017-11-07 09:51:10 -08:00
Steve Howell 48b18e4a38 Only show active realm users in compose typeahead.
There's no reason to include deactivated users in compose
typeahead, since we won't let the compose happen.

This also removes cross-realm bots from the typeahead, which
is mostly driven by not having a convenient function to include
them, but also it's rare that it makes sense to talk to a cross-realm
bot unless replying to it.
2017-11-07 09:51:10 -08:00
rht 77f32a1e0c frontend_tests: Use python 3 syntax for typing. 2017-11-04 19:57:55 -07:00
Cynthia Lin f63585bd6d hotkeys: Ensure navigation hotkeys do not work while overlay is open.
Fixes #7123.
2017-11-03 15:38:10 -07:00
Tim Abbott 493529d981 compose: Fix node test failure from video link integration.
It's pretty annoying that we're seeing this several hours after the
original code was merged.
2017-10-30 23:06:04 -07:00
Jack Zhang fef828a037 compose: Add video link button, powered by Jitsi. 2017-10-30 17:13:47 -07:00
Tim Abbott bb80c0cc24 compose_state: Extract insert_syntax_and_focus.
This moves the existing emoji picker code to a new library.
2017-10-30 17:12:56 -07:00
Harshit Bansal 5020ba4a20 emoji: Allow users to change emoji set.
This feature was merged in PR #4383 but was disabled due to some
remaining emoji infra changes.

Fixes: #209.
2017-10-28 10:38:33 -07:00
Henrik Pettersson 09cd47c6ad Add UI for viewing and cancelling open Zulip invitations.
Lets administrators view a list of open(unconfirmed) invitations and
resend or revoke a chosen invitation.

There are a few changes that we can expect for the future:

  * It is currently possible to invite an email that you have already
    invited, it might make sense to change this behavior.

  * Resend currently sends an invite reminder instead of resending the
    original invite, this is because 'custom_body' was not stored when
    the first invite was sent.

Tweaked in various minor ways, primarily in the backend, by tabbott,
mostly for style consistency with the rest of the codebase.

Fixes: #1180.
2017-10-27 13:07:43 -07:00
Steve Howell df03e30d68 popovers: Fix is-active checks for popovers.
We were incorrectly reporting active bots as non-active in
popovers, and we had no test coverage for cross-realm bots.

We also rename the function to is_active_user_for_popover,
since the old name, realm_user_is_active_human_or_bot, suggested
the wrong semantics for cross-realm bots.

Last but not least, we only do a blueslip warning if a user id
is not found.  When lookups fail, we are pretty confident that
the user is not active, so an error is overkill.  We can change
that as part of issue #7120.

Fixes #7153
2017-10-26 13:56:32 -07:00
Steve Howell f8f4d9cb63 people.js: Rename realm_get -> get_active_user_for_email.
We rename this function to be more clear, and we also remove
a stray function name for `realm_get` that was for the wrong
exported function.
2017-10-26 09:52:42 -07:00
Steve Howell 2699a6aac9 refactor: Extract people.is_valid_email_for_compose().
It's easier to unit test logic inside of people.js than compose.js.

We allow users to compose emails to any of our cross-realm bots.
Someday we may tighten up which cross-realm bots are valid targets,
since it's not necessarily the case that those bots do anything
useful when you send them messages.
2017-10-26 09:45:08 -07:00
Steve Howell 646bd356a3 Rename get_realm_human_user_ids -> get_active_user_ids.
The function name `get_realm_human_user_ids` was a lie--it
includes active bots as well.

The only user of this function is `activity.js`, which wasn't
impacted by the misleading name, because we eventually filter
out bots in the `info_for` function.

It's possible that we actually want to include bots in the right
sidebar, since they can be difficult to discover in other parts
of the UI.  Or, if we want to keep the right sidebar as all
human users, we may eventually want to make the logic to exclude
bots happen higher in the stack (but for real, this time).
2017-10-26 09:17:43 -07:00
Aditya Bansal 3fb0f7c092 home.html: Cleanup to use 4 space indentation.
Tweaked by tabbott to also make the translation tags make more sense.
2017-10-25 10:58:49 -07:00
Tim Abbott b1301cdfec node_tests: Restore 100% coverage on people.js. 2017-10-24 16:24:03 -07:00
Tim Abbott 11eba1173c popovers: Don't show bots as deactivated in user popovers.
Apparently this is a bug that slipped in when we started showing
normal users as deactivated in the user popovers: all bot users were
treated that way as well.

We'll want to do #7153 as a follow-up to get things fully working how
we want them.
2017-10-24 15:59:51 -07:00
Umair Khan 2db1cba9cc i18n: Use language code instead of locale.
We have been assigning locale to language code. Mostly code and locale
are same but for languages like zh-Hans, locale is zh_Hans and code is
zh-hans.

After this commit, compilemessages command should be run.
2017-10-20 11:21:26 -07:00
Vishnu Ks 4b5327b326 form: During realm creation give option to install in root domain.
This presents multiple states for the subdomain input option
depending on the existence of a root domain.

Commit modified heavily by Brock Whittaker <brock@zulipchat.com>.

Fixes #6863.
2017-10-19 16:10:14 -07:00
Brock Whittaker 4f088292ee popovers: Hide user email and PM feature for deactivated users.
This hides the emails of deactivated users from the popovers along
with the link to send a PM to them.
2017-10-18 00:06:12 -07:00
Tim Abbott 773f8fcb05 stream_events: Fix exceptions when subscribed by another client.
We were getting several exceptions in mark_subscribed if the streams
overlay wasn't open, basically because we'd try to filter the
right-side stream list when it wasn't present in the DOM.
2017-10-17 23:42:29 -07:00
Shubham Dhama d6a34c7a0c composebox_typeahead: Start emoji typeahead with single letter.
This changes the behaviour of the typeahead in the compose box to
start appearing with single letter lying in the range of a-z or '+'.

This is a nice solution, because all emoji names start with lower-case
letters, while most emoticons like :P use a capital letter or similar.

Fixes: #6808.
2017-10-17 16:06:13 -07:00
Steve Howell ae139a78b8 presence: Change "unknown" to "offline".
We never make an actionable distinction between the "unknown"
presence status and the "offline" status, so we now
just use "offline" as the status for persons who don't
have recent presence records that the client knows about.

(Usually, users without presence rows have never been online,
or they have been deactivated, or they have been offline so long
that they don't show up in our date-limited queries.)
2017-10-12 10:42:06 -07:00
Tim Abbott 8828e96b87 presence: Avoid checking activity when reloading.
We sometimes get blueslip errors from browsers that are clearly still
attempting to reload long after they should have.  These browsers can
produce a lot of unnecessary presence update exceptions.

To solve that, we start checking reload_in_progress in the presence
code path.

While we're at it, we also add some blueslip logging for the reload
code path, in case it becomes useful when debugging future issues.
2017-10-11 20:39:28 -07:00
Brock Whittaker 71d61f93d5 streams: Change button styles on new stream creation form.
This changes the button styles from the old bootstrap buttons to
the new button styles on the stream creation form.
2017-10-11 16:17:36 -07:00
Brock Whittaker 6039687ecd streams: Add "Create Stream" button to right side.
This adds a button to allow a user to more easily discover the
stream creation functionality to the right side of the streams
overlay.
2017-10-11 16:17:36 -07:00
Brock Whittaker 20af49b2bb streams: Call `actually_filter_streams` on stream events update.
Previously it was called before the event was processed by the server
and the subscription was updated to have the user subscribed to a
stream, so there was a race condition that would make it iso that
sometimes the stream line would disappear on the next render pass due
to the event not having completed yet.

This makes it so that the re-render happens after the event is
processed in `stream_events.js`.

Fixes: #6797.
2017-10-11 12:44:10 -07:00
Harshit Bansal 6f4d24d851 reactions.js: Fix the conditional check for sending reaction request.
Request for adding an reaction only if there is a default emoji or
an active realm emoji with that name while request for removing a
reaction should be sent only if there is a default emoji or a realm
emoji(may be active or deactivated) with that name. Earlier we were
not including deactivated realm emojis while deciding whether a
request for removing a reaction should be sent or not which was
causing requests for the removal of reactions with deactivated realm
emojis not to be sent to the backend.

Fixes: #6007.
2017-10-09 11:31:21 -07:00
Greg Price a116303604 passwords: Express the quality threshold as guesses required.
The original "quality score" was invented purely for populating
our password-strength progress bar, and isn't expressed in terms
that are particularly meaningful.  For configuration and the core
accept/reject logic, it's better to use units that are readily
understood.  Switch to those.

I considered using "bits of entropy", defined loosely as the log
of this number, but both the zxcvbn paper and the linked CACM
article (which I recommend!) are written in terms of the number
of guesses.  And reading (most of) those two papers made me
less happy about referring to "entropy" in our terminology.
I already knew that notion was a little fuzzy if looked at
too closely, and I gained a better appreciation of how it's
contributed to confusion in discussing password policies and
to adoption of perverse policies that favor "Password1!" over
"derived unusual ravioli raft".  So, "guesses" it is.

And although the log is handy for some analysis purposes
(certainly for a graph like those in the zxcvbn paper), it adds
a layer of abstraction, and I think makes it harder to think
clearly about attacks, especially in the online setting.  So
just use the actual number, and if someone wants to set a
gigantic value, they will have the pleasure of seeing just
how many digits are involved.

(Thanks to @YJDave for a prototype that the code changes in this
 commit are based on.)
2017-10-08 15:48:44 -07:00
Steve Howell 3e6bfe1b23 Use user_ids, not emails, for bulk stream operations.
We now return user_ids for subscribers to streams in add-stream
events.  This allows us to eliminate the UserLite class for
both bulk adds and bulk removes.  It also simplifies some JS
code that already wanted to use user_ids, not emails.

Fixes #6898
2017-10-08 12:31:12 -07:00
Steve Howell 810532641e activity.js: Extract get_filtered_and_sorted_user_ids().
This function was extracted from build_user_sidebar().  We
also slightly streamlined it to not unnecessarily call
filter() when the filter text was blank. This extraction
also eliminated the need for us to have the two-line
filter_and_sort() function.

Also, we get to 100% coverage in this commit.
2017-10-08 12:01:59 -07:00
Steve Howell 6888255153 Add people.get_realm_user_ids().
This saves us from doing an unnecessary map() in
activity.js.
2017-10-08 12:01:59 -07:00
Steve Howell 943eefb7c0 activity.js: Extract get_filter_text().
We were using slightly different logic to get the filter
text in various places.  Now we're consistent, and it's
easier to test the edge-case behavior.
2017-10-08 12:01:59 -07:00
Steve Howell 3ef2df363b activity.js: Consolidate initialization code.
We now intialize user-list-filter within activity.initialize(),
which gives us more control to set the module variable
`meta.$user_list_filter` before we build the user sidebar,
while setting up its handlers after we build the sidebar.
2017-10-08 12:01:59 -07:00
Steve Howell e3ee0245c4 Change userid -> user_id in people.js. 2017-10-07 12:16:45 -07:00
Tim Abbott cf3d035edf eslint: Set array-bracket-spacing rule and clean project. 2017-10-06 12:43:12 -07:00
Tim Abbott 82b708b721 eslint: Add and enforce space-in-parens lint rule. 2017-10-06 12:36:59 -07:00
Umair Khan 063268246e 06-settings.js: Disable flaky test.
This commit disables the password change tests. These tests are affected
by the race condition due to which a user's session can be flushed after
a change in password. This happens because in Django 1.7+ session hash
is changed whenever password is changed. Till we can find a better
solution to this problem these tests cannot be enabled.
2017-10-06 12:08:36 -07:00
Harshit Bansal 48ac282667 hotkeys: Remap ':' to close the reactions popover in case of empty search.
Fixes: #6806.
2017-10-05 19:05:27 +05:30
Harshit Bansal ea5cb23c8e build_emoji: Extend emoji mappings to use new emojis from iamcal dataset.
Emojis which are represented by a sequence of codepoints or emojis
with ZWJ are not included until we implement a mechanism for dealing
with their unicode versions.

Fixes: #6279.
2017-10-04 23:09:14 -07:00
Tim Abbott 0b765811b6 activity: Fix presence tests once again. 2017-10-04 21:58:16 -07:00
Tim Abbott 68e75833b7 activity: Fix the node tests.
These were unfortunately broken with the recent changes to filter all
users.
2017-10-04 21:06:51 -07:00
Vishnu Ks 0c35bd60cf frontend: Seperate out info on accessing emails to template. 2017-10-04 08:20:29 -07:00
Cynthia Lin c87ecf0f63 hotkeys: Prevent drafts overlay from showing while lightbox is open.
Fixes #6757.
2017-10-03 08:36:54 -07:00
rht 2ce9e4d9a1 frontend_tests: Replace optparse with argparse.
Tweaked by tabbott to fix the command name being reported properly.
2017-09-30 09:31:06 -07:00
Tim Abbott 6c1c29408e composebox_typeahead: Rewrite code for handling modifier+enter.
We've iterated on this code incorrectly something like 3 times now, so
it's worth rewriting it with a lot of comments in a way that makes
sense.

The main actual functional change here is that modified key + enter
now is consistently the opposite of enter (in terms of whether to
provide a newline or send the message) in all cases.

Fixes #6489.
2017-09-29 17:22:29 -07:00
Harshit Bansal b69e85fa05 emoji_picker: Don't display title text for emojis in emoji picker.
Now that we display the name and aliases of the currently focused
emoji at the bottom of the emoji picker, we don't need to display
the title text for emojis separately.

Fixes: #6111.
2017-09-29 21:10:07 +00:00
Harshit Bansal bb38f98975 emoji_picker: Update emoji showcase on mouse hover. 2017-09-29 21:10:03 +00:00
Harshit Bansal 2873b886fb emoji_picker: Add emoji showcase.
Emoji showcase refers to the space at the bottom of the emoji
picker we use for showing name as well as aliases of the currently
focused emoji.

Fixes: #6110.
2017-09-29 21:09:00 +00:00
Harshit Bansal 4973d992d1 emoji_picker: Move the category tabs to just below the emoji filter.
Also removes the now unused `get_rendered_emoji_categories()` function.
2017-09-29 20:22:09 +00:00
Harshit Bansal d4dfc53a0f emoji.js: Remove some unused data structures.
This commit removes some unused data structures: `emojis_by_unicode` and
`default_unicode_emojis` to be particular.
2017-09-29 11:17:06 -07:00
Harshit Bansal 5b5bcce098 emoji: Migrate bugdown emoji to use sprite sheets.
This commit switches to use sprite sheets for rendering emojis
in all the remaining places, i.e., message bodies and composebox
typeahead. This commit also includes some changes to notifications.py
file so that the spans used for rendering emojis can be converted
to corresponding image tags so that we don't break the emoji rendering
in missed message emails since we can't use sprite sheets there.

As part of switching the bugdown system to use sprite sheets, we need
to switch the name_to_codepoint mappings to match the new sprite
sheets.  This has the side effect of fixing a bunch of emoji like
numbers and flag emoji in the emoji pickers.

Fixes: #3895.
Fixes: #3972.
2017-09-29 11:14:34 -07:00
Brock Whittaker 983be4e8ce right-sidebar: Add perfectScrollbar to the right sidebar.
This adds the perfectScrollbar to the right side and theoretically
updates it any time a piece of code interacts with the sidebar and
updates the counts of users displayed in it.
2017-09-27 19:21:20 -07:00
rht c2290b0328 Remove the rest of print_function. 2017-09-27 18:06:47 -07:00
Vishnu Ks 865bc06945 settings: Show attachment size and upload date in uploaded files page. 2017-09-27 17:50:22 -07:00
Vishnu Ks 2f32439fc3 node_tests: Fix broken assert.equal in templates.js. 2017-09-27 17:50:22 -07:00
Harshit Bansal ee6024281a org_settings: Fix dropup menu for notifications stream not opening.
We were having an anchor tag inside a button which is incorrect HTML.
Chrome and safari handle this case but firefox doesn't and hence the
dropup menu wasn't opening on firefox.
2017-09-26 23:04:49 -07:00
Harshit Bansal ef4337edcb hotkey: Remap `+` key to use canonical name for thumbs up emoji. 2017-09-26 16:50:00 -07:00
Steve Howell 490935249c Simplify rendering of "more topics" link.
We now use a template to render the "more topics" link.

We also remove an unnecessary conditional and an unnecessary
attribute.

Finally, our unit tests are a bit more granular now.
2017-09-26 13:58:54 -07:00
Steve Howell 46e8005bfb Inline feature_flags.use_server_topic_history.
Despite a few warts, we are going forward with getting topic
history from the server when you click "more topics."  This
commit simplifies the code by removing the feature flag
checks.
2017-09-26 13:58:54 -07:00
Joshua Pan 178f5080cf hotkey.js: Switch 'q' and 'w' hotkeys.
On a standard keyboard, 'q' is to the left of 'w', so it makes sense
for the hotkeys for the left and right sidebars to be `q` and `w`,
respectively, not the other way around.
2017-09-25 12:14:07 -07:00
Cory Lynch 0da74f4d6d filter.js: Add test coverage for group-pm-with.
Added one little additional test in
people.js to get up to 100% coverage.
2017-09-24 15:13:58 -04:00
Cory Lynch 1c0043ea47 Add empty narrow msg for group-pm-with.
Also added test case.
2017-09-24 15:13:58 -04:00
Cory Lynch a90eda0154 Add 'group-pm-with' to operator autocomplete.
As you're typing this new keyword, it should be suggested
via get_operator_suggestions. Added relevant test.
2017-09-24 13:56:33 -04:00
Abhijeet Kaur 2bf3324395 frontend: Add ability to search by "group-pm-with" search operator.
This allows user to view all group private conversation messages
with a specific user. That is, it views all the the group private
messages from groups which include the given user.

Add search suggestion for group-pm-with. Add operator name
and description in "Search operators" tab.

Add change in tab name to "Group Messages" when using this operator.
Add frontend_tests for group-pm-with search operator.

Fixes: #3882.
2017-09-24 11:58:48 -04:00
Steve Howell f965a156a9 Revert "Get unread messages from the server in the web app."
This reverts commit c953759486.

The client side logic for dealing with server counts is actually
fine, as far as we know, but there are still some data-related
issues with cleaning up old unread counts.
2017-09-22 10:20:19 -07:00
Rishi Gupta 88bec16452 hotspots: Only narrow to PMs on first load.
After first load, the browser should set tutorial-status to started,
so this should automatically only happen once.

Fixes #6575.
2017-09-22 05:01:53 -07:00
Joshua Pan b201e2c311 hotkey.js: Simplify ctrl+[ hotkey logic. 2017-09-19 19:07:30 -07:00
Joshua Pan d387291b6c reactions.js: Extract open_reactions_popover().
Added tests for open_reactions_popover() also.
2017-09-19 19:07:30 -07:00
Joshua Pan 67064a46e5 compose_state.js: Extract focus_in_empty_compose().
Wrote some tests for the function also.
2017-09-19 19:07:30 -07:00
Tim Abbott 02d931a53e tools: Fix running full-stack tests from tools/ directory.
Previously these tests required you to run them with the root of the
Zulip repository as the current working directory, just due to
sloppiness.

We clean this up, while also making the path handling more consistent
and involving less fragile code.

Fixes #4169.
2017-09-17 11:12:51 -07:00
Cynthia Lin bd7d9da668 hotkeys: Disable 'n' stream creation if user cannot create streams.
Tweaked by tabbott to handle a corner case and add test coverage.
2017-09-16 09:12:38 -07:00
Rishi Gupta 0677bd2a6d hotspots: Rename and update new_topic_button. 2017-09-15 04:14:52 -07:00
Rishi Gupta c985791773 hotspots.js: Inline map_hotspots_to_DOM.
The function is confusing and added unnecessary complexity, given that it is
only called in one place, and is not a function that should be exposed to
other modules.
2017-09-15 04:14:52 -07:00
Sampriti Panda e98d7a6ee8 Fix issues with left-sidebar stream search and multiple words.
If you typed in more than one word for a stream with multiple words in
it's name, it would not show up in the search list. This fixes that
and adds some more tests covering the entire functionality of the
filter.
2017-09-15 00:22:59 -07:00
Cory Lynch f4a09b7758 recent_senders: Add sort by stream message recency.
If both users haven't posted in the current topic, then
as a second order sort, check which user has posted first
in the stream as a whole.

Fixes part of #5956; we still need to sort by sending in the
organization.
2017-09-14 07:20:52 -07:00
Vishnu Ks d8f8e29ff5 frontend: Show link to delete files in quota exceeded error. 2017-09-14 06:04:09 -07:00
Joshua Pan 42b05912f8 hotkeys: Make '?' hotkey toggle. 2017-09-14 05:56:55 -07:00
Sarah c3a8138f74 user_settings: Add push notifications for all stream messages.
Add setting to enable push notifications for all stream messages.
2017-09-14 05:41:37 -07:00
Steve Howell c953759486 Get unread messages from the server in the web app.
The server sends down lists of unread message ids in various
buckets, and we now use those on the client to provide more
complete counts of unread messages.
2017-09-12 06:02:40 -07:00
Brock Whittaker dba09c979c Restructure organization settings and permissions.
This restructures organization settings and permissions to be
more accurately grouped and for the permissions page to not be too
long.

CHANGES:

PROFILE:
    (this was split out)
    organization-profile-admin.handlebars:
        form #1:
            name
            description
            (SUBMIT)
        avatar:
            (UPLOAD)
            (DELETE)

SETTINGS:
    organization-settings-admin.handlebars:
        language (mostly untouched)
        message editing:
            time limit/history/retention
        message feed:
            mandatory-topics
            preview images
            preview websites

PERMISSIONS:
    organization-permissions-admin.handlebars
    (mostly stuff was removed)
    Joining:
        restrict domains
        require invite
    User Identity:
        name changes
        email changes
    Streams/Emoji:
        creating streams:
            waiting period (ADDED)
        adding emojis
    (SUBMIT) for whole panel

The profile group (name, description, avatar) were split into a new
page that did not previously exist, and the permissions was stripped
of message settings (message editing, message feed), but keeping the
"waiting period" input and putting it in the "Streams & custom emoji"
section.

Fixes: #5844.
2017-08-28 17:20:13 -07:00
Steve Howell 3846e60a71 Add stream_data.get_streams_for_admin(). 2017-08-27 19:08:04 -07:00
Steve Howell 106d58df47 Add stream_data.get_non_default_stream_names().
This allows us to get the typeahead values for adding a default
stream using client-side data.
2017-08-27 19:08:04 -07:00
Steve Howell b32a9444dd js: Clean up how we track default stream names.
We continue to have page_params.realm_default_streams, but
now we do lookups on whether a stream is a default stream
by using a Dict indexed by stream_id.

We are also careful to update that during live updates.

This fixes a flaw that we weren't updating the list of realms
correctly for events that remove a default stream.
2017-08-27 19:08:04 -07:00
Tim Abbott 5d974b7f57 emoji: Remove :s from emoji popover title attributes. 2017-08-27 17:34:44 -07:00
Tim Abbott e80f93dc42 markdown: Set is_me_message in apply_markdown.
This should make the variable available to things like drafts and
previews.
2017-08-27 09:34:24 -07:00
Tim Abbott 133f005530 markdown: Remove is_me_message UserMessage flags.
This never made sense to be a flag on the UserMessage table, since
it's not per-user state.  And in fact it doesn't need to be in a
database at all, since it's easily computed from content anyway.

Fixes #1099.
2017-08-27 09:34:24 -07:00
Tim Abbott eb6d736df3 compose: Fix local rendering of previews.
Apparently, local rendering of previews had broken sometime in the
last few months in a refactoring that resulted in us passing a string,
rather than an object, into markdown.js.
2017-08-27 09:33:52 -07:00
Tim Abbott 07a156c400 notifications: Fix desktop/sound notifications for @all.
It appears that previously, these weren't being triggered.
2017-08-24 23:56:10 -07:00
Tim Abbott 4069b166ea run-casper: Fix a mypy annotation error. 2017-08-24 21:02:32 -07:00
Tim Abbott 0148338a05 casper: Always use REALMS_HAVE_SUBDOMAINS.
This is preparation for setting REALMS_HAVE_SUBDOMAINS to be
permanently True.
2017-08-24 20:44:37 -07:00
Steve Howell b215229d22 unread: Add code to set unread counts from page_params data.
This won't run in production due to the feature flag.
2017-08-23 17:25:52 -07:00
Vaida Plankyte b2c0ff68c2 frontend: Add hotkey information to title/inline text.
This should make many Zulip hotkeys significantly more discoverable.
2017-08-23 17:12:09 -07:00
Tim Abbott 74c628b105 editing: Fix live update of ability to edit messages.
Previously, we didn't check the organization-level settings when
rendering a message list; instead, we only checked it when putting
messages into the message_store.  That resulted in the state being
stale in the event that the setting controlling whether one can edit
messages was changed.

We remove some node tests, because revidving the node test for their
new home in message_list_view would be more work than we probably want
to do with an upcoming release.  We basically need to be better about
exporting functions like populate_group_from_message_container and
set_topic_edit_properties, so we can do fine grained testing.

When we get around to the node tests, rather than exporting these
functions, it might make sense to create a new module with a name
like message_container.js, which would have all of these
last-second type of data manipulations on message objects.  This
would be nice to split out of message_list_view.js.  MLV is our
biggest module, and it's mostly cohesive, but it's real job
should be about assembling messages into a DOM list, which is
probably 80% of the code now.  The 20% that I'd want to consider
splitting out is actually closer in spirit to message_store.js.

Thanks to Steve Howell for helping with the node tests.
2017-08-23 12:03:35 -07:00
Max Schaefer 1b445a75ad filter: Remove a spurious assignment.
Variable `predicate` is reassigned right on the next line, so this
assignment has no effect.
2017-08-22 23:49:18 -07:00
Max Schaefer 90510418a8 node_tests: Remove spurious assignments to `args`.
In both cases, `args` is a local variable that goes out of scope
immediately after the assignment. Since the variable isn't captured by
a closure either, the assignment has no effect.
2017-08-22 23:49:05 -07:00
Umair Khan d59e381131 casper: Make sure account-settings-status is invisible. 2017-08-22 23:37:20 -07:00
franziskagoltz 61fbf1a7e3 editing: Hide topic-edit-pencil if message editing is disabled.
This fixes a confusing bug where administrators would be offered the
convenient topic-edit pencil even if message editing was actually
disabled.

This doesn't yet fix the real-time sync issues of changing the setting
without reloading.

Fixes #5946.
2017-08-22 19:43:56 -07:00
Aditya Bansal f645a0304b emoji_pickers: Add tests for emoji_picker.initialize(). 2017-08-22 08:07:25 -04:00
Steve Howell 770ec92891 hotkeys: Fix "n" key to work inside a muted stream.
Normally the "n" key skips over muted streams, but if we
are currently narrowed inside a muted stream, it will now
go to the next topics within that stream.

For me the use case was that I have a stream I check up on
about once a day, and "n" would be super useful for me to
clear out unread counts while still skimming some content,
and without having to temporarily unmute the stream.
2017-08-17 09:01:49 -07:00
Tim Abbott f8b1916781 stream_sidebar_row: Rename data-name to data-stream-name.
This is for greater consistency with the rest of the codebase.
2017-08-16 18:03:44 -07:00
Tim Abbott 5e968ce30d stream_list: Use data-topic-name for topic names.
The name data-name was ambigious.
2017-08-16 18:03:44 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Tim Abbott 30181dcc08 node: Fix node test for user_events. 2017-08-16 16:46:41 -07:00
Aditya Bansal 245d571ae9 emoji.js: Refactor to make better use of initialize(). 2017-08-16 19:18:26 -04:00
Steve Howell 29c05c82f0 Fix A/D hotkeys for cycling through stream narrows.
We now use similar code for A/D hotkeys as we do for the "n"
key.

The old code was using jQuery operations that got tripped up
by our splitters between active and inactive streams.

Fixes #4569
2017-08-16 15:45:47 -07:00
Steve Howell b4590e1303 Add topic_generator.reverse_wrap_exclude().
This allows us to traverse a list backwards, cycling to the
bottom as needed.

This code is going to be used for the "A" key that cycles
upward in the stream sidebar.  It's probably overkill for
that use case, but it does give us O(1) behavior and avoids
the pitfall of accidentally mutating a list when reversing it.
2017-08-16 15:45:47 -07:00
Vaida Plankyte b165784264 frontend: Remove purposeless title attributes from gear menu. 2017-08-16 10:19:02 -07:00
Vaida Plankyte c9de03b163 frontend: Make perfectScrollbars pass tests. 2017-08-16 08:07:28 -07:00
Tim Abbott 9081f2cf44 reactions: Store the emoji codepoint in the database.
This is the first part of a larger migration to convert Zulip's
reactions storage to something based on the codepoint, not the emoji
name that the user typed in, so that we don't need to worry about
changes in the names we're using breaking the emoji storage.
2017-08-15 09:29:27 -07:00
Steve Howell 57f17ae543 Extract top_left_corner.js.
Here are the functions in top_left_corner:

    get_global_filter_li: pure code move
    update_count_in_dom: simplifed copy of similar function in stream_list.js
    update_dom_with_unread_counts: pure code move, split out from function
       of same name in stream_list.js
    delselect_top_left_corner_items: pure code move
    handle_narrow_activated: pure code move + rename
    handle_narrow_deactivated: pure code move, split out from from function
       of smae name in stream_list.js
2017-08-14 13:03:57 -07:00
Steve Howell 0f3b565d40 Create explicit handlers for stream activate/deactivate.
Calling explicit functions ensurest that the sidebars
get activated for narrows before less important things
happen, and it also makes testing easier.
2017-08-14 13:03:57 -07:00
Harshit Bansal 99d3668523 emoji_picker: Change emoji picker to be category based. 2017-08-14 12:52:35 -07:00
Steve Howell 60cca43d5e Always show "more topics" link if you have server history.
Until we have an easy way to consistently determine whether a
stream has more topics than have been loaded already, we err
on the side of showing a "more topics" link.  This in some ways
leads to a more consistent experience where you can zoom in on
any stream, even one that's really new.
2017-08-11 13:01:39 -07:00
Steve Howell fad024ebda Simplify stream sidebar narrows.
This fix simplifies how we re-render topic lists when we
re-narrow or zoom out from a topic list.

    * The topic_list.zoom_out() no longer gets called as
      part of re-narrowing, and we eliminate the clear_topics
      option.

    * For all situations where we narrow to a filter that does
      not have a topic, we simply call the new function
      clear_topics().

    * The stream_list code no longer calls remove_expanded_topics()
      in cases where the new narrow has a topic.  This allows us
      to optimize away scroll/flicker churn a little more easily.

As part of this, we rename maybe_activate_stream_item() to
update_stream_sidebar_for_narrow(), since the function clears
stuff as well as turning stuff on.
2017-08-11 13:01:39 -07:00
Steve Howell 2146e17709 node tests: Improve topic_list tests.
We test a little deeper now, covering rebuild (albeit mostly with
stubs) and active_stream_id.
2017-08-11 13:01:39 -07:00
Steve Howell f706efe12e Add topic_list.active_stream_id(). 2017-08-11 13:01:39 -07:00
Steve Howell 9dd78c803c Make auto-scrolling less aggressive.
We have code that can automatically scroll an element into "view"
in its container.  We use this for stream sidebar rows inside the
stream list.

Generally the stream sidebar rows are small enough to fit into
the container, and the prior algorithm worked correctly for that
scenario.

If you have lots of topics, however, and a short screen, the
algorithm was being too aggressive.  For example, if the top
wasn't showing, it would scroll the top into view, but at the
cost of scrolling the bottom out of view.

This fix makes the general scrolling algorithm more tame.

Part of the user-facing problem is that the element we pass
into the scrolling code for the stream sidebar rows is bigger
than the part of the row that actually should be shown on
screen.  Nevertheless, it makes sense here to make the general
algorithm more robust.
2017-08-11 13:01:39 -07:00
Steve Howell c11c5c3795 Extract stream_list.scroll_delta() and add tests. 2017-08-11 13:01:39 -07:00
Steve Howell 5608dc0add Fix bug with topic edits on read messages.
If you read a message, then got a topic edit for it, we were
adding the message to our data structure of unread stream/topic
messages.

Now we guard against this in unread.update_unread_topics. I
no longer expose an update() method in unread_topic_counter,
since we really want to do the unread check at a higher level
to keep other data structures consistent.
2017-08-10 14:36:18 -04:00
Steve Howell e64277879f Use zjquery to test topic_list.js.
We no longer use real jQuery to test topic_list.  This changes
the nature of the tests to be higher level checks on how the DOM
is constructed.  The actual details of how templates get
rendered should be in templates.js.
2017-08-09 12:32:09 -07:00
Steve Howell 5c5ce3c1b9 Use zjquery in user_events test.
We don't use zjquery in a meaningful way, but we need to be careful
about leaking the real version of jQuery from prior tests.
2017-08-09 12:32:09 -07:00
Steve Howell 779a29e70e Use zrequire in node_tests/stream_list.js. 2017-08-09 12:32:09 -07:00
Steve Howell 7cfc73b040 Use zrequire in node_tests/stream_data.js. 2017-08-09 12:32:09 -07:00
Steve Howell 890794ac8f Use zrequire in node_tests/pm_list.js. 2017-08-09 12:32:09 -07:00
Steve Howell d6b618e2eb Use zrequire in node_tests/activity.js. 2017-08-09 12:32:09 -07:00
Steve Howell 9e054c8b3b Use zrequire in node_tests/narrow.js. 2017-08-09 12:32:09 -07:00
Steve Howell 2f775c3e0b node tests: Extract zrequire helper.
We are phasing out the following in tests:

    add_dependencies - this is just kind of a clunky UI
    require - normal JS requires cause test leaks

In order to plug require leaks, we are effectively doing what
we always have done inside of add_dependencies, which is to
keep track of which modules we have done `require` on, and
these get cleared between tests.

Now we just use `zrequire` every time we want to pull in real
code to our global namespace.
2017-08-09 12:32:09 -07:00