Commit Graph

7093 Commits

Author SHA1 Message Date
onkar shedge ba7e78bc65 message_edit: Allow editing topics indefinitely.
Previously, Topic editing was offered in the UI even to message
senders and organizations admins only if the message was no more than
one day old.  This was correct for the "community topic editing" case,
but not for message senders and organization admins.

While we're at it, this also centralizes some previously haphazard
logic to always call message_edit.is_topic_editable().

Tweaked significantly by tabbott to fix the logic.

Closes #10568.
2018-12-04 17:41:21 -08:00
Tim Abbott c21247abf9 Revert "Position sidebars with top instead of margin-top."
This reverts commit c4620af2161283fe2cff0ba8f89789211d02bbdd.

This broke the positioning of the permissions request layer when that
appears.
2018-12-04 17:26:37 -08:00
Steve Howell 44ef8baff1 hashchange: Add hash_util.get_hash_category().
This replaces hashchange.get_main_hash(), which had
a slightly misleading name.  Also, moving this to
hash_util forces us to keep 100% coverage on it.
2018-12-04 17:16:40 -08:00
Steve Howell 67fba69b0c hashchange: Go to home page for bogus narrows.
This was the original intent of the code, and I think
it's the right behavior.
2018-12-04 17:16:38 -08:00
Steve Howell bcb142e68e hashchange: Move parse_narrow to hash_util.js.
The goal here was to enforce 100% coverage on
parse_narrow, but the code has an unreachable line
and is overly tolerant of bogus urls.  This will
be fixed in the next commit.
2018-12-04 17:16:32 -08:00
Steve Howell dac543891f hashchange: Move functions around in file.
This just puts similar functions near each other.
2018-12-04 17:16:29 -08:00
Steve Howell d9439e819e hashchange: Remove block comment.
This comment is less necessary now that we have docs
and have cleaned up the code a bit.
2018-12-04 16:13:18 -08:00
Anders Kaseorg 9ba860b4f2 Avoid double redirects to /login and then to /login/.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-12-04 16:12:58 -08:00
Tim Abbott d5f2eb3790 Revert "buddy list: Put "me" at the top of the list."
This reverts commit 1890c30ee1.
2018-12-04 16:08:18 -08:00
Rohitt Vashishtha ee3b4f3ee9 hotkeys: Map `CTRL + .` to narrow to compose box target.
Also adds relevant tests and documentation. We currently
do not narrow to a new topic, and instead just narrow to
the stream. Similarly, we do not narrow to a PM if any of
the recipients are invalid.
2018-12-04 13:58:00 -08:00
Tim Abbott 3079cf803c Revert "typeahead: Tab opens typeahead if not open with a non-empty input."
This reverts commit 0e2c509a24.
2018-12-04 13:58:00 -08:00
Tim Abbott 9ea4f50c1b Revert "search: Open typeahead on empty string only if lookup triggered by Tab."
This reverts commit b961093c14.
2018-12-04 13:58:00 -08:00
Roger Souza a0ca502f16 hello: Fix a header alignment issue when page is around 375px.
Fixes: #10771

This commit fixes the alignment of the header inside integration section
when page is around 375px of width.
2018-12-04 12:45:55 -08:00
Steve Howell 4af1061974 Remove unused expected_hash variable.
We stopped setting this nearly five years ago, as part
of bd9cccffce

The big conditional that I removed here should have
always evaluated to false, as I understand the code.
Presumably either the browsers handle # -> '' redirects
better now, or we address this somewhere else in our
codebase.
2018-12-04 12:24:39 -08:00
Steve Howell a9391e0499 keydown_util: Ignore alt-arrow and similar things.
We ignore keystrokes like alt-left-arrow and alt-right-arrow,
so that the browser can do back/forward.

We may need to refine the handling of ctrl/alt/shift in the
future, but now we only support single-key operations.
2018-12-04 12:24:39 -08:00
Steve Howell 7a2527aed1 hashchange: Call stop_auto_scrolling() directly. 2018-12-04 12:24:39 -08:00
Steve Howell 6bfcebe6da Update hashchange docs and tweak function names.
This is mostly doc updates, and we also rename
a couple functions to have more consistent naming.
2018-12-04 12:24:39 -08:00
Steve Howell 1804d6c9ce Make back button work for some Settings/Org changes.
This change removes all the complexity around
get_hash_group(), and we now only go into the
"same overlay" logic within Settings or within
Manage Organization, but not between them.

This means if you're in Settings but hit the back
button to something under "#organization" we now
do "more stuff", since we want to err on the side
of reloading sections, etc.

There's not much flicker in my testing, and
this is not a super common transition, anyway.
2018-12-04 12:24:39 -08:00
Abhinav Singh 979fae0406 portico: Add autofocus to the first input field with errors.
This code brings the focus to the first input field with errors rather
than just the first input field present in the form after the sign up
form is rendered again after invalid data is submitted.

Note from tabbott: This still doesn't handle the ToS checkbox being
the source of the error, but that's an independent issue.

