Commit Graph

6637 Commits

Author SHA1 Message Date
Joshua Pan 2fcc54ac14 ui: Rename update_starred to update_starred_view. 2018-08-01 11:07:44 -07:00
Roman Godov 5e70577f84 models: Rename Realm.show_digest_email field.
This renames Realm.show_digest_email field to
digest_emails_enabled, for greater clarity as to what it does
just from seeing the setting name, without having to look it up.

Fixes part of #10042.
2018-08-01 11:05:58 -07:00
Shubham Dhama 5fafddaef5 settings_user: Use `person` as an argument in open_user_info_form_modal. 2018-08-01 10:39:03 -07:00
Sampriti Panda d917901ca3 subs: Fix bug with narrow_to_row callback in subs modal.
We set the keep=false for the narrow_to_row callack so that it is deleted
once the subs modal is opened. Previously, this callback would cause issues
when you then tried to open the All Streams Settings as it would narrow to
the stream row.
2018-08-01 10:14:09 -07:00
Cynthia Lin 9efe907ef1 night_mode: Use nested selectors to change night mode element styling.
This is a SASS-exclusive feature that simplifies a majority of the night
mode selectors.
2018-07-31 17:41:27 -07:00
Cynthia Lin 0314d63e7a night_mode: Improve legacy searchbox styling to fit night mode. 2018-07-31 17:41:27 -07:00
Cynthia Lin ae48010158 night_mode: Improve pill searchbox styling to fit night mode. 2018-07-31 17:41:27 -07:00
Tim Abbott 0044866682 events: Fix starring logic correctly.
In 47aaa73f96, we fixed one issue, which
is that server_events_dispatch.js was calling `update_starred` with
the wrong arguments, but created a new one (toggle_starred wasn't
updated) and missed another (which is that we weren't ever updating
message.starred, and thus if you toggle a message's star-state in one
browser, and then tried to toggle it back in a second, it would feel
like the click didn't work, because it was trying to toggle
e.g. off->on a second time).
2018-07-31 17:38:24 -07:00
Cynthia Lin cdbb38096a night_mode: Fix broken background color for user profile. 2018-07-31 17:06:11 -07:00
Joshua Pan 47aaa73f96 events: Fix buggy update starred event.
Fixes #10111.
2018-07-31 14:47:36 -07:00
Akash Nimare cc6af84a08 portico: Redesign download button on apps page.
This PR updates the styling of download button so
that it matches with the other buttons on portico pages.

Partially fixes #10104.
2018-07-31 14:18:28 -07:00
Shubham Padia 3e6eb360c4 stream edit: Remove bottom margin from `sub_settings_title`. 2018-07-31 11:12:09 -07:00
Shubham Padia 7d6ee2e10a stream_edit: Display server error message when subscribing other users. 2018-07-31 11:12:09 -07:00
Tim Abbott d377ac5768 people: Fix blueslip errors for late-added users.
This was supposed to be suppressed when a reload is in progress,
however, the logic was accidentally checking that
reload.is_in_progress was a defined function, not whether a reload was
actually in progress.
2018-07-31 10:41:33 -07:00
Tim Abbott f71316edd0 presence: Suppress some unnecessary blueslip errors for presence.
There was previously a race condition where reload.is_in_progress was
set after `activity.js` sent the presence request to the server, but
before we process the response; in that race condition, we still
shouldn't send blueslip errors to the server.
2018-07-31 10:40:34 -07:00
Akash Nimare 57ed871800 pill: Fix broken width of input-pill.
This PR fixes a UI bug which was caused by removing
the width of pill-container.

This issue was only visible in night mode.
2018-07-31 09:45:12 -07:00
Roman Godov c0806917ec models: Rename Realm.restricted_to_domain field.
This renames Realm.restricted_to_domain field to
emails_restricted_to_domains, for greater clarity as to what it does
just from seeing the setting name, without having to look it up.

Fixes part of #10042.
2018-07-31 09:28:33 -07:00
Cynthia Lin 29442ffb93 zcommand: Add light/dark mode command aliases for day/night mode.
Fixes #10095.
2018-07-31 07:12:31 -04:00
Shubham Padia 28589c5563 search pills: Backspace should remove a search pill with typeahead open.
Fixes part of #10026.

Typeaheads stopped propogation of keydown and keyup events for any
key except tab and enter. If stopAdvance was true even tab and enter
were not allowed.

