Commit Graph

6068 Commits

Author SHA1 Message Date
Max Nussenbaum 99b1dec92a portico: Align "Create Organization" button.
This aligns the Create Organization button on /new with the email
address input.
2018-05-08 09:26:25 -07:00
Max Nussenbaum 985e8e4a9a portico: Move open source image above text on mobile.
This moves the image that accompanies the open source section to
be above the text (instead of smushed to the side) on small
windows.
2018-05-07 14:41:37 -07:00
Max Nussenbaum 83b20488a7 portico: Fix subhead line break on mobile.
The line break in the homepage subhead looked weird on mobile.
The line now only breaks on display widths greater than 767px.
2018-05-07 14:39:20 -07:00
Max Nussenbaum 5f94c7dab5 portico: Adjust integration padding.
The integrations box on the landing page had some extra padding
at the bottom. This removes it so the spacing is more even.
2018-05-07 14:36:16 -07:00
Max Nussenbaum 992abdeccf portico: Adjust integration box spacing on mobile.
This gives the integration boxes on the homepage a little more
space on very small viewports (<450px).
2018-05-07 14:36:16 -07:00
Max Nussenbaum b7974a4923 portico: Improve spacing for app icons.
The app icons (web/mobile/desktop) got all squished together when
they broke to a new line in smaller windows. They now have better
spacing and all break at the same time.
2018-05-07 14:31:21 -07:00
Max Nussenbaum f05bd2fdad portico: Align CTA buttons on plans page.
This adjusts the spacing on the CTA buttons on the plan page
so that they are all vertically aligned.
2018-05-07 14:27:05 -07:00
Max Nussenbaum e31d7d2d83 portico: Fix white border around integration icon widgets on homepage
The integration widgets on the homepage had a weird-looking white
border. That border has now been updated to match the better-
looking border on the integrations page.
2018-05-07 14:18:06 -07:00
Yago González 6837fc5d56 i18n: Add missing strings for custom profile fields and fix capitalization.
The "Short/Long Text" option for custom profile fields wasn't properly
capitalized (i.e. "Text" should have been all lowercase), and also
wasn't properly tagged for translation.

For the sake of consistency, the change to proper capitalization has
also been applied to the models and any tests involving this feature.

Due to a bug in Django, it complained about the models having changed
and thus not being consistent with the migrations. That isn't actually
true (since the database stores the numeric values for each key), but
the migrations have been modified to avoid this error. This does not
affect the migrations' behaviour in any way.
2018-05-06 19:44:36 -07:00
Tim Abbott 063d11b139 js: Standardize indentation of switch/case statements.
This gets my current draft eslint indentation configuration passing
cleaning on static/js.
2018-05-06 19:35:18 -07:00
Tim Abbott d6db335f68 js: Reindent case clauses consistently. 2018-05-06 19:35:18 -07:00
Tim Abbott df98fd5cd9 hotkey: Make it possible to use ctrl+K from inside compose.
This works for other text boxes as well, but compose is the main one
that one would want to do a search from.

It's possible we'll find after doing this that "getting back into
compose" becomes a problem, but I guess we can handle that when the
time comes.
2018-05-06 19:30:31 -07:00
Aastha Gupta 66edc003ca hotkey: Make 'Ctrl' hotkeys work with 'CMD' on MacOS.
We only have a couple hotkeys with this model, but they should both
do the correct corresponding thing on MacOS.
2018-05-06 19:21:36 -07:00
Aastha Gupta 19806a0283 keyboard UI: Add Ctrl + k hotkey.
Fixes #8216
This commit binds the Ctrl + k to go to the search bar.
2018-05-06 19:19:00 -07:00
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Tim Abbott 4d0e64ee41 js: Fix some invalid whitespace.
These were detected using eslint.
2018-05-06 12:38:44 -07:00
Tim Abbott 384a8f2e9f custom fields: Clean up template logic for field ID.
This makes a few important cleanup changes:
* Using the more standard data-field-id name for the ID value.
* Using $(e.target).closest() rather than `.parent`, which is more
  robust to future changes in markup.
2018-05-05 15:40:16 -07:00
Yashashvi Dave 06e63af4b4 custom fields: Add UI for choice type custom fields. 2018-05-05 11:59:08 -07:00
Yashashvi Dave 512ab5dbaf js/settings_account.js: Remove hard-coded field no, clean template context. 2018-05-05 11:59:08 -07:00
Shubham Dhama 38630295ac upload/jquery-filedrop: Fix progress bar for paste upload. 2018-05-05 06:32:10 -07:00
Steve Howell 264dcb6f40 refactor: Extract MessageListData class.
Most of this was straightforward.

Most functions that were grabbed verbatim and whole from
the original class still have one-line wrappers.

Many functions are just-the-data versions of functions that
remain in MessageList:  see add, append, prepend, remove as
examples.  In a typical pattern the MessageList code becomes
super simple:

    prepend: function MessageList_prepend(messages) {
        var viewable_messages = this.data.prepend(messages);
        this.view.prepend(viewable_messages);
    },

