Commit Graph

1967 Commits

Author SHA1 Message Date
Yashashvi Dave e398b25429 user popover: Remove repetitive "Last seen" text from all last seens.
This text was unnecessary.

Fixes part of #10303.
2018-08-28 16:04:52 -07:00
Marco Burstein 6f57cd4d23 upload: Use a placeholder when uploading.
Use the placeholder `[uploading file]()` when uploading before the
upload has completed. This behavior prevents an image from being
improperly placed when typing after starting an upload. This is based
on GitHub's handling of image uploading.

Also, add tests to the `upload` Node tests and update existing tests to
account for the new behavior.

Fix #10305.
2018-08-26 23:33:24 -07:00
Marco Burstein fa22cf18f6 compose_ui: Create the `compose_ui.replace_syntax` function.
`replace_syntax` will replace text inside of a compose textbox. Also,
add tests to the `compose_ui` Node tests for this function.
2018-08-26 23:33:24 -07:00
Vishnu Ks 62b93d551a signup: Fix broken resend email link in realm creation flow.
Also use name for selecting form in casper tests
as form with action=new is present in both /new
and /accounts/new/send_confirm/ which breaks
test in CircleCI as
waitWhileVisible('form[action^="/new/"]) never stops
waiting.
2018-08-26 22:54:05 -07:00
Vishnu Ks d2e4417a72 urls: Separate endpoint for signup and new realm email confirm.
This is preparation for the next commit.
2018-08-26 22:53:57 -07:00
Steve Howell c8fbc0706f tests: Test misc things with input pills. 2018-08-26 22:32:08 -07:00
Steve Howell 53fee3606c tests: Test arrowing between input pills. 2018-08-26 22:32:08 -07:00
Steve Howell a3b573a07c tests: Test pasting into pill input area. 2018-08-26 22:32:08 -07:00
Steve Howell 892085723f tests: Test copying text from input pills. 2018-08-26 22:32:08 -07:00
Steve Howell 1600529a8b tests: Clean up duplicate setup for input_pill.
We just set pill_input.before to a noop for all
of our tests in set_up, and callers can always
override it with more specific implementations.
2018-08-26 22:32:08 -07:00
Steve Howell 3745d44bed node tests: Add test for input pill exit button. 2018-08-26 22:32:08 -07:00
Harshit Bansal 9bd56d0ce4 build_emoji: Change emoji sprite sheets to use hyphens in names.
Use of hyphens is more consistent with our other emoji infra names.
2018-08-26 22:16:23 -07:00
Steve Howell 37acb3e2cb tests: Test left arrow for pill input. 2018-08-25 06:51:15 -04:00
Steve Howell c9fab959b9 tests: Test comma behavior for input pills. 2018-08-25 06:51:15 -04:00
Steve Howell 383567aa73 tests: Test enter-key behavior for input pills. 2018-08-24 10:00:04 -07:00
Steve Howell 572990b7f4 tests: Add set_up() helper for input_pill tests. 2018-08-24 10:00:04 -07:00
Steve Howell 9e0c8e50d1 tests: Cover removePill function for input_pill.
We simulate hitting backspace while focused on
particular pill.
2018-08-24 10:00:04 -07:00
Steve Howell bee592b44e node tests: Bring list_cursor to 100% coverage.
We had some indirect coverage of this already, so
this mostly focuses on error cases and corner
cases.
2018-08-24 10:00:04 -07:00
Shubham Dhama c8a8dbb86a org settings: Remove redundant lines for disabling non-existent checkbox.
In commit c293bb82c4 we changed
id_realm_invite_by_admins_only and realm_invite_required checkboxes to a
single dropdown so these lines are redundant now.
2018-08-23 11:52:59 -07:00
Joshua Pan eca4266cde drafts: Don't save drafts with 2 or less characters.
Fixes #10357.
2018-08-22 16:52:18 -07:00
Joshua Pan 2aeabf24a6 frontend: Create data structure for starred messages. 2018-08-21 13:42:23 -07:00
Yashashvi Dave 6622f995b0 user profile popover: Rename user last seen.
Rename "Last seen just now" to "Just now",
and "Unknown" to "More than 2 weeks ago"
in user profile popover.
2018-08-21 11:42:59 -07:00
Yashashvi Dave 1e27cb18eb user profile popover: Hide popover when user clicks on edit-profile-btn. 2018-08-21 11:42:59 -07:00
Yashashvi Dave 03f5422ce8 custom profile field: Minor tweaks in field-table in admin settings.
This commit add minor changes in profile field table in
admin settings:
 - Hide table header if there is no field
 - Fix width of table column
2018-08-21 11:42:59 -07:00
Yashashvi Dave 463fb622b6 custom profile field: Remove all static use of field-type name or id.
This commit removes all static use of field-type's name or id in
frontend.
2018-08-21 11:37:51 -07:00
Yashashvi Dave 6e65235a6d zerver/lib/events.py: Add FIELD_TYPE_CHOICES_DICT to page_params.
This commit add FIELD_TYPE_CHOICES_DICT to page_params and replace
FIELD_TYPE_CHOICES.

FIELD_TYPE_CHOICES_DICT includes all field types with keyword, id
and display name. Using this field-type-dict, we can access field
type information by it's keyword, and remove all static use of
field-type'a name or id in frontend.
This commit also modifies functions in js where this page_params
field-types is used.
2018-08-21 11:37:51 -07:00
Joshua Pan 793ec9e266 tests: Test all update_display_settings events. 2018-08-19 14:51:31 -04:00
Joshua Pan e0426e42cd tests: Test all realm update dispatch events. 2018-08-19 14:51:31 -04:00
Joshua Pan ccd438a7ee tests: Test minor dispatch events.
These events just call another function. This covers
attachments, invites_changed, and submessage.
2018-08-19 14:51:31 -04:00
Joshua Pan 212db4d155 tests: Use zjquery for server_events_dispatch tests. 2018-08-19 14:51:31 -04:00
Joshua Pan e3504e88a7 tests: Test update realm bot owner event. 2018-08-19 14:51:31 -04:00
Joshua Pan 402e34be3b tests: Test blueslip for subscription events. 2018-08-19 14:51:31 -04:00
Joshua Pan 76ffd967c5 tests: Test typing notifs event from oneself. 2018-08-19 14:51:31 -04:00
Joshua Pan 875383e7c3 tests: Test delete stream event. 2018-08-19 14:51:31 -04:00
Joshua Pan e4a34c3512 tests: Test dispatching stream create event. 2018-08-19 14:51:31 -04:00
Joshua Pan 6b61e54c08 tests: Rename stream test to stream__update test. 2018-08-19 14:51:31 -04: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
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
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
Yashashvi Dave 3c9a2a6d53 custom profile field: Remove logic of choice-field-delete-btn.
Hide `delete-btn` of first choice in create-new-custom-field and
edit-choice-type-field form, so user can not delete all choices
and have to submit at least one choice.
This commit remove this logic of choice-field-delete-btn from
both settings.
This is preparatory commit of adding new logic in `delete-btn`.
2018-08-14 10:17:57 -07:00
Cynthia Lin 300c4c496f user groups: Display error on user group name edit failure.
Fixes #10234.
2018-08-13 16:13:49 -07:00
Cynthia Lin 736388b4df user groups: Improve styling of user groups in admin view. 2018-08-13 16:13:49 -07:00
Tim Abbott 62bee26ea7 Revert "hotkey: Add hotkey to narrow to starred messages."
This reverts commit 144d21494e.
2018-08-13 15:05:36 -07:00
Joshua Pan 144d21494e hotkey: Add hotkey to narrow to starred messages.
Fixes #9684.
2018-08-13 11:39:32 -07:00
Shubham Padia e21e8c1bae compose: Hide subscribe button and change text for waiting period users.
Fixes #10124.
Users in the waiting period category cannot subscribe other users to
a stream. When a user tries to mention another unsubscribed user, a
warning message appears with a subscribe button on it to subscribe
the other user.
This commit removes the subscribe button and changes the warning text
for users in the waiting period category.
2018-08-13 10:18:35 -07:00
Shubham Padia 3f019cafb2 compose: Improve error handling when subscribing other users to a stream.
Instead of displaying a fixed error message inside the yellow bar itself,
now the yellow bar disappears on error and a red compose_error is shown.
The error message is the one returned from the server.
2018-08-13 10:18:35 -07:00
Marco Burstein 6f14f4f047 compose: Update the `New topic` button to `New stream message` in PMs.
If a user is narrowed by `is:private`, `pm-with`, or `group-pm-with`,
change the `New topic` button to say `New stream message` instead for
added clarity.

Also, add to the Casper and Node tests for this behavior.

Fix #9072.
2018-08-09 08:55:01 -07:00
Rohitt Vashishtha c41c82aae0 settings_emoji: Use display_name in handlebars.
This commit fixes two issues with the previous implementation:

1. JavaScript's replace replaces only the first instance,
   thus we need to use a regex.
2. Handlebars was setting the id of the HTML elements with
   spaces in between which broke the delete button; now a
   new variable display_name is passed to the template.

This also makes changes to the casper tests to have an emoji
name with multiple spaces in it to ensure this bug doesn't
appear again.
2018-08-07 10:22:08 -07:00
Marco Burstein 9c1dd5cda5 compose: Deactivate the reply button when there are no messages.
When visiting a narrow like
https://chat.zulip.org/#narrow/stream/doesnotexist, grey-out the reply
button and add the title `There are no messages to reply to.`

Also, add to the tests for `narrow.js` with
`#left_bar_compose_reply_button_big`.

Fix #8547.
2018-08-07 10:19:45 -07:00
Joshua Pan 5303281dfb tests: Fully cover hash_util.js. 2018-08-04 17:56:02 -07:00
Steve Howell ecb3879d0c refactor: Break subs dependency in stream_data.
We move remove_deactivated_user_from_all_streams
into stream_events.js.  There were some minor changes
to rename variables and also to not rely on using
`stream_info`.
2018-08-04 14:06:19 -07:00
Steve Howell ffca07ffdd refactor: Move by_sender_uri to hash_util. 2018-08-04 09:32:27 -07:00
Steve Howell a866f3ec17 refactor: Move huddle_with_uri to hash_util. 2018-08-04 09:32:27 -07:00
Steve Howell fc62e554ce refactor: Move pm_with_uri to hash_util. 2018-08-04 09:32:27 -07:00
Steve Howell 9accc2a3b6 refactor: Move operators_to_hash to hash_utils.
This breaks some unnecessary dependencies on
hashchange.js, in favor of hash_util, which
has fewer dependencies.
2018-08-04 09:32:27 -07:00
Steve Howell ab26e27fef Move stream-related uri helpers to hash_util.
This allows several modules to no longer need
to import `narrow` (or, in our current pre-import
world, to not have to use that global).

The broken dependencies are reflected in the node
tests, which should now run slightly faster.
2018-08-04 09:32:27 -07:00
Shubham Dhama db4ee05653 stream_data: Add helper function to get default streams. 2018-08-04 09:27:16 -07:00
Steve Howell ab22b4411f refactor: Move list of frequent emojis to emoji.js.
All of our data related to emojis is in emoji.js.
Now typeahead_helper no longer depends on emoji_picker.

Generally we want typeahead_helper to only depend
on data modules to avoid complicated circular
dependencies (or at least mitigate them).
2018-08-04 07:59:42 -07:00
Steve Howell c7ab3884c6 refactor: Extract reload_state module.
This is part of work to break some of our
nastier circular dependencies in preparation
for our es6 migration.

This commit should facilitate loading leaf-like
modules such as people.js before all of the things
that reload.js depends on.
2018-08-04 13:55:02 +00:00
Steve Howell a7d7f6cada settings: Make unsubscribed streams less sticky.
When you unsubscribe a stream by clicking on the
checkmark, we don't want it to disappear right
away, but we also don't need it to stay around
once you start searching for new streams.

Note from Tim: This commit removes some complex code that was just a
workaround for the fact that this widget used to automatically
re-filter immediately after clicking to unsubscribe a user.

Since we've since fixed that original issue, we don't need this.
2018-08-03 16:01:02 -07:00
Steve Howell 1c2ddb00d1 buddy list: Add padding to progressive scrollings.
We add a padded div to our container for the buddy
list to give scrolling the illusion that we've
rendered every list item, while still letting
the browser do the heavy lifting instead of trying
to fake it out too much.
2018-08-02 16:59:27 -07:00
Steve Howell 94884a4418 buddy list: Introduce buddy_list_wrapper div.
This new div allows us to split out two concerns:

    semantic list of items - remains in #user_presences
    widget real estate - controlled by new #buddy_list_wrapper

We will use this for progressive rendering.  We want to add
padding to the buddy list without messing with the integrity
of the actual HTML '<ul>' list.  (One ugly alternative would
have been to add a dummy list item, which be a pitfall for
any code traversing the list.)

Basically, all the code relating to click handlers and similar
things was left alone.  We only change js/css related to
scrolling, resizing, and overflow.
2018-08-02 16:56:50 -07:00
Steve Howell 1a84af1e79 buddy list: Add v1 progresive scrolling.
This version of progressive scrolling lazily
renders buddy list items, but it doesn't
provide the browser with any notion of upcoming
list items, so as you scroll down and the size
of the rendered list grows, the scrollbar shows
you being too close to the bottom.

This maintains 100% coverage on buddy_list.js.
2018-08-02 16:56:50 -07:00
Shubham Dhama 7776fa0d05 settings_user: Move "Make admin" button to user-info-form modal. 2018-08-02 15:55:50 -07:00
Steve Howell 2d8f7843a2 node tests: Consolidate some set_global() calls.
Hopefully these cleanups will make it a little easier
to migrate our tests to take advantage of a true
module loading system.
2018-08-02 08:02:12 -04:00
Tim Abbott 4b4d420a5f message_flags: Clarify name for toggle_starred_and_update_server.
This makes it clear that the function sends the update to the server,
not just toggling the UI or local data structures.
2018-08-01 11:09:12 -07:00
Joshua Pan 2fcc54ac14 ui: Rename update_starred to update_starred_view. 2018-08-01 11:07:44 -07:00
Tim Abbott 0044866682 events: Fix starring logic correctly.
In 47aaa73f96, we fixed one issue, which
is that server_events_dispatch.js was calling `update_starred` with
the wrong arguments, but created a new one (toggle_starred wasn't
updated) and missed another (which is that we weren't ever updating
message.starred, and thus if you toggle a message's star-state in one
browser, and then tried to toggle it back in a second, it would feel
like the click didn't work, because it was trying to toggle
e.g. off->on a second time).
2018-07-31 17:38:24 -07:00
Tim Abbott d377ac5768 people: Fix blueslip errors for late-added users.
This was supposed to be suppressed when a reload is in progress,
however, the logic was accidentally checking that
reload.is_in_progress was a defined function, not whether a reload was
actually in progress.
2018-07-31 10:41:33 -07:00
Tim Abbott f71316edd0 presence: Suppress some unnecessary blueslip errors for presence.
There was previously a race condition where reload.is_in_progress was
set after `activity.js` sent the presence request to the server, but
before we process the response; in that race condition, we still
shouldn't send blueslip errors to the server.
2018-07-31 10:40:34 -07:00
Roman Godov c0806917ec models: Rename Realm.restricted_to_domain field.
This renames Realm.restricted_to_domain field to
emails_restricted_to_domains, for greater clarity as to what it does
just from seeing the setting name, without having to look it up.

Fixes part of #10042.
2018-07-31 09:28:33 -07:00
Joshua Pan 28d04f6960 tests: Test composing scheduling reminder indicator. 2018-07-31 11:23:20 -04:00
Joshua Pan bf8aa2a1d7 tests: Remove unnecessary jQuery stub.
$().is(':visible') is already implemented in zjquery.
2018-07-31 11:23:20 -04:00
Anders Kaseorg 9a99d76296 tools: Remove pointless uses of shell=True.
Which, not coincidentally, is all of them.  Don’t use shell=True.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-30 22:39:06 -07:00
Shubham Dhama e08daf9a00 settings_user: Add modal for user info and roles form.
Advantages of changing it to modal is that now it doesn't render
form for every row i.e. form is rendered only for row edit button
is clicked.
2018-07-30 13:48:36 -07:00
Shubham Dhama 16357fc84a people: Add common function for getting active human users. 2018-07-30 13:48:36 -07:00
Aditya Bansal 5b5d8bb310 thumbnails: Rename data-original to data-src-fullsize. 2018-07-30 13:00:23 -07:00
Tim Abbott 906718f154 node tests: Fix minor linter error.
I'm not sure how this slipped in.
2018-07-30 12:17:27 -07:00
Steve Howell f63dde8777 node tests: Add coverage to subs.js.
We test populate_stream_settings_left_panel() and use
its values to simulate data for filter_table().
2018-07-30 11:25:32 -07:00
Steve Howell 132d0971ae Remove stream data stubs in typeahead tests.
We now use real stream_data functions, rather than
stubbing some of them to return strings instead of
structures.
2018-07-30 11:25:32 -07:00
Steve Howell 95d136ca5e Extract search_util.js module.
We probably should have done this a while ago, even
though these functions are pretty tiny.  The goal here
is to make it easier to have more consistent search
semantics.

Our first use case is subs.js.  In this case we
are able to decouple a bit of generic string
matching from the subs-specific code.
2018-07-30 11:25:32 -07:00
Steve Howell 064d0f3c89 Extract stream_data.sort_for_stream_settings().
We move some data code from subs.js to stream_data.js.

It's not clear we have been using the optimal sort for
dealing with locales, but this change preserves the
current behavior.  The only subtle change here is that
we look up subs using a Dict now instead of a plain
JS object.
2018-07-30 11:25:32 -07:00
Steve Howell 5641c77c94 refactor: Introduce other_stream_ids in filter_table().
We now build up three buckets of stream ids for slightly
more consistent code that will help in future refactorings.
2018-07-30 11:25:32 -07:00
Cynthia Lin e9cf545ada scroll_util: Account for element padding in height calculations. 2018-07-27 09:09:52 -07:00
Cynthia Lin 3670b480c3 node_tests: Cover a compose PM recipients typeahead corner case . 2018-07-27 00:12:52 -07:00
Cynthia Lin 2fe4056b3c composebox_typeahead: Add user groups to PM recipient typeahead.
When a user group is selected, we add PM pills for each user in the
group instead of creating a PM pill for the user group.

Fixes #9971.
2018-07-26 11:21:11 -07:00
Steve Howell 8aa3eebe70 refactor: Render Stream Settings in two steps.
We now render the "skin" part of "Stream Settings" before
adding in the actual streams.  The new function
populate_stream_settings_left_panel() takes care of adding
the streams.  It uses a new template called
`subscriptions.handlebars`.

Splitting out this function will give us more flexibility
for various improvements.

First, we can decide to render the list after we open the
overlay, just to avoid the problem that users don't know why
the modal's opening.  (And we could add a loader spinner as
needed.)

