Commit Graph

9386 Commits

Author SHA1 Message Date
Tim Abbott 900aea88a4 panels: Restructure to actually make sense.
The original implementation of panels.js was just for notifications,
and ended up running a bunch of notifications-specific code, including
registration click handlers and some localstorage-related
notifications logic, every time a panel was supposed to be opened.

This refactoring makes the panels library make sense -- we now
initialize all click handlers in the initialize() method, and do the
notifications check in a single, coherent place scoped to notifications.
2020-03-26 12:49:55 -07:00
Tim Abbott 19b806d6c2 settings: Fix notification settings update notifications.
This fixes the "Saving..." widget being on the wrong line.

Thanks to Shubham Dhama for the fix.
2020-03-26 11:45:07 -07:00
Puneeth Chaganti ca6cf9aeeb
stream settings: Allow tabbing to the input to add new subscribers.
Commit 68335d9124 removed the ability to tab
into this field, since it was a hidden field. This field is no longer
hidden, and this commit restores the ability to tab into it.
2020-03-26 11:31:15 -07:00
Vaibhav Raj Singh ee9678a2bd stream settings: Fix issues with viewing/editing long stream names.
In continuation to #13250

CHANGES:
-the stream name edit button is now visible for long names too.
-ellipsis are removed when you click on edit name option.
-added border while editing name to give a text-box feel.

REASONS:
-added border while editing the name to give a textbox-esque feel.
-text overflow was changed from ellipsis to clip (while editing) as
ellipsis prevented editing the entire name (clip provides better
functionality).

The last two changes are reverted back to original (i.e. ellipsis and
no border) once you finish editing the stream name.

P.S.- clicking on anywhere else updates the new name perfectly
2020-03-25 17:56:32 -07:00
Pragati Agrawal dd13136371 settings: Migrate notification checkboxes to table format.
Here we have migrated checkboxes of all general notifications to the table.
By general notifications we mean, Mobile, Email, Desktop audio, and visual
notifications.

This is a part of a bigger migration to simply our notifications setting
changing infrastructure for all streams and individual streams. Later we
will add more row to this for different categories of notifications in
addition to the current ones ("Streams" and "PMs, mentions, alerts").

Fixes: #12182.
2020-03-25 17:45:59 -07:00
Steve Howell 1826bac1b1 default streams: Fix overly aggressive typeahead.
When you select a typeahead, it shouldn't
immediately do the action for you; you should
have to hit enter first.  Even though 99% of
the time you're gonna confirm the typeahead,
it's jarring when you don't expect it.

You can still add a bunch of default streams
quickly, using only the keyboard, because
we have always had support for the enter
key saving.  (and tab and enter also works)
2020-03-25 17:11:25 -07:00
Steve Howell 697b00dd6e default streams: Change remove api to use stream_id.
This is a full-stack change:

    - server
    - JS code
    - templates

It's all pretty simple--just use stream_id instead
of stream_name.

I am 99% sure we don't document this API nor use it
in mobile, so it should be a safe change.
2020-03-25 17:11:25 -07:00
Steve Howell 2cd9c77979 refactor: Stop using page_params.realm_default_streams.
We now only use `page_params.realm_default_streams` during
initialization, and then after that we use `stream_data`
APIs to get default stream ids and related info.  (And
for the event that replace the data, we just update our
internal data structures as well.)

Long term we should have the server just send us ids here,
since we are now hydrating info from stream data in all places.
2020-03-25 17:11:25 -07:00
Steve Howell ba495e57eb refactor: Simplify get_invite_stream_data().
This code is a bit simpler.

The previous code was concatenating two lists
and then removing duplicates by calling filter().

Now we just have two loops that append to a single
list, and the second loop detects duplicates
before inserting into the list.

We also now use `default_stream_ids` instead of
`page_params` data, which is convenient for two
reasons:

    - working with sets of ids is convenient
    - we don't need to maintain `page_params`
      data any more
2020-03-25 17:11:25 -07:00
Steve Howell 6313917143 stream_data: Remove invite_streams().
This function was made obsolete in
b4e2313cbc.

It was replaced by get_invite_stream_data(),
which has plenty of coverage.
2020-03-25 17:11:25 -07:00
Steve Howell 4610ef3169 refactor: Remove stream_data.get_default_status().
There was no reason to have this when it's more
robust to look up streams by id than name.
2020-03-25 17:11:25 -07:00
Steve Howell abc0c4d48c default streams: Make filters case-insensitive. 2020-03-25 17:11:25 -07:00
Steve Howell a81fd786f5 refactor: Use get_default_stream_ids() in settings.
We now use the up-to-date info from stream_data
to hydrate the default stream ids.  All we need
here in the template is `invite_only` and `name`.