Two large functions had some minor surgery:

    triage_messages =
            top half of add_messages +
            API to pass three lists back

    change_message_id =
            original version +
            two simple callbacks to list

For the function update_muting_and_rerender(), we continue
to early-exit if this.muting_enabled is false, and we copied
that same defensive check to the new function
named update_items_for_muting(), even though it's technically
hidden from that codepath by the caller.
2018-05-05 06:31:51 -07:00
Vishwesh Jainkuniya 3a514c7e41 stream-edit: Fix typo in comment. 2018-05-05 06:25:06 -07:00
Steve Howell 0463bb2c5e Fix corner case with recent narrowing optimization.
For a commit that was just merged I had the "back-out" case
at the wrong nesting level.  It was a pretty obscure failure
scenario that never came up in practice, but basically if you
were starting at a message that was not in your narrow, but
we did have some messages in your narrow, we would try to
go near the old message instead of talking to the server to
find the next unread message in that narrow.
2018-05-04 17:34:34 -07:00
Steve Howell 4573bdd005 narrow: Load messages locally for most sidebar clicks.
Barring a few minor edge cases, when we now do a narrow
that is based on a sidebar-like search (e.g. stream/topic,
no extra conditions), we now go directly to either the
first unread message we know about locally or the last
message if we're all caught up.

We of course used to do this in master until recently; this behavior
was broken by Tim's narrowing refactor branch (ending with
26ac1d237b) which moved us to always
using the select_first_unread flag, by default (fixing issues where if
you clicked around while your pointer was behind, you'd land in the
wrong place).

We now have arguably the best of both worlds:
* The pointer is not considered when computing narrowing positioning
* We only go to the server for sidebar clicks if the data isn't
  available in the browser.
2018-05-04 16:36:51 -07:00
Steve Howell da0c01e4ba Fix regression with topic edits clearing narrows.
We had a recent regression that had kind of a funny symptom.
If somebody else edited a topic while you were in a topic
narrow, even if wasn't your topic, then your narrow would
mysteriously go empty upon the event coming to you.

The root cause of this is that when topic names change,
we often want to rerender a lot of the world due to muting.
But we want to suppress the re-render for topic narrows that
don't support the internal data structures.

This commit restores a simple guard condition that got lost
in a recent refactoring:

        see 3f736c9b06

From tabbott: This is not the correct ultimate place to end up,
because if a topic-edit moves messages in or out of a topic, the new
behavior is wrong.  But the bug this fixes is a lot worse than that,
and no super local change would do the right thing here.
2018-05-04 16:33:23 -07:00
Tim Abbott 43fa0aacbf attachments: Implement frontend for real-time sync.
We now do real-time sync to update the attachments UI when new
attachments are uploaded/deleted.

While we're at it, we fix the UI for the delete option to not do a
weird local echo thing.

This completes the work of a couple issues.  There's still useful
performance work to do here (see the TODO), but it's a minor issue in
a rarely-used screen.

Fixes #6731.
Fixes #3710.
2018-05-04 16:22:27 -07:00
Tim Abbott 19737aab3e attachments: Store the attachments state in a global. 2018-05-04 16:22:27 -07:00
Tim Abbott 802636fbde attachments: Extract format_attachments_data. 2018-05-04 16:22:27 -07:00
Tim Abbott 62a92764f1 attachments: Move one-time-rendering logic out of set_up_attachments. 2018-05-04 16:22:27 -07:00
Tim Abbott 02ad498aa2 attachments: Use data-attachment-id to refer to attachments.
This may fix an issue with the delete button not actually sending the
right data to the server; I'm not sure.  Extracted from a patch by
Aastha Gupta.
2018-05-04 16:22:27 -07:00
Tim Abbott 956bd74905 attachments: Send events for attachment updates.
We send add events on upload, update events when sending a message
referencing it, and delete updates on removal.

This should make it possible to do real-time sync for the attachments
UI.

Based in part on work by Aastha Gupta.
2018-05-04 16:22:27 -07:00
Tim Abbott 69c4645bd2 attachments: Stop fetching attachments in / endpoint.
We only use this data in a rarely-used settings screen, and it can be
large after years of posting screenshots.

So optimize the performance of / by just loading these data when we
actually visit the page.

This saves about 300ms of runtime for loading the home view for my
user account on chat.zulip.org.
2018-05-04 16:22:26 -07:00
Steve Howell 0067ccb931 refactor: Add filtering helpers to message_list.js. 2018-05-04 10:59:56 -07:00
Steve Howell af24f51f0d Add MessageList.is_search().
This prevents MessageListView from having to know about
list.filter.
2018-05-04 10:59:56 -07:00
Armaan Ahluwalia cca10beb78 css/webpack: Moved archive styles to webpack bundle.
This commit moves the stylesheets under the archive bundle in
the Django pipeline to being compiled by webpack instead. It
also removes a remaining call to a portico stylesheet that no
longer exists.
2018-05-03 19:15:49 -07:00
Armaan Ahluwalia 54bf2a6231 css/webpack: Transition landing-page.css to webpack.
This commit transitions landing-page.css from the Django pipeline
to being compiled by webpack as landing-page.scss under the
'landing-page' and 'integration' bundles.
2018-05-03 19:15:23 -07:00
Lyla Fischer aee02e2695 user docs: Add styling for keyboard_tip admonition. 2018-05-03 18:33:35 -07:00
Steve Howell a68fa980d3 Add starred messages to our new API for unread ids.
Even though starred messages are never unread, it's useful
for us to have helper functions for them.