Second, we can improve our filter features so that we do
filtering in the data instead of moving DOM rows around,
which is expensive.

Third, we can eventually introduce progressive rendering.

Finally, having the function broken out will make profiling
more precise about where bottlenecks exist.
2018-07-26 11:20:46 -07:00
Harshit Bansal cf5b2b4815 emoji: Change emoticon mapping for `:)`, `(:` and `:(`.
See discussion on CZO:
https://chat.zulip.org/#narrow/stream/101-design/subject/emoji.20picker/near/617811
2018-07-26 11:17:03 -07:00
Steve Howell 5cdce82f7c refactor: Add compare_function to buddy_list.
We were passing this in before, but having it as
a data member reinforces the idea that we'll want
this to be a first-class concept in the list, since
we depend on ordering for various things.
2018-07-25 15:53:27 -07:00
Steve Howell 45ab5a2f61 refactor: Simplify navigation code for buddy list.
We can now take advantage of self.keys to return
first_key, prev_key, and next_key.
2018-07-25 15:53:27 -07:00
Steve Howell d69b3a3c71 refactor: Track user_ids in buddy_list.js.
We now keep track of keys in buddy_list.js, so that
when we insert/remove items, we no longer need to
traverse all the DOM.  Instead, we just find out
which position in the list we need to insert the
key in (where "key" is "user_id") and then find
the relevant DOM node directly and insert the new
HTML before that node.  (And of course we still
account for the "append" case.)

