Commit Graph

4249 Commits

Author SHA1 Message Date
Shubham Dhama 8d70e59ad0 org settings: Rename functions for more clarity. 2018-04-01 16:11:12 -07:00
Shubham Dhama 7fbf613f89 org settings: Unexport functions not used in other modules. 2018-04-01 16:11:12 -07:00
Shubham Dhama e317cd2c17 org settings: Add labels as a context to admin templates.
(It is a preliminary change for deduplication of org settings template.)
This adds org settings labels as a context to admin templates so that
they can be used as a context variables in admin templates.
The reason we did this in JS code because of translation issue when
passed (as a context in `partial` handlebars helper) directly within
template.
2018-04-01 14:52:12 +05:30
Shubham Dhama b7aae89029 org settings: Add realm level default time format setting. 2018-03-31 16:23:26 -07:00
Shubham Dhama f4d6b2a853 org settings: Split "Language and notifications" section.
This splits "Language and notifications" section into "Default user
settings" and "Notifications".
With this, we can easily add other default user settings in the
same place.
2018-03-31 16:22:52 -07:00
Shubham Dhama e04b8271ca org settings: Remove obsolete UI updating code for realtime sync.
In our new system for updating realm settings, we don't need to create
separate functions to update the input elements for each feature.
Most of the work is done automatically by
`settings_org.sync_realm_settings`.
2018-03-31 16:19:09 -07:00
Balaji2198 724117cd45 org settings: Refactor the `render_notifications_stream_ui` function.
We are having a same code in `render_notifications_stream_ui`
and `render_signup_notifications_stream_ui` functions aside from
the HTML element. So this commit will remove the duplicate code in
`render_signup_notifications_stream_ui` and make use of
`render_notifications_stream_ui`.

Fixes #8886.
2018-03-31 16:08:47 -07:00
Balaji2198 21fe9fe20a org settings: Add elem param to the render_notifications_stream_ui. 2018-03-31 16:08:47 -07:00
Aastha Gupta 9d052bcf5e copy_and_paste.js: Fix exception on IE11 with clipboardData.
On IE11, ClipboardData isn't defined; one can instead access it with
`window.clipboardData`, but that doesn't support text/html, so this
code path couldn't do anything special anyway.

So we instead just let the default paste handler run on IE11.

Fixes #8850.
2018-03-31 15:47:33 -07:00
Steve Howell cd8c15f1cf pills: Use a template to render the pills. 2018-03-31 09:32:52 -07:00
Steve Howell d48fb1d776 pills: Use insertText for copy/paste. 2018-03-31 09:32:52 -07:00
Tim Abbott 3fd8d718f4 websockets: Fix race condition in CSRF token initialization.
It appears that we were not always initializing the Socket object
after `setup.js` had the opportunity to set csrf_token.

This should fix #6961.
2018-03-31 09:29:56 -07:00
Akash Nimare 51113baebc desktop-app: Update app to latest v1.9.0. 2018-03-30 13:14:10 -07:00
Tim Abbott e840e5b3a8 Revert "Ignore new messages when lists are behind."
This reverts commit bcdd12773e.

We need to do some improvements in handling FetchStatus for initial
narrows before this will be safe to deploy in production.
2018-03-30 11:52:14 -07:00
Tim Abbott 8b91ea3a74 Revert "Suppress local echo when we are not caught up."
This reverts commit 80ed8294a1.

We need to do some improvements to FetchStatus for narrows before this
is safe to have running in production.
2018-03-30 11:51:52 -07:00
Tim Abbott 5c1dd162be settings: Eliminate remaining NEW_USER_BOT code.
I somehow missed this when removing the rest of the custom
NEW_USER_BOT logic.

This may fix a Casper test that has been failing.
2018-03-30 09:16:22 -07:00
Steve Howell 9ce9c2f9db Extract info_overlay.js.
There are several ways we open help for keyboard shortcuts,
markdown help, and search operators.

    - from the gear menu
    - from the compose box
    - from the search box
    - hitting ? for keyboard help
    - arrowing/clicking through the tabs

This just moves the relevant code into a module and changes a
bunch of one-line calls in various places.
2018-03-30 09:07:23 -07:00
Shubham Dhama efeee28b12 settings: Remove obsolete lines of code.
There don't exist any element with this classes and it seems they
are accidentally added during addition of `bot_creation_policy`.
2018-03-30 16:07:53 +05:30
Shubham Dhama aca2364455 settings: Focus "Add a new bot" tab when there is no active bot.
Fixes: #8872.
2018-03-30 16:07:01 +05:30
Shubham Dhama 0ef195ecc2 settings: Refactor code for focussing bot tabs. 2018-03-30 16:07:01 +05:30
Steve Howell 90e10a11de components: Simplify toggle component.
This adds some helpers to avoid some duplication, and we also
now track the selected idx directly, since it's all under our
control.

The main addition is `select_tab`, which we now use for some
things that used to simulate clicks.
2018-03-29 16:13:46 -07:00
Umair Khan c14cefc24c settings: Add support for adding/removing custom profile fields.
Now that we have support for displaying custom profile fields, this
adds administrator-level support for creating them.

Tweaked by tabbott to fix a few small bugs and clean up the commit message.

Fixes #1760.
2018-03-29 13:59:16 -07:00
Yago González 1237f819bb settings: Fix typo. 2018-03-29 08:04:51 -07:00
Shubham Dhama b580c62bd4 settings: Fix exception on updating bot_creation_policy.
This initializes the bot_creation_policy_values after the page
is loaded.

Previously we initialize these values in `settings.js` when settings page
is loaded at least once, so if we open two tabs, one(1) in which we
haven't opened the settings page yet and if in another tab (2) we
update the `bot_creation_policy` value, then because of the event
which calls `settings_bots.update_bot_permissions_ui` causes exception
in (1) because `bot_creation_policy_values` isn't initialized yet.

Fixes: #8852.
2018-03-29 08:03:42 -07:00
Tim Abbott 9f2a3c2921 settings_org: Fix spelling in set_create_stream_permission_dropdwon. 2018-03-29 08:02:19 -07:00
Shubham Dhama 35cfb86723 org settings: Fix real-time sync for realm_waiting_period_threshold.
This fixes a minor bug in which the value of `input` element of
`realm_waiting_period_threshold` don't get updated because in
`set_create_stream_permission_dropdwon` we don't change the
value of the input.
So, this minor refactor handles this more carefully.
2018-03-29 08:00:58 -07:00
Shubham Dhama 7eea186306 org settings: Make sync_realm_settings to be available at load time.
This moves `sync_realm_settings` function out of `_setup` so that
we can call `settings_org.sync_realm_settings` without opening
settings page at least once.

This also fixes a minor bug in which if we have two tabs opened and
in one we haven't opened settings page at least once and in
another we change an org setting, then we get an exception in
the former tab because of the event as `sync_realm_settings`
isn't defined yet.
2018-03-29 08:00:50 -07:00
Shubham Dhama 29f57d54a0 org settings: Move discard_property_element_changes out of `_setup`. 2018-03-29 17:44:39 +05:30
Shubham Dhama e53c6f5639 org settings: Move independent functions out of `_setup` function.
This commit moves some functions out of `_setup` function which are
independent of each other and any function inside `_setup` function.
2018-03-29 17:44:39 +05:30
Shubham Dhama 4472f5b230 org settings: Prefer `val` over `attr` to change value of dropdown.
Changing the selected value of dropdown by `val` has more advantage
over `attr` especially in the case when dropdown value is chnaged
multiple times like due to events and discarding changes.

Though it is applicable to other elements but in this commit it is just
used for `id_realm_create_stream_permission` dropdown.

There are many question about this at stackoverflow:
https://stackoverflow.com/a/22093618/7418550
https://stackoverflow.com/a/4837162/7418550
2018-03-29 17:44:38 +05:30
Shubham Dhama 6ec5c28e97 org settings: Move property types out of `_setup` function.
Since we don't have any string needed to be translated in
property_types we can move it outside `_setup` function to
get to the safe side if they needed to get accessed before
`_setup` is called.
2018-03-29 17:44:27 +05:30
Shubham Dhama 86967c2be1 settings: Include settings label as context to template.
This is a preliminary commit which includes settings' (checkboxes)
label as a context for rendering template.
The reason we did this in JS code because of translation issue when
passed (as a context in `partial` handlebars helper) directly within
template.
Currently this is done for notifications' settings.
(There will be no UI change)
2018-03-28 16:17:45 -07:00
Tim Abbott 3d5b6539d1 unread: Fix confusing aliasing of variable names. 2018-03-28 12:21:36 -07:00
Tim Abbott d92af69cce styles: Rename dark-mode to night-mode.
This matches the externally-facing name for the feature as well as the
setting variable in the code.
2018-03-28 10:41:26 -07:00
Steve Howell 084ef0bea9 Fetch new messages when you scroll forward in narrows.
Note from tabbott: This is a somewhat surprising feature to be adding
this late in Zulip's development, but the model we've had of what
narrows are easy to access via clicking around has meant that it was
fairly difficult to get into a narrow that didn't include the very
latest messages in that narrow.

Fixes #3465.
2018-03-28 09:12:59 -07:00
Steve Howell 80ed8294a1 Suppress local echo when we are not caught up. 2018-03-28 09:12:25 -07:00
Steve Howell bcdd12773e Ignore new messages when lists are behind.
If individual messages arrive before we get the latest
messages from the server, they can create gaps in rendering,
and would often be offscreen anyway, so we just ignore them.
2018-03-28 09:12:25 -07:00
Steve Howell 4e431516bf Update message_list.all.fetch_status during frontfill. 2018-03-27 18:14:09 -07:00
Steve Howell 60c77ddf6c Update message_list.all in do_backfill(). 2018-03-27 18:14:09 -07:00
Shubham Dhama 419208cabe settings: Refactor to use pluck to extract `setting` attribute.
This is just a small refactor to use `pluck` over manually using `map`.
2018-03-27 18:01:03 -07:00
Rohitt Vashishtha 6dda3fe83e emoji: Do selective local echo of emoticon conversions.
Earlier, we used to convert all occurrences of an emoticon on the
frontend. That behavior has been altered to do conversions only
when the emoticon has some terminal symbols around them, and not
any alphabet or number. Also adds tests for emoji conversions for
the above logic.

Fixes #8585.
2018-03-27 17:16:55 -07:00
Shubham Dhama 33b6e19e31 org settings: Remove obsolete property_types's status messages.
Since now we use buttons as a method to show saving status,
we don't need anymore `msg`, `checked_msg` etc.
2018-03-27 16:48:29 -07:00
Shubham Dhama 2f496ffe1f org profile: Use new org setting changes saving framework.
With this we have the same way to save changes done in org profile
subsection, i.e. show "Save" button beside header of subsection,
add "Discard changes" button for org profile subsection and
show "Save" and "Discard" button only when needed.

Also, there is so much code which become obsolete which is removed
in this commit.
2018-03-27 16:48:28 -07:00
Marco Burstein 6279a9ef09 message view: Hide "view source" and "quote" for deleted messages.
Fix #8839.
2018-03-27 16:43:24 -07:00
Tim Abbott ac7031de3a message_list_view: Add a workaround for Chrome scrolling down bug.
Based on extensive manual testing with print-debugg (the exact
situation here was highly reproducible), in the absence of this line
here or slightly above here, Chrome 64 will consistently trigger an
extra scroll-forward-by-12000-pixels size downward scrolling event
immediately after it finishes rendering the 5th batch of ~100 messages
one gets from hitting the End key in `near:1` narrows.

I don't understand clearly why this change would protect against such
a Chrome bug, but my best guess is that Chrome was doing some sort of
incorrect optimization, and querying the scrollTop was forcing it to
come to a clear conclusion about the scrolling position before
appending more content.

But runs with the scrollTop() line not present in that function show a
scrollTop of around 25K in `append()` just before the call to
`render()`, and 37K at the end; while runs with this scrollTop line
always show 25K both before and after, so it does seem to work.
2018-03-27 13:51:28 -07:00
Tim Abbott 43ec04dcff narrow: Fix a buggy condense_and_collapse call.
Previously, when unnarrowing, we were calling this on the wrong
selector (this was missed years ago when we refactored Zulip to use
divs rather than table rows in the main message feed).

Noticed while debugging #5312.
2018-03-27 09:53:45 -07:00
Puneeth Chaganti 97b90c1e87 condense: Re-condense all messages on window resize.
Previously, if you started out with a very small window, loaded the
Zulip webapp, and then resized the window to be larger, you'd get the
condensed "[More]" links on essentially every message.  This failure
mode was most visible with multi-protocol Electron apps like Rambox
that would sloppily start with a tiny window and then resize it when
loading Zulip.

