Commit Graph

25897 Commits

Author SHA1 Message Date
Yashashvi Dave 0a9fbe2ce6 zerver/tests/test_custom_profile_data.py: Refactor tests.
Refactor tests to include generic function for invalid
assertion and remove repetitive assertion code.
2018-04-30 10:53:23 -07:00
Yashashvi Dave a97a00a4c6 custom fields: Replace field id with field name in error message. 2018-04-30 10:53:23 -07:00
Yashashvi Dave 0d7d94d0db custom fields: Add support for custom URL field type. 2018-04-30 10:53:23 -07:00
Yashashvi Dave d2128105dd custom fields: Fix bug in real time sync for user settings.
Currently when admin add/remove/update custom fields, changes
are not reflected in user settings page, if settings tab
is already open. This might be rare case, but it looks like
an error when admin go to user settings page just after
updating custom fields in org settings.

Fix this by re-rendering custom fields in user settings
on custom_profile_fields event.
2018-04-30 23:04:25 +05:30
Yashashvi Dave 4033f210af custom fields: Add support for custom date field type. 2018-04-30 23:04:25 +05:30
Yashashvi Dave 94d787aa2e zerver/test/test_custom_profile_data.py: Remove hard-coded field no's. 2018-04-30 23:04:25 +05:30
Yashashvi Dave 576920bf8c custom fields: Add frontend validations in textual custom fields.
Add validations for short and long textual custom fields in
frontend.
2018-04-30 23:04:25 +05:30
Priyank Patel 50b13219a3 webpack: Combine both js and css into one portico bundle.
Combines, both portico js and css into one bundle. This for now solve
the issue of an empty js bundle being generated by webpack for the
portico-styles stylesheet.
2018-04-30 10:23:39 -07:00
Yashashvi Dave 5e63e6061b custom fields: Add UI for custom field hint.
Fixes #8876
2018-04-30 10:14:50 -07:00
Rohitt Vashishtha 639fa0db77 zblueslip: Convert node_tests/narrow_state.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha a87123ec23 zblueslip: Convert node_tests/input_pill.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha aa0c9a1a2a zblueslip: Convert node_tests/dict.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha 65bb2f3c40 zblueslip: Convert node_tests/channel.js to zblueslip. 2018-04-30 10:12:55 -07:00
Yashashvi Dave 66759358e2 create stream: Add maxlength restriction on name and description. 2018-04-30 10:11:25 -07:00
Yashashvi Dave a28adb0ba3 stream settings: Reset stream description on error.
Reset old value of stream description on error. This commit
also update the error message on updating stream name and
description.
2018-04-30 10:11:25 -07:00
Yashashvi Dave 7e9ccead2e stream settings: Fix server error on long stream description.
Add backend validations to check stream description length.
2018-04-30 10:11:23 -07:00
Tim Abbott 976e61d687 validators: Improve error messages for check_capped_string. 2018-04-30 10:07:06 -07:00
Yashashvi Dave 8729c9001d static/js/settings_streams.js: Move delete_stream func to `stream_edit.js`. 2018-04-30 17:48:16 +05:30
Yashashvi Dave 7bbe44d7a0 org settings: Remove "Delete streams" administrative tab from settings.
Fixes #9227
2018-04-30 17:47:34 +05:30
Eeshan Garg 0a7d1bc746 webhooks/freshdesk: Update docs to conform to new style guide. 2018-04-29 18:06:14 -07:00
Eeshan Garg 057ff9c91e models: Add Stream.history_public_to_subscribers.
This commit adds a new field history_public_to_subscribers to the
Stream model, which serves a similar function to the old
settings.PRIVATE_STREAM_HISTORY_FOR_SUBSCRIBERS; we still use that
setting as the default value for new streams to avoid breaking
backwards-compatibility for those users before we are ready with an
actual UI for users to choose directly.

This also comes with a migration to set the value of the new field for
existing streams with an algorithm matching that used at runtime.

With significant changes by Tim Abbott.