Fixes #10869.
2018-12-04 12:22:09 -08:00
Abhinav Singh 586ce70b8b portico: Auto-detect field to focus for registration page.
This replaces the manually-curated logic for which field to focus.
2018-12-04 12:22:09 -08:00
varunvaruns9 4ff25d0366 org settings: Add lock icon next to uneditable tabs.
Add a lock icon to the right of tabs on which nothing is editable
for normal users. Add lock next to Custom emoji option if only admin
can edit them.

Tweaked by tabbott to use title for the lock icons, rather than
aria-hidden, since they do convey useful information.

Fixes: #10893.
2018-12-04 09:50:39 -08:00
Vishnu Ks 788b98d041 portico: Add page for redirecting to a realm subdomain. 2018-12-04 09:35:35 -08:00
Tim Abbott 815388b023 lint: Fix CSS linter rules not running.
Apparently, our CSS linter rules haven't been running since we
migrated to SCSS.
2018-12-04 09:35:34 -08:00
Tim Abbott e7c5bc0cee lint: Fix broken whitespace in landing-page.scss.
This is a classic race between linter expansions and an old PR.
2018-12-03 17:42:52 -08:00
Aditya Bansal 7d0d4b5eec integrations: Start to use flex box for positioning in dropdown.
Positioning using flexbox makes life much easier for everyone. With
this change we make positioning of icon relative to the label in the
dropdown menu much easier to do and alter if required. We now no
longer need to fiddle with tedious pixel measurements for placing the
icon in the right place.

As a result of this commit we had to change a click event binding
back to be associated with .dropdown-toggle class rather than being
associated with the h3, i because of the re-arrangement of the
dropdown configs.
2018-12-03 17:29:47 -08:00
Aditya Bansal 7db1dc2434 integrations: Fix cursor changing to a pointer at the wrong location.
Basically cursor used to change to a pointer hand (which indicates
something clickable) in area around the actual dropdown.
2018-12-03 17:28:58 -08:00
Aditya Bansal 5875eea1b5 integrations: Fix alignment of categories dropdown with the lozenges.
The integration categories dropdown was too wide in comparison to
the category lozenges and hence this commit attempts to smooth up
the UI a bit on that front.
2018-12-03 17:28:58 -08:00
Aditya Bansal 9a9dd158c4 integrations: Fix behaviour of angle icon associated with the dropdown.
Here we just fix the behaviour of angle icon which is present
in the integration categories dropdown. It used to change direction
from down to right only if "All" options from the dropdown was
selected (which is also the initial and default option). This behaviour
was pretty inconsistent and looked odd. Rather than having a direction
changing icon here, it migth be just better to stick with just the
down facing angle arrow. Arrow direction in general represents in
which direction the dropdown is gonna open up (in addition to the
fact that a dropdown exits here).
2018-12-03 17:21:17 -08:00
Aditya Bansal b32f54e775 integrations: Add animation to integrations dropdown.
We make the integration categories dropdown gradually slide down/up
rather than appearing instantenously. I believe this gives a better
look to the dropdown and how it behaves.

We also fiddle a bit with the code relating to angle icon in the
dropdown. Basically though its behaviour was already buggy and
will be addressed in an upcoming commit, we try to maintain whatever
behaviour it had before introduction of the annimation effect.
2018-12-03 17:21:17 -08:00
Aditya Bansal 11f896809f integrations: Fix issue with area from where dropdown can be toggled.
The issue here was that if we opened up integrations page in
responsive mode (so the integrations category sidebar turns into a
dropdown) and click a few centimeters outside the actual dropdown
or perhaps the dropdown menu when its open, it is possible to toggle
or select a integration category.
What this essentially means is that clicking in blank area outside
visible boundaries of dropdown menu its possible to interact with it.

Fix: We change elements on which the click event is tied to and
adjust a bit of CSS for relevant elements so things look as they
used to but function in correct or better manner.
2018-12-03 17:21:17 -08:00
Aditya Bansal 98cab354bd integrations: Fix buggy behaviour around categories dropdown.
What is the buggy behaviour?
Before this commit if you were to open the integrations docs page
in a smaller window so that the integrations categories sidebar
changed into a dropdown (so that our page is responsive to
screen size), one would notice that selecting a category from the
dropdown menu didn't make dropdown to auto collapse. This feels very
uncomfortable from users prespective since an ugly dropdown with all
the categories sticking around uncollapsed kind of defeats the purpose
of having a dropdown.

Fix: We make the categories dropdown toggle/auto collapse upon
selection of a category.
2018-12-03 17:21:17 -08:00
psg0796 90def916bc left-sidebar: Match line spacing of user list on left sidebar.
Vertically aligned presence indicator with names on left sidebar.