advanceKeyCodes option was added to typeahead which allowed to specify
key codes for which propogation of keydown and keyup events should not
stop. advanceKeyCodes does not respect the stopAdvance option.
As the backspace key code is added to advanceKeyCodes in search.js,
the backspace key deletes pill on pressing backspace if input is empty
or only consists of spaces.
2018-07-30 14:33:06 -07:00
Shubham Dhama 4186ebe56a settings_user: Don't render bot_owner_select for user list.
This optimize the case when the user-info-form modal is opened
in user-list by not rendering bot_owner_select handlebar.
This bug is before changing form to modal.
2018-07-30 13:48:36 -07:00
Shubham Dhama 8f115c8291 settings_user: Refactor `open-user-form` click handler. 2018-07-30 13:48:36 -07:00
Shubham Dhama 5506f74084 settings_user: Remove redundant verbose check of owner value. 2018-07-30 13:48:36 -07:00
Shubham Dhama e08daf9a00 settings_user: Add modal for user info and roles form.
Advantages of changing it to modal is that now it doesn't render
form for every row i.e. form is rendered only for row edit button
is clicked.
2018-07-30 13:48:36 -07:00
Shubham Dhama 2b738d02c3 org settings: Refactor modal "partials" to a seperate file. 2018-07-30 13:48:36 -07:00
Shubham Dhama 2bcd21aeca org settings: Use people.get_active_human_persons to get active humans. 2018-07-30 13:48:36 -07:00
Shubham Dhama 16357fc84a people: Add common function for getting active human users. 2018-07-30 13:48:36 -07:00
Aditya Bansal 5b5d8bb310 thumbnails: Rename data-original to data-src-fullsize. 2018-07-30 13:00:23 -07:00
Harshit Bansal 8aabce5a5f hotkeys: Use canonical name for reacting with `+` hotkey.
This is sort of a temporary fix to bring the state back to how it
was in commit: ef4337edcb. However,
long-term we will need to fix our local echo feature to do merging
of names just like we do on backend.
2018-07-30 12:18:33 -07:00
Steve Howell 6a4bacbd18 stream settings: Avoid redundant sorting step.
We don't need to get our original items in sorted
order, especially since we re-sort them using
a different comparison function.
2018-07-30 11:25:32 -07:00
Steve Howell 51edcb02c8 Streamline typeahead for stream links.
We don't need to get sorted streams in the "source"
function for typeahead, since we sort them later,
and we don't need to recalculate values.

This preserves the behavior that we include
unsubscribed streams in the typeahead, which is
probably intentional.
2018-07-30 11:25:32 -07:00
Steve Howell 5c4d44bf3d refactor: Extract subs.get_stream_id_buckets().
This pulls the essential bucketing/sorting logic out
of filter_table().

The diff isn't quite as clean as I'd like, but some
of the code that got added back to filter_table() can be
eliminated in the future.  Basically, all the stuff
related to hidden ids can just be zapped if we go
to an approach of just re-building the DOM cleanly
whenever our filters change.
2018-07-30 11:25:32 -07:00
Steve Howell 68dba4515d refactor: Use triage_stream() to filter streams.
We replace two calls to stream_matches_query() with
a single call to triage_stream(), which prevents us
from doing the same is-subscribed checks twice.
2018-07-30 11:25:32 -07:00
Steve Howell 95edf68fd0 Refactor stream_matches_query to early-exit.
For the non-subscribed case, checking flags is a quick
way to reject streams vs. the more expensive indexOf
checks.
2018-07-30 11:25:32 -07:00
Steve Howell 95d136ca5e Extract search_util.js module.
We probably should have done this a while ago, even
though these functions are pretty tiny.  The goal here
is to make it easier to have more consistent search
semantics.

Our first use case is subs.js.  In this case we
are able to decouple a bit of generic string
matching from the subs-specific code.
2018-07-30 11:25:32 -07:00
Steve Howell 064d0f3c89 Extract stream_data.sort_for_stream_settings().
We move some data code from subs.js to stream_data.js.

