Commit Graph

7203 Commits

Author SHA1 Message Date
Tim Abbott 34f5218a0d ui_report: Add support for passing "".
I'm not really a fan of the "Failed:" pattern in some places, and this
lets us avoid it.
2018-12-18 12:33:42 -08:00
Joshua Pan 5c196d70bd css: Switch upper left logo and text to a single image.
This is preparation for allowing customization of this field.
2018-12-18 12:19:56 -08:00
Vaibhav 7371fd2647 notifications: Refactor code using logic from message_viewport.
Logic for checking if the last message in the current table is visible was
already written in message_viewport.js; Code in notifications.js is changed
to reduce redundancy.
2018-12-18 11:53:08 -08:00
Steve Howell f4f59a7557 presence: Rename presence.set_user_status() -> set_info_for_user(). 2018-12-18 11:01:10 -08:00
Steve Howell ba69dcc74c presence: Rename activity.set_user_status().
We are trying to carve room for a more specific
"user_status" concept, which refers to statuses
that users specifically set, like "I'm away".

So we call this function "update_presence_info",
which reflects that it's more about actual
"presence"--i.e. the user really is present
in the browser, even though the actual human
may not want to be disturbed.
2018-12-18 11:01:06 -08:00
Steve Howell 2c719bdb3f buddy list: Exclude current user from searches.
The current user gets excluded from all non-empty
searches, even ones that match the user, since
it can look funny when the user's at the top of a
search, and you'd never need to search for yourself
(again, since the current user is at the top of
the buddy list).
2018-12-18 11:01:06 -08:00
Steve Howell bf152b94b5 presence: Put current user back at the top of the buddy list.
We tried this out, reverted it, and then put it back.
2018-12-18 11:01:01 -08:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Rishi Gupta d2b47dc270 org settings: Rename linkification regular expression field to pattern.
We use pattern in the table, so we should match that in the form.
2018-12-17 12:58:52 -08:00
Tim Abbott d469c14d11 docs: Advertise arbitrary org GitHub patterns for linkifiers.
Now that we support this, we should make it really obvious that we do.

Also, link to the Help Center article.
2018-12-17 12:58:52 -08:00
Tim Abbott ad9e063a5c settings: Rename realm_filters template to use linkifiers. 2018-12-17 12:29:39 -08:00
Tim Abbott 12b3e79661 settings: Rename "settings_filters" to "settings_linkifiers".
This makes the JS codebase match the UI for how to describe this
feature.  No user-facing effect.
2018-12-17 12:28:55 -08:00
Steve Howell 7a44d99b96 settings: Eliminate admin_sections module.
We move all of its logic into settings_sections.

Note that this is slightly more than a refactor.
We are slightly more aggressive about resetting
sections.  For example, if you go into Settings,
then exit the overlay, then go into Manage
Organization, we will now reset sections for both
groups.
2018-12-17 10:13:20 -08:00
Steve Howell 0543e8fbc1 settings: Call maybe_disable_widgets() in set_up() methods.
We now rely on set_up() methods to call their
own module-specific versions of maybe_disable_widgets()
in the codepath for admin_sections.load_admin_section().

And then for live updates, we just explicitly call
all four modules that support maybe_disable_widgets().

This should make switching between sections slightly faster,
and it also reduces the risk of module A messing with
module B's state.  (Granted, we have lots of other ways
that modules can mess with each other's state.)
2018-12-17 10:13:18 -08:00
Steve Howell b88a5700f6 settings: Extract multiple versions of maybe_disable_widgets(). 2018-12-17 10:13:16 -08:00
Tim Abbott cb9b526f0c third: Extract bootstrap typeahead to its own module.
Bootstrap's typeahead is the main part of the project that we've
forked, and moving it to its own module should help unlock our ability
to upgrade bootstrap itself.
2018-12-17 09:06:52 -08:00
Steve Howell d8c454b097 todo lists: Make lists sharable.
We no longer restrict who can add tasks or check
them off.

Fixes #10440
2018-12-17 07:40:27 -08:00
Tim Abbott e9f889d57e portico: Fix totally broken ToS re-accept form styling.
This form isn't actively used, which is how it ended up broken, but it
basically didn't display its content properly at all.

Convert it to use our standard white-box framework.