This is an initial part of our efforts on #9232.
2018-04-28 22:54:04 -07:00
Tim Abbott 9729b1a4ad search: Remove buggy double-call of set_message_booleans.
In a refactor last fall, we changed `set_message_booleans` to mutate
state (specifically, destroying msg.flags in favor of setting
properties like `msg.unread`).  This was fine for most code paths, but
the maybe_add_narrowed_messages code path called
`message_store.add_message_metadata` twice (once after talking to the
server to find out whether the messages go into the current narrow),
and so when we extracted set_message_booleans from that, the second
call didn't properly short-circuit.

We fix this by just removing the second call, and also add a comment
warning about the add_message_metadata call there as being dangerous.

Fixes #8184.
2018-04-28 14:39:24 -07:00
Tim Abbott e087be6630 home: Ignore handlebars errors in the test suite.
The handlebars error message is just for the manual development
environment; this prevents the state of compiling handlebars templates
from run-dev.py from potentially causing the unit tests to fail.
2018-04-28 13:49:24 -07:00
Tim Abbott 7d6bb3dcb4 settings: Remove obsolete default_desktop_notifications setting.
This actually hasn't been hooked up to do anything in years.

While we're at it, we remove the entire "Zulip Labs" settings page.
2018-04-28 13:46:07 -07:00
Shubham Dhama 7f679bcdce org settings: Make allowed domain table status element fade out. 2018-04-28 13:24:59 -07:00
Shubham Dhama 689c717284 message_edit: Don't offer UI to edit topics after time limit.
This fixes a couple places where with community topic editing, we'd
show the edit-topic UI basically indefinitely.
2018-04-28 13:14:27 -07:00
Shubham Dhama da8157d414 message: Extract function for editability of topic. 2018-04-28 13:00:29 -07:00
Shubham Dhama 30b1ec9433 org settings: Change default allow_community_topic_editing value.
This changes the default value of allow_community_topic_editing to
`True` which was merged with `False` default value temporarily.
2018-04-28 13:00:29 -07:00
Shubham Dhama 7f9cfab15a org settings: Add frontend for allow_community_topic_editing. 2018-04-28 13:00:29 -07:00
guaca 3c01ea78b0 settings: Add modal fade.
This implements the modal fade idea suggested here:

https://chat.zulip.org/#narrow/stream/6-frontend/subject/Visual.20Design.20Strategy.20for.20Settings.20UI/near/559763
2018-04-28 12:55:15 -07:00
Steve Howell 160931377f node tests: Test deactivating streams. 2018-04-28 11:15:14 -07:00
Steve Howell 6e851f98f6 node tests: Test refreshing pinned streams. 2018-04-28 11:15:14 -07:00
Steve Howell cf24445809 node tests: Add test for stream_list.rename_stream. 2018-04-28 11:15:14 -07:00
Steve Howell 74e7c81c94 node tests: Add coverage for topic zooming.
These tests cover the stream_list side of the interaction.
2018-04-28 11:15:14 -07:00
Steve Howell c22a1d1f23 refactor: Simplify return values for would_receive_message().
Instead of treating false differently from undefined, our
function is now a regular boolean function, and we limit our
code comments to the one corner case where the true/false
decision is kind of arbitrary and possibly confusing.
2018-04-28 11:15:14 -07:00
Steve Howell 2efae10c7c refactor: Remove dead code from would_receive_message().
The buddy list never includes yourself nor bots, so we
remove the special case handling for those situations.

If we were to put bots or the current user back in the list,
I'm not convinced the old logic was what we'd want in either
case going forward.

For example, we might want to fade bots that aren't subscribed
to public streams, since they might otherwise confuse people,
but then again they would receive messages.  And then "yourself"
is a recipient in the technical sense but they're kinda
not and either way it doesn't provide much signal either way.
2018-04-28 11:15:14 -07:00
Steve Howell fe62dacee0 node tests: Add coverage for stream sidebar search. 2018-04-28 11:15:14 -07:00
Steve Howell d1bf6028ef Remove hack for stream cog.
We don't need to special-case the stream cog handler when we
handle the click event for the surrounding header.  The browser
will fire the event for the cog first, which stops propagation.
2018-04-28 11:15:14 -07:00
Steve Howell e9c6f3a07d stream list: Use newer code for the list cursor.
The new list_cursor class is more generic and saves the state
of your cursor across redraws.