It's not clear we have been using the optimal sort for
dealing with locales, but this change preserves the
current behavior.  The only subtle change here is that
we look up subs using a Dict now instead of a plain
JS object.
2018-07-30 11:25:32 -07:00
Steve Howell 5641c77c94 refactor: Introduce other_stream_ids in filter_table().
We now build up three buckets of stream ids for slightly
more consistent code that will help in future refactorings.
2018-07-30 11:25:32 -07:00
Lyla Fischer ba791b7071 user docs: Remove add-a-link-preview since it is a server admin doc. 2018-07-29 20:32:46 -04:00
Lyla Fischer 9f80322a35 user docs: Update custom-linkification doc. 2018-07-29 20:32:46 -04:00
Lyla Fischer c6938a42d6 user docs: Update add-custom-emoji. 2018-07-29 20:32:46 -04:00
Tim Abbott aa8533a5f7 locale: Update transation data from transifex and repo. 2018-07-27 12:26:10 -07:00
Steve Howell 441a21fac8 Use jQuery objects in MessageListView._rows.
The values of this dictionary used to be raw DOM elements,
but get_row() wraps them again, so there's not a huge
reason to store them as raw DOM elements internally.  It
is slightly easier to reason about the code if everything
stays at the jQuery level.

To preserve the old behavior here, we have to do something
that is kind of ugly, but at least it's explicit now.  In
the old code, our cache was DOM elements, and if an id
wasn't in the cache, we would sneakily return $(undefined)
with this code in get_row():

    return $(this._rows[id]);

And it turns out that $(undefined) is basically just a
zero-element jQuery object.  A lot of our code depends
on this behavior and just works around the zero-element
objects as needed with checks like this:

    if (this.selected_row()).length === 0) {
        // don't try to get offset
    }

For now we just preserve this behavior.  We could eventually
be more strict here, or at least have aggressive warnings
on cache misses, but we'd need to retrofit code to be
able to call something like `has_rendered_selection()`
and/or deal with `undefined` as the return value for the case
where the selection hasn't been rendered.

Here is some example code that would cause tracebacks if
we just returned `undefined` for cache misses:

    rerender_preserving_scrolltop: function () {
        // old_offset is the number of pixels between the top of the
        // viewable window and the selected message
        var old_offset;
        var selected_row = this.selected_row();
        var selected_in_view = selected_row.length > 0;
        if (selected_in_view) {
            old_offset = selected_row.offset().top;
        }
        return this.rerender_with_target_scrolltop(selected_row,
            old_offset);
    },
2018-07-27 11:14:53 -07:00
Steve Howell 69b42a7440 refactor: Extract MessageListView._fix_single_row().
This function is more cohesive and always takes in
a jQuery object containing exactly one DOM element,
and it does all stuff at the jQuery level of
abstraction (no raw DOM).

It's a pretty simple extraction--removing the level
of indentation makes the diff a bit noisy.
2018-07-27 11:14:27 -07:00
Steve Howell 6b2c291b4e refactor: Extract MessageListView._put_row().
Saving row data in `_rows` is a very data-specific task,
unlike the rest of `_post_process`, plus extracting it
will help with unit testing.
2018-07-27 11:10:50 -07:00
Steve Howell 3d853f9bf4 refactor: Pass in jQuery objects to _post_process.
We shorten the name of the function and avoid having
all the callers call `.get()`.  Now we mostly stay
in jQuery "space", which avoids some confusion about
when we're dealing with raw DOM elements and which
will facilitate unit testing.
2018-07-27 11:10:49 -07:00
Shubham Padia 5bf6e55778 search pills: Fix visual bugs due to CSS refactoring of input pills.
Changed search pill padding, `.navbar-search` flex-wrap to match with
the CSS refactoring in 66df4e3e84.
The `height: 100%` changes to `.navbar-search` and `.input-append`
make up for the issue in which the pills overflowed in the mobile
view due to `.navbar-search` height being declared 40px explicitly
while the actual heiight in mobile view was shorter.
2018-07-27 10:54:09 -07:00
Yashashvi Dave 00f9772ccc stream list: Scroll to opened stream on zoom out from stream-more-topics.
Currently on zoom out from stream topics, scrollbar didn't scroll back
to opened stream. Because call to scroll-to-stream func isn't called
after all streams view is displayed. So wrong stream element is
passed to func.

Fix this by calling scroll-to-stream func after all-stream-list view
is displayed.
2018-07-27 09:09:53 -07:00
Cynthia Lin e9cf545ada scroll_util: Account for element padding in height calculations. 2018-07-27 09:09:52 -07:00
Cynthia Lin ee82f14d04 subs: Use scroll_util to move selected stream rows into view.
This eliminates a bunch of complex logic we previously used when
trying to make keyboard stream row navigation smoother.
2018-07-27 09:08:49 -07:00
Aditya Bansal 5190f4c51a stylesheets: Fix coding style to comply with stylistic rules. 2018-07-27 00:15:58 -07:00
Aditya Bansal 5bca93d147 hotspots.scss: Fix styling to conform to stylistic rules. 2018-07-27 00:15:58 -07:00