This still doesn't look great in various ways, but it's at least not
obviously totally busted now.
2018-12-17 07:28:29 -08:00
Tim Abbott 7485cb2a50 widgets: Rename voting_widget to poll_widget.
This ensures greater consistency with our other widgets' naming
convention.
2018-12-16 19:46:48 -08:00
Tim Abbott 2cca6a1be8 csrf: Improve API for when no CSRF input is available.
Since we're adding this to a large number of portico pages, there's no
guarantee that these pages actually have a CSRF input.

Though given that the logout template contains a CSRF input,
realistically it should always be present.
2018-12-16 16:19:23 -08:00
Tim Abbott adebe1bd4e js: Extract csrf.js and include in common bundle.
This should make it possible to use this AJAX setup code in logged-out
code as well, which is necessary to use blueslip from portico pages.
2018-12-16 16:18:42 -08:00
Tim Abbott ed9430f3a6 Revert "js: Extract csrf.js and include in common bundle."
This reverts commit dbffa66b6d.

This broke the logged-in app, due to some webpack issue.
2018-12-16 16:16:06 -08:00
Tim Abbott 6416737e70 Revert "csrf: Improve API for when no CSRF input is available."
This reverts commit 9198fa4ec9.
2018-12-16 16:15:54 -08:00
Steve Howell 7d23076a0e drafts: Fix bug in finding current element.
We weren't using the actual sorted data to find
the last element.  This probably worked by accident
in some cases, but this commit makes it more
deterministic.
2018-12-16 15:46:41 -08:00
Steve Howell ebd6d84326 refactor: Call format_drafts() more directly.
We want the return value from this for the next
commit, so we no longer call `format_drafts` indirectly
from `populate_and_fill`, and we rename the latter
to `render_widgets`.
2018-12-16 15:46:41 -08:00
Steve Howell 1584789916 refactors: Move format_draft() to module level.
This is a pure code move.
2018-12-16 15:46:41 -08:00
Steve Howell e22a50a3e3 drafts: Use lists instead of dicts.
We were using a dict to return a sorted list of
formatted drafts, instead of building a list.
2018-12-16 15:46:41 -08:00
Steve Howell 29052b36a5 minor: Rename last_draft -> curr_draft. 2018-12-16 15:46:41 -08:00
Steve Howell c82233c435 drafts: Avoid callback mechanism.
We had an anonymous callback for drafts that was
hard to read.  It's much easier to flatten the code,
give functions actual names, and stub them as needed
in the unit tests.
2018-12-16 15:46:41 -08:00
Tim Abbott 9198fa4ec9 csrf: Improve API for when no CSRF input is available.
Since we're adding this to a large number of portico pages, there's no
guarantee that these pages actually have a CSRF input.

Though given that the logout template contains a CSRF input,
realistically it should always be present.
2018-12-16 15:35:54 -08:00
Tim Abbott dbffa66b6d js: Extract csrf.js and include in common bundle.
This should make it possible to use this AJAX setup code in logged-out
code as well, which is necessary to use blueslip from portico pages.
2018-12-16 15:35:54 -08:00
Steve Howell 840210a0ba minor: Move setup_event_handlers() in code.
We place this code under populate_and_fill().

And instead of calling this at the end of
populate_and_fill(), we call it AFTER
populate_and_fill().
2018-12-16 14:38:28 -08:00
Steve Howell e38496ddc0 drafts: Show active element clearly. 2018-12-16 14:38:28 -08:00
Tim Abbott 0779d343fa message_list: Fix handling of unknown email in mentions.
If a user has an old mention and has since been renamed, there's
really nothing for us to do to render it; we should just return as
though we have no data.
2018-12-16 14:36:26 -08:00
Marco Burstein 046ecc5d50 styles: Fix compose options hidden when editing.
Fix an issue that when a message is being edited, sometimes compose
options are hidden if there is no time limit. Also, move the options
further from the time limit to make them more noticeable.

