Commit Graph

171 Commits

Author SHA1 Message Date
Steve Howell 012bb7b6c7 Use stream_id for by_stream__uri().
The stream_list test that was fixed here was sort of
broken.  It accomplished the main goal of verifying
what gets rendered, but now the data setup part is
more like the actual app code (and simpler, too).
2018-12-14 16:05:40 -08:00
Steve Howell bf6f5e7bc5 muting: Pass stream_id to muting_ui.mute and unmute.
We temporarily allow settings_muting to have
incomplete line coverage--we will fix this soon.
2018-12-14 16:02:48 -08:00
Aditya Jain 8f0ccdf1c9 user settings: Fix active background links when a modal is visible.
A bug caused background links to open even when a modal in the user
settings overlay was active in the foreground. This commit fixes this
by disabling mouse events for the background when the modal is active,
and restoring them as soon as the modal starts closing.

Fixes #10654.
2018-12-09 22:32:53 -08:00
Tim Abbott 838dd6d273 lint: Add eslint enforcement for comma-spacing.
We've been enforcing this manually for a long time, and hadn't
realized it was missing from our eslint configuration.
2018-12-07 12:22:24 -08:00
Steve Howell a39c7096c0 hashchange: Use overlays.close_active() in a few places.
The `change_tab_to` calls are a relic of very
early versions of Zulip.
2018-12-07 08:03:20 -08:00
Steve Howell bc18eb1d41 stream links: Use more standard API to go to location.
For stream links inside messages (like "#social") we
now use these functions:

    hashchange.go_to_location:

        We don't need to set href.  Relative paths
        are more standard, and the url is already
        encoded.

    hash_util.by_stream_uri:

        This saves a step in building the URL.
2018-12-02 19:07:19 -08:00
Steve Howell 846dfb2fe4 hashchange: Extract hashchange.go_to_location().
We use this API when we want the machinery
of the hashchanged system to come into play.
2018-12-02 19:07:15 -08:00
Steve Howell 91e4784b92 subject -> topic: Rename narrow.by_subject. 2018-11-14 23:24:06 -08:00
Steve Howell 7ae8907b3f subject -> topic: Rename narrows_by_subject. 2018-11-14 23:24:06 -08:00
Marco Burstein 502e9fe8a6 compose: Open the mobile compose popover when the `+` button is pressed.
The `+` button will only be displayed on mobile devices.
2018-10-31 16:47:48 -07:00
Steve Howell d070f55e00 Prevent clicks from closing user profile modal.
We have a body-level click handler that closes
all modals if you click outside a modal.  This
code is a bit brittle, because we need to first
check that the element we clicked is not in a modal,
and our markup there isn't entirely consistent.

This is a quick fix that just adds `#user-profile-modal`
as one of the selectors to look for.

Fixes #10500
2018-09-14 08:44:25 -04:00
Shubham Padia 4f4aee6d10 compose: Do not close compose box on click if parent/itself contains "a".
When the icon or the text of a menu item in settings dropdown was
clicked, already open compose box was closed. Clicking on the empty
area of that menu item i.e the area where the icon or text was not
present did not close compose box. This commits check whether the
target itself is an anchor tag or of any of its parent contains the
anchor tag.
2018-08-09 17:51:40 -07:00
Tim Abbott 4b4d420a5f message_flags: Clarify name for toggle_starred_and_update_server.
This makes it clear that the function sends the update to the server,
not just toggling the UI or local data structures.
2018-08-01 11:09:12 -07:00
Aditya Bansal 5552bfbeda settings_overlay.html: Upgrade to use font-awesome 4.7 icon prefixes. 2018-07-11 20:17:11 +05:30
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Akash Nimare d5e3ab761b settings: Unify code for setting-panel. 2018-06-27 11:48:50 -04:00
Akash Nimare 00a34fb46a settings: Remove duplicate code from setting panel.
We don't need to update this classes since we have
already added those classes in the setting_panel_menu.js.
2018-06-27 11:48:50 -04:00
Akash Nimare 68cf2b1690 settings: Fix broken setting items in smaller window.
Fixes: #9780.
2018-06-27 11:48:50 -04:00
Shubham Dhama d060101cfa message: Fix opening of compose box on mobile webapp. 2018-06-12 13:31:42 -04:00
Shubham Dhama 80a2d5bc59 eslint: Enable `conditionalAssign` config of no-trailing-spaces rule. 2018-06-11 07:51:24 -04:00
Steve Howell beecee4b8c Move panel click handler into settings_panel_menu.js.
This is mostly a code move, but because things are more
modular now, we don't need the two conditionals to find
out what kind of panel menu we're inside of, and our
selectors are less brittle.
2018-06-06 09:42:33 -07:00
Steve Howell db514002ec settings: Use separate lists for the two sidebar panels.
The list with the options for normal settings now has
the class normal-settings-list.

The list with the options for org settings now has
the class org-settings-list.

The new markup helps us avoid code like this:

    $(".settings-list li:not(.admin)")

We also have funny hacks in our key handlers related
to the old combined-list approach, which we can
eventually eliminate.
2018-06-06 09:42:33 -07:00
Joshua Pan dcee398622 onboarding: Redesign intro_reply hotspot in bottom whitespace.
This is a trial to have the first reply hotspot in the bottom
whitespace (and stick there until "Got it!"  is pressed).

Tweaked by tabbott to clean it up a bit.  Still needs more work on the
visuals.
2018-05-23 14:22:19 -07:00
Steve Howell 9eb3bdaf6c page load: Make initializations more explicit.
We now initialize most modules in ui_init.js, which
isn't the perfect place to do it, but at least now
we have a mostly consolidated entry point.

