Commit Graph

3259 Commits

Author SHA1 Message Date
Brock Whittaker 5e1471f5a3 Add preview_node functionality to util.js.
This shows a preview of a node given a reference to it like:
<tag id=“id” class=“className”></tag>.

It's intended to be used for reporting errors that are introduced by
developers in features such as the upcoming progressive list rendering.
2017-04-14 14:42:16 -07:00
Brock Whittaker f08c8b1c56 Fix settings page height issue.
The height of the settings page content is not quite as tall as the
settings page could allow which makes for an empty white space at the
bottom of the settings content container.
2017-04-14 14:38:45 -07:00
Yago González f62b8ea080 css: Properly wrap text inside tabs.
The tabs can have text inside them that is wider than 90px, especially
in some unexpected cases (e.g. a translation longer than the original
English string).

This type of tabs can be seen in the following popover menus:

 - Stream subscriptions
 - Help (with hotkeys, formatting info, etc.)
 - Settings

Now text wider than the tab is ellipsized so it doesn't cause any
problem with the rest of the layout, except in the help popover (where
it gets wrapped).
2017-04-14 14:15:37 -07:00
Raghav Jajodia 09090fa8a6 message_edit: Replace image tag with inline SVG tag for clipboard image. 2017-04-14 14:07:59 -07:00
Raghav Jajodia ae48eaa90d single_message: Show "Copied!" success message after copying.
As the user clicks the "Copy and close" button, the message_edit
closes and a success message is shown for a few seconds.
2017-04-14 14:07:36 -07:00
Raghav Jajodia 2bb632824e message_edit: Modify css for hover over 'Copy' button.
Replace background-image of copy button with an image
and change color on hover.
2017-04-14 14:01:57 -07:00
Raghav Jajodia fd5ad3658d message_edit: Only show "Copy" button for View Source/Topic-edit-only.
The "Copy" button will only be shown for "View Source"
or "Topic editing only". Also replaced "Copy to clipboard"
with "Copy and close" to make autoclose less surprising.

Fixes #4238.
2017-04-14 14:01:57 -07:00
Steve Howell 5ba79f9c3a refactor: Move respond/reply methods to compose_actions.js.
This moves respond_to_mention() and reply_with_mention() to
compose_actions.js.  These methods are basically thin layers
on top of compose_actions.start().
2017-04-14 13:09:19 -07:00
Steve Howell dd0c50f0df Extract compose_actions.js.
This module extracts these two functions that get called by
several other modules:

    start()
    cancel()

It is a little bit arbitrary which functions got pulled over
with them, but it's generally functions that would have only
been called via start/cancel.

There are two goals for splitting out this code.  The first
goal is simply to make `compose.js` have fewer responsibilities.
The second goal is to help break up circular dependencies.
The extraction of this module does more to clarify
dependencies than actually break them.  The methods start()
and cancel() had actually been shimmed in an earlier commit,
and now they no longer have a shim.

Besides start/cancel, most of the functions here are only
exported to facilitate test stubbing.  An exception is
decorate_stream_bar(), which is currently called from
ui_init.js.  We probably should move the "blur" handler out
of there, but cleaning up ui_init.js is a project for another
day.

It may seem slightly odd that this commit doesn't pull over
finish() into this module, but finish() would bring in the
whole send-message codepath.  You can think of it like this:

* compose_actions basically just populates the compose box
* compose.finish() makes the compose box do its real job,
  which is to send a message
2017-04-14 13:09:19 -07:00
Steve Howell 703074215a Export compose.abort_xhr(). 2017-04-14 13:09:19 -07:00
Steve Howell 254b9559da Export compose.clear_preview_area(). 2017-04-14 13:09:19 -07:00
Steve Howell 9bd096f3cf compose: Extract blur_textarea(). 2017-04-14 13:09:19 -07:00
Steve Howell ec8bd077d1 compose: Extract clear_textarea(). 2017-04-14 13:09:19 -07:00
Brock Whittaker fe8f63c389 message view: Fix rare cases where click-to-reply was not handled.
The comment explains this change is fairly good detail.  This change
is designed to fix complaints that sometimes clicking on a message to
reply doesn't work, which we can reproduce as being caused by clicks
that happen simultaneous with a few pixels of mouse motion at the same
time as the click.