Fixes: #10554
2018-12-03 17:03:37 -08:00
Shubham Padia b961093c14 search: Open typeahead on empty string only if lookup triggered by Tab.
Fixes part of #10026.
Adds additional option to typeahead:
`tabOpensEmptyTypeahead`(default: false):
tabOpensEmptyTypeahead overrides helpOnEmptyStrings.
This commit sets helpOnEmptyStrings to false and
tabOpensEmptyTypeahead to true. Now typeahead will
open on an empty string only if Tab has been pressed.
2018-12-03 16:54:38 -08:00
Shubham Padia 0e2c509a24 typeahead: Tab opens typeahead if not open with a non-empty input.
Fixes part of #10026.
NOTE: The Tab key will select option from typeahead if the typeahead
is already open i.e the same behaviour as Enter.
NOTE: This behaviour applies irrespective of search pills are enabled
or not.
2018-12-03 16:54:38 -08:00
dipu989 524ef509fe user settings: Fix download zuliprc button styling. 2018-12-03 16:30:58 -08:00
Scott Lee e542ff0e62 css: Clean up spacing in the "your bots" cards.
These cards somehow ended up a bit malformed, with uneven spacing
between widgets and the icons hanging below the avatar.
2018-12-03 16:18:47 -08:00
Tim Abbott 333b8ef668 signup: Move registration JS to signup.js.
Also, fix a linter error encountered in the process.
2018-12-03 12:22:59 -08:00
Steve Howell 779ed37cfa hashchange: Fix update_browser_history() call for settings.
Even prior to my recent change in settings_panel_menu.js,
we were assigning window.location.hash a value that doesn't
have a '#' prefix.  This probably doesn't matter too much
for the browser, but it does confuse our own checks about
whether we're redundantly updating browser history.

Now we prefix the settings hash with '#' and we encorce
this convention with a blueslip error.
2018-12-03 10:09:35 -08:00
Steve Howell 05be16e051 hashchange: Remove is_exit_overlay code.
Just calling update_browser_history is sufficient
here, and we end up short-circuiting some code
in hashchanged():

    * we don't need to set state.old_hash, because
      that's what update_browser_history does
    * we bypass the is_overlay_check, which is always
      false in this context
2018-12-03 10:09:35 -08:00
Marco Burstein 307799113e right sidebar: Fix night-mode presence styling.
Fix the background color of night-mode presence indicators by setting
the background color to transparent instead of white when inactive.

Fix #10932.
2018-12-02 19:14:40 -08:00
Steve Howell c8cbf39a16 Avoid fake clicks when launching settings pages.
Fake clicks sometimes require more code, and they're
brittle to selectors changing, and it's harder to
debug.
2018-12-02 19:07:24 -08:00
Steve Howell c4d3578de3 Move more code into activate_section().
This code was added to the click handler, but it can
really go into activate_section().  This way the code
also runs when we first launch settings.
2018-12-02 19:07:24 -08:00
Steve Howell 473f2650fd refactor: Change settings_panel_menu.activate_section().
We now have activate_section take a section, rather than
an li, so it will be easier to call directly.
2018-12-02 19:07:24 -08:00
Steve Howell ec3f6434a6 subs: Remove complicated onlaunch triggers.
We can reliably just use hashchange.go_to_location()
when you click on "Stream Settings" in the left
sidebar popover.
2018-12-02 19:07:24 -08:00
Steve Howell 623e3f3c9f hashchange: Extract hash_util.stream_edit_uri. 2018-12-02 19:07:19 -08:00
Steve Howell bc18eb1d41 stream links: Use more standard API to go to location.
For stream links inside messages (like "#social") we
now use these functions:

    hashchange.go_to_location:

        We don't need to set href.  Relative paths
        are more standard, and the url is already
        encoded.

    hash_util.by_stream_uri:

        This saves a step in building the URL.
2018-12-02 19:07:19 -08:00
Steve Howell 846dfb2fe4 hashchange: Extract hashchange.go_to_location().
We use this API when we want the machinery
of the hashchanged system to come into play.
2018-12-02 19:07:15 -08:00
Steve Howell 636e54389b settings: Streamline code for navigating panels.
We call hashchanged.update_browser_history() when
we switch panels.  This API short circuits the
hashchanged callback and avoids code churn.

(We weren't actually double rendering, as the downstream
code does nothing at this point, so this is more
just preventig a pitfall and moving to a consistent
API.)
2018-12-02 19:07:15 -08:00
Steve Howell f930502312 stream settings: Streamline up/down arrow code.
We can eliminate export_hash() and just directly
call switch_to_stream_row().
2018-12-02 19:07:15 -08:00
Steve Howell b4d5c7e68a hashchange: Avoid double-rendering Subscribed/All tabs.
Before this commit, we would sometimes have
the toggler handle clicking or arrowing to
the All tab, but then also rewrite the hash
which caused us to re-process the event.

Now we only call update_browser_history()
in the callback handler from the toggle widget.

There's a bit of refactoring to make this happen,
but the call stacks end up being this:

    call toggler.goto(...)
        # callback is dispatched
            call subs.switch_stream_tab
                actually_filter_streams
                update_browser_history
2018-12-02 19:07:13 -08:00