All the new foo.initialize() methods introduced in
this module run the same order relative to each
other as before this commit. (I did some console
logging with a hacked version of the program to
get the order right.)  They happen a bit later than
before, though.

A couple modules still have the `$(function() {`
idiom for miscellaneous reasons:

       archive - is a different bundle
       common - used elsewhere
       list_render - non-standard code style
       scroll_bar - no exports
       setup - probably special?
       socket - $(function () is nested!
       transmit - coupled to socket
       translations - i18n is a bigger problem
       ui_init - this bootstraps everything
2018-05-15 15:46:04 -07:00
Tim Abbott e4c50ff4fd narrow: Remove unnecessary select_first_unread option.
We consistently either pass a `then_select_id` into narrow.activate,
or were using the select_first_unread option.  Now, we just compute
select_first_unread based on the value of then_select_id.
2018-04-22 21:33:33 -07:00
Steve Howell 76d83af62b buddy list: Extract activity.narrow_for_user.
This change makes a common code path for these two operations:
        * clicking on a user
        * hitting enter when a user is highlighted

The newer codepath, for the enter key, had some differences that
were just confusing.  For example, there's no need to open the
compose box, since that's already handled by the narrowing code.

For possibly dubious reasons, I let each handler still call
popovers.hide_all() on its own, since it makes the code a bit
more consistent with existing code patterns.
2018-04-22 20:08:08 -07:00
Steve Howell f73bfd2a5c refactor: Extract settings_toggle.js.
This mostly moves code, and we also abandon the lookup mechanism
for finding our toggler.
2018-04-20 13:45:58 -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 4cf42ce478 settings: Move remove-default-stream-button handler to settings_streams. 2018-03-26 10:27:09 -07: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
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
Shubham Dhama 120ebc8f13 hotspots: Move the code for closing hotspot icon to hotspots.js. 2018-03-18 10:22:09 -07: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
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
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 7d8d7f7f9b reminders: Add alert message for set reminder success or failure. 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
rht 763a96228f left sidebar: Remove plus icon from the stream bar. 2018-01-09 09:05:23 -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 b530ee145f click_handlers: Include expanded mobile sidebars as popovers.
This prevents the sidebars from automatically closing when users
click inside the popover area. Fixes #7896.
2018-01-04 09:12:07 -05:00
Steve Howell d52552dcc3 Simplify/unify starring messages from the frontend.
We now do all of the main logic for starring/unstarring
a message in `message_flags.toggle_starred`:

    * mark the message as read (just in case)
    * update the UI (i.e. the green star in the message)
    * update the server

The calling code in both the click handler and the hotkey
handler remains simple--they just handle minor details like
finding the message and clearing popovers.

For updating the server, we now call the new
`send_flag_update` helper.

And we continue to delegate some of the logic to
`ui.update_starred`, but we remove some code there that's
now pushed up to `message_flags.toggle_starred`.

This change should be mostly transparent to users, but it
does remove some inconsistent behaviors between the click
handler and the hotkey handler.  Before this change, the
click handler was more aggressive about updating the UI
and marking the message as read.  For people using the "*"
key to star/unstar, they probably would only have noticed
different behavior on a slow connection or in an edge
case scenario where only half of the message was onscreen.

More importantly, by simplifying how we talk to the server,
this eliminated up to a one-second lag due to the debounce
logic in the batch_updater code.  The complicated debounce
logic is only really needed for batch-updating "read"
messages, and it was overkill and sluggish for starring
messages.

Last but not least, we add defensive code for the local
echo case.  (Users have to wait till the message gets acked
to star it.)
2017-12-26 09:01:21 -05:00
Shreyansh Dwivedi 5b49259722 compose box:Add a reply button. Fixes #5578 2017-12-15 14:23:24 -05:00
Rishi Gupta 191f8f1b39 left sidebar: Change Home to All messages.
We made this change because users often unnecessarily click "Home"
first in their use of Zulip, because it seems appealing.  While "All
messages" isn't quite precise (it doesn't include muted streams), it
does describe relatively simply the interleaved view that this
represents.

This commit leaves everything as "home" in the code, and only changes
user-visible strings and docs. Changing the code will be a big project;
there are hundreds of relevant occurrences in variable names, etc.

Further, we'll probably want to convert those various variable names
in different ways.

Tweaked by tabbott to extend the commit message and update a few comments.
2017-11-28 15:42:58 -08:00
Tommy Ip 6e22847548 refactor: new message content -> compose textarea. 2017-11-28 12:53:40 -08:00
Tommy Ip b9c2f479d3 refactor: s/send-status-close/compose-send-status-close. 2017-11-27 21:35:14 -08:00
Tommy Ip c0c58f9761 refactor: s/send-status/compose-send-status. 2017-11-27 21:35:14 -08:00
Harshit Bansal 8a4fc9970f reactions.js: Migrate webapp to use the new reactions API.
Fixes: #6909.
2017-11-20 15:27:20 -08:00
Brock Whittaker 2c000c0f1d settings: Increase specificity of sidebar <li> selector.
This was interfering with <li> elements outside of the settings page.
2017-11-15 13:42:44 -08:00
Brock Whittaker b1e52610dc Remove selection on longtap.
This removes the text selection that occurs on longtap due to the
standard iOS/Android behavior.

Fixes: #6480.
2017-09-25 12:31:07 -07:00