Comment and commit message rewritten by tabbott for clarity.
2017-04-14 11:25:15 -07:00
hackerkid cd5334c827 Show local time of user in user_popover. 2017-04-14 10:38:29 -07:00
hackerkid 15cdd23525 Add option for setting timezone in user display settings. 2017-04-14 10:38:21 -07:00
hackerkid bf3b2ac673 Include timezone in user_dict fields.
Tweaked by tabbott to avoid adding timezone to bot dicts, since bots
don't need a timezone.
2017-04-14 10:33:55 -07:00
derAnfaenger ecf9a50610 Clarify UI description of message retention. 2017-04-14 10:13:34 -07:00
Steve Howell e23b660ccc compose: Extract set_focus().
Most of the code here was in show_box(), but we also pull in the
call to get_focus_area() from compose.start().
2017-04-13 17:13:19 -07:00
Steve Howell 0841320966 compose: Extract maybe_scroll_up_selected_message().
The extraction here is straightforward, but where we put the
caller is a slightly subtle change.  Instead of continuing to
invoke this code at the end of show_box(), we instead call it
at the beginning of complete_starting_tasks().  This change is
valid, because show_box() and complete_starting_tasks() are only
ever called from compose.start().
2017-04-13 17:13:19 -07:00
Steve Howell aa5409cf3a compose: Extract complete_starting_tasks(). 2017-04-13 17:13:19 -07:00
Steve Howell e73b56c7b5 compose: Extract expand_compose_box(). 2017-04-13 17:13:19 -07:00
Steve Howell 79ff32a01e compose: Extract autosize_message_content(). 2017-04-13 17:13:19 -07:00
Steve Howell f06bd41586 Fix PM list sort ordering during scrollback situations.
Before this fix, if you scrolled back in your PM history for a
person that you've had recent conversations with, then we would
backdate the record of their most recent conversation, and this
would make the sort ordering under the "Private messages"
section incorrect.

This commit fixes this error by re-writing the function
message_store.insert_recent_private_message() to check any
prior timestamps for that user.  It also optimizes the function
a bit to short-circuit in O(1) time for cases where a recipient
already has a more recent timestamp, by having a Dict keyed
on user_ids_string.
2017-04-13 12:13:20 -07:00
Steve Howell f5550301cf Extract message_store.insert_recent_private_message().
This function is slightly easier to unit test, and it isolates us
from changing message formats.  This removes some extraneous
code that would ensure that message timestamps were >= 0 that
probaby dates back to some really old migrations.
2017-04-13 12:13:20 -07:00
Steve Howell 6b549248e8 Extract settings_filters.js. 2017-04-13 10:39:39 -07:00
Steve Howell 3e37f64f71 Extract settings_streams.js. 2017-04-13 10:39:39 -07:00
Steve Howell 70afb59cff Extract settings_users.js.
This affects three admin sections:

    * Users
    * Deactivated users
    * Bots
2017-04-13 10:39:39 -07:00
Steve Howell 0fc7b9907f Extract settings_org.js (and fix live updates).
This is mostly moving code, but we do add short-circuit logic
for some live-updating methods here.

Note that this affects two different sections of the admin app:

    * Organization settings
    * Authentication methods

We really want to move to one module per section, but there is some
legacy coupling that makes this difficult for now.
2017-04-13 10:39:39 -07:00
Steve Howell a3b44148af Extract settings_emoji.js. 2017-04-13 10:39:39 -07:00
Steve Howell 76ec9cf60b Fix bug with (un)subscribe button showing on wrong narrow.
We had a bug for a while where if somebody subscribed you to a
stream, and you were narrowed to another stream, we'd show
a button in the "trailing bookend" to "Unsubscribe" from the
current stream.  I'm not sure how long we had that bug, but it
was at least a couple months old, and I couldn't track down an
issue for it.

Now we make sure that the stream event for the subscription is
related to the current narrow.

Users should still see messages when they subscribe/unsubscribe
themselves or when another user re-subscribes them to the stream
that they are narrowed to.
2017-04-13 08:01:44 -07:00
Steve Howell 33eb5ad237 Add narrow.is_for_stream_id() helper. 2017-04-13 07:49:55 -07:00
Brock Whittaker ec956d6d6e integrations: Preserve scroll position on integration inspect.
This preserves the scrolltop state of the user when they enter into
an integration's specifics, so when they exit out it scrolls them
back down the page.

