Commit Graph

1329 Commits

Author SHA1 Message Date
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 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 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
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 02bc506518 bot_data.js: Fix dict indentation. 2018-02-09 12:30:24 -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 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
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
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
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
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 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
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
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
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 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
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
Aditya Bansal efbddce34d settings_user_groups.js: Add 100% node test coverage. 2018-01-20 08:01:06 -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 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
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
Steve Howell 93d5a33f2a casper tests: Show the server output inline.
Showing the server output transparently in casper tests
will save developers headaches chasing down flakes.  It's
particularly important to see server output intermingled
with the Casper output.
2018-01-16 13:25:19 -05:00
Steve Howell fa0ac8b6b5 casper tests: Always show console output from the app.
We now always show JS console output when running Casper tests.
The app is not spammy for the "happy path", so there's no real
reason to quiet it down, and it's never been well documented
how to turn on the option, so we've subjected developers to
needless head scratching in the past.
2018-01-16 13:25:19 -05:00
Steve Howell 5336c03da9 casper tests: Use helper functions for message editing test.
We use these functions to be consistent with the style of the rest
of the code:

    * common.then_click
    * submit_checked
    * submit_unchecked
2018-01-16 13:25:19 -05:00
Steve Howell 7fe59d2dcd casper: Add heading output to message editing test.
It's always been difficult to find code in this file, particularly
when you're matching it up to test failures.
2018-01-16 13:25:19 -05:00
Steve Howell e7546db0b0 casper: Remove dead code related to message editing.
All the code removed here is pretty old and caused annoying
flakes.  We don't realistically have anybody who can fix
the code.
2018-01-16 13:25:19 -05:00
Aditya Bansal 26bbdc0875 settings_user_groups.js: Add node tests to increase test coverage. 2018-01-10 06:56:52 -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
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
Robert Hönig e28943cd9a zjquery: Allow attribute selector '[]'. 2018-01-07 18:49:16 +01:00
Robert Hönig a7b35f24b9 zjquery: Add support for trigger() with string as argument. 2018-01-07 18:47:55 +01:00
Cynthia Lin a937750b1a node tests: Add 100% test coverage for user_groups.js. 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 83706e1bcd org settings: Add User groups content and design. 2018-01-06 11:50:52 -05:00