The Rambox experience was essential to our being able to track this
down; once we knew what was happening, the fix was simply to
re-compute the condense state on resize.

Commit message rewritten by tabbott to explain the debugging and
context involved here, since this was one of our longest-lived mystery
bugs.

Fixes #5312.
2018-03-27 09:53:45 -07:00
Shubham Dhama 4cf42ce478 settings: Move remove-default-stream-button handler to settings_streams. 2018-03-26 10:27:09 -07:00
Steve Howell 825f5feba4 stream_create: Finish handler cleanup.
This commit is similar to the prior commit, in that we are
more disciplined about setting up handlers.  We set them up right
as the widgets get rendered, and the handlers only delegate
up to the container div (id="stream_creation").
2018-03-26 06:44:19 -04:00
Steve Howell 954fceeed6 stream_create: Make handlers more modular for users.
We now wire up the handlers that correspond to elements in
the 'new_stream_users' template when we render that template,
rather than at startup time.

We also delegate the events only up to #people_to_add, rather
than all the way up to body/document.
2018-03-26 06:44:19 -04:00
Steve Howell 04e25fe2a2 Extract stream_create.create_handlers_for_users(). 2018-03-26 06:44:19 -04:00
Shubham Dhama eb0da20b78 settings: Clean up repeating code in error callbacks.
This cleans repeating code in error callback in settings.
We made a generic function in `ui_report.js` which require two
arguments `xhr` and `btn`; we preferred `btn` over `row` as argument
because a row may have more than one buttons.