Fixes: #4424.
2017-04-12 21:14:21 -07:00
Brock Whittaker e3d510154d drafts: Move the draft empty placeholder logic to template render path.
This moves the logic to embed the translated string “(no topic)” to
only render in the handlebars template rather than saving in
localStorage and therefore being added to the message topic and
eventually put in the database if not changed.

Fixes: #4378.
2017-04-12 14:15:31 -07:00
Brock Whittaker b6d285f1f4 integrations: Fixup inconsistent lozenge heights.
This normalizes images to all take up 100px even if they fall short
so that the text that is underneath will always be horizontally
aligned.
2017-04-12 13:10:41 -07:00
Umair Khan 24295e6ac8 i18next: Add expirationTime option to cache.
This ensures that we don't fill up local storage with cached
translations data when using a server that restarts often (e.g. a
development environment).

Fixes: #4443.
2017-04-12 09:32:49 -07:00
Umair Khan 0cd7c400e1 i18next: Add i18next: to the local storage cache prefix.
This just makes it easier to see what these local storage entries are
related to.
2017-04-12 09:32:31 -07:00
Brock Whittaker ffa654f780 left-sidebar: Remove <hr> divider if last pinned stream is unpinned.
The <hr> is supposed to separate the pinned streams from the unpinned
streams, so if the <hr> is the first element (checked by doing
$hr.prev().length === 0), then it means there are no longer any pinned
streams and therefore it isn’t necessary to have a divider.

Fixes: #4395.
2017-04-11 17:06:37 -07:00
Brock Whittaker d74f72f08f gear-menu: Re-add the organization settings link.
This re-adds the organization settings link and toggles the text
dependent on whether the user is an administrator or not.

Fixes: #4201.
2017-04-11 16:31:33 -07:00
Brock Whittaker 1f8d9a46f0 Remove extra "Unsubscribe" on left-sidebar stream popover.
An extra "Unsubscribe" was left over from when it was a CSS :pseudo
content rather than text in the templates.
2017-04-11 16:14:55 -07:00
Brock Whittaker 473214b32f stats: Change popover font size and weight to be more readable.
This changes the font size and weight of the popver at the bottom
of the screen (hover over "?" to see) to be a larger font size
(increased to 0.75rem from 11px) and to a bolder font weight
(500 from 300) which improves the readability of it.
2017-04-11 14:00:27 -07:00
Aditya Bansal d56100693d profile-popover: Fix position to hide the pointed-to message border.
In this commit we just adjust the position of user profile popover
opened when we click upon buddy from buddy list to view user profile.
The new position ensures that the little blue border visible from back
due to pointed to message is completely hidden by the popover.
2017-04-07 17:34:57 -07:00
Aditya Bansal 5ff87892ee profile-popover: Fix extra padding in user-profile popovers.
In this commit we remove the extra padding appearing around the
user profile images. This can be only reproduced when opening
user profile from buddy list.
2017-04-07 17:34:57 -07:00
Abhijeet Kaur 8f88b045a4 Rename "Administration" to "Organization" in the settings UI.
This better sets expectatations for the fact that in Zulip, the
Organization settings UI is available read-only to non-administrator
users.

Tweaked by tabbott to update some additional references.
2017-04-07 17:32:56 -07:00
Steve Howell 06f9c28fd2 settings: Lazy-load settings sections.
For the settings UI, we now wait until a user goes to a particular
settings section before calling the appropriate function to set
up the section (which usually involves setting up click handlers
and populating initial data).
2017-04-07 15:20:12 -07:00
Steve Howell c4b4979a74 Add Dict.clear() method. 2017-04-07 15:20:12 -07:00
Steve Howell 46af691e76 minor: Move line of code to hide digest settings.
This line was overlooked when extracting code to
settings_notifications.js.  It was not causing a user facing
error, but it was in the wrong place.
2017-04-07 15:20:12 -07:00
Steve Howell 7f17fc020f Extract settings_bots.js. 2017-04-07 15:20:12 -07:00
Steve Howell 153c24d071 Remove dead code related to bot/stream settings.
We had never-enabled code to allow users to set default
streams for their bots (for event registration, default sending, etc.).

This commit removes the code.
2017-04-07 15:20:12 -07:00
Abhijeet Kaur 015229fc68 Rename "Administration" to "Organization" in settings.
Rename "Administration" tab in Settings to "Organization."

Also rename the same in the navigation-bar for admin-users.
2017-04-07 07:18:50 -07:00