There's a little more bookkeeping to make this
happen, but it should help reduce some code in
upcoming commits and pave the way toward
progressive rendering optimizations.

This commit should produce a minor speedup
for activity-related events that go through
buddy_list.insert_or_move(), since we are
not traversing the DOM to find insertion points
any more.
2018-07-25 15:53:27 -07:00
Shubham Padia 56644d149a typeahead: Replace `no-break space (U+00A0)` in query with `space (U+0020)`.
Typing "tim " did not did not produce any match when suggesting person
in composebox typeahead or user group typeahead as the space at the
end of the "tim " string passed by the browser was a
`no break-space (U+00A0)`  instead of `space (U+0020)`.

Although there are unicode characters other than `no break-space` which
represent spaces, only U+00A0 is replaced as it was the only space
character encountered when testing this issue manually.

Fixes #10039.
2018-07-25 14:55:11 -07:00
Joshua Pan 8de454ad2d tests: Test private msg validation with zephyr mirror. 2018-07-24 07:51:11 -04:00
Joshua Pan f5ee360c57 tests: Test nonexistent_stream_reply_error(). 2018-07-24 07:51:11 -04:00
Joshua Pan ac133c357c tests: Test Google Hangouts video call link. 2018-07-24 07:51:11 -04:00
Marco Burstein bb09bea0b6 ui: Simplify hotkey deprecation notices.
To reduce code duplication when creating hotkey deprecation notices,
create the `get_hotkey_deprecation_notice` function. Also, create a
`ui` testing file with a test for the new function.