Fix #11056.
2018-12-16 13:45:43 -08:00
Tim Abbott 728c601ff4 poll widget: Only show "Add option" if a question has been set.
This makes the UI less confusing.
2018-12-16 11:59:21 -08:00
Tim Abbott 5d31c57638 poll widget: Move the "Add option" feature below options.
This is the more normal ordering for a poll.  Fixes part of #11010.
2018-12-16 11:39:04 -08:00
Steve Howell 35b904b184 subject -> topic: Fix subject in opts.
It's kinda difficult to track down all the interactions
with the opts that go through compose_actions.start(),
but I think I got everything.
2018-12-16 11:26:18 -08:00
Steve Howell 057ee6633a reload: Use "topic" to encode compose topic. 2018-12-16 11:26:18 -08:00
Steve Howell 9861cdfeb6 drafts: Use "topic" internally.
We still have to support "subject" for old drafts,
but we write "topic" for new drafts.
2018-12-16 11:26:18 -08:00
Steve Howell 9ba7b4fcbb drafts: Extract drafts.restore_message().
We make our deep-copy more explicit, change
the var name from draft_copy to compose_args,
and clean up some code formatting.
2018-12-16 11:26:16 -08:00
Steve Howell d7aa5fcc38 compose: Remove obsolete references to replying_to_message.
The `replying_to_message` field was used in some
early versions of compose fade, but it has no more
use in the current code.

The drafts implementation didn't really make any sense,
anyway, as we were claiming to reply to the same
message we were drafting.
2018-12-16 11:26:02 -08:00
Tim Abbott bdc4876948 notifications: Fix missing translation tags for above-compose alerts.
Apparently, these had never made it to being translated.  Since
they're an important part of the user experience, we add translation
tags for them now.
2018-12-16 11:14:09 -08:00
Tim Abbott 6c7725d21f notifications: Compute link earlier in mix notifications code.
This should make it more obvious how to later add a feature to include
a link for out-of-view-scroll-down notifications, should we ever want
that.
2018-12-16 11:02:52 -08:00
Vaibhav 372cb20f9e notifications: Notify when sent message is scrolled down in view.
A common source of confusion for new users is sending a message when
you're scrolled up in the message feed; in this case, it's nice to
communicate to the user why the message is not in view.

Fixes #10792.

Restructured by tabbott to replace overly complex logic for getting
the position of the new message with a `message_list.get_row()` call.
2018-12-16 10:59:25 -08:00
Tim Abbott 008722b809 portico: Fix logic for whether a password field is present.
Now, we correctly avoid calling various password quality/strength
functions in the registration flow in the event that there isn't a
password form on the current page.

Before, some code wasn't inside a block at all, while other code was
using an incorrect check (an empty jQuery object is not falsey).

The overall result was that this would often crash on certain
pages/flows, stopping JS execution and causing various secondary
problems.
2018-12-15 13:58:38 -08:00
Steve Howell a4c80089f3 page load: Fix two bugs related to muting/unreads.
The first bug fixed here has been around for a long
time--we were redundantly updating unread counts
indirectly via muting_ui.initialize(). The
unread counts also get updated in
unread_ui.initialize(), when we have more valid
state.  (And it's worth noting here that the unread
counts get updated yet again once message fetches
complete.)

The second bug was a very recent regression from
my recent stream name -> stream id cleanup in the
muting system.  We now depend on stream_data to
initialize muting data, so we need to initialize
muting.js slightly later in the process.

These fixes are intertwined, because they were both
somewhat caused by the anti-pattern of having
muting_ui.js initialize unread_ui.js and muting.js,
instead of doing more direct, fine-grained initialization
from ui_init.js.

Essentially we replace this code:

    exports.update_muted_topics = function (muted_topics) {
        muting.set_muted_topics(muted_topics);
        unread_ui.update_unread_counts();
    };

with this:

    exports.initialize = function () {
        exports.set_muted_topics(page_params.muted_topics);
    };

And the modules load like this:

    stream_data
    ...
    muting
    ...
    unread_ui

And we don't need any page-load initialization for muting_ui,
which is mostly used for Settings/Muted topics.
2018-12-15 13:44:30 -08:00
Steve Howell 625388ccf0 refactor: Call stream_data.initialize() more directly.
This function used to be called initialize_from_page_params(),
and we called it indirectly through `subs.js`.

Now we call it directly from `ui_init.js`, which gives us a
bit more control over how things are initialized.  In fact,
this sets us up for the next commit, where I fix a recent
regression I introduced.
2018-12-15 13:44:30 -08:00
Rishi Gupta 111eda604b portico: Add /atlassian for Zulip users migrating from HipChat. 2018-12-14 23:42:47 -08:00
Steve Howell c8cee5d900 topic list: Remove unnecessary markup.
The data attribute here has some value if you're
inspecting the HTML in the browser, but it's not
worth the extra code.

All the list items have data-stream-id, so there's
no need for the parent to have it.
2018-12-14 16:05:40 -08:00