This change makes it so that clicking on "Starred Messages"
takes you to the last read message immediately, without a
server delay.
2018-05-03 14:36:34 -07:00
Steve Howell 3e19efca36 Change narrow.get_first_read_id -> get_first_read_info.
This function, which is only used in tests so far, needs
to return something more meaningful than undefined when
we don't find an id.
2018-05-03 12:44:30 -07:00
Steve Howell 4eb033964e Add fetch_status.has_found_newest(). 2018-05-03 12:44:30 -07:00
Tim Abbott 42fe331093 echo: Fix exception when topic-editing locally echoed messages.
Previously, if you topic-edited locally echoed messages, it would
throw this exception:

TypeError: Cannot read property 'indexOf' of undefined
    at Object.h.is_status_message (https://chat.zulip.org/static/min/app.274582375298.js:1742:154)
           = static/js/markdown.js line 125 column 13

    at Object.h.apply_markdown (https://chat.zulip.org/static/min/app.274582375298.js:1741:291)
           = static/js/markdown.js line 93 column 29

    at Object.a.edit_locally (https://chat.zulip.org/static/min/app.274582375298.js:1750:195)
           = static/js/echo.js line 176 column 5

    at Object.d.save (https://chat.zulip.org/static/min/app.274582375298.js:1921:376)
           = static/js/message_edit.js line 132 column 13

The behavior with this patch is still not ideal, in that we don't ever
send the edit to the server (if the issue was lag, not an actual error
on sending), but this at least makes the on-error case correct.
2018-05-03 12:14:43 -07:00
Shubham Dhama 9f78540bd0 org settings: Make save-discard widget look better.
This fixes some minor glitches with buttons:
* Movement of the organization-settings-parent block on the
  appearance of widgets.
* Large and odd look of save button.
* Use of fadeIn and fadeOut rather than changing opacity as
  opacity don't actually remove them.
2018-05-03 10:32:34 -07:00
Tim Abbott 0ada5fa9d8 stream_data: Fix exception when notifications_stream is private.
If notifications_stream is private and the current user has never been
subscribed, then we would throw an exception when trying to look up
notifications_stream.  In this situation, we should just treat it like
the stream doesn't exist for the purposes of this user.
2018-05-03 08:33:07 -07:00
Priyank Patel 1e1b72f6c8 webpack: Transition stats.css to use webpack.
The stats.scss file is added to activity bundle.
2018-05-03 08:08:23 -07:00
Priyank Patel c780bc33ba webpack: Transition activity.css to use webpack.
The activity.scss file is added to activity bundle.
2018-05-03 07:53:24 -07:00
Steve Howell c00a054893 minor: Update comment in narrow.activate(). 2018-05-03 07:52:15 -07:00
Steve Howell 93ce1fa95c refactor: Extract save_pre_narrow_offset_for_reload().
This is purely to make it easier to read narrow.activate()
without having to page past lots of unnecessary detail when
you're trying to understand things like how we set the
selection.
2018-05-03 07:52:15 -07:00
Steve Howell e0557046f3 refactor: Extract narrow.update_selection().
The maybe_select_closest helper, when first introduced, was
tiny and close to its callers.

As it's grown, it's become kind of a big hurdle to reading
narrow.activate(), because it's out of chronological order
and it's hard to tell at a glance which variables it's closing
on.

Now we just move it out to module scope.

It's mostly moving code, with these minor changes:

        * we pass in opts for the old closure vars
        * we rename then_select_offset -> select_offset
        * we early-exit on empty lists
2018-05-03 07:52:15 -07:00
Steve Howell d359c89b0c refactor: Introduce select_strategy in narrow.activate.
We replace these variables in narrow.activate:

        then_select_id (int w/-1 as a sentinel)
        select_first_unread (boolean)

The main goal here is to get away from the boolean, since
we are about to introduce a third select strategy.

The new var is select_strategy and it has a union
type with these flavors:

        "exact" (was select_first_unread === false)
        "first_unread" (was select_first_unread === true)

The new flavor will be something like "last_id".

Eliminating then_select_id is also nice, since the -1
sentinel value could be a pitfall, and it's semantically
cleaner to encapsulate behind a check for
select_strategy.flavor.
2018-05-03 07:52:15 -07:00
Steve Howell b046b158d9 refactor: Add a fetch_message IIFE in narrow.activate.
We use an IIFE (immediately invoked function expression)
to fetch messages.  This will allow us to introduce some
local vars in a subsequent commit without creating an ugly
diff and without cluttering an already crowded namespace.
2018-05-03 07:52:15 -07:00