Since we are no longer using data from `page_params`,
we can remove `maybe_update_realm_default_stream_name`.
(If you are wondering if we still get live updates,
we get that via a more upstream call to
update_default_streams_table in the event
dispatching codepath.)
2020-03-25 17:11:25 -07:00
Steve Howell 8d8226117c refactor: Extract get_default_stream_ids().
We only used get_default_stream_names() in a
test, so now it's being replaced with a function
that just gets ids.

We'll have use for get_default_streams_ids()
in an upcoming commit.
2020-03-25 17:11:25 -07:00
Steve Howell f8913dc321 default streams: Remove complicated remove logic.
Now if a default stream gets deleted, we just
redraw the table.  We always have a small number
of default streams, and the way that we were removing
rows without the actual consent of `list_render` was
really janky (and just a vestige of pre-list-render
code that never got fully ported).

This also makes us consistent with how we handle
added streams (i.e. just call
`update_default_streams_table`).

ASIDE:

Ideally we will update `list_render` at some point to
have an API for adding and removing elements.  It does
allow you now to call `data()` to reset its data, but
for now we just build a new `list_render` object every
time.
2020-03-25 17:11:25 -07:00
Abhishek-Balaji 0ec1710fec css: Reorder elements in `.rendered-markdown` in night_mode.scss.
Some styling elements associated with '.rendered-markdown' were
present separately. Reordering them so that they are together.
2020-03-25 15:10:34 -07:00
Abhishek-Balaji da818e16ed css: SCSS nesting for `.top-messages-logo` in night_mode.scss. 2020-03-25 15:10:34 -07:00
Abhishek-Balaji f2e6c5b317 css: SCSS nesting for `.hotspot.overlay` in night_mode.scss.. 2020-03-25 15:10:34 -07:00
Abhishek-Balaji b5dd58415e css: SCSS nesting in night_mode.scss for `.alert`. 2020-03-25 15:10:34 -07:00
Abhishek-Balaji 694035171d css: SCSS nesting for `.alert-box` in night_mode.scss. 2020-03-25 15:10:34 -07:00
Abhishek-Balaji e7b7a644ea css: SCSS nesting for `.rendered_markdown` in night_mode.scss. 2020-03-25 15:10:34 -07:00
Siddharth Varshney 05865b3eb3 css: Reorder css for `.help .sidebar h1` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney fe0bda565a css: Reorder `.help .app-main` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney fcb875421d css: Use SCSS nesting for `.app.help` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney a4fa2bd52d css: Use SCSS nesting in `.app.help .sidebar.show` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney 8c2fb3f8e1 css: Use SCSS nesting for `.app.help .markdown` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney 5157faa7f3 css: Reorder `.help .sidebar .content:not(.shown)` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney d25b71b405 css: Reorder `app.help .hamburger` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney ca8c6d023b css: Use SCSS nesting for `.api-center .code-section` in porticos.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney d7ada65967 css: Use SCSS nesting for `.navbar.footer .nav` in portico.scss. 2020-03-25 10:57:14 -07:00
Siddharth Varshney 630b43964a css: Reorder `html` below `body` in portico.scss. 2020-03-25 10:57:14 -07:00
Anders Kaseorg 77ce5841b9 info_overlay: Fix keyboard accessibility of keyboard shortcuts modal.
Commit 03393631bd (#14142) regressed the
keyboard accessibility of the keyboard shortcuts modal.  Fix it by
moving tabindex="0" to the scrolling element of the SimpleBar.

Fixes #14320.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-24 20:41:24 -07:00
Steve Howell 6d03b82dcb bot_data: Remove set_can_admin.
We stopped needing this with
0329b67048
(Dec 2016).

The function sets `bot.can_admin`,
which was only used in `bot_data.get_editable`.

We removed two tests (and then put back
some test setup that needed to leak down
to the last test).
2020-03-24 20:40:19 -07:00
Steve Howell 4a78b54c53 bot settings: Simplify code for bot owners. 2020-03-24 20:40:19 -07:00
Steve Howell 58b72a2194 refactor: Make bot owner hovers more robust.
This is code simplification motivated
by a recent bug that we fixed with some
server changes, but which was really
caused in some sense by our client code
using an overly finicky
condition to check falsiness.

For cross-realm bots, the value of
`user.bot_owner_id` may be `null`, or it
may simply be `undefined`, depending
on whether the server passes `None`
or simply omits the field.

We don't want out client code to be
coupled to that rather arbitrary
decision.

We were doing a `!== null` check instead
of checking for falsiness, which led to
blueslip errors in the past.  Because a
bot owner id could be plausibly 0, a falsiness
check would be brittle in a different way.

Now we avoid that ugliness by calling
`get_bot_owner_user`, which either returns
an object or `undefined`.

And then the caller can just do a concise
check for whether `bot_owner` exists.

And we also fix up the crufty code that
was putting `bot_owner_full_name` on to
the object instead of using a local.

We have a bug report for this again, although
it might be on an old branch.

Fixes #13621.
2020-03-24 20:40:19 -07:00
Steve Howell d916cbbb70 cosmetic: Remove ugly bot_data__* names. 2020-03-24 20:40:19 -07:00
Tim Abbott d9bb6d0081 compatibility: Add more strict desktop app blocking.
This allows us to block use of the desktop app with insecure versions
(we simply fail to load the Zulip webapp at all, instead rendering an
error page).

For now we block only versions that are known to be both insecure and
not auto-updating, but we can easily adjust these parameters in the
future.
2020-03-24 20:33:11 -07:00
Pragati Agrawal 6fb438277e settings_notifications: Use single `.on()` instead of multiple `.click()`.
By this change we don't need to loop over each input element to attach the
handler, instead, we can use single `.on()` which takes care of changes.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 0080499b08 settings_notifications: Use get_input_element_value for input values.
settings_org.get_input_element_value function returns values of input
elements in proper format based on their data-setting-widget-type.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 53294928c4 settings: Fix toggling push notification checkbox when disabled.
We know that by default the value of `enable_stream_push_notifications` is
true, so on some server if push notifications are disabled then due to
```
{{#unless show_push_notifications_tooltip}}
```
the `enable_stream_push_notifications` checkbox is rendered as unchecked
and when we update any other setting in the "Stream notifications" section,
due to `settings_notifications.update_page()` all checkboxes are changed to
current values which means above checkbox get checked.

We can deal with this bug either making changes in
`settings_notifications.update_page()` but we should show check/uncheck
state of checkboxes anyway so removing this `unless` condition fixes this
bug.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 83933034a4 settings: Simplify logic to show push notification tooltip in templates.
Instead of having logical expressions in templates, it's always preferred
to calculating them in javascript and pass the results as a context. It
also enhances the readability of templates and testing of such logic is
easier in js over templates.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 1871443d10 settings_notifications: Rename variable to all_notification_settings.
`all_notification_settings_labels` is misleading that this variable is a
list of notifications setting labels so changed it to
`all_notification_settings`.
2020-03-24 16:06:45 -07:00
Pragati Agrawal b8945bafb4 settings_org: Extract get_input_element_value function.
The reason for extracting this function is that getting the text, integer,
boolean value from the input elements (like checkboxes, dropdowns) is a
common task, and later we can use this function to get the input element
value in `settings_notifications` in the upcoming commit.
2020-03-24 16:06:45 -07:00
Ryan Rehman f439bd7c36 list_render: Reset Data for sorted tables.
This is a bug fix where, if a list_render
object with the given name exists and it's items
have been sorted, then the filtered_list's data
does not get updated on re-rendering.

This line was present in the original commit
9576d5caef.
2020-03-24 16:06:45 -07:00
Ryan Rehman 1c605366ed list_render: Remove requirement of filter in opts.
The use case for this are small or fixed tables, which do not need
filtering support. Thus we are able to not include the unnecessary
search input inside the html parent container.
It is not used at present, but will be required when we refactor
the settings pages.

We also split out exports.validate_filter function for
unit testing the above condition.
2020-03-24 16:06:45 -07:00
shubhamgupta2956 6ab1908214 settings: Reword setting name in settings menu.
Rewords "User list on left sidebar in narrow windows" in settings menu
to "Show user list on left sidebar in narrow windows".
2020-03-24 10:47:00 -07:00
Siddharth Varshney 328961a4fc settings: Reorganize options/sections in `Organization Permissions`.
As a consequence of too many options in the bottom `Other permissions`
subsection, the `Save` button could end up too far up from the bottom,
such that it might appear offscreen on low-height laptops.

We fix this by reorganizing the settings in a way that is both more
intuitive and also ensures that none of the subsections are too tall.

Fixes: #14274.
2020-03-24 10:36:40 -07:00
shubhamgupta2956 24603134f4 css: Use SCSS nesting for ".header-main".
Used SCSS nesting for ".header-main" in archive.scss.
2020-03-24 10:27:11 -07:00
Steve Howell 3e199ed559 reactions: Remove name from local_id.
Adding the emoji name, which can have multiple aliases,
to the `local_id` key seemed to needlessly complicate
the code here.
2020-03-23 17:30:18 -04:00
Steve Howell f59cca2dcd reactions: Rewrite code to use clean reactions.
Before this commit, the reactions code would
take the `message.reactions` structure from
the server and try to "collapse" all the reactions
for the same users into the same reactions,
but with each reaction having a list of user_ids.
It was a strangely denormalized structure that
was awkward to work with, and it made it really
hard to reason about whether the data was in
the original structure that the server sent or
the modified structure.

Now we use a cleaner, normalized Map to keep
each reaction (i.e. one per emoji), and we
write that to `message.clean_reactions`.

The `clean_reactions` structure is now the
authoritatize source for all reaction-related
operations.  As soon as you try to do anything
with reactions, we build the `clean_reactions`
data on the fly from the server data.

In particular, when we process events, we just
directly manipulate the `clean_reactions` data,
which is much easier to work with, since it's
a Map and doesn't duplicate any data.

This rewrite should avoid some obscure bugs.

I use `r` as shorthand for the clean reaction
structures, so as not to confuse it with
data from the server's message.reactions.

It also avoids some confusion where we use
`reaction` as a var name for the reaction
elements.
2020-03-23 17:30:18 -04:00
Tim Abbott f644f5fc2c css: Change emoji size within text to 20x20px.
We've often gotten the complaint that Zulip's emoji are a bit too big;
this should address the worst consequences of that (line-wrapping
being off with large emoji present) while still making it possible to
easily see what a given emoji is.

The right place to change this is in rendered_markdown.scss, not the
main emoji definition in zulip.scss, as the latter is also used in
places like the emoji picker where a larger size is valuable.

Closes #12731, an older PR that did this with slightly different
parameters (and without a comment).
2020-03-22 15:09:49 -07:00
Siddharth Varshney 5a1b27bf32 css: Merge `.help .sidebar h2` in portico.scss. 2020-03-22 12:48:51 -07:00
Siddharth Varshney 0c8b7161df css: Merge `.help .sidebar h1` in portico.scss. 2020-03-22 12:48:49 -07:00
SiddharthVarshney b9eda45c0b css: Merge `body` in portico.scss. 2020-03-22 12:47:53 -07:00
Siddharth Varshney 962684f189 ui: replace all mute icons from eye/eye-slash with bell/bell-slash.
eye/eye-slash icon is generally used for toggling hiding actions and we are using that same icon for mute action which can be a bit confusing
2020-03-22 12:31:48 -07:00
Steve Howell 9c027e76bb search/hash_util: Parse negated searches properly.
Fixes #14254

You can test this on dev:

    * do "-stream:Verona" in the search bar (the minus
      sign negates the search here)
    * reload the browser

You should see the same search (all streams besides Verona).
2020-03-22 11:29:02 -07:00
Steve Howell 778d457bf7 Avoid blueslip error for empty streams.
We simplify the code for deciding whether
we show a subscribe button or not, and in
doing so avoid a blueslip error where we
were passing `undefined` into `get_sub()`.
2020-03-22 11:29:02 -07:00
shubhamgupta2956 304b538b33 css: Reorder ".support-search-button". 2020-03-22 11:24:44 -07:00
shubhamgupta2956 9823226a49 css: Use SCSS nesting for ".table-striped". 2020-03-22 11:24:44 -07:00
Steve Howell f0c99b42ec Rename people.add_in_realm to people.add().
We had this API:

    people.add_in_realm = full-fledged user
    people.add = not necessarily in realm

Now the API is this:

    people.add = full-fledged user
    people._add_user = internal API for cross-realm bots
        and deactivated users

I think in most of our tests the distinction between
people.add() and people.add_in_realm() was just an
accident of history and didn't reflect any real intention.

And if I had to guess the intention in 99% of the cases,
folks probably thought they were just creating ordinary,
active users in the current realm.

In places where the distinction was obviously important
(because a test failed), I deactivated the user via
`people.deactivate`.

For the 'basics' test in the people test suite, I clean
up the test setup for Isaac.  Before this commit I was
adding him first as a non-realm user then as a full-fledged
user, but this was contrived and confusing, and we
didn't really need it for test coverage purposes.
2020-03-22 10:55:11 -07:00
Steve Howell 25d2e2e122 Rename get_realm_persons() to get_realm_users().
The function's name was misleading, since it includes
any bots in your realm.
2020-03-22 10:55:11 -07:00
Steve Howell 7ac5d0602b minor: Rename function to get_active_humans().
Saying `human_persons` is a bit redundant (although
kind of an artifact of our legacy use of `person`
when we really mean `user`.)
2020-03-22 10:55:11 -07:00
Steve Howell 26daeeb358 minor: Optimize get_active_human_persons().
This is used in a few settings panels.  We
optimize it by avoiding creating an intermediate
list of all users.
2020-03-22 10:55:11 -07:00
Steve Howell 156ff33d22 stream edit: Extract stream_data.potential_subscribers().
We want to move more logic to stream_data to facilitate
testing.

Both before and after this commit, we essentially build a
new list of users for typeahead, but now the new list
excludes subscribed users.  We can do even better than
this in a follow-up commit.
2020-03-22 10:55:11 -07:00
Steve Howell 7088d09094 presence/people: Use people.get_active_human_count().
Before this commit, presence used get_realm_count()
to determine whether a realm was "small" (and thus
should show all human users in the buddy list, even
humans that had not been active in a while).

The `get_realm_count` function--despite a very wrong,
misleading comment--was including bots in its count.

The new function truly counts only active humans
(and no bots).

Because we were overcounting users before this change,
we should technically adjust `BIG_REALM_COUNT` down
by some amount to reflect our original intention there
on the parameter.  I'm leaving it alone for now, though,
since we've improved the performance of the buddy list
over time, and it's probably fine if a few "big" realms
get re-classified as small realms (and show more users)
by virtue of this change.

(Also note that this cutoff value only affects the
"normal" view of the buddy list; both small realms
and large realms will show long-inactive users if you
do searches.)

Fixes #14215
2020-03-22 10:55:11 -07:00
YashRE42 254cc96420 navbar: Extract navbar border into outer div.
This is a prep commit for the new navbar, since the new navbar switches
between a search bar and stream descriptions, it's easier to have the
border defined in an outer div. Due to the way the changesets is
generated, this may seem like a large diff, however, the only change to
navbar.html is to add an opening div with the ".top-navbar-border" class
and a corrseponding closing div to wrap around "#search_box" and
"#search_box_legacy". Apart from this, a few styles have been edited in
zulip.scss and night_mode.scss.
2020-03-20 14:53:43 -07:00
shubhamgupta2956 338bd0e6e2 css: css: Use SCSS nesting for '.zoom-in' in left-sidebar.scss 2020-03-19 16:47:36 -07:00
shubhamgupta2956 7b38d4473c css: Use SCSS nesting for '#add-stream-link' in left-sidebar.scss 2020-03-19 16:47:35 -07:00
shubhamgupta2956 b08e0cf86e css: Use SCSS nesting for '#topics_header' in left-sidebar.scss 2020-03-19 16:47:34 -07:00
shubhamgupta2956 e81ff6bdee css: Use SCSS nesting for '.narrows_panel' in left-sidebar.scss 2020-03-19 16:47:32 -07:00
shubhamgupta2956 d99b0cf7f5 css: Use SCSS nesting for '.hashtag' in left-sidebar.scss 2020-03-19 16:47:28 -07:00
Anders Kaseorg 07bca27fbc styles: Exempt visibility from overlay show transition.
This fixes a failure to give focus to a newly shown overlay.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-19 11:23:40 -07:00
Anders Kaseorg 815418d0d7 portico: Typographical nitpicking.
Punctuate marketing headings with a period.  Fix a couple of
title-cased headings to sentense case.  Consistently use curly
apostrophes, curly quotation marks, and Unicode ellipses.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-17 16:53:46 -07:00
majordwarf 6da7b390e4 css: Reorder CSS rulesets above media queries. 2020-03-17 12:40:08 -07:00
majordwarf 69422dca9e css: Use SCSS nesting for `.forgot-password-container`. 2020-03-17 12:40:08 -07:00
majordwarf c034287da6 css: Use SCSS nesting in portico-signin.scss for `.split-view`. 2020-03-17 12:40:08 -07:00
majordwarf 87f8061a12 css: Use SCSS nesting for `.static.org-url`. 2020-03-17 12:40:08 -07:00
majordwarf 76999ccaa8 css: Use SCSS nesting for `#registration`. 2020-03-17 12:40:08 -07:00
majordwarf 17f29b3d25 css: Merge `.subdomain` in `portico-signin.scss`. 2020-03-17 12:40:08 -07:00
majordwarf bc1f075d25 css: Reorder `#registration`to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf eb3b5a626a css: Use SCSS nesting for `.split-view` and `.back-to-login`. 2020-03-17 12:40:08 -07:00
majordwarf 18c6cc9929 css: Use SCSS nesting for `.back-to-login-wrapper`. 2020-03-17 12:40:08 -07:00
majordwarf f881ceba3f css: Use SCSS nesting for `.login-social-button`. 2020-03-17 12:40:08 -07:00
majordwarf 62f367f2ff css: Merge `button` style for `.login-social-button`. 2020-03-17 12:40:08 -07:00
majordwarf 4956020f0b css: Use SCSS nesting for `.info-box`. 2020-03-17 12:40:08 -07:00
majordwarf 08edbcad86 css: Use SCSS nesting for `.split-view`. 2020-03-17 12:40:08 -07:00
majordwarf 2b6a618be5 css: Reorder `.split-view` to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 7067646764 css: Use SCSS nesting for `.portico-page`. 2020-03-17 12:40:08 -07:00
majordwarf 7f05f19c03 css: Reorder `.portico-page` to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 649399dba8 css: Use SCSS nesting for `#login_form`. 2020-03-17 12:40:08 -07:00
majordwarf a3b395ce94 css: Reorder `#login_form` to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 5eeef33117 css: Use SCSS nesting for `.register-account`. 2020-03-17 12:40:08 -07:00
majordwarf aeaaf601ea css: Use SCSS nesting for `.register-page-container`. 2020-03-17 12:40:08 -07:00
majordwarf 5dbd3499a9 css: Reorder `.register-page-container` to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf e24fe3b5a6 css: Use SCSS nesting for `.login-page-container`. 2020-03-17 12:40:08 -07:00
majordwarf 37983b0e41 css: Reorder `.login-page-container` to put next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 889aeffc83 css: Use SCSS nesting in portico-signin.scss for `.app-main`. 2020-03-17 12:40:08 -07:00
majordwarf 8a556fd2a7 css: Merge `.login-page-header` in portico-signin.scss. 2020-03-17 12:40:08 -07:00
majordwarf 39286fc1cd css: Reorder portico-signin.scss to put `.app-main` next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 868891e724 css: Use SCSS nesting in portico-signin.scss for `.register-form`. 2020-03-17 12:40:08 -07:00
majordwarf 65fbc2f612 css: Refactor and reorder `.register-form` child elements. 2020-03-17 12:40:08 -07:00
majordwarf 84d92b8e9a css: Refactor and nest `.forgot-password-container`. 2020-03-17 12:40:08 -07:00
majordwarf 9a29978b09 css: Use SCSS nesting in portico-signin.scss for `.account-creation`. 2020-03-17 12:40:08 -07:00
majordwarf b7f7f4ef05 css: Use SCSS nesting in portico-signin.scss for `.new-style`. 2020-03-17 12:40:08 -07:00
majordwarf f7f3148e44 css: Use SCSS nesting in portico-signin.scss for `.input-box`. 2020-03-17 12:40:08 -07:00
majordwarf a14846f259 css: Use SCSS nesting in portico-signin.scss for `.alert`. 2020-03-17 12:40:08 -07:00
majordwarf 3b5fa831ac css: Use SCSS nesting in portico-signin.scss for `button`. 2020-03-17 12:40:08 -07:00
majordwarf 8d92c7277c css: Merge `button` in portico-signin.scss. 2020-03-17 12:40:08 -07:00
majordwarf 1cfd309130 css: Reorder portico-signin.scss to put `.new-style` next to each other. 2020-03-17 12:40:08 -07:00
majordwarf 4b3890c7e2 css: Use SCSS nesting in portico-signin.scss for `.header`. 2020-03-17 12:40:06 -07:00
majordwarf 6709fccd49 css: Merge `.header` in portico-signin.scss. 2020-03-17 12:35:25 -07:00
majordwarf 1e579921b7 css: Remove empty CSS ruleset from portico-signin.scss. 2020-03-17 12:35:25 -07:00
YashRE42 96cd8d3677 filter: Cache value of can_mark_messages_read.
Given that can_mark_messages_read is called whenever the blue box
cursor stops on a message and that it is calculated purely on the
basis of sorted_term_types, it makes sense to cache the result.
2020-03-17 12:27:08 -07:00
YashRE42 4d972e1d10 filter: Cache/store sorted_term_types.
Given that the sorted term types depends only on the filter, it makes
sense to only build them once and cache the results.
2020-03-17 12:27:08 -07:00
Pranav 83ad56aa64 ui: Fix list_render sorting breaking after re-creation/update.
Previously, when list_render.create was called, if a list_render
object with the given name existed, it returned the existing
list_render object with the previous properties, without the property
to sort the lists added.  The root cause of the bug was that when we
added the sorting click handlers, we put them just in the constructor,
not in __set_events, the function we call from appropriate code paths
to add the other necessary click handlers.

Fix this by moving the code to add the sorting properties into
__set_events().

Fixes #14175.
2020-03-17 12:08:02 -07:00
Steve Howell 327831df1e hotkeys: Fix "n" key behavior in some narrows.
If you were in the "Starred messages" narrow and
your pointer was on a message with the stream/topic
of "social/lunch", we wouldn't move you to the unread
messages for that topic.

I fixed this by removing the code that looked at
the current message's topic.  Instead, we only look
at the active narrow to figure out the "next" topic
to go to.

Fixes #14120.
2020-03-17 05:41:47 -07:00
Anders Kaseorg a491c5a162 styles: Fix SimpleBar hover styling for simplebar@5.1.0.
Follow an upstream adjustment to the styling of the vertical
scrollbar (but not the horizontal scrollbar).

https://github.com/Grsmto/simplebar/issues/420

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-13 16:14:23 -07:00
majordwarf 68dcdcd28e todo_list: Add task description and index numbers.
The user can pass description along with the task name by splitting the input string with hyphen.

Eg: Task Title - Task Description
todo_list: Add index numbers to task.
2020-03-12 08:02:06 -04:00
majordwarf ba2f11f78c todo_list: Render task name in bold text. 2020-03-12 08:02:06 -04:00
Tim Abbott 68274cae74 apps: Fix broken desktop download links.
This was introduced by my failing to properly test the recent bundle
of changes to this logic.
2020-03-10 14:38:23 -07:00
BIraj 60385366f0 js: Cleanup debug.js example to use ES syntax. 2020-03-09 14:07:13 -07:00
sahil839 6a791e1939 subscriber list: Fix display of email addresses in subscribers list.
Original email address is shown to admin users in subscriber list when
email_address_visibilty is set to "Admins only" by passing delivery_email
at required places.  Email address are not shown to non-admin users when
visibility is set to "Admins only".

Tweaked by tabbott to fix a few bugs and dead code.

Fixes a part of #13541.
2020-03-08 12:42:08 -07:00
Tim Abbott d0927d38fc streams: Use user IDs in membership list to track subscribers.
User IDs are more robust than email addresses as they don't change
with time, and also don't have complications with
different email_address_visibility settings.
2020-03-08 12:37:48 -07:00
Divyanshu Agrawal 043b55b5af user status: Save status on enter keypress.
This is a common UX pattern for forms - a user would expect the
input to be submitted on hitting enter.

So, create a 'keypress' event listener on the input field for the
new status, which calls 'submit_new_status' on enter key press.
2020-03-06 17:13:50 -08:00
Wbert Adrian Castro Vera 40a6602b09 filters: Refactor filter_with_new_topic to expand its functionality.
This intent is that we'll be able to reuse this when editing streams
as well.

* Rename method: filter_with_new_topic to filter_with_new_param.
* Fix tests and method calls.
2020-03-06 17:10:26 -08:00
Tim Abbott 9230213bde settings: Add EMAIL_ADDRESS_VISIBILITY_NOBODY.
This extends our email address visibility settings to deny access to
user email addresses even to organization administrators.

At the moment, they can of course change the setting (which leaves an
audit trail), but in the future only organization owners will be able
to change that setting.

While we're at this, we rewrite the settings_data.js test to cover all
the cases in a more consistent way.

Fixes #14111.
2020-03-06 16:34:08 -08:00
Siddharth Varshney 2a3038797b portico: Update google play and app store badges.
This updates update the download android and ios app button on
/apps/android and /apps/ios routes respectively to use the official
badges provided by the google and apple.

We also clean up some of the JavaScript implementing the page.

Fixes #14061.
2020-03-06 12:12:02 -08:00
Divyanshu Agrawal 8b2b693231 settings page: Apply dark theme to 'code' elements in night mode.
The example regexes for linkifier settings are not themed according
to the user's dark theme setting.

Modify 'night_mode.scss' to render all 'code' elements with dark
theme.
2020-03-06 11:59:28 -08:00
Siddharth Varshney dcc92de205 protico: Fix alignment, appearance and link for Current plan button.
This, as a side effect, fixes a vertical alignment issue of the "Buy
standard" button for users who haven't selected a plan as well.

Fixes #14011.
2020-03-05 14:07:34 -08:00
majordwarf 9b0a5deb2b css: Use SCSS nesting in stats.scss for `.center-charts`. 2020-03-05 13:57:01 -08:00
majordwarf 7faaed680b css: Use SCSS nesting in stats.scss for `#id_messages_sent_over_time`. 2020-03-05 13:57:01 -08:00
majordwarf 930e8704c0 css: Use SCSS nesting in stats.scss for `.button`. 2020-03-05 13:57:01 -08:00
majordwarf f18f1e547c css: Use SCSS nesting in stats.scss for `.buttons`. 2020-03-05 13:57:01 -08:00
majordwarf 1ebb7c1c89 css: Use SCSS nesting in stats.scss for `.pie-chart`. 2020-03-05 13:57:01 -08:00
majordwarf 733cb116fc css: Use SCSS nesting in stats.scss for `.chart-container`. 2020-03-05 13:57:01 -08:00
majordwarf fdfcbfbaa6 css: Reorder stats.scss to put similar elements next to each other. 2020-03-05 13:57:01 -08:00
majordwarf da5651435e css: Remove redundant rules for `#users_hover_info` and `#hoverinfo`.
The copy of the styling for users_hover_info:

```
-#users_hover_info {
-    left: 25px;
-    top: -40px;
-}
```

Looks less good than the common one with #hoverinfo, so we remove it.
2020-03-05 13:57:01 -08:00
Divyanshu Agrawal c0e19ed905 settings page: Change cursor for date input to 'pointer'.
Currently, the cursor for the date input field in the settings page
is 'not-allowed' as it has the disabled attribute because we want
users to pick the date from the date picker. But this leads to
confusion whether the field is editable at all.

Change the cursor to 'pointer' to make it clear that the field has
a click action associated with it.
2020-03-05 11:10:42 -08:00
Tim Abbott 56591890b0
org settings: Fix bot owner profile display.
Clicking on the 'Owner' value for a row in the list of bots does
nothing, and causes a blueslip error.

This is because the map object in which we store the users have
integer keys, while we pass the owner id as string.

This is fixed by parsing the owner id to integer before passing it
on.

Fixes #14107.
2020-03-05 11:02:54 -08:00
majordwarf 5181ca9a66 css: Reorder stats.scss so `.pie-chart` are in same place. 2020-03-04 14:25:54 -08:00
majordwarf 4e8deb1e50 css: Reorder stats.scss so `.chart-container` are in same place. 2020-03-04 14:25:54 -08:00
Anders Kaseorg eee784312d stats: Fix Other calculation.
In commit 2248d4d9a4 (#13883) I
incorrectly migrated a loop.  Fixes #14052.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-02 17:45:44 -08:00
Steve Howell d1d0b415f1 i18n: Rename translations.js to i18n.js.
The file populates `windows.i18n`, so now
the file name matches our convention.

Note that the module really just initializes
`i18next` and then does this:

    window.i18n = i18next;

It doesn't really add any functionality to
third party library.
2020-02-29 12:19:51 -08:00
Steve Howell 1abd00eac2 i18n: Remove code to sweep local storage.
Before 2018, we used a feature of i18next where
we would cache translations in local storage
for up to two weeks:

    var cacheOptions = {
        // ...
        prefix: 'i18next:' + page_params.server_generation + ':',
        expirationTime: 2*7*24*60*60*1000,  // 2 weeks
    };

    i18next.init({
        /// ...
        cache: cacheOptions
    }

Because `server_generation` would change each time you
upgraded a server, a frequently upgraded server like
chat.zulip.org would cause its active users to start
to accumulate lots of obsolete key/value pairs in local
storage over the two weeks.

See #4443 for more details.

We eventually reduced the cache life to 2 days.  And then
on top of that, newer versions of the server would start
to clean up after themselves using this commit from
April 2017:

    e3f1d025ae

We then removed the caching option altogether a year
later in May 2018:

    cff40c557b

We kept around the code to remove all the old keys, though.
This was particularly important for users who may have
been hitting servers that did an upgrade to the new
version from some older version that didn't have the
key-fixing code.

But mostly the problem takes care of itself after
either two days or two weeks, even on really out-of-date
servers.

The original problem was most likely to affect server
admins that did a lot of upgrades (and possibly only really
affected chat.zulip.org), so as long as those server
admins continued their patterns, it's highly likely that
they've done several upgrades since May 2018 that would
have cleaned these keys out for good.

And, again, even if there is some strange straggler here,
they probably only have one set of keys that will expire
either two days or two weeks after an upgrade, depending
on how long ago the prior upgrade was.  (All of their
keys based on older versions of `server_generation` would
have long since expired.)

Finally, any upgrade certainly won't make the problem
worse for any users under this hypothetical situation,
since the new server won't be writing new keys.

So I am removing the cleanup code.
2020-02-29 12:19:51 -08:00
Steve Howell 979dcfe85b refactor: Extract settings_data.py.
This extracts a new module with three
functions, which we will test with 100%
line coverage:

    - show_email
    - email_for_user_settings
    - get_time_preferences

The first two break several dependencies
in the codebase on `settings_org.js`.  The
`get_time_preferences` breaks an annoying
dependency on `page_params` within people.

The module is pretty cohesive, in terms that
all three functions are just light wrappers
around `page_params` and/or `settings_config`.

Now all the modules that want to call show_email()
only have to require `settings_data`, instead of
having a dependency on the much heavier
`settings_org.js` module.

I also make some of the unit tests here be more
full-stack, where instead of stubbing show_email,
I basically just toggle `page_params.is_admin`.
2020-02-28 17:11:24 -08:00
Akash Nimare 97947bc381 desktop: Update desktop app to v4.0.3. 2020-02-28 12:04:18 -08:00
Tim Abbott d79a7a8c35 panels: Show a banner for users with legacy desktop apps.
Users who are using ZulipDesktop or haven't managed to auto-update to
ZulipElectron should be strongly encouraged to upgrade.

We'll likely want to move to something even stricter that blocks
loading the app at all, but this is a good start.
2020-02-28 01:54:46 -08:00
Tim Abbott 82fa72f08a emoji_picker: Improve logging for invalid emoji names.
This should help us properly investigate a bug likely involving users
clicking on emoji reactions whose name->codepoint mapping has changed.
2020-02-27 17:41:45 -08:00
Tim Abbott 9810327aad channel: Ignore error responses when reloading too. 2020-02-27 17:41:45 -08:00
Tim Abbott 9b8240c436 server_events: Only rerender stream settings if open.
This follows the convention of other code calling into
add_sub_to_table of checking whether the stream settings overlay is
open (and thus in the DOM) before trying to rerender it.
2020-02-27 17:41:44 -08:00