Commit Graph

1864 Commits

Author SHA1 Message Date
Steve Howell 1a927a424f Avoid passing around full_name parameter in subs.js.
All of the eventual callers to prepend_subscribers()
and format_member_list_elem() call people.get_by_email()
anyway, so now we do it one place.  The one exception
was using page_params.fullname, which is awkwardly
different than what we call that variable elsewhere
(fullname vs. full_name).
2016-10-25 18:15:24 -07:00
Steve Howell 51f0f7c7c4 Simplify creating subscriber list.
We were awkwardly reversing a list to use a one-line
helper method that did exactly the opposite of what
we wanted. :)  Now we just append simply.
2016-10-25 18:15:24 -07:00
Steve Howell 89b17ec2a4 Extract prepend_subscriber().
This is a minor change to avoid some 2-line calls in our
code.  (We're about to introduce a third usage of this.)
2016-10-25 18:15:24 -07:00
Tim Abbott 14dc98d8b9 server_events: Switch to using REST-style URLs.
This eliminates our use of /json/get_events; we'll remove that
endpoint in a future commit.
2016-10-25 18:02:16 -07:00
Brock Whittaker fd9a3f4609 admin: Remove values from emoji form input on success.
This removes the values after successfully creating a new realm emoji.
2016-10-25 17:01:03 -07:00
Brock Whittaker bdd20f6b8b settings: Fix Zulip Labs Spacing Issue.
This fixes a spacing issue with Zulip Labs not having a space before
the icon.
2016-10-25 16:59:08 -07:00
Tim Abbott 7ebfa25f5a message_edit: Make .save() automatically call .end() if no changes.
Previously, all of the callers of message_edit.save() would check if
it returned true, and if so, call message_edit.end().  This resulted
in various bugs in the past, so we switch to the much cleaner model of
just calling .end() inside .save().
2016-10-25 16:34:57 -07:00
Tim Abbott 05a2e57b14 message_edit: Make enter save when editing topics.
Fixes #1272.
2016-10-25 16:34:57 -07:00
Tim Abbott ff575aed99 message_edit: Fix error handling if user has re-narrowed. 2016-10-25 16:34:57 -07:00
Tim Abbott 985b4072c0 message_edit: Show a success message briefly. 2016-10-25 16:34:56 -07:00
Rishi Gupta d14f276322 topic_edit_form: Rename message_edit_topic to inline_topic_edit.
message_edit_form.handlebars already has a message_edit_topic that
refers to the topic edit section of message editing, and this made
things very confusing.
2016-10-25 16:33:20 -07:00
Rishi Gupta 82a0fe0eca actions popover: Change "Topic Edit" to "View Source / Topic Edit".
Also edit the icon to show "View Source" as the primary feature.
2016-10-25 15:12:32 -07:00
Rishi Gupta 7c227d8bb2 message_edit: Set focus to cancel button in topic-edit-only case.
Because the user was most likely intending to use the "View Source"
functionality, this makes exiting more convenient.
2016-10-25 15:11:39 -07:00
reyha d96d4e30ab Stream settings: sets zero margin for 'Streams Deletion' table.
This removes the extra space at the bottom of the 'Stream Deletion'
table, by setting the margin for the table to '0px'.

Fixes #2077.
2016-10-25 15:08:47 -07:00
Brock Whittaker 82b5ef34be lightbox: Close lightbox if use clicks anywhere on the background. 2016-10-25 14:51:55 -07:00
Brock Whittaker 2ce601ebd1 Fix Multiple Lightbox Issues.
This fixes the following issues:
1. Photos are no longer resized larger than their native resolution.
2. Photos with transparency now have a checkerboard behind them to
signal an alpha of less than one.
2016-10-25 14:51:35 -07:00
Brock Whittaker bb23d6ed60 lightbox: Fix focus state when exiting lightbox.
Previously, exiting the lightbox and then hitting enter reopened the
lightbox with a null image.

Fixes #1982.
2016-10-25 14:48:34 -07:00
Tim Abbott 0f7c8c6d34 subs: Rerender subscriber counts from peer changes correctly.
This makes subscriber count management completely nice and real-time.
2016-10-25 14:40:24 -07:00
Steve Howell de727245aa subs: Add subscriber counts to the /#subscriptions page.
This borrows some work from krtkmj in #525.

Fixes #483.
2016-10-25 14:40:00 -07:00
Steve Howell 029682ec41 Fix stream_data.remove_subscriber().
We get events to delete subscribers for streams we are not
necessarily subscribed to, and it is now important to
process those events to produce the correct UI for showing
the number of subscribers to streams.
2016-10-25 14:29:27 -07:00
Tomasz Kolek 4790316b57 Add user setting option to always send push notifications.
Add option in user's settings for getting mobile push notifications
even if a Zulip browser is online.  Default is False.

Fixes: #1596.
2016-10-25 10:52:29 -07:00
Rishi Gupta b6da450b96 admin.js: Use RealmAlias instead of Realm to show the restricted domains.
Passes the allowed domains for a realm to the frontend, via
page_params.domains. Groundwork for allowing users to add and
remove domains via the admin setting page, rather than via the
realm_alias.py management command.
2016-10-25 10:07:20 -07:00
Tim Abbott 28cefc4996 hashchange: Fix buggy arguments to hashchanged causing scrolltop bug.
Because jQuery passes the actual hashchange event to an onhashchange
handler, the `if reload` checks in the `hashchanged` function were
always returning true, resulting in the wrong logic being used for
computing where to send the user in the event that they edited the
hash in the browser to change their narrow.
2016-10-23 20:07:12 -07:00
Rishi Gupta 49b23ea84a frontend: Allow users to see the source of messages they can't edit.
Previously we showed an "Edit" item in the actions popover menu when a user
could edit the content or topic of a message, and nothing otherwise. We now
show "Edit", "Edit Topic", or "View Source" in the popover menu for every
message, depending on the editability of the message, and present an
appropriate version of message_edit_form when the menu item is clicked.

Finishes #1604 and #1761.
2016-10-22 18:53:59 -07:00
Rishi Gupta 879f2a1e2e message editing: Refactor editability computation to use editability_types.
We compute the editability of messages in several places around the
frontend; standardize the definitions and store in
message_edit.get_editability. This commit should not change app behavior.
2016-10-22 18:52:49 -07:00
Rishi Gupta c2c389e949 message_edit.js: Refactor edit_message.
Cleanup and re-organize edit_message in preparation for the view source
changes. There are no behavior or logic changes in this commit.
2016-10-22 18:52:49 -07:00
Tim Abbott bd416c0425 message_edit: Cleanup unnecessary 2-layer nesting. 2016-10-22 18:52:49 -07:00
Tim Abbott 5b3caa4d18 message_edit: Fix tooltip with multiple messages being edited.
This fixes an issue where if there were multiple messages being
edited, all of them would have the same tooltip content.
2016-10-22 18:52:49 -07:00
Tim Abbott 5b656db303 message_edit: Clean up tooltip creation code.
This contains no functional changes.
2016-10-22 18:52:49 -07:00
Tim Abbott 0ccf8b162e message_edit: Move topic-editing-only warning.
This makes no functional change, because
`page_params.realm_message_content_edit_limit_seconds === 0` means
can_edit_content is always true.
2016-10-22 18:52:49 -07:00
Tim Abbott d5c3ad8eb5 message_edit: Only initialize composebox_typeahead if needed. 2016-10-22 18:52:49 -07:00
Tim Abbott 76d49300b3 message_edit: Move original_topic variable to a better spot. 2016-10-22 18:52:49 -07:00
Tim Abbott 0acfcbe247 message_edit: Update currently_editing_messages in clearer place. 2016-10-22 18:52:49 -07:00
Tim Abbott d2501396cf message_edit: Reindent form definition. 2016-10-22 18:52:45 -07:00
Tim Abbott 2b58fa0a19 message_edit: Move some setup code closer to where it's used.
This has no functional changes.
2016-10-22 18:40:44 -07:00
Rishi Gupta ebc8bfa6ca javascript: Change all message.is_stream to (message.type === "stream").
We need message.is_stream for some handlebars template code, but
message.is_stream should be thought of as a private variable for that
template.
2016-10-22 18:11:08 -07:00
Amy Liu 3ee777a11a Add UI for deactivating your own Zulip account.
Fixes #1009.
2016-10-20 22:29:30 -07:00
sonali0901 1bc7990327 Extract people.filter_people_by_search_terms()
This code used to be in subs.js, but now it's in people.js and has
some unit tests.

I did this w/showell as part of live coding on Zulip.
2016-10-20 21:44:26 -07:00
hackerkid bca1953aa4 Add support for !gravatar syntax in echo.js. 2016-10-20 14:40:45 -07:00
hackerkid 95b5ac1d5d Add support for !avatar syntax in echo.js. 2016-10-20 14:40:33 -07:00
Brock Whittaker e463577f30 Fix language alert to display language name.
If you chose the same language as was already selected, the alert would
say “is now the default language!” where it omits the language name.

This is the fix so that the language name appears all the time.
2016-10-19 15:17:16 -07:00
Steve Howell 4073ae09a1 streams: Use page_params.neversubbed_info client-side. 2016-10-18 17:33:58 -07:00
Brock Whittaker 10f7146ddd Change Lightbox to Support YouTube Videos.
The lightbox will now distinguish between whether or not something is a
photo and a YouTube video by the class name of the message inline
preview. It embeds the YouTube video in the lightbox as an iFrame
rather than previewing the video screenshot.
2016-10-18 14:45:47 -07:00
Christie Koehler 2595b32165 Update with proper LF line-endings. 2016-10-17 20:19:55 -07:00
Steve Howell 7fd74c45d7 Clean up startup code for streams.
The startup code in subs.js used to intermingle data
stuff and UI stuff in a loop inside a called function,
which made the code hard to reason about.

Now there is a clear separation of concerns, with these methods
being called in succession:

    stream_data.initialize_from_page_params();
    stream_list.create_initial_sidebar_rows();

The first method was mostly extracted from subs.js, but I simplified
some things, like not needing to make a copy of the hashes
we were passed in, plus I now garbage collect email_dict.  Also,
the code path that initialize_from_page_params() mostly replaces
used to call create_sub(), which fired a trigger, but now it
just does data stuff.

Once the data structure is built up, it's a very simple matter
to build the initial sidebar rows, and that's what the second
method does.
2016-10-17 19:58:23 -07:00
Steve Howell d26942e72d Extract stream_list.create_sidebar_row().
This replaces add_stream_to_sidebar(), which was kind of a misleading
name, and it also adds a couple lines of code that were always
called right after calling add_stream_to_sidebar().
2016-10-17 19:58:23 -07:00
Steve Howell 869a124d7d Extract stream_data.get_streams_for_settings_page().
This function will make it easier to unit test upcoming
changes related to stream counts.

This was mostly moving code, but one change is that we
don't call create_subs() in subs.js any more (which would
have been kind of circular dependency), since the only thing
that it did besides calling a more appropriate function
in stream_data.js was to generate a trigger that was
subsequently ignored and possibly a UI trap, as we don't
want to be messing with the stream sidebar when we go into
the stream settings page.

We now simply call exports.create_sub_from_server_data() for
newly encountered unsubscribed streams (which don't belong in
the sidebar anyway.)
2016-10-17 19:58:23 -07:00
Steve Howell 965c6047db Move add_admin_options() to stream_data.js.
This function used to live in subs.js.  It's mostly a code move,
but I simplified the logic to determine whether it's subscribed
not to do a lookup into the same data structure that the sub
already came from.

I also added some tests.
2016-10-17 19:58:23 -07:00
Steve Howell cf08f04dbc Move receives_*_notifications() to stream_data.js.
This moves these functions from subs.js to stream_data.js:

    receives_desktop_notifications
    receives_audible_notifications

This makes notifications.js no longer dependent on the
bloated subs.js.
2016-10-17 19:58:23 -07:00
Steve Howell e25b67af26 Remove subs.sub_pinned_or_unpinned(). 2016-10-17 19:58:23 -07:00