Note that we no longer cycle from bottom to top or vice versa.

The node test code that was removed here was kind of complex
and didn't actually assert useful things after calling methods.
2018-04-28 11:15:14 -07:00
Steve Howell 779535fda3 minor: Extract some vars in stream_sort tests.
This is just to make the next commit a bit more convenient.
2018-04-28 11:15:14 -07:00
Steve Howell 605a90ce36 node tests: Reach 100% coverage for scroll_util.js. 2018-04-28 11:15:14 -07:00
Steve Howell 97b9367d20 refactor: Extract scroll_util.js.
We now use scroll_element_into_container() in two different
places, so it's worth extracting.
2018-04-28 11:15:14 -07:00
Steve Howell 068e4bf32b buddy list: Populate user-fade via templates.
When we populate the buddy list or update it for activity, we now
have buddy_data set a faded flag that is rendered in the template.
This avoids some re-rendering overhead and is on the eventual path
to having our widget be more data-oriented (and all rendering happens
"behind" the widget).

We still do direct DOM updates when the compose state changes or
when we get peer subscription events.
2018-04-28 11:15:14 -07:00
Steve Howell d88d6df53b refactor: Fix naming conventions in compose_fade.js.
We don't really need the "_" prefix for private functions, since
public functions are exported, and it was a bit distracting.
2018-04-28 11:15:14 -07:00
Steve Howell d4fc92c1c7 refactor: Rename method to compose_fade.update_all().
The function was misnamed before.
2018-04-28 11:15:14 -07:00
Steve Howell 5d6c9c1b47 compose_fade: Extract user_fade_config.
This commit extracts the key UI elements of updating the buddy
list for compose fade into a configuration, and we interact with
the buddy_list API.
2018-04-28 11:15:14 -07:00
Steve Howell fb712027bf buddy list: Fix and simplify up/down navigation.
This introduces a generic class called list_cursor to handle the
main details of navigating the buddy list and wires it into
activity.js.  It replaces some fairly complicated code that
was coupled to stream_list and used lots of jQuery.

The new code interacts with the buddy_list API instead of jQuery
directly.  It also persists the key across redraws, so we don't
lose our place when a focus ping happens or we type more characters.

Note that we no longer cycle to the top when we hit the bottom, or
vice versa.  Cycling can be kind of an anti-feature when you want to
just lay on the arrow keys until they hit the end.

The changes to stream_list.js here do not affect the left sidebar;
they only remove code that was used for the right sidebar.
2018-04-28 11:15:14 -07:00
Steve Howell c63f2db25b hotkeys: Remove call to activity.blur_search().
The blur_search() function was removed in this commit:

See da06832837

We now no longer attempt to call it.  It's not completely clear
to me what this did before, but we are rewriting a lot of the
keyboard navigation for search anyway.
2018-04-28 11:15:14 -07:00
Steve Howell f11b3c9934 buddy_list: Clean up selector references.
In this cleanup I make it so that all jQuery selector references
are toward the top of the module, and we do all finds relative
to the container ('#user_presences').

This will make it easier to make a better list abstraction for
the buddy list, for things like progressive rendering.
2018-04-28 11:15:14 -07:00
Steve Howell 65d8eb3189 buddy list: Extract user_search.js.
This was a bit more than moving code.  I extracted the
following things:

        $widget (and three helper methods)
        $input
        text()
        empty()
        expand_column
        close_widget
        activity.clear_highlight

There was a minor bug before this commit, where we were inconsistent
about trimming spaces.  The introduction of text() and empty() should
prevent bugs where users type the space bar into search.
2018-04-28 11:15:14 -07:00