Fix #10004.
2018-07-23 22:41:59 -07:00
Steve Howell 520e85b866 Use topic_data.js for topic typeaheads.
This replaces some old code with calls to topic_data.js.

Now our topic typeahead uses the same data as our
sidebar, stream suggestions, and the "n" key, so any
future improvements to that data will benefit all
features the same.

This is an important piece of #9857.
2018-07-23 16:08:24 -07:00
Harshit Bansal a906d564a3 emoji: Rename `css_class` to `emoji_code` in emoji.js.
Now that `emoji_collection` and `emojis_by_name` are global
datasources in the webapp we need to rename things carefully
to reflect their actual meaning. The fact that emoji code is
used as a css class for unicode emoji is one thing but it is
not its sole use so renaming it seems a good idea.
2018-07-23 12:35:08 -07:00
Harshit Bansal 88bc78645d emoji: Move `emoji_collection` from emoji picker to emoji.js.
This commit moves the `emoji_collection` datasource in the emoji
picker to emoji.js and renames it to `emojis_by_name`. It is a
mapping from emoji name to object where each object describes an
emoji. This is an effort in the direction of de-duplicating and
unifying the datasets being used by various our widgets(like
emoji picker and composebox typeahead) in the webapp. Migrating
all the widgets to a single datasource will help us in removing
the whole class of annoying bugs which causes some emojis to be
missing from some widgets.
2018-07-23 12:35:08 -07:00