Fixes: #8788.
2018-03-25 10:40:40 -07:00
Shubham Dhama 3e47a9fe22 org settings: Add real-time syncing for property changes. 2018-03-25 08:30:47 -07:00
Shubham Dhama 315058498b org settings: Handle dependent sub settings manually.
This replaces the previous logic of triggering change() event.
(Also, when we trigger the change() event whole path for detecting
changes in a subsection are triggered which isn't good.)
2018-03-25 08:30:04 -07:00
Shubham Dhama 84a5786b2e org settings: Refactor the discard changes function.
This extract the logic of resetting the value of a single property element
at a time so that we can reuse this for real-time-syncing.
2018-03-25 08:30:04 -07:00
Shubham Dhama a779fc6095 org settings: Use disable_sub_setting_onchange for dependent checkbox.
This makes use of `settings_ui.disable_sub_setting_onchange` for
handling dependent `id_realm_disallow_disposable_email_addresses`
checkbox when `id_realm_restricted_to_domain` is changed.
2018-03-25 08:30:04 -07:00
Shubham Dhama f17fa3305b org settings: Fix discard changes for realm_create_stream_permission.
On discarding changes made for `realm_create_stream_permission` always
"by_admin_user_with_custom_time" get selected because
`create_stream_by_admins_only` isn't a valid page_param.
2018-03-25 08:30:04 -07:00
Shubham Dhama ce156dd21d settings_ui: Revert extension for success callback in do_settings_change.
This reverts success callback extension for `do_settings_change` function
because it seems it is better to make the request directly rather
than calling `do_settings_change`.
And hence `error` callback extension is also removed  for the same
reason, but a error_continuation is added to do additional tasks when
errors happened.
2018-03-25 08:30:04 -07:00
Steve Howell aac76c14bd settings: Avoid duplicate form handlers.
For forms that are built early in setting up the settings panel,
we don't want to attach multiple submit handlers every time we
go into the gear menu, so we use "off" to clear any old handlers.

We also attach handlers directly to the form, instead of
using delegation up to the container div.
2018-03-25 08:28:04 -07:00
Steve Howell e30b619ad5 Fix leaky O(N) email hint handler.
We only have one possible email hint, so there's no reason
to create one for each stream row, especially since we don't
clean them out when we close stream settings.
2018-03-25 08:28:04 -07:00
Steve Howell 45f0df6d31 message view: Removed message_rendered.zulip event.
We don't have any consumers for this event after removing
some obsolete code related to subscribe buttons.

Handling this event reliably consumed about 75% of the time
spent in _post_process_dom_messages, and maybe a percentage
point or two of overall rendering, so this will be a minor
speedup.
2018-03-24 12:31:36 -04:00
Steve Howell 4f05cefb32 Remove obsolete code for stream subscribe buttons.
In 18e43895ff we replaced
stream subscribe buttons with stream links.  The new feature
has been well tested and well received for over a year now,
so it's safe to remove the older feature at this point.

Older sites will have super old messages that still have the
rendered markup; this commit does not attempt to address those
situations.  Most likely, clicking on an old button in the old
message will either do nothing or look like a message reply.
2018-03-24 12:31:36 -04:00
Tim Abbott 51073afc36 subs: Remove incorrect expectOne() in settings_button_for_sub.
This removes an assertion added in
b6408a0383 that was only true if that
stream's edit UI was visible.
2018-03-23 15:24:42 -07:00
Tim Abbott 195b96c989 lightbox: Add debugging code for unknown message IDs.
This should help debug a traceback we've been seeing in production
where the fetched message was undefined.
2018-03-23 15:17:21 -07:00
Tarun Kumar d403b7a2d5 user-groups: Prevent user not in user group from editing/deleting it.
Admin and user group members are allowed to edit/delete group.
Add node-tests to maintain 100% coverage for settings_user_groups.js
Fixes #8315.
2018-03-23 14:44:47 -07:00
Tarun Kumar 5ac767149c user-groups: Update UI to mention only members can edit a user group.
Also, we remove unnecessary tips regarding modification settings.

Remove 'Only organization administrators can edit these settings'.
Remove 'Anyone in this organization can add user groups'.
2018-03-23 14:44:47 -07:00
YJDave 886e77e858 subscription: Fix bug in display email hint popover on hover.
Fixes #8743
2018-03-23 09:55:44 -07:00
Shubham Dhama c50117418e org settings: Fix unexpected saving of input-text fields on "Enter".
Before this commit when we press enter in the text-input field the
first subsection get saved because a click event is triggered for
the first save button (of first subsection) irrespective of the
location of text input field in the whole form which is expected
as a default behavior of the forms.

The simple fix is to make the button of type "button" and override
action of "enter" in an input field.

More info at https://stackoverflow.com/a/12914700/7418550 and
https://stackoverflow.com/a/7060762/7418550
2018-03-23 07:28:46 -07:00
Shubham Dhama 8304c37dfb org settings: Make each subsection of org-permissions independent.
This makes each subsection of org-permissions independent from the
perspective of saving changes.
All the behavior we have for org-settings are also ultimately
reflected here as well like individual "Save" button for each
subsection, "Discard" button for discarding changes done in a
subsection and appearance of this button only when required.
2018-03-23 07:28:46 -07:00
Shubham Dhama 3b7f045da5 org settings: Extract function to discard changes done in a subsection.
In the new function, property values are handled more carefully i.e.
we first check whether property_name refers to a property values
which we can't get from the value of input elements like we have in org
permissions section for properties like realm_add_emoji_by_admins_only
where we have used dropdown and hence we get a string value but we
expect a true/false (check/uncheck) value.

Also, it is better to trigger a `change` event after changing a value
because we have properties which are dependent on the values of another
settings. Previously we trigger `click` event for checkboxes but
there exist some settings other than checkboxes like dropdown
for realm_create_stream_permission where realm_waiting_period_threshold
only appears after selecting custom values for threshold value from
dropdown.
2018-03-23 07:28:46 -07:00
Aastha Gupta f900f955c0 message edit: show spinner on topic change.
On clicking the checkbox in topic edit form, display a spinner and
hide the cancel icon.  Also, do not display any success message.

Fixes #8793.
2018-03-23 07:21:22 -07:00
Priyank 603dc4a2ef electron_bridge: Notify electron app when realm name is updated. 2018-03-22 22:05:44 -07:00
Priyank f0190fe0b8 electron_bridge: Notify electron app when org avatar is updated. 2018-03-22 22:05:12 -07:00
sinwar 675e844e6b team page: Add contributors of zulip-terminal.
It adds zulip terminal contributions to
team page using github apis.
2018-03-22 21:06:18 -07:00
Tarun Kumar 59b1f59605 user-groups: Add function wrappers to reduce variable scope.
Extract set_up_typeahead function.
Extract pill_remove function.
2018-03-22 16:48:46 -07:00
Sarah 91197fa4f1 org settings: Add logic for applying allow_community_topic_editing.
Applies the logic to allow community members to edit topics
of others' messages if this setting is True. Otherwise,
only administrators can update the topic of others' messages.

This logic includes a 24-hour time limit for community topic editing.
2018-03-22 16:13:36 -07:00
Anupam-dagar 865480ec42 portico: Fix positioning of "disposable email address" errors.
Modified by tabbott to prevent losing the frontend errors, and make it
more clear which errors are from the frontend vs. backend.

Fixes: #8784.
2018-03-22 14:38:57 -07:00
Shubham Dhama f97cff54aa org settings: Fix casper failing due to check_property_changed. 2018-03-22 12:51:09 -07:00
Shubham Dhama 6cdbcfd80c org settings: Refactor check_property_changed.
In this refactor property values are handled more carefully i.e.
we first check whether property_name refers to a property values
which we can't get from the input elements like we do have in org
permissions section for properties like realm_add_emoji_by_admins_only.

Small refactor in property_value_element_refers is to prevent many
return statements on further addition of property names.
2018-03-22 11:44:58 -07:00
Shubham Dhama 42ee40d1bc org settings: Refactor failed status element to use class.
This changes failed status element to use class
`.admin-realm-failed-change-status` rather than id so that we can use
the same code in `save_organization_settings()` in future to refer to
failed-status element of that section.
2018-03-22 23:17:13 +05:30
Shubham Dhama 22ab571b8f org permissions: Extract logic to complete request data for subsection.
To keep click handler for "save" button clean, we extracted the
the `if` statements where we complete request data for certain fields
which aren't mentioned in `property_types`.
2018-03-22 23:17:13 +05:30
YJDave 11c995b70f custom profile data: Send event to active user on update.
On update of custom profile fields, send an event to all
active users of realm.
2018-03-21 16:08:12 -07:00
YJDave 82c8d43209 custom profile data: Enable user to edit custom field's value in settings.
This will enable user to edit the value of custom fields from
user settings.
2018-03-21 16:08:12 -07:00
YJDave b404d0e156 custom profile data: Set custom field's values in user setting page on load.
Set realm custom field's values for current user in user setting page
when page gets load.
2018-03-21 16:08:12 -07:00
Steve Howell a110736584 Use do_backfill() in start_backfilling_messages().
This change mostly de-duplicates code, but it also prevents
some unnecessary backfills if you're in the home view and
happen to scroll back while the idle loop is right in the middle
of a backfill fetch, or if the idle loop has taken you back
to the oldest message already.  This is a consequence of
do_backfill() calling msg_list.fetch_status functions.

Everything else should work pretty much the same, since
do_backfill() computes anchor essentially the same way we
originally doing it in the onIdle() function.
2018-03-21 14:07:00 -07:00
Steve Howell 7242fa8eb8 message_fetch: Extract do_backfill().
This slightly changes the order of operations of what we do in
the `cont` callback, so that we update fetch status earlier.
The order is somewhat arbitrary here, but we generally want to
update data structures first.
2018-03-21 14:07:00 -07:00
Steve Howell e8bc781fd5 Use message_list.all for backfill anchor for home view.
The "all" list and "home" list are basically kept in sync, and
the former is a superset of the latter.

Whenever we are backfilling, we want to backfill "all", so we use
it as the anchor, even though home_msg_list is the message list
we are actually rendering.
2018-03-21 14:07:00 -07:00
Steve Howell f524a095a2 refactor: Extract message_fetch.get_backfill_anchor().
This is just moving code.
2018-03-21 14:07:00 -07:00
Tim Abbott 1e7dc70c7f reactions: Fix the hotkey for adding an emoji reaction.
This was incorrectly migrated in
a49655e0d4a868d3973e53cf8482b91aa2df1bb1; the toggle_emoji_reaction
function didn't expect this type.
2018-03-21 13:26:24 -07:00
Harshit Bansal a49655e0d4 emoji: Migrate realm emoji to be addressed by `id` rather than `name`.
This commit migrates realm emoji to be addressed by their `id` rather
than their name. This fixes a long standing issue which was causing
an error on uploading an emoji with same name as a deactivated realm
emoji.

Fixes: #6977.
2018-03-20 22:24:44 -07:00
Gooca 2363c9955a ui scrollbar: Update perfect-scrollbar to 1.3.0.
Update perfect-scrollbar to fix stutter space-scrolling in #8544. Also
reworked deprecated `element.perfectScrollbar` to `new
PerfectScrollbar(element)`.  Lastly, updated provision version and
changed node module path to new path.

This also refactors perfect-scrollbar in help.js to work with updated
version of perfect-scrollbar. Because the update also changed
perfect-scrollbar's css selectors for all scrollbars in zulip, we
update those too.

Fixes #8544.
2018-03-20 21:59:11 -07:00
knovokresch a021485b2e copy_and_paste.js: Support copying recipient headers from several topics.
Algorithm for copying messages from serveral topics was changed:
 - if there are selected messages from more than 1 recipient block
   then the recipient bar headers are copied;
 - If there are multiple messages from only one recipient block
   then recipient bar header is not copied.
Fixes #7217.

Also adds a full suite of Casper tests for the copy-paste functionality.
2018-03-20 21:56:05 -07:00
knovokresch cdd3b816bf copy_and_paste.js: Extract method for constructing recipient header. 2018-03-20 21:55:01 -07:00
knovokresch 2320a38a9c copy_and_paste.js: Extract method for constructing div with copied text. 2018-03-20 21:55:01 -07:00
Steve Howell 4edf66f927 Track fetch status of initial home message load.
This has a small stylistic change.  The load_more function
is recursive, and we now early-exit when the recursion is
finished (i.e. when we've found the newest row).
2018-03-20 15:23:29 -07:00
Steve Howell df4d325d6c Extract start_backfilling_messages(). 2018-03-20 15:23:29 -07:00
Steve Howell c282b94bab Track fetch status for initial narrow. 2018-03-20 15:23:29 -07:00
Steve Howell 0169a06f99 stream_data: Fix traceback with opening the compose box.
We need to call update_calculated_fields earlier since we
use can_access_subscribers in user_is_subscribed.
2018-03-20 15:23:29 -07:00
Shubham Dhama 679941b319 compose: Fix "compose fade" not working when private message focused.
The problem was that we now have pills instead of emails in the compose
recipient box for private messages.
Fixes: #8755.
2018-03-20 15:09:47 -07:00
Shubham Dhama 9ca335bcb2 org settings: Add discard button to discard changes for a subsection.
This will reset the changes done in a subsection to the current ones
in page_params.

It will only appear when there are some user-provided changes to be reset.
2018-03-20 14:48:59 -07:00
Shubham Dhama 62f646816d org settings: Show "save" button only when setting is changed.
With this "Save" button is only shown when there are changes in a
subsection. This means if we changed a setting and reverted it back to
original ones, then, "Save" button will get disappear. Hence, we're shown
"Save" when there are some property changes to send to the server.
2018-03-20 14:48:12 -07:00
Shubham Dhama be0298314a org settings: Make each subsection independent for saving changes.
This makes each subsection(like "Message feed") independent of changes
done in any other subsection and the save button of each subsection
saves the changes done in that subsection only.
2018-03-20 14:48:10 -07:00
Tim Abbott 1e453981a3 stream settings: Fix exceptions when rerendering subscribers.
If another user subscribed to or unsubscribed from a stream while the
current user was not subscribed, we previously would attempt to
rerender the subscriber counts for that stream, even though they
weren't rendered at all in the first place; this would trigger
blueslip errors from the expectOne() check in this function.

Fixes #8720.
2018-03-19 10:28:24 -07:00
YJDave 2cbfcbb740 subscription: Fix unexpected blueslip warnings on add subscriber.
In stream settings, if user add subscriber to unsubscribed public
stream from `Add` input widget it gives lots of blueslip warnings,
cause user isn't subscribed to public stream.

Fix this by changing condition to `sub.can_access_subscriber` from
`sub.subscribed` in blueslip warning, cause user can access
subscribers in such cases even if not subscribed to stream.

Tweaked by tabbott to make the node tests pass.
2018-03-19 10:24:14 -07:00
Cynthia Lin 333b8b095c subscriptions: Use tooltips for stream info hover content.
Fixes #8718.
2018-03-18 19:44:53 -07:00
Aastha Gupta 7485461cc6 notifications: Check if localstorage is enabled.
This checks for whether local storage is enabled and if it
is not enabled, then it will skip checking the value of
"dontAskForNotifications" key in the local storage.

This should eliminate an occasional JavaScript traceback we were
seeing in production.

Fixes #8721.
2018-03-18 12:54:11 -07:00
Shubham Dhama b34b8cdb97 hotspots: Fix real-time sync for dismissing hotspots.
This closes all the hotspots which aren't included in the event.hotspots.
This means we treat all the hotspots in event.hotspots as the hotspot
which need to be shown.

Fixes: #8690.
2018-03-18 10:22:09 -07:00
Shubham Dhama 120ebc8f13 hotspots: Move the code for closing hotspot icon to hotspots.js. 2018-03-18 10:22:09 -07:00
Tim Abbott c3f94fa388 stream_create: Fix use of "realm" in an error string. 2018-03-16 16:59:02 -07:00
Tim Abbott 8a53e83cf6 help: Use more consistent module name for perfectScrollbar.
The `Ps` alias that we were using previously was potentially confusing
and made this usage harder to grep for.
2018-03-16 12:50:33 -07:00
gooca 591624972e Refactor perfect-scrollbar: Call ui methods in stream_list.js. 2018-03-16 12:47:47 -07:00
gooca 26eb60b382 Refactor perfect-scrollbar: Call ui methods in topic_list.js. 2018-03-16 12:47:46 -07:00
gooca 336d81ca4a Refactor perfect-scrollbar: Call ui methods in resize.js. 2018-03-16 12:47:46 -07:00
gooca a50054bdc1 Refactor perfect-scrollbar: Call ui methods in scroll_bar.js. 2018-03-16 12:47:46 -07:00
gooca ba05ac5c77 Refactor perfect-scrollbar: Call ui methods in emoji_picker.js. 2018-03-16 12:47:44 -07:00
YJDave e8f6b9e575 js/stream_edit.js: Remove function to update stream on subs add/remove.
Remove the functions call for updating stream settings UI in
frontend, cause we are already handling this in the subscription
add and remove event we get after successful operation.
2018-03-16 12:22:06 -07:00
Balaji2198 6ffe2cc815 compose: Fix "New Topic" button behaviour auto-populates the current topic.
Previously, Clicking a "New Topic" in a topic narrow auto-populates
the current topic.

Fixes #8608.
2018-03-16 12:01:24 -07:00
Steve Howell 12509515ae message_viewport: Call set_message_offset() for prepending.
This is consistent with other places in the code.
2018-03-16 11:44:20 -07:00
Steve Howell 58c1427859 message_fetch: Use found_oldest flag from server.
We now use the found_oldest flag from the server to determine
whether we should load older messages.

This requires us to change a few places in the code where we
pass the whole payload around now instead of just the messages.

Actually, many of the "cont" callbacks don't even look at the
data, so this change wasn't as invasive as I might have
predicted.
2018-03-16 11:42:52 -07:00
Steve Howell 9105692b07 Add typing.initialize() to prevent tracebacks.
We now wait to start typing notifications until everything else
is initialized.  This prevents traceback where things like compose
pills have not been initialized.
2018-03-16 09:23:23 -07:00
sreenivas alapati a2fa087235 attachments_ui: Remove unnecessary export of bytes_to_size. 2018-03-15 18:06:04 -07:00
Shubham Padia 4fb1704e6e settings: Add save instructions below pill container on changes.
Fixes #8088.
2018-03-15 17:29:12 -07:00
Shubham Padia dd5ce49ce0 settings: Add button to cancel user group auto save on blur.
Clicking the cancel button removes all the changes and the user
group returns back to the original state. Saved button is showed
once the changes are saved on blur.
2018-03-15 17:29:12 -07:00
Shubham Padia 28f0ac2e14 settings: Save user group name/desc changes along with member changes.
Add do_not_blur func to not save changes when blur event's origin
is one of name/description/pill input from the current user group.
Changes in any of name/desc/members are saved together on blur from
any of the input field given do_not_blur is false.
2018-03-15 17:29:12 -07:00
Shubham Padia 9aec2b8b74 settings: Auto save user group members on blur.
Auto saves group members if focus moves from the input field in the
pill container.
2018-03-15 17:29:12 -07:00
Shubham Dhama c4fda0e19e org settings: Extend populate_data_for_request for selected property types.
To populate data for requests limited to only selected input elements,
we have to extend `populate_data_for_request` for objects other
than `property_types`, e.g. now we can collect data only for user identity
by passing org_permissions.user_identity as changing_property_types.
2018-03-15 17:06:45 -07:00
Shubham Dhama c4d0fb602c org settings: Split `property_types` according to sections.
This splits property types according to sections in
"Organization settings" viz. Organization settings, Organization
permissions, and Organization profile. Where org. settings and
org. permissions are further categorized according to the
subsections.
These changes are made to save changes for each subsection independently.
2018-03-15 17:06:45 -07:00
Shubham Dhama 0bd5a7cf29 settings_ui: Extend `do_settings_change` for other request methods also.
With this, we need to send channel request method callback as an
argument while calling.
2018-03-15 17:06:45 -07:00
Shubham Dhama 01a160de5e settings_ui: Extend do_settings_change for other optional parameters.
This extends `do_settings_change` function for parameters like
`success` and `error` functions which will replace the default ones,
for functions that need to be excuted in success callbacks and for
desired success message.
All these parameters are optional.
2018-03-15 17:06:45 -07:00
Shubham Dhama 95067ddb08 org settings: Disable "Add filter" button when a request is in transit.
This prevents accidental multiple click requests due to which we get
some errors like "This field cannot be blank" (though we have successfully
added the desired filter).
Fixes: #8699.
2018-03-15 13:56:15 -07:00
Shubham Dhama 233e1b4b1b org settings: Clear input fields of filter settings on success. 2018-03-15 13:56:15 -07:00
Tarun Kumar dafaf28099 user-groups: Update user_group_name_dict, when name/description is edited.
We do not update user_group_name_dict when name or description is edited,
which may lead to errors if get_user_group_from_name is called, so to fix
that we update user_group_name_dict also.
2018-03-15 10:09:28 -07:00
Shubham Dhama 8f4523e8dd compose typeahead: Add all public streams including unsubscribed streams.
This makes it convenient to mention a stream you're not subscribed to,
which can be useful for communicating about where a topic is
discussed, for example.

Fixes: #5757.
2018-03-14 11:10:43 -07:00
Shubham Dhama 5a9b1f863f drafts: Fix same day's timestamp when language is other than english. 2018-03-14 10:57:11 -07:00
Shubham Dhama 7aeae688e7 compose: Remove draft older than 30 days.
This removes drafts older than 30 days as they become irrelevant
for the user. Those drafts are removed before populating them.

Fixes: #7602.
2018-03-14 10:57:11 -07:00
Harshit Bansal 40958e0824 emoji: Switch to 64px 256 color indexed sprite sheets.
This commit switches our emoji infrastructure to use 256 color indexed
64px spritesheets. Earlier we were using non-indexed 32px spritesheets
which were blurry on high dpi displays. These indexed spritesheets not
only provide a crispier display but are also smaller in size.

This commit also removes the `emoji-datasource` package as a dependency
as all the data is now sourced from individual datasource packages.

Fixes: #7862.
2018-03-14 10:28:45 -07:00
Tarun Kumar 81a1612cbd user-groups: Fix reordering when name/description is edited.
The edited group iswas going to the bottom, it is not staying at its
position, so to fix this we sort by ids of the groups to maintain
proper relative order.

(Original commit also fixed another issue, but Tim replaced that with
the previous commit for a better solution).

Fixes #8692.
2018-03-14 10:12:46 -07:00
Tim Abbott bea9b6a748 user_groups: Fix real-time sync of user groups.
This fixes the user groups UI to follow the Zulip standard mechanisms
(using the appropriate server_events system to update all browsers
properly).  It also, as a side effect, fixes #8692, since it
eliminates the weird behavior of trying to re-insert a user group
after reformatting it in the frontend.

Thanks to Tarun Kumar for preliminary work on this.
2018-03-14 10:12:14 -07:00
YJDave efffc07351 stream settings: Don't show add-subs-btn if user can't add subscribers.
Even if realm admin can access unsubscribed private stream subscribers,
admin can't add subscriber to stream. Hide the option to add subs to
stream in UI.
2018-03-14 09:21:14 -07:00
YJDave 2031118545 stream settings: Allow realm admins to access all private stream subs.
This will allow realm admins to access subscribers of unsubscribed
private stream.  This is a preparatory commit for letting realm admins
remove those users.
2018-03-13 14:59:09 -07:00
YJDave 37f9d5c193 stream settings: Allow realm admins to update any stream name & description.
This will allow realm admins to update the names and descriptions of
private streams even if they are not subscribed, which fixes the buggy
behavior that previously nobody could(!).
2018-03-13 14:59:09 -07:00
YJDave 3b8c2e45be user settings: Fix user avatar not updated in settings page.
On uploading new avatar, user avatar in settings page doesn't
get updated. Cause we have set `src` attribute of wrong html
element instead of image element in user settings page.

Fixes #8680.
2018-03-13 10:57:36 -07:00
Rohitt Vashishtha b22e8dc2b7 lint: Replace 'return undefined;' with 'return;'.
Also adds a custom rule to eslint. Since the recommended way of extending
eslint is to create plugins as standalone npm packages, the separate rule
is published as 'eslint-plugins-empty-returns'.

Fixes #8669.
2018-03-13 08:22:42 -04:00
Tim Abbott 4ae1418831 popovers: Rename confusing my_email to user_popover_email. 2018-03-12 12:24:50 -07:00
Priyank Patel 29c6d23043 user profiles: Add copy-to-clipboard btn for long emails.
Implements copy to clipboard btn that shows up if email is too long.
Making it easier for user to copy long emails.
2018-03-12 12:06:40 -07:00
Rohitt Vashishtha 3710252eba portico: Prevent Firefox from bfcaching the page.
Firefox stores the last state of the page in its back/forward cache
in memory and uses that for quickly rendering the page. Since our page's
last state was 'faded-out', the content wasn't visible when the browser
rendered the page from it's bfcache.

Fixes #7907.
2018-03-11 22:17:18 -07:00
Vishnu Ks 3da2a1e18d admin: Add a realm setting to disallow signups using disposable emails.
Fixes #2955
2018-03-11 22:05:58 -07:00
Aastha Gupta dc60b3a44b compose: Don't clear compose box on narrow if it matches compose.
If we're entering a topic narrow, and the compose topic is the same as
narrowed topic, then leave the compose box open.

This is important if you open compose in a topic narrow, click on a
narrow, and then use the back button to return to that original
narrow.  Before this change, we'd close the compose box for no reason.

Fixes #6510.
2018-03-11 21:25:23 -07:00
Harshit Bansal e3c09e0308 settings: Prevent multiple requests while adding custom emoji.
This commit fixes a hard to reproduce issue which was causing
multiple requests while creating a realm emoji.

Fixes: #8475.
2018-03-11 16:17:47 -07:00
YJDave b6408a0383 stream settings: Fix sub-unsub btn not showing on private stream creation. 2018-03-11 15:58:18 -07:00
YJDave ff6d83b2f2 stream settings: Fix subscribers not showing on private stream creation.
Previously, stream subscribers were not rendering correctly. Due to
following reasons:
- Subscribers list didn't get initialized
- Subscriber members template add subscriber-list-table DOM element
  conditionally, which doesn't handle case if user have access to
  subscribers later.

Fix this by cleaning subscriber member template to hide the
elements, instead of conditionally adding DOM elements and
initialize subscribers list even if user can't access subscribers.
2018-03-11 15:58:18 -07:00
Tim Abbott 6e048c5d3f copy_and_paste: Enable copy-paste handler in production.
Now that we've fixed the issues we encountered when first testing
this, we can try it out in production again.
2018-03-11 15:26:27 -07:00
Tim Abbott 87f1516f5d subs: Harden subscriber count code path against bugs.
This expectOne() should catch some classes of bugs here.
2018-03-10 10:00:14 -08:00
Tim Abbott 12db219305 stream settings: Fix subscriber counts when creating invite-only streams.
Previously, when creating an invite-only stream, the subscriber counts
were not being rendered properly, in that the "create" event for the
stream had the user not yet subscribed (so can_add_subscribers was
false), and then the rerendering we did when the user susbcribed just
tried to update the number, not actually rerender the thing.
2018-03-10 10:00:14 -08:00
Tim Abbott ddef39832f subs: Reverse conditional for rerender_subscribers_count.
This is for more consistency with rerender_subscribers_list.
2018-03-10 10:00:14 -08:00
Tim Abbott a0d33fa1cf subs: Use sub_for_stream_row helper more consistently.
This cleans up a bunch of hard-to-read duplicated jQuery code.
2018-03-10 09:41:24 -08:00
YJDave e50cedfcb8 stream settings: Remove stream from subscribed list immediately on unsub.
When user click on unsubscribe button, to unsubscribe from private stream
immediately remove unsubscribed stream from all subscribed stream list.
We don't remove public stream immediately on unsubscription, cause
user may want to undo/subscribe back to stream.
2018-03-10 09:35:47 -08:00
YJDave 32407b4dc0 stream settings: Hide stream members immediately on unsub, if can't access.
If user unsubscribe from private stream, then user can't
access unsubscribed stream members.
After subscription removal, immediately render subscription members
template in case of user can't access stream subscriber.
2018-03-10 09:32:45 -08:00
YJDave c94b21e9ac settings: Add setting to disable message content in missed message emails.
Fixes #6938.
2018-03-09 21:16:02 -08:00
YJDave 7cc675cfc1 create stream: On stream create event, add sub to stream lists.
Currently, our stream creation do not add stream list to all
stream list. Only subscription-add event add stream list to
stream list. If public stream is created without acting user
subscribed to stream, then newly created stream is not listed
to all stream list.

On stream creation add sub to all stream list table.
2018-03-09 18:29:16 -08:00
YJDave 9183d59426 create stream: Restrict non-admin to create stream without subscribing.
Only allow realm admins to create stream without subscribing
themselves, restrict non realm admin users.

This new restriction is only for the UI; we don't actually block it at
the backend/API level (one could always create and then remove oneself
anyway).
2018-03-09 18:20:14 -08:00
Tim Abbott b8fd24b13d stream_create: Clear errors when re-submitting form.
Previously, if you fixed the errors and then tried to re-create a
stream, you'd see an error.
2018-03-09 18:15:46 -08:00
YJDave e9e6b126ec create stream: Don't allow creating stream with zero subscribers.
Restrict users(even realm admins) from creating stream with zero
subscribers only in UI.
In backend, if subscribers are zero, we automatically subscribe
current user to stream.
2018-03-09 18:09:38 -08:00
YJDave c3a289b473 create stream: Add div element indicating stream creation result.
Add div element to inform user whether stream is successfully
created or not. This will help to inform user in case if current
user is not subscribed to created stream.
2018-03-09 18:09:38 -08:00
YJDave 3280135a4c stream settings: Update subscription count on subscription event.
On subscription add or removal event, render subscription count
template in case of user can't access subscribers.
2018-03-09 18:00:49 -08:00
Tim Abbott c5904499db stream_data: Move calls to update_calculated_fields to events layer.
This migrates what were effectively data update functions to be called
from the main stream_events handlers, instead of being called from the
view-update code in subs.js.
2018-03-09 18:00:31 -08:00
YJDave cc2eb60ca5 stream settings: Fix error in rendering stream members in UI.
To re-render stream members on subscription add or remove event,
we are accessing undefined value "active_stream.stream_id" rather
than "active_stream.id", which resulted in falsey value and our
stream members were not updated unconditionally.
2018-03-09 18:00:20 -08:00
YJDave 777841781f stream settings: Hide stream membership part, if can't access subs.
Do not display stream membership section in stream settings,
if user not allowed to access stream subscribers.
2018-03-09 16:24:05 -08:00
YJDave c1f9b04435 stream settings: Don't show never subscribed private stream's preview-link.
For public stream, always show stream preview link.
For private stream, only show stream preview link if user is currently
subscribed or previously subscribed to private stream.
2018-03-09 16:24:05 -08:00
Steve Howell 616a06e5b2 Use msg_list.fetch_status instead of load_enabled.
We now attach a fetch_status to message lists, so that they
can track their fetch status individually.  When you go
back in a narrow and get all the older messages, we turn
off future fetches.

The narrow.js code no longer needs to orchestrate anything
here.  The "home" message list won't have as many redundant
fetches after this commit, because we don't need to reset
flags every time we do `narrow.deactivate`.

And then actual narrows get a new message list every time
you narrow, so their fetch status gets reset implicitly
as part of constructing the MessageList object.
2018-03-09 14:20:58 -08:00
Steve Howell 1e446fcb1a refactor: Call message_scroll.hide_indicators() directly.
We are going to remove message_fetch.reset_for_narrow() soon,
but its callers probably still want to hide any scrolling
indicators, and we just let them do that directly.
2018-03-09 14:20:58 -08:00
Steve Howell fef2840531 Add FetchStatus class.
We will use this in subsequent commits to replace the
`load_more_enabled` flag.
2018-03-09 14:20:58 -08:00
Steve Howell ec305149be Extract message_fetch.load_messages_for_narrow().
This helps us consolidate the fetching constants without
having to export them.  It will also remove some
responsibility for narrow.js to track fetching state.
2018-03-09 14:20:58 -08:00
Steve Howell 22162a02a8 Remove unused cont_will_add_messages flag.
(It was always false.)
2018-03-09 14:20:58 -08:00
Priyank cd48236756 electron_bridge: Send unread count to electron app on update. 2018-03-09 14:12:33 -08:00
Harshit Bansal 5aa8629a10 reactions: Migrate `emoji_code` to store `id` for realm emoji.
Till now, we had been storing realm emoji's name in emoji code field
in reactions' model. This commit migrates it to store realm emoji's id.
It is a part of effort to migrate realm emojis to be referenced by their
id and not by name.
2018-03-09 13:46:27 -08:00
Shubham Dhama 3b92f6115a hotkey: Add 'delete' to delete focused draft. 2018-03-09 13:30:09 -08:00
Shubham Dhama 777b6de689 org settings: Add setting to prevent users from adding bots.
Fixes: #7908.
2018-03-09 13:21:55 -08:00
Steve Howell 7bbdf79b78 Rename functions to show_loading_older/hide_loading_older. 2018-03-09 11:04:29 -08:00
Steve Howell 389421d9c2 Rename reset_load_more_status to reset_for_new_narrow.
We are about to make this logic a little more specific to
what happens when you make a new narrow.
2018-03-09 11:04:29 -08:00
Steve Howell ae84908eca Rename load_more_messages to maybe_load_older_messages.
We will soon have maybe_load_newer_messages as well.
2018-03-09 11:04:29 -08:00
Steve Howell 68d3441de1 Rename load_old_messages to load_messages.
This function will eventually sometimes load messages that
are "new" relative to the messages that have already been
loaded.
2018-03-09 11:04:29 -08:00
Shubham Padia 077475c563 compose: Don't warn if mentioned stream members form a superset.
Fixes #8634.
Suppress private stream warning if you're to a stream whose
membership is a subset of #mentioned-stream-name.
2018-03-09 10:46:41 -08:00
Robert Hönig 35c7428490 frontend: Add create-bot loading indicator.
The former "the-bot-is-being-created" indicator was useless,
since it only edited the value attribute of the "create-bot" button;
that attribute only sets the text of a button when it is initially created.

This commit replaces the old code with a spinning loading indicator,
like the one used for editing bots.
2018-03-08 15:05:00 -08:00
Steve Howell 47f3af9e50 refactor: Extract constants in message_fetch.js.
Having constants at the top is particularly convenient
for tweaking things while testing the fetch code.
2018-03-08 15:03:47 -08:00
Steve Howell 571773564f minor: Use message_viewport.at_top() in scroll_finished.
This effectively changes a condition from `=== 0` to `<= 0`,
but that probably doesn't matter (and would only help).  More
importantly, it just makes the code more consistent.
2018-03-08 15:03:47 -08:00
Steve Howell b8f39b2ff1 refactor: Early-exit in message_scroll.scroll_finished.
This is just cosmetic to flatten the function a bit.
2018-03-08 15:03:47 -08:00
Steve Howell 8063f73f6d Extract message_scroll.js.
This mostly moves code from ui.js.

We change the arguments to `message_fetch.load_more_messages()`
to be `opts` with callbacks for `show_loading` and `hide_loading`.

We also defer starting the scroll handler until `message_fetch.js`
has been initialized.
2018-03-08 15:03:47 -08:00
Steve Howell 7819319695 minor: Remove unused `ui.have_scrolled_away_from_top`. 2018-03-08 15:03:47 -08:00
Shubham Padia a78024f53d bots: Delete bot from bot_data set on realm_bot delete event.
Fixes #8577.
2018-03-08 07:54:19 -08:00
Shubham Dhama a0ab87bef2 notifications: Clean and automate global notifications update handler.
To prevent specifying notifications individually for global
updates, automate handle_global_notification_updates using
settings_notifications.notification_settings where we have
the keys of all the types of notifications.
2018-03-08 07:19:48 -08:00
Steve Howell fb3293a24a node tests: Add tests for input_pill.js.
This gets us coverage on most of the core "data" code, but it
doesn't get deep into the key handlers.
2018-03-07 15:53:11 -08:00
Steve Howell 60f08b069c reload: Handle errors with compose_actions.start().
If we have bugs in our compose code, we don't want them to
cause other strange side effects during reload.  (We recently
had a test deployment that was a bit buggy, and the reload
problem was tough to chase down due to the misleading
symptoms.)
2018-03-07 15:53:11 -08:00
Steve Howell c7ad2a5a8e minor: Simplify declaration for reload.initialize().
We are moving away from this pattern in our code.

    export.foo = function bar__foo() { ...};
2018-03-07 15:53:11 -08:00
Steve Howell 3a1bf04a56 compose: Add pills for typing in PM recipients.
@brockwhittaker wrote the original prototype for having
pills in the recipient box when users compose PMs (either
1:1 or huddle).  The prototype was test deloyed on our
main realm for several weeks.

This commit includes all the original CSS and HTML from
the prototype.

After some things changed with the codebase after the initial
test deployment, I made the following changes:

    * In prior commits I refactored out a module called
      `user_pill.js` that implemented some common functions
      against a more streamlined version of `input_pill.js`,
      and this commit largely integrates with that.

    * I made changes in a prior commit to handle Zephyr
      semantics (emails don't get validated) and tested
      this commit with zephyr.

    * I fixed a reload bug by extracting code out to
      `compose_pm_pill.js` and re-ordering some
      calls to `initialize`.

There are still two flaws related to un-pill-ified text in the
input:

    * We could be more aggressive about trying to pill-ify
      emails when you blur or tab away.

    * We only look at the pills when you send the message,
      instead of complaining about the un-pill-ified text.
      (Some folks may consider that a feature, but it's
      probably surprising to others.)
2018-03-07 15:53:11 -08:00
Steve Howell 1aba722e63 user_pill: Add Zephyr logic.
For Zephyr realms we have to be more lax with email validation.

This will be relevant for compose pills.
2018-03-07 15:53:11 -08:00
Steve Howell f0d101edf5 pills: Streamline input pills (for user groups).
The main point of this change is to streamline the core
code for input pills, and we use also modify user groups.

The main change to input_pill.js is that you now
configure a function called `create_item_from_text`, and
that can return an arbitrary object, and it just needs
a field called `display_value`.

Other changes:
    * You now call `input.create(opts)` to create the
      widget.
    * There is no longer a cache, because we can
      write smarter code in typeahead `source` functions
      that exclude ids up front.
    * There is no value/optinalKey complexity, because
      the calling code can supply arbitrary objects and
      do their own external data management on the pill
      items.
    * We eliminate `prependPill`.
    * We eliminate `data`, `keys`, and `values`, and just
      have `items`.
2018-03-07 15:53:11 -08:00
Tim Abbott 0d29864c6a setting: De-duplicate logic for bulk-updating notifications settings.
In the new data model, this duplication was unnecessary.
2018-03-07 15:21:17 -08:00
Shubham Dhama 2782a5d8dc settings: Update notification settings to new feedback style.
This split notification settings to separate settings for streams,
PM/mention and other notifications settings.
Previously we have to treat them combined, but with this refactor,
we can treat them separately for future changes.

Fixes #8587.
2018-03-07 15:21:17 -08:00
Tim Abbott b55f881447 settings: Split notification_settings into a few sub-variables.
This refactor has no functional effect, but sets us up to be able to
do the next refactor.
2018-03-07 15:20:53 -08:00
Akash Nimare cd84fde8c5 apps: Update desktop app to latest release v1.8.2. 2018-03-07 14:09:35 -08:00
YJDave b358fb2c42 org settings: Hide table-list-data until page gets load.
Until page gets load, table lists are empty. Which results in
showing empty-data-text("No data match to search query") in
setting page parallel to loading spinner.

Hide table-list and show loading spniner until
setting page and table-list gets load.
2018-03-07 13:34:50 -08:00
YJDave f46d925208 org settings: Fix issue, loading spinners are not visible.
In org settings, loading spinners are not visible, currently
because their size is very small.

Fix this, by increasing width and height of spinners and
adding spinner text, to make spinners more visible.
Fixes #8502
2018-03-07 13:34:50 -08:00
Shubham Dhama a5812544ec settings: Fix real-time sync with notifications settings.
The if condition in "update_global_notifications" case was always false.
Similar to c672a1c.
2018-03-07 17:05:15 +05:30
YJDave a059247398 message editing: Fix bugs in `recipient-row` template rendering.
In `recipient-row` template, if conditions to add/hide/show edit
icon for message topic is incorrect.
In some cases, we only want to just hide the edit icon, but icon
should be in DOM, cause in future if organization settings are
changed we want to show edit icon in message row.

If user can edit topic of message, surely add edit icon element to
DOM regardless of user is allowed to edit or not. If user is
allowed to edit then show edit icon otherwise hide edit icon element.
2018-03-06 07:17:28 -08:00
YJDave eb67c46928 message editing: Move update msg-topic-edit-icon func to `message_edit.js`.
Move function `update_message_topic_editing_pencil` to file
`message_edit.js` from `settings_org.js`.
2018-03-06 07:17:28 -08:00
YJDave a4366d9a6d message editing: Clean update msg-topic-edit-icon function.
`update_message_topic_editing_pencil` function update edit
icon for message topic in message row header.

- Remove erroneous `meta.loaded` check.
- Add proper check of message editing permission in realm
  before updating message-topic-edit-icon in function.
- Update `always-visible-topic-edit` element in function
  simultaneously.
2018-03-06 07:17:28 -08:00
YJDave d360a70523 static/js/settings_org.js: Rename func which updates msg-topic-edit-pencil.
Rename `toggle_allow_message_editing_pencil` to
`update_message_topic_editing_pencil` in `settings_org.js`.
As this function update the pencil icon for updating message
topic in message row header.
2018-03-06 07:17:28 -08:00
Aditya Bansal 06cabc1e8a popovers: Fix issue with user-info-popover in legacy mention messages.
We fallback to using data-user-email attrib for mention messages
from the times when we use to expose user emails to frontend.
This is only required for cases where we are dealing with anything
that isn't rendered dynamically (like the messages that were already
sent and stored long time ago). Hopefully we won't be needing this
kind of fallback logic in more places so I am putting off efforts
to try to extract fallback logic for common use. Also this is like
this because it will probably be tricky to extract out a common
fallback logic in this case because of different situations involved.

Fixes: #8588.
2018-03-06 06:41:17 -08:00
Shubham Dhama 3fb862533f upload: Fix upload under message edit mode when edited using hotkeys.
This refactors the attachment of jQuery-filedrop handler into
`message_edit.start_edit_with_content`.
2018-03-05 10:42:38 -08:00
Tommy Ip 5ee6c608c0 message edit: Allow uploading files.
Fixes: #198.
2018-03-05 10:42:38 -08:00
Tim Abbott 787d5c50e0 upload: Inline clear_out_file_list.
This provides a slightly clearer interface, allowing us to remove the
unnecessary split of the code for the clone_file_input concept across
multiple modules (we now just clone it on-demand).
2018-03-05 10:42:38 -08:00
Rhea Parekh 416f11030f user settings: Display avatar source.
This makes it easier for users to tell how Zulip ended up with an
avatar for them without them uploading one: through the Gravatar
service used across many Wordpress blogs.

Fixes #8225.
2018-03-05 09:12:59 -08:00
YJDave d36ec962bb deactivation-stream-modal: Make stream name a template variable.
In stream deactivation modal, make "stream_name" a template variable,
rather than patching stream name to modal header in javascript.
Add tests for deactivation stream modal.
2018-03-04 19:26:50 -08:00
YJDave 8ba91e48c1 stream settings: Add delete stream button.
Add option to delete stream in stream setting page for
realm admins only.
2018-03-04 19:26:50 -08:00
YJDave 077e56e3b6 static/js/settings_streams.js: Refactor delete stream method. 2018-03-04 19:26:50 -08:00
Tim Abbott fb340811a4 display_settings: Fix pencil being lost updating default language.
The HTML was just done sloppily in the first version of this feature.
2018-03-04 19:23:58 -08:00
Tim Abbott 9acf30b3d3 display_settings: Fix real-time sync of default language.
We apparently weren't sending to the frontend the data needed to
update the display of the current language.
2018-03-04 19:23:58 -08:00
Tim Abbott c9724fe284 display_settings: Clean up and mark real-time sync issues.
This fixes the real-time sync of the settings state for night mode,
and also makes it clear where a few outstanding bugs are in this
page's sync.
2018-03-04 18:38:14 -08:00
Tim Abbott c672a1c112 settings: Fix real-time sync for display settings.
The conditional we previously had in server_events.js was always
false.
2018-03-04 18:32:05 -08:00
Tim Abbott cec34302be settings_ui: Move main function for new settings system to library code.
This should make it much easier to convert other checkboxes in the
product to use this mechanism.
2018-03-04 18:26:27 -08:00
Tim Abbott 4d8e18e58f settings: Move display_checkmark to settings_ui.js. 2018-03-04 18:26:27 -08:00
Tim Abbott 6a06e453c7 display_settings: Extend de-duplication of unnecessary logic.
We add a new option to the change_display_setting function to support
cases with a custom on-success or on-failure message.
2018-03-04 18:09:46 -08:00
Tim Abbott 7dbd515191 settings: De-duplicate code for managing display settings.
Now that we have a common framework here, there's no need for so many
copies of the channel.post logic.
2018-03-04 17:59:54 -08:00
Balaji2198 5aa7098c81 display_settings: Change success/failure feedback interface.
This replaces the cumbersome system we had for giving users feedback
on settings state changes in the display settings UI.

We expect this new system to be what we will attempt to migrate other
settings widgets to match over the coming weeks and months.  It also
provides the opportunity to significant refactor away a lot of the
code duplication in settings_display.js.

Thanks to Brock Whittaker for redoing the styling and improving the
code simplicity.

Fixes #7622.
2018-03-04 17:47:05 -08:00
Balaji2198 b846ab1000 settings: Change wordings of all alert-status in Display settings. 2018-03-04 16:36:56 -08:00
Marco Burstein bdb86f1b5e emoji: Add support for translating emoticons.
Add `translate_emoticons` to `prop_types` and `expected_keys`.
Furthermore, create a emoji-translating Markdown inline pattern.

Also use a JavaScript version of `translate_emoticons` and then use
this function during Markdown previews and as a preprocessor. This
is only needed for previews, because usually emoticon translation
happens on the backend after sending.

Add tests for emoticon translation, a settings UI, and a /help/ page
as well.

Tweaked by tabbott to fix various test failurse as well as how this
handles whitespace, requiring emoticons to not have adjacent
characters.

Fixes #1768.
2018-03-04 15:37:24 -08:00
YJDave 8cd3e55fae default stream: Fix default stream suggestion do not include private stream.
Private streams were not included in stream suggestions for default streams
in org settings.
Remove function, which exclude private streams from stream suggestions
for default streams.
2018-03-04 13:42:28 -08:00
Shubham Dhama bfcfe84bdd compose: Append space when text added at the end of textarea.
This appends a space when text is inserted at the end of a message
using `compose_ui.insert_syntax_and_focus`.  This is definitely what
users expect when using this feature.

Fixes: #8569.
2018-03-04 13:16:17 -08:00
Shubham Padia e15a22dae2 message-editing: Topic_data.remove_message on delete_message dispatch.
Fixes #8411.
If the last msg in a topic is removed, that topic is removed
from recent topics in the streams left sidebar.
2018-03-04 13:10:26 -08:00
Tim Abbott aed8cc9062 user_groups: Handle add/remove members events.
This fixes the real-time sync for the user groups membership data
structure to work like these work in the rest of Zulip; now, edits
made in one browser are immediately and correctly reflected in other
browsers.
2018-03-04 09:45:31 -08:00
Tim Abbott 0147826042 user_groups: Convert members to a dict in frontend. 2018-03-04 09:45:31 -08:00
Tim Abbott 3a14317376 user_groups: Move meta.loaded check to actual exported interface.
This should fix an exception that we were seeing where the expectOne()
check would fail if the user groups page hadn't been rendered yet.
2018-03-04 09:40:56 -08:00
YJDave 59cf67062f settings: Add generic func to disable settings elements in UI.
We have some settings which are inter-dependent. If one setting
is checked or unchecked, it's dependent-sub-setting get disabled
or enabled. i.e. If user unchecked setting allow-message-editing
then message-editing-time-limit setting should get disabled in UI.

Add generic function to change disable attribute of sub settings
on checked or unchecked event of main setting in `settings_ui.js`.
2018-03-03 08:38:54 -08:00
YJDave f5a24efdd8 static/js: Add `settings_ui.js` file for common settings UI functions. 2018-03-03 08:38:54 -08:00
Tim Abbott 92ba40b0c7 settings: Use .attr() properly for disabling name/email change.
It turns out the consistent `.prop()` approach I switched to a few
commits back didn't actually work.  Instead, we establish consistency
by always using `.attr`, which does.

Usually, I'd go back and fix the older commits, but in this case it
feels not worth it.
2018-03-02 12:49:46 -08:00
Tim Abbott 72a31150f7 settings: Move name/email change display commits to correct file.
These most properly belong in settings_account.js, since they are
updating the UI widgets on that page.
2018-03-02 12:49:36 -08:00
Tim Abbott 9fe0f81f4a settings: Simplify is_admin logic for name changes.
This now also should correctly handle when a user's state as to
whether they are an admin changes.
2018-03-02 12:49:36 -08:00
Tim Abbott 4e32b5df00 settings: Rename functions for updating email/name change UI.
These functions no longer do a toggle.
2018-03-02 12:49:36 -08:00
Tim Abbott 63db3e0b3d settings: Fix erroneous meta.loaded check for name/email change.
That check is for the settings_org.js page, which is of course not
actually the page that these fields are on.
2018-03-02 12:49:36 -08:00
Tim Abbott 9b8c541a74 settings: Set state of name/email change fields from data.
Rather than having a toggle function that just flips the state, it's
more correct to have the state just be set to what it should be.

Also, we clean up the use of .attr() for a thing better accessed via
.prop().

We should probably rename the function at this point, but we save that
for a future commit.
2018-03-02 12:49:32 -08:00
YJDave ce46cd914a settings: Allow admin to change email/name even if it is disabled in realm.
Allow realm admin users to change their email or name even,
changing name or email is disabled in realm.
2018-03-02 12:17:00 -08:00
Tim Abbott 483876ff9a typeahead: Remove check for impossible case.
The pre-matching that occurs before we even get here makes it
impossible for this case to occur, and it causes a test coverage
error.
2018-03-01 21:22:59 -08:00
Shubham Padia 8722c755e3 onboarding: Add bouncing ? next to hotspots.
Fixes #8124.
Adds bouncing question mark with twice the frequency of the
pulse.
2018-03-01 20:23:51 -08:00
Tim Abbott 542f4766d3 typeahead: Fix last word issues with latest typeahead feature.
Apparently, a bug in my refactor in
5edbcb87fd meant that "King L" would end
up matching "King Hamlet", because we weren't requiring a match at the
start of the word for the last word of a multi-word query.

Thanks to Greg Price for the report.
2018-03-01 16:00:33 -08:00
Tim Abbott 5edbcb87fd typeahead: Rewrite query_matches_source_attrs to be obviously correct.
This restructures this fairly complicated function to a much cleaner
implementation, with fewer unnecessary variables and a cleaner flow.
While we're at it, we document the function.
2018-03-01 14:45:09 -08:00
YJDave 245d65eb9e compose typeahead: Don't autocomplete for suffixes followed by a space.
For "#word text" (and similar situations, like "@word text" and
":word text"), we should only show the autocomplete for entries
where word matches the full first word of something being
completed (and similarly for multi-word phrases).

Fixes #8279
2018-03-01 14:45:09 -08:00
Alena Volkova e4a62aa778 compose: Add a function for handling validation errors. 2018-03-01 08:40:51 -08:00
Robert Hönig 695b3e48e8 frontend: Add embedded bot config data editing. 2018-03-01 08:25:43 -08:00
Robert Hönig 7b7f4cc62d bot settings: Generate embedded bot selector in handlebars.
It's better to do stuff like this in HTML templates like
handlebars instead of JS.
2018-03-01 08:25:43 -08:00
Robert Hönig 044b0beeab frontend: Store embedded bot data in bot_data.js.
In specific, this stores config_data and service_name
for embedded bots.
2018-03-01 08:25:43 -08:00
Shubham Dhama d6a38901ae compose: Fix clearing of existing text on replying from popovers.
compose_action.respond_to_message and compose_action.start starts new
compose box so we should check whether we are already composing
or not. So, behavior, when we are composing, is that the user we want
to mention is added to the same compose-text without the changing stream
and topic name.
2018-03-01 08:00:42 -08:00
Shubham Dhama dcac002213 compose: Use insert_syntax_and_focus to insert text in compose textarea.
Use compose_ui.insert_syntax_and_focus() when we need to insert text
inline-ly followed by the focus to compose textarea because it does
this job more smartly(it take cares of spaces).
2018-03-01 08:00:42 -08:00
Shubham Dhama c995c1a36a popovers: Fix two click handler attached to (rightbar) user_popovers.
No need to have separate click handler for user_popovers and
message_info_popovers as the same user-id can be extracted similarly
from the target of both the click events.

Another refactor, `sender_info_popover` was confusing as it doesn't
fix into the context of rightbar user popovers so changed it to
`info_popover_actions` since that section of popovers contains popover
actions.
2018-03-01 08:00:42 -08:00
Aastha Gupta d124597f4b org-settings: Add setting to turn off welcome emails.
This adds an organization-level setting to provide an option to turn
off the welcome emails.

Fixes #8000.
2018-02-28 12:39:01 -08:00
elenaoat 7b455f597b compose: Add spaces around markdown for attachments.
If your cursor is in the middle of a word when you upload
an image, the code will now properly put spaces in the markdown
around the attachment link.

Fixes: #7212.
2018-02-27 11:58:36 -05:00
Abhigyan Khaund a75f0aa594 hotkeys: Add "p" to narrow to next unread PM thread.
This works simimlar to the "n" key for next topics.

This commit does a few things:

    * It wires up the hotkey to an existing function
      that could change narrows.
    * It adds documentation.
    * It adds logic to make sure the compose box does
      not open.

@showell helped a bit with the wording of comments here.

Fixes #4874
2018-02-27 07:20:31 -05:00
Catherine Kleimeier d032e1ad96 Node Unit Tests: Create test for notifications.message_is_notifiable
We create a node unit test,
with 'muting' and 'stream_data' modules as dependencies,
to test the logic in notifications.message_is_notifiable.

Part of #2945
2018-02-26 16:50:14 -05:00
Aastha Gupta 2f99e6b7b2 settings: Add loading indicator for account deactivation.
Fixes #8175.
2018-02-23 08:20:45 -08:00
Sampriti Panda 90c89dcc5a copy_and_paste: Fix quirks with some parts of toMarkdown.
* Raw links don't use the proper markdown syntax and get pasted as is.
* Text in Ordered List format are not escaped like in normal markdown.
2018-02-22 08:26:45 -08:00
Umair Khan 7ad177abe6 i18n: Flag emojiset type name string for translation.
The other emojiset types are things like "Google", and "Twitter",
which don't need to be translated.  And the string is already tagged
for translation as a variable where it is used here:

  static/templates/settings/display-settings.handlebars#L87

Fixes #7970.
2018-02-22 05:36:03 -08:00
Shubham Dhama b17d4e193c popovers: Show hotkey reminder for sender info popovers only.
Hotkey reminders in user popovers( i.e. `@` and `R`) should be present
only for sender info popovers, hence for user-mention and user-presence
popovers it will show no such reminders.

Fixes: #8313.
2018-02-21 13:06:22 -08:00
Harshit Bansal cf203db78a emoji: Remove now unused `emojis_name_to_css_class` dict. 2018-02-21 12:48:27 -08:00
Harshit Bansal 31baf25783 emoji picker: Change the delimiter used in `emoji_id`.
We were using underscore as a delimiter in `emoji_id` in emoji picker
but since `emoji_type` also contains underscores, it seems wrong to
use underscore as a delimiter. This commit switches `emoji_id` to use
comma as a delimiter instead of underscore.
2018-02-21 12:48:27 -08:00
YJDave 105093e3f4 org settings: Fix bug in edit user-name-form in active user setting.
In active user settings, when user click on user-name-form to edit
user's full name, we don't set any default value for full-name
input field, which results in garbage or falsy value in input field.

Set true value of selected user's full name in input field by default
in user-name-form.
2018-02-21 09:16:45 -08:00
YJDave 4119eb342d org settings: Display error message on top of active user setting page.
Currently, an error message on active user setting is showing at
the row of edited user profile in user-profiles-list-table.
Instead, show error message on top of setting page.

Tweaked by tabbott to also remove the HTML element.
2018-02-21 09:11:53 -08:00
YJDave dc2b505acb org settings: Fix bug in error reporting on active users setting.
In active users setting, an errors occurred on editing user
profiles, are not reported correctly because there is missing
argument in call of ui_report.error() function.
Fix the issue by passing proper arguments in ui_report.error()
function call.
2018-02-21 09:11:46 -08:00
Brock Whittaker 4d54515455 input-pill: Add copy override functionality for input pills.
When a pill is selected and you press copy, it will by default return
the value, but it can be overridden with the `onCopyReturn` function.
2018-02-20 14:18:11 -08:00
Brock Whittaker bee0fa4001 input-pill: Disable input of commas with invalid pills.
A user should not be able to start forming a new pill if the previous
pill is invalid.
2018-02-20 14:11:51 -08:00
Brock Whittaker 4cd25fb861 input-pill: Add multiple pill support with pasting.
This allows for pasting in comma separated lists that will validate
pills on paste, along with creating an API for inserting many pills.

This now allows in the `input_pill.pill.append` a comma separated list
that will then call the `insertManyPills` method that will break up the
input and then call `append`.
2018-02-20 14:11:47 -08:00
Akash Nimare 9dba134c7a markdown: Do not use CMD+CTRL on macOS.
This fixes an issue where we allowed both the CMD+CTRL keys for our
compose markdown shortcuts.  The correct behavior is to allow either
Cmd or Ctrl, based on whether it's MacOS (Cmd) or Ctrl
(Linux/Windows), to match how those platforms work.

Fixes #8430.
2018-02-20 09:50:10 -08:00
Steve Howell 1f6ddf0110 refactor: Extract transmit.js from compose.js.
We now isolate the code to transmit messages into transmit.js.
It is stable code that most folks doing UI work in compose.js don't
care about the details of, so it's just clutter there.  Also, we may
soon have other widgets than the compose box that send messages.

This change mostly preserves test coverage, although in some cases
we stub at a higher level for the compose path (this is a good thing).
Extracting out transmit.js allows us to lock down 100% coverage on that
file.
2018-02-20 09:29:26 -08:00
Vishnu Ks d34dd4cd02 signup: Show subdomain availability during signup.
This uses an actual query to the backend to check if the subdomain is
available, using the same logic we would use to check when the
subdomain is in fact created.
2018-02-19 10:45:17 -08:00
Shubham Dhama da65e1dcb6 drafts: Sort drafts by last modified.
This moves the last modified draft to bottom.
2018-02-19 09:55:50 -08:00
Shubham Dhama 804a5f3306 drafts: Add timestamps showing when last modified.
Fixes: #3790.
2018-02-19 09:55:50 -08:00
Steve Howell c7724c6ec4 minor: Fix typos in hashchange comments.
We make the URL slightly more realistic and fix a spelling typo.
2018-02-19 09:03:11 -08:00
Steve Howell 46a49777c4 Add stream ids to urls for stream-related narrows.
This commit prefixes stream names in urls with stream ids,
so that the urls don't break when we rename streams.

strean name: foo bar.com%
before: #narrow/stream/foo.20bar.2Ecom.25
after: #narrow/stream/20-foo-bar.2Ecom.25

For new realms, everything is simple under the new scheme, since
we just parse out the stream id every time to figure out where
to narrow.

For old realms, any old URLs will still work under the new scheme,
assuming the stream hasn't been renamed (and of course old urls
wouldn't have survived stream renaming in the first place).  The one
exception is the hopefully rare case of a stream name starting with
something like "99-" and colliding with another stream whose id is 99.

The way that we enocde the stream name portion of the URL is kind
of unimportant now, since we really only look at the stream id, but
we still want a safe encoding of the name that is mostly human
readable, so we now convert spaces to dashes in the stream name.  Also,
we try to ensure more code on both sides (frontend and backend) calls
common functions to do the encoding.

Fixes #4713
2018-02-19 09:03:11 -08:00
Shubham Dhama 1192111ce2 group popovers: Refactor setting up scrollbar.
Using a wheelspeed of 0.68 is fine as used throughtout Zulip.
2018-02-18 20:20:51 -08:00
Shubham Dhama 9feae472f8 org settings: Add button to deactivate organization.
This adds button under "Organization profile" settings, which
deactivates the organization and sends an "event" to all the
active user and log out them.

Fixes: #8212.
2018-02-18 10:20:38 -08:00
ryan dea7d1d1b6 profile menu: Show profile-edit option when a user clicks on self-profile.
This removes some options when a user clicks on their own profile, and
replaces them with an option to edit their own profile settings.

Front end test adjusted because it was testing an option that does not
appear if a user clicks on their own profile.

Fixes #5075.
2018-02-16 16:59:45 -08:00
ihsavru 4103996a22 org-settings: Fix styling of Allowed Domains modal.
Fixes: #7628.

Cleaned up by Brock Whittaker and Node tests fixed by Steve Howell.
2018-02-16 16:00:21 -08:00
Eric Eslinger 786bda674c popovers: Add a popover for group mentions.
This adds a click handler to `.user-group-mention` which works in a
fashion that is quite similar to `.user-mention`. It generates and
displays a popover.

The popover has a list of members, their online status (if they are
not bots) or their bot status if they are bots (it's not clear whether
ultimately bots should be able to be members of usergroups, but I'm
able to add one, so I thought it would be worth supporting).

The popover's `UL` element has max-height and overflow-y atttributes
so large groups will grow a scrollbar.

Fixes #8300.
2018-02-16 13:37:02 -08:00
Eric Eslinger bc21344dc6 popovers: Fix memory leak with old popovers.
This change resets the list_of_popovers array to a new empty array after
hide_all has been called. Prior behavior kept it around, and it kept
pointers to orphaned DOM nodes.

Fixes #8416.
2018-02-16 13:33:06 -08:00
Shubham Padia 9802264302 message-editing: Mark message as read before deleting it.
Fixes most of #8411.

Unread counts in the left sidebar were previously not updated
immediately on message delete.
2018-02-16 12:53:20 -08:00
Brock Whittaker d30a6c64c3 Revert "Make recipient bar styling more compact and clean."
This reverts commit 8e2d9b8f68.

This adds the arrows back to the recipient bars because even though
it's not our end state, it looks better than the boxy design that we
had in between.
2018-02-16 11:55:00 -08:00
Shubham Dhama a32e1eb913 markdown: Require double-asterisk around all mentions.
This enforces `**` around all the mentions including "at-all" and
"at-everyone" mentions. Hence this makes `@all` and `@everyone`
invalid mentions, resulting into proper syntax for these mentions as
`@**all**` and `@**everyone**` respectively.

Note from tabbott: This removes an old feature/syntax, which made
sense back when @Tim was also a way to mention a user with Tim as
their first name.  Given how nice typeahead is now, the user part of
the feature was removed a while ago; this should have gone at the same
time.

Fixes: #8143.
2018-02-16 11:45:08 -08:00
Tim Abbott 55feafb513 unread_ops: Add a quick comment explaining an interface. 2018-02-16 11:44:41 -08:00
Shubham Padia b12a5a2da0 stream settings: Use a bulk query when changing all streams.
This avoids hitting Zulip's rate limits when there are more than 100
streams involved.

Manual testing:
- Changed notification settings for all streams from notifications tab of user settings
- Monitored the network tab to make sure 1 query is being sent
- Checked notification settings of individual streams

Fixes #5898.
2018-02-16 11:28:55 -08:00
Shubham Dhama 152da74e73 typeahead: Fix typeahead ordering for user group mentions.
Previously, a user with "ham" anywhere in their email address would be
sorted before a group whose name starts with "ham", which resulted in
a lot of frustrating when trying to mention groups.

Fixes: #8301.
2018-02-16 10:10:39 -08:00
Vishnu Ks a46e21ee3e bankruptcy: Add UI widget to mark all messages as read.
This is the natural analog of the similar streams UI feature.

Fixes #7585.
2018-02-15 18:01:03 -08:00
Shubham Dhama 995138d730 settings: Allow uploading same image as avatar after deleting.
Previous hack wasn't working but changing the value of
file input element to empty works.
For more info https://stackoverflow.com/questions/20549241.

Fixes: #8377.
2018-02-14 09:37:16 -08:00
Tim Abbott 118dfb9690 hotkey: Document message_view_only with a comment.
fixes #8323.
2018-02-14 09:34:32 -08:00
Tim Abbott dcda633b3a help: Fix scroll position when reloading browser window with hash.
This uses the same technique as the last commit, just with the final
case for how we navigate to/from these pages.
2018-02-14 09:26:42 -08:00
Aman Jain d48664fc5f help: Fix links with query selector from left sidebar.
This resolves the issue of scrolling to correct position when loaded
from left sidebar to a link with query selector.

Fixes #6714.
2018-02-14 09:25:26 -08:00
Tim Abbott 6638c12aef upload: Extract feature_check helper function. 2018-02-13 14:37:26 -08:00
Tim Abbott 8836161611 upload: Refactor file upload code path to use more variables.
Now, all the various DOM elements are named by a variable, keyed off
the configuration of the upload_options object.

This is most of the work required to support file upload in the
message edit area.
2018-02-13 14:37:26 -08:00
Tim Abbott 9de7a69b13 upload: Move compose initialization back to compose module.
This makes the lines of logic a bit simpler.
2018-02-13 14:37:26 -08:00
Tim Abbott 7af769a272 upload: Extract upload.options structure.
This is a nonfunctional refactor that is key preparation for allowing
uploading files in message editing.

Note that this makes no actual changes to the code; it just changes
the function structure.
2018-02-13 14:37:22 -08:00
Florian Jüngermann ec3e0caece right-sidebar: Enable up and down arrow keys.
This users the new generic functions in stream_list.js to implement a
similar behaviour for the right sidebar (user list).

Fixes #5920.
2018-02-12 15:38:23 -08:00
Florian Jüngermann b489ccc126 left-sidebar: Enable up and down arrow keys.
When in the stream-searchbar, a user can now use the arrow keys to iterate
through the suggestions. Therefore the currently selected list element is
assigned a CSS class 'highlighted_user'.
The main functional testing is done with casper but node test are still
included to keep the high coverage.
Line-wrapping issues are resolved. Night-mode CSS handling is included.
2018-02-12 15:35:56 -08:00
Steve Howell 35cc206dcc Add narrow.narrow_to_next_pm_string().
This helper function will allow us to cycle through PM narrows
that are unread, once we map it to a hotkey and/or other UI.

(We intend to make something like the "n" key for topics, but
that works on PM narrows instead.)
2018-02-12 09:34:59 -08:00
Steve Howell 13abed229c Add narrow_state.pm_string(). 2018-02-12 09:34:59 -08:00
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
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
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 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 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
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
Shubham Dhama 9cd7f59c9b recent senders: Use message ids instead of timestamps for sorting.
This matches the convention that we use everywhere else in Zulip.

Fixes: #5956.
2018-02-08 18:39:10 -08:00
Greg Price 756bbef1f2 Revert "settings: Check if xhr response text include ':' or not."
This reverts commit dd406e87e.  Whatever awkward error message might
have motivated that change, we can fix in a more targeted way when we
see it again.  This version would delete the potentially-informative
context the caller provided in `response` -- even just "Failed" --
based on whether an error message happened to contain a colon
somewhere in it, which is sure to end up feeling unpredictable.
2018-02-06 13:44:10 -08:00
Roman Godov b875fe07eb settings: Added setting to turn on and off realm name in email subject.
Users having only account in one realm will not be distracted by realm
name in subject lines of every email.  Users who have multiple
accounts in realms can turn this setting on and receive a
corresponding realm name in email's subject.

Tweaked by tabbott to rebase and address a few small issues.

Fixes #5489.
2018-02-05 18:01:54 -08:00
Greg Price ca1129dea3 Revert "Streams: Disallow certain markdown characters in stream names."
This reverts commit dd1b14378b.

Deleted a conflicted test entirely.
2018-02-05 16:55:21 -08:00
Umair Khan c415cc74d7 validate_stream_message_address_info: Add i18n tags.
Fixes #7076
2018-02-05 16:26:24 -08:00
Brock Whittaker 1a93cd4ffe panels: Give admins a red warning banner when email isn't configured.
Also refactor the "panels"/banner code to be a bit clearer about how
it's supposed to generically work, using [data-process] as a uniquely
identifying marker.

Fixes: #8166.

[greg: rebased and squashed a series of fixup commits.]
2018-02-05 16:00:52 -08:00
Brock Whittaker fe3a5665da panels: Rename "desktop_notifications_panel" => "panels".
The original code made a 3/4-hearted effort to generically accommodate
more banners/"panels" later, but named itself after the first one made.

[greg: expanded commit message.]
2018-02-05 16:00:52 -08:00
Brock Whittaker 61dad0701a /login/: Remove previous alerts before displaying new alerts.
The issue is that the server wants to display an error when you make a
request and fail, but the jQuery form validator also wants to display
errors at the same time. This removes the server errors to display the
jQuery.

Fixes: #8239.
2018-02-05 13:42:48 -08:00
VishalCR7 68df428de9 portico: Add a loading indicator to login button.
Added a loading indicator when user clicks on Log in button.

Fixes #6477.
2018-02-05 13:42:46 -08:00
ihsavru 0f443c89f2 settings: Allow selecting 'restrict to domain' even if no domains selected.
Fixes #7626
2018-02-05 13:34:36 -08:00
Shubham Dhama c8d038a239 popovers: Fix user-mention popover errors of `@all` mention.
`@all` and `@everyone` mentions don't have specific popover, so
constraint added to prevent console errors.
2018-02-05 10:34:47 -08:00
Robert Hönig 31a1c3e5d6 Efficiently clear typeahead when renaming a bot.
There's no reason to clear every user from the typeahead to handle a
single bot being renamed.

This amends 1df3e04.
2018-02-05 10:19:21 -08:00
Tim Abbott 6e0f3a9d75 dict: Add documentation for why we have dict.js. 2018-02-05 10:16:37 -08:00
YJDave 32ede6a355 settings: Restrict opening full name and email change overlay modal.
Set condition before opening full name and email change overlay modal,
to check whether changing full name or email is allowed in realm.
2018-02-02 17:50:37 -08:00
Balaji2198 f49d9d016f hotkeys: Add '>' as a hotkey for quote and reply to message.
Tweaked by tabbott to fix a few minor issues.

Fixes #8146.
2018-02-02 17:37:53 -08:00
Umair Khan 302e106860 compose: Add parentheses for correct precedence. 2018-02-02 07:24:12 -05:00
YJDave ff8be1ac94 markdown shortcuts: Set cursor position for link insertion shortcut.
For link insertion shortcut without text selection,set the cursor
position between "[]" rather than selecting "url" in "[](url)" string.
2018-02-01 17:35:08 -08:00
YJDave dbefdad0ab markdown shortcuts: Stop triggering italic shortcut with Ctrl+Shift+i.
The Italic shortcut(Ctrl+i) should not be trigged by Ctrl+Shift+i,
since ctrl+shift+i opens the web inspector in major browsers.
2018-02-01 17:34:27 -08:00
YJDave b519f1c640 markdown shortcuts: Replace Ctrl+L with Ctrl+L+Shift for link insertion.
As Ctrl-L was interfering with browsers's Ctrl-L, the shortcut key
for link insertion is changed to Ctrl+L+Shift.
2018-02-01 17:31:01 -08:00
Tim Abbott ef42bb2e73 settings: Fix real-time sync for account settings.
This restores the property that changing one's name in on browser's
"account settings" also changes the user's name in other browser windows'
"account settings" pages.
2018-02-01 16:38:26 -08:00
YJDave 7e8da54209 settings: Move full name setting UI into modal.
This makes this UI widget more consistent with its neighbors.

tabbott: This introduces a bug with how the `full_name_field` HTML is
managed; it should be done via the `server_events.js` handler.
2018-02-01 16:08:07 -08:00
YJDave 8582e757cd settings: Improve email change modal in user setting.
- On error, do not close the modal and show the error in the modal.
- Change the order of the `Cancel` and `Change` buttons.
2018-02-01 16:08:07 -08:00
YJDave 21cbdfdb79 settings: Improve password change modal UI.
- When password fields are cleared, update password strength bar.
- On data dismiss, clear password fields.
- Exclude forgot-password div from focus.
- On enter key, modal should be submitted not dismissed.
- Change password btn text from "Change password" to "*****"
2018-02-01 16:08:07 -08:00
Brock Whittaker 957d1ee896 landing-page: Click anywhere to close sidebar.
This makes it so you can click anywhere over the grey-ed out area
to close the sidebar.

Fixes: #8208.
2018-01-31 14:50:17 -08:00
Greg Price 9798bb51c8 notifications: Restore a comment explaining `received_messages`.
A comment like this was removed in
  fa44d2ea6 "settings: Remove autoscroll_forever setting."
The comment went on to say something about autoscroll, but this
part still seems relevant.  While here, adjust grammar and caps.
2018-01-31 07:51:16 -05:00
Greg Price b69873522b upload: Handle JSON errors from server generically. 2018-01-29 16:06:11 -08:00
Greg Price d053e07760 upload: Make filedrop error handling more consistent.
The first argument to the error callback is *usually* a string code
from a list in the filedrop source; but sometimes it was the text
the server sent in the HTTP status line, instead.  The latter isn't
predictable, and so it's not possible to write app code that uses it
to handle error consistently.

Instead, use that parameter for the numeric HTTP status code.  This
still isn't totally clean in that sometimes it's internal filedrop
errors, as strings, and sometimes it's HTTP status codes, as numbers;
but at least both of those are things we can sanely handle with a
`switch` statement.

Also pass through `serverResponse`, which for a nice JSON error from
the server will contain meaningful information about the error which
the calling code can use for nice error handling.  And just drop the
HTTP status text, which at best is redundant with the numeric code.

In passing, fix one case where for no obvious reason filedrop was
passing the file object but not the index.

This should be a pure refactor.
2018-01-29 16:06:11 -08:00
Greg Price 55cf54c087 upload: Remove old per-user quota feature.
We'll replace this primarily with per-realm quotas (plus the simple
per-file limit of settings.MAX_FILE_UPLOAD_SIZE, 25 MiB by default).

We do want per-user quotas too, but they'll need some more management
apparatus around them so an admin has a practical way to set them
differently for different users.  And the error handling in this
existing code is rather confused.  Just clear this feature out
entirely for now; then we'll build the per-realm version more cleanly,
and then we can later add back per-realm quotas modelled after that.

The migration to actually remove the field is in a subsequent commit.

Based in part on work by Vishnu Ks (hackerkid).
2018-01-29 16:06:11 -08:00
Logan Williams 53e4dc1a46 left sidebar: Clicking on a stream clears the stream search.
Clears and hides the search bar when a stream is selected from the
filtered stream list.

Fixes: #7909.
2018-01-29 11:04:48 -08:00
aedorado c98d355321 right-sidebar: Fix clicking between Users label and search icon.
This brings the right sidebar UI to match the similar widget in the
left sidebar.  Since there's no other plausible effect for a click in
this whitespace, this small tweak should make using Zulip a bit more
convenient.

Fixes #8161.
2018-01-27 16:29:44 -08:00
Brock Whittaker 709ffe6361 informational-overlays: Fix category duplication bug, change map to array.
There is a bug on MacOS on Zulip where the categories are all
duplicated due to faulty looping logic, while also changing the Map to
an Array since maps have less cross-browser support.
2018-01-27 15:20:49 -08:00
Jerry Zhang db0fe676db linter: Remove extra space in message_list_view.js. 2018-01-23 15:14:13 -08:00
Brock Whittaker 97acdb7252 ui_util: Move `place_caret_at_end` to ui_util module.
This makes it publicly accessible across the codebase.
2018-01-23 15:00:11 -08:00
Aditya Bansal 0ec50d8cc8 reminders: Hide message menu reminder's option behind features_flag. 2018-01-24 03:33:40 +05:30
YJDave 15dd94035c org settings: Handle NEW_USER_BOT not being set.
If NEW_USER_BOT is not configured in organization, then disable setting
for selecting stream for new user notification.
2018-01-23 15:23:25 -05:00
YJDave 2ca0fb4128 user setting: Move password change flow in UI into modal.
Thanks to @brokwhittaker for his significant chagnes in
password modal design.
2018-01-23 14:40:47 -05:00
Brock Whittaker ffe3a6c127 settings: Remove password confirmation in modal.
This removes the requirement to confirm your new password.
It isn't necessary and can be fixed easily with an email
reset if messed up.
2018-01-23 14:38:59 -05:00
YJDave 2b133ee99c settings: When overlay modal opens, remove previous alert messages. 2018-01-23 14:38:59 -05:00
YJDave 8a1fb5bae5 org settings: Change add emoji permission to be dropdown. 2018-01-23 14:26:40 -05:00
YJDave 676d543d86 org settings: Change create stream permission to be dropdown.
Organization permission setting allow-user-to-create-stream is
change to dropdown, from checkbox.
2018-01-23 14:26:40 -05:00
Weronika Grzybowska 7ac7100a1d messages: Make checking for status message consistent with backend.
Adds a check for newline that was present on backend, but missing in the
frontend markdown implementation. Updating messages uses is_me_message flag
received from server instead of its own partial test. Similarly, rendering
previews uses markdown code.

Fixes #6493.
2018-01-23 09:26:41 -05:00
Robert Hönig 4cc8c74aaa frontend: Internally refer to bots by ID.
This is done by using a bot's ID instead of email in
the handler methods for bot_data.bots and bot_data.services,
and updating all code paths involved.
2018-01-23 07:29:00 -05:00
Robert Hönig bd6fa385a5 frontend: Add outgoing webhook config entries to the "edit bot" menu.
This allows users to edit an outgoing webhook's endpoint URL
and interface type after it has been created.

Fixes #7411.
2018-01-23 07:29:00 -05:00
Cynthia Lin 7d8cd37035 modals: Dynamically replace keyboard shortcuts for Mac OS.
Fixes #3577.
2018-01-22 19:41:17 -05:00
Cynthia Lin d449fcb309 user docs: Dynamically replace keyboard shortcuts for Mac OS. 2018-01-22 19:41:17 -05:00
YJDave 81599cf906 stream settings: Display warning if user can not access subscribers.
Display warning, saying "You can not access private stream subscribers,
in which you aren't subscribed", if user can not access subscribers;
instead of showing zero subscriber to stream.
2018-01-22 18:26:36 -05:00
YJDave 8f65de1970 stream settings: Always show stream type, regardless of subscribed or not. 2018-01-22 18:26:36 -05:00
YJDave c22285c154 stream settings: Allow org admin to update settings of unsub-stream.
As per backend validations.
2018-01-22 18:26:36 -05:00
Aditya Bansal 40f161ca63 settings_user_groups.js: Remove unnecessary call to get a person. 2018-01-20 08:01:06 -05:00
akashnimare 37c792aee5 apps: Update desktop app to latest release. 2018-01-20 00:46:31 +05:30
YJDave 8905744bb1 stream settings: Add period at the end of error messages. 2018-01-19 13:05:43 -05:00
Aditya Bansal 1324d2e3c0 reminders: Make shortcuts to setup reminder in message feed work. 2018-01-19 11:33:11 -05:00
Aditya Bansal 7d8d7f7f9b reminders: Add alert message for set reminder success or failure. 2018-01-19 11:33:11 -05:00
Aditya Bansal 0f71a7ecca reminders: Add UI for setting up reminders for messages in the feed. 2018-01-19 11:33:11 -05:00
Aditya Bansal 732321818d scheduledmessage: Adjust schedule_message to accept callbacks. 2018-01-19 11:33:11 -05:00
Aditya Bansal 9efc1b08a1 reminders: Add slash command to set reminders from reminder bot. 2018-01-19 11:33:11 -05:00
Aditya Bansal f272ea9087 scheduledmessages: Start using/expecting delivery_type as a param. 2018-01-19 11:33:11 -05:00
Aditya Bansal 5a794f9871 compose.js: Add schedule_message() to handle scheduling of messages.
In this we add code to support '/remind' command for causing
messages to be scheduled.
2018-01-19 11:33:11 -05:00
Aditya Bansal b71ed33e64 compose: Extract the 'Sending...' from template to be added with Js.
In this we change the way 'Sending...' is displayed. Instead of
hardcoding it into the template we make change the paradigm so
that we can have a flexible message about what's happening
rather than just always saying 'Sending...'. For eg. this will
help in the upcoming feature of Scheduled Messages by having this
message say 'Scheduling...'.
2018-01-19 11:33:11 -05:00
Sampriti Panda 6c32379985 compose: Fix browser extensions interfering with compose box.
Make sure that clicks outside <body> triggered by extensions
don't close the compose box.
2018-01-18 15:53:06 -05:00
Shreyansh Dwivedi b0fb7aa6b2 bugdown: Add preview for vimeo videos.
This also amends a commit from Brock Whittaker <brock@zulipchat.com>
that merges two separate functions for YouTube videos and Vimeo videos
into a generic video recall function.

Fixes #7550.
2018-01-17 09:11:43 -05:00
Steve Howell 8530ed0b5e org settings: Make button-clicking code more clear.
On the "Organization settings" page, we had two Save buttons
for admins that had identical markup.  This was confusing for
people reading the code.  Now the two buttons have different
markup and individual, targeted click handlers (albeit still
calling the same function to do most of the work).

The context of this fix is that I was debugging a
Casper flake where our Casper tests were essentially clicking
on the same button twice.  Depending on the timing,
the second button click could cause a "No changes saved!"
behavior that confused the Casper test.  It is unclear whether
Casper was clicking both buttons here (in which case this fix
is necessary) or the same button twice (in which case this fix
just removes a nasty red herring for debugging).

The code still has the flaw that both buttons basically submit
the same data to the server, despite the appearance on the page
that there are two forms.  The best fix for that is probably
just to move the Language/Notifications stuff to another
panel.  I wanted to avoid touching this code altogether, but
the minor modifications here were necessary to improve the
Capser testing situation.
2018-01-16 13:25:19 -05:00
Rohitt Vashishtha cc8942e0dc /team: Fetch zulip-js repository data. 2018-01-16 12:23:19 -05:00
Robert Hönig 3accf7b935 embedded bots UI: Fix wrong _.each argument order. 2018-01-11 06:30:54 -05:00
Andy Perez 25b32a5ed7 markdown: Fix backend rendering regex.
An image link such as [example](http://www.example.com/example.png)
is supposed to be inlined by the backend.  The regex
backend_only_markdown_re in markdown.js does not recognize this link
as an image link, causing issues when adding fixtures to
zerver/fixtures/markdown_test_cases.json .
2018-01-09 16:43:22 -05:00
Robert Hönig d1d8365a6b embedded bots: Add config data UI.
This adds UI fields in the bot settings for specifying
configuration values like API keys for a bot. The names
and placeholder values for each bot's config fields are
fetched from the bot's <bot>.conf template file in the
zulip_bots package. This also adds giphy and followup
as embedded bots.
2018-01-09 11:50:54 -05:00
rht 763a96228f left sidebar: Remove plus icon from the stream bar. 2018-01-09 09:05:23 -05:00
YJDave 2d52131554 user settings: Fix live updates in email change setting.
To toggle email change display, replace display = None
to disabled = true.
Email field shouldn't be removed from settings, it should only
disabled if email changes are disabled in realm.
2018-01-08 14:35:03 -05:00
Cynthia Lin da06832837 right-sidebar: Make Search people input collapsible with search icon.
Fixes #4816
2018-01-07 15:05:03 -05:00
Cynthia Lin 7c1a803927 left-sidebar: Fix styling of Streams header to not use links. 2018-01-07 15:05:03 -05:00
Robert Hönig 82db9a211e bot settings: Set converter as default in embedded bot list.
The previous value 'xkcd' is not yet an embedded bot.
2018-01-07 18:52:04 +01:00
Cynthia Lin 5b70bb80b1 org settings: Add typeahead to user group member inputs.
Fixes #165.
2018-01-06 11:50:52 -05:00
Cynthia Lin 58d37702a4 org settings: Add functionality for updating data of user groups. 2018-01-06 11:50:52 -05:00
Cynthia Lin 48f7e8c0d0 org settings: Add functionality for saving state of edited user groups. 2018-01-06 11:50:52 -05:00
Cynthia Lin d6a937aa2a org settings: Add functionality for adding/removing users from groups. 2018-01-06 11:50:52 -05:00
Cynthia Lin a8c20876b9 org settings: Add user group save functionality for editing groups. 2018-01-06 11:50:52 -05:00
Cynthia Lin 7da0c126e4 org settings: Add user group deletion functionality. 2018-01-06 11:50:52 -05:00
Cynthia Lin 168e7bb2d6 org settings: Add user group creation functionality. 2018-01-06 11:50:52 -05:00
Cynthia Lin 8c8cd5fbf1 org settings: Render user group data dynamically. 2018-01-06 11:50:52 -05:00
Cynthia Lin 7790e2b23c org settings: Add framework for User groups page. 2018-01-06 11:50:52 -05:00
YJDave d80d5a2443 stream settings: Restore original stream name in UI on error.
Update stream-name-editable span in UI if it throws error
changing stream name.
2018-01-04 16:52:54 -05:00
YJDave de13dd41c2 stream narrow: Set message if narrows to never-subscribed private stream.
If user narrows to never-subscribed private stream, display
nonsubbed_private_nonexistent_stream_narrow_message.
2018-01-04 16:52:54 -05:00
YJDave 6a94b33eb0 stream membership: Display add-subscribers option only if user can add.
Display add-subscribers-to-stream option only if stream is
public or user is subscribed to private stream.
2018-01-04 16:52:54 -05:00