Commit Graph

1895 Commits

Author SHA1 Message Date
Tim Abbott a90532e074 admin: Clean up Zulip labs changing reloading browser. 2016-12-21 14:21:06 -08:00
Sampriti Panda 425a55e568 settings: Implement delete avatar functionality 2016-12-21 13:35:22 -08:00
Sampriti Panda e72cd0b1cc urls: convert set_avatar from legacy URL to REST endpoint 2016-12-21 13:35:22 -08:00
Tim Abbott e538d7ef03 admin: Fix waiting period status UI not hiding. 2016-12-21 13:19:40 -08:00
Rafid Aslam bfe84a10f0 API: Migrate POST `json/fetch_raw_message` to GET `json/messages/<id>` 2016-12-21 13:08:40 -08:00
Tommy Ip 400c8c1f65 Prioritize stream subscribers in typeahead list.
When autocompleting names using @mention, subscribers of the stream
would appear at the top of the list. Added new test module to reflect
this change.
2016-12-21 12:59:43 -08:00
Sanskar Modi e6beaa2711 Improve @all warnings user interface significantly.
* Doesn't pop up the warning until you actually try to send the message
* Eliminates the red warning.
* Changes confirm text to "Yes, send".
* Adds a stream size threshhold of 15 people; smaller streams don't
  prompt about this.

Fixes #2257.
2016-12-21 11:40:47 -08:00
Shubham Singh bade6f496b Fix autocompleting stream names inside message editing.
Fixes #2577.
2016-12-21 11:09:42 -08:00
KingxBanana 23f3271551 Clear popovers on stream narrows fix (Issue #2281) 2016-12-19 21:05:18 -08:00
Akhil 06615bee00 streams: Implement copy-subscribers feature.
In the new stream creation modal, added checkboxes for each stream
and a toggle to see or hide the checkboxes. Altered filtering to
filter streams and users. Added corresponding casper tests.

When a stream is checked/unchecked, it does not affect the state
of any user checkbox. This may be visually unclear as users can be
added even if their checkboxes are empty.

Fixes #2448
2016-12-17 11:20:47 -08:00
paxapy 28bd9d035c click_handlers.js: Handle clicks on stream links using data-stream-id.
This causes Zulip to correctly handle clicks on announcements for
renamed streams.

The stream name that the user typed will still be displayed, which
isn't ideal, but is probably the best we can do without more invasive
rerendering of old messages.

Fixes #426.
2016-12-15 22:48:19 -08:00
Tim Abbott 7cd3a5873d admin: Remove unnecessary set_up_deactivate_user_modal. 2016-12-15 18:18:26 -08:00
Brock Whittaker d20e643c59 admin: Fix Deactivate/Reactivate User Buttons.
This fixes the behavior to be consistent and remove the “Working…” bug.
2016-12-15 18:17:07 -08:00
Steve Howell 47a655a3cc Extract people.extract_people_from_message() and fix bug.
This commit extracts people.extract_people_from_message()
from message_store.add_message_metadata(), and now
add_message_metadata() extract people before it calls
process_message_for_recent_private_messages(), which
fixes a bug where we are trying to look up an email
for a deactivated user who was in the message but not
in the pre-loaded list of people.

Fixes #2701
2016-12-15 17:44:58 -08:00
Steve Howell b46d7654f8 Change people.remove() to people.deactivate() and fix bug.
This commit changes people.remove() to be people.deactivate(),
and it fixes a bug where deactivating users was causing tracebacks
in the PM list if somebody had PM'ed the deactivated user
recently.
2016-12-15 17:44:58 -08:00
Steve Howell b2bb2f8ea0 Extract people.init() function.
We need this for node tests, so that you don't have to explicitly
remove every user between tests.  (Also, people.remove() is about
to have different semantics.)
2016-12-15 17:44:58 -08:00
vaibhav 75bf501553 Add optional waiting period for users to create streams.
This adds support for only allowing normal users with account age
equal or greater than a "waiting period" threshold to create streams;
this is useful for open organizations that want new members to
understand the community before creating streams.

If create_stream_by_admins_only setting is set to True, only admin users
were able to create streams. Now normal users with account age greater
or equal than waiting period threshold can also create streams.

Account age is defined as number of days passed since the user had
created his account.

Fixes: #2308.

Tweaked by tabbott to clean up the actual can_create_streams logic and
the tests.
2016-12-15 16:54:30 -08:00
Tim Abbott f0f4be4af7 lint: Fix remaining no-unused-vars eslint rule violations. 2016-12-14 22:36:47 -08:00
Tim Abbott fe2d38392f subs: Restore debouncing of stream filtering.
This appears to have been accidentally removed in the redesign.
2016-12-14 22:36:47 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
Brock Whittaker 80ad28bab5 Don't repeat date header if message date is same as previous.
This primarily works to make sure that new queued messages don’t end up
with redundant date headers on them.
2016-12-14 20:41:33 -08:00
Tommy Ip 0329b67048 admin: Limit bots in settings page.
Updated `get_editable()` so that organization admins only see their
own bots in their personal settings page; this removes a lot of
unnecessary clutter.

Fixes #2657.
2016-12-14 19:29:02 -08:00
Tommy Ip fa4050d62d Improve error handling in is_current_user().
Realm bots have a owner of `null` but that is not explicity handled
in `is_current_user()`.
2016-12-14 19:27:43 -08:00
Steve Howell 546cc27f0d minor: Add code comment re:unread counts. 2016-12-14 19:10:55 -08:00
Steve Howell 5444486acb Have unread_topic_counter.get_counts() return a result.
Before this change, we passed in a hash to get_counts() to
mutate, but now we make the caller responsible for splicing
results into a bigger data structure.

The function now involves no mutation.
2016-12-14 19:10:55 -08:00
Steve Howell b11fbf0b4b Consolidate stream/topic logic for unread messages.
This change introduces an unread_topic_counter object
that manages unread counts for streams and topics.  Consolidating
all the logic into a single class will set us up to add
logic for dealing with topic counts that includes provisional
counts of unread messages from the server.  It also makes
the current code a little easier to reason about.

Most of this change was simply extracting functions, but
I also removed a few unnecessary and inconsistent calls to
`stream_data.canonicalized_name` that preceded our use of
Dict with a fold_case argument.
2016-12-14 19:10:55 -08:00
Brock Whittaker c25694a9d9 Do not reload page on form submission in settings page.
Currently under Zulip Labs and Notifications, saving changes reloads
the page. This shouldn’t happen.

Fixes #2697.
2016-12-14 16:32:32 -08:00
Brock Whittaker 6ed7ba8935 Blur all links after clicking.
The links don’t have to stay focused and produce unintended side
effects.
2016-12-14 15:37:43 -08:00
Brock Whittaker 660144a79d Blur the active element on settings/streams modal exit.
This blurs any focused element so that you can’t accidentally enter
into anything on a hidden modal.
2016-12-14 15:37:43 -08:00
Brock Whittaker a460fcddef Add Date Headers to Floating Bar and Message Headers.
This adds the date of a block of messages to the floating recipient
bar along with message headers of blocks that are the first of a
particular day.
2016-12-13 20:36:39 -08:00
Bojidar Marinov 8b44ace3a8 frontend: Make global notifications live-update on changes.
Fixes #2527
2016-12-13 20:22:13 -08:00
Brock Whittaker 65288848b1 Fix Hiding Stream Creation Prompt on "Enter".
The stream creation prompt would be hidden if someone clicked “Enter”
and the form failed. This is presumably due to some bootstrap magic.
2016-12-13 13:16:51 -08:00
Bickio 868f343980 Do not open compose box if user sidebar search is empty.
Fixes #2357.
2016-12-13 11:04:08 -08:00
Brock Whittaker 1886f0a015 redesign: Convert subscriptions page to overlay.
This is a major change to the /#subscriptions page, converting it to
by a side-by-side list of streams and their settings in an overlay.
There are no new features added/removed, but it's a huge changeset,
because it replaces the old navigation logic and moves the stream
creation modal to appear in the right side of this overlay.
2016-12-09 11:08:08 -08:00
Igor Tokarev 0bac986f26 Fixed compose box PM recipient typeahead handling of focus.
This closes #2315.
2016-12-07 22:13:47 -08:00
Tommy Ip fe4a0e72fc Add new button to download ~/.zuliprc from settings page.
Added new option to download .zuliprc file directly from settings
page.  This should help reduce friction when setting up new
bots/integrations. This new feature is available in the bot cards and
the 'show your API key' section. One caveat is that the filename is
automatically set to 'zuliprc' instead of '.zuliprc', since as most
browsers do not allow filenames to start with a dot.

Fixes #2327.
2016-12-07 21:28:41 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
Yago González e65c42cb5f eslint: Turn on errors for new-cap rule.
Now the eslint rule "new-cap" is set as: ["error", { "newIsCap": true, "capIsNew": false }]
2016-12-07 05:33:16 -08:00
Rafid Aslam ce94fb2eb1 deps: Change zxcvbn download method from download-zxcvbn to npm.
- Replace download-zxcvbn with downloading it from npm.
- Change zxcvbn.js path to node_modules (because npm put it to
`node_modules` directory.
- Bump `PROVISION_VERSION` in `version.py` to 2.4.

Fixes #2423.
2016-12-06 17:54:56 -08:00
Rafid Aslam 0951b838ca deps: Update zxcvbn to 4.4.1
Update zxcvbn to 4.4.1, and change `crack_time` to
`crack_times_seconds` because `crack_time` has been changed to
`crack_times_seconds` in 4.4.1.
2016-12-06 17:51:33 -08:00
Zac Pullar-Strecker e6e11aefb3 settings: Add option to disable websockets.
This can be useful in scenarios where the network doesn't support
websockets.  We don't include it in prod_settings_template.py since
it's a very rare setting to need.

Fixes #1528.
2016-12-05 21:55:22 -08:00
K.Kanakhin 7bf10ec74f update-sockjs: Update sockjs from version 0.3.4 to 1.1.1.
- Add browserify to npm dependencies.
- Add SockJS-client to npm dependencies.
- Add npm postinstall script to generate browser version of SockJS-client
  from npm package.
- Change deprecated SockJS object property 'protocol_whitelist' to
  'transports'.
- Fix settings.
2016-12-05 21:36:10 -08:00
lonerz abde152d9c eslint: change array-callback-return from warning to error. 2016-12-05 21:21:19 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
lonerz a8b39e6c0f Switch yoda eslint rule from warning to error (in .eslintrc) 2016-12-04 19:48:10 -08:00
lonerz 025fe9980b Switch no-empty eslint rule from warning to error (in .eslintrc) 2016-12-05 01:35:14 +00:00
Rafid Aslam 0290aeb6ab lint: Fix several no-unused-vars eslint rule violations.
These changes were extracted by tabbott from the original commit
to merge now because they have been reviewed as safe.
2016-12-03 18:43:47 -08:00
Rafid Aslam 426cb13e23 Remove `enforce_arity` function from util.js.
Remove `enforce_arity` function from util.js, because it is
not used anymore.
2016-12-03 18:43:46 -08:00
kevv87 1fb9220354 lint: Remove old jslint linter.
Now that we're using eslint, jslint is no longer required.
2016-12-02 18:49:42 -08:00
Tim Abbott 2c940b93ab js: Fix some minor whitespace issues. 2016-12-02 18:39:30 -08:00
AZtheAsian 5e9918135b eslint: change quote-props from off to error and fix violations. 2016-12-02 18:35:53 -08:00
Krzysztof Zbudniewek b8fc3f0e65 eslint: change space-before-blocks from warning to error and fix violations 2016-12-02 17:40:09 -08:00
AZtheAsian 9c0ebc7359 eslint: change no-else-return to error and fix violations 2016-12-02 14:43:09 -08:00
AZtheAsian ed0bc831be eslint: change one-var from warning to error and fix violations 2016-12-02 11:25:16 -07:00
Tommy Ip b3f4feb996 eslint: change max-len from warning to error and fix violations. 2016-12-02 14:16:33 +00:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
Tommy Ip c90da24541 eslint: change keyword-spacing from warning to error and fix violations. 2016-12-01 14:22:15 -08:00
aakash-cr7 d99b17070e edit: Fix traceback when saving edits to unsent messages.
7b0c6459b4 accidentally failed to update
one of the calleers of update_private_messages, resulting in this code
path failing consistently.

Fixes #2416.
2016-12-01 10:39:43 -08:00
Tommy Ip 7b2c313f37 eslint: change brace-style from warning to error and fix violations. 2016-12-01 10:20:22 -08:00
Brock Whittaker 4935f0c693 popovers: Hide actions popover once the muting button is clicked.
The popover shouldn’t still display once a valid action on the popover
has been taken.

Fixes #2366.
2016-11-29 16:47:03 -08:00
Arpith Siromoney f7dc2f33cd Change name of eslintrc file to .eslintrc.json
Currently it does this for the eslintrc files in zulip,
zulip/frontend_tests and static/js

This commit also fixes json style issues (quotes)
2016-11-29 08:58:39 -08:00
Tim Abbott 3d1bcb05e1 tornado: Move event_queue.py to zerver/tornado/.
Fixes #729.
2016-11-26 22:29:28 -08:00
Calvin Lee 4e5c4c5ffb streams: Add support for setting stream description during creation.
Add new box for stream description in the stream creation form,
modify backend so its contents end up as the stream description.

Fixes: #2283.
2016-11-26 16:55:35 -08:00
Steve Howell 604079a9d4 Fix formatting for Group PMs in the right sidebar.
We now sort users by the lower case value of their
full names in each of the links in the "GROUP PMs"
section of the right sidebar.  We still use "+n others"
for big huddles.
2016-11-26 11:48:52 -08:00
Steve Howell d953eca14c Make group PMs reply-to's more consistent in case.
We now sort lists of users ids deterministically, and we also
sort list of emails deterministically and without regard to case.

This probably fixes the bug #2343, although I never got a great
repro on that.
2016-11-26 11:48:52 -08:00
Steve Howell 578b276523 node tests: Add tests for message_store.js. 2016-11-26 11:48:52 -08:00
Steve Howell af9ff9a030 Have unread.num_unread_for_person accept a user_id.
(It used to take an email as its parameter.)
2016-11-26 11:48:52 -08:00
Steve Howell 772571fd82 Use data-user-ids-string in Private Messages sidebar.
This commit also changed message_store.recent_private_messages
to use user_ids_string instead of reply_to.
2016-11-26 11:48:52 -08:00
Steve Howell aadfe133e2 buddy list: Use user_ids in DOM list elements. 2016-11-26 11:48:52 -08:00
aakash-cr7 79b4ac8155 Add tooltips to buttons appearing when message is not delivered. 2016-11-26 10:13:48 -08:00
Arpith Siromoney 29d3019262 Switch no-loop-func eslint rule from warning to error (in .eslintrc)
The one error that needed to be fixed was in static/js/echo.js.
The function in the loop was being used by _.each(). This has been
replaced by iterating through the array using a while loop instead.
2016-11-25 14:02:44 -08:00
Arpith Siromoney 497c7702cc Run eslint in tools/lint-all with npm run --silent lint
This commit adds a basic eslintrc that emulates jslint defaults.
Rules that conflict with our existing code have been switched to
warnings instead of errors. Globals have been added to the eslintrc. The
bundled js file (generated by webpack) and blueslip.js are ignored with
.eslintignore.

To display warnings, run npm run lint-loud. This runs eslint without the
--quiet option on static/js and frontend_tests.

npm run --silent lint is run by tools/lint-all (in addition to jslint).
The --silent option is used to suppress the default output from npm run.

Fixes #535.
2016-11-18 16:15:45 -08:00
Vladislav Manchev d7e1e4a2c0 Add initial implementation of custom realm filters.
This PR was abandoned by Vladislav and then substantially modified by
Igor Tokarev and Tim Abbott to complete it and fix a number of bugs.

Fixes #544.
2016-11-17 17:11:25 -08:00
Steve Howell 8f96853fcb presence: Convert presence_info to use user IDs.
When we filtered buddy lists, a recent change introduced some
bugs related to case-insensitive emails.  We now circumvent the
bug by indexing presence_info with user_ids.
2016-11-17 13:27:28 -08:00
Brock Whittaker 5d2b81358c Code Simplification and Emoji Drag Fix.
There’s no need for four separate `$(sel).is()` statements, one will
do. This also added .drag to the list to ignore.
2016-11-17 11:21:15 -08:00
Brock Whittaker 2663215625 Do not close message compose box on drag.
On the drag to resize emoji box action, do not close the message
compose box.
2016-11-17 11:21:15 -08:00
Steve Howell 82a497ec08 Remove spurious blueslip error for topic lists.
If we update an unread count for a topic that is not part of
our truncated list, we don't need to complain.
2016-11-16 22:01:30 -08:00
Brock Whittaker 9582079cd9 edit: Fix "View source" icon being orphaned post-hover.
It turns out it wasn’t a one-liner, it was actually a -2-liner. :)
2016-11-16 14:03:54 -08:00
Steve Howell 3b594a6efa bug fix: Keep old, active, upper-case topics in the topic list.
If you narrowed to a topic that was not one of the most recent 5
topics and had uppercase characters, it would disappear from the
topic list as soon as all of its messages were read.
2016-11-16 12:17:31 -08:00
Steve Howell f4bf154981 bug fix: Fix topic unread counts for upper-case streams.
If stream names weren't entirely lowercase, then our function
topic_list.is_for_stream() was improperly reporting false and
failing to update unread counts for the active topic widget.

This regression was probably introduced in the fairly recent
53eea250d0 commit.

Fixes #2330.
2016-11-16 10:08:44 -08:00
Steve Howell 9eb825fff5 Refactor PM unread counts to use user_ids as keys.
We now use comma-delimited lists of user_ids for the following
data structures in unread.js:

    - unread_privates[<user_ids_string>]
    - get_counts.pm_count[<user_ids_string>]
2016-11-15 18:31:59 -08:00
Steve Howell 1783879108 people.js: Add methods for user_ids_string/emails_string.
Added:
    * people.user_ids_string_to_emails_string
    * people.emails_strings_to_user_ids_string
2016-11-15 18:31:59 -08:00
Steve Howell 7750d43d23 Simplify finding elements in pm_list.js.
We no longer need iterate_to_find, and we just use simpler
selectors.
2016-11-15 18:31:59 -08:00
Steve Howell f5e1dcd11d buddy list: Sidebar menu now uses user_id, not email. 2016-11-15 18:31:59 -08:00
Tim Abbott 49d24cee2a subs: Fix clearing filter table on subscribe. 2016-11-15 12:49:40 -08:00
Brock Whittaker 3d8ed7b55f subs: Rewrite Stream Filter Function.
This is more performant, along with accepting a parameter for
filtering only streams that are subscribed to if the toggle is set to
subscribed only.

Also, it now does substring matches, rather than just matching if an
entire word matches the search query.

Fixes #2141.
2016-11-15 12:21:43 -08:00
Brock Whittaker 1def0b6701 hashchange: Add hashchange ignore mechanism for overlays.
This will make it possible to do hash changes in soon-to-be-overlay
pages like the /#subscriptions and /#settings page.
2016-11-15 11:53:38 -08:00
Brock Whittaker 75db036733 Add toggle component.
This adds the toggle component which removes the necessity to have HTML.
2016-11-15 10:20:37 -08:00
Steve Howell 26857ac3aa admin: Use helpers when opening user form. 2016-11-15 09:37:47 -08:00
Steve Howell 7656c31769 Extract admin.get_email_for_user_row(). 2016-11-15 09:37:47 -08:00
Steve Howell 33a87492e2 admin: Remove obsolete active_user_row class. 2016-11-15 09:37:47 -08:00
Steve Howell ecfac010fc Extract admin.set_up_deactivate_user_modal().
This sets us up to eliminate the "active_user_row" hacks in
our next commit.
2016-11-15 09:37:47 -08:00
Steve Howell dcfb5c30c6 admin users: Fix real-time-sync for full names.
When an ordinary user changes their name, the admin sees the change
when they open the edit form now.
2016-11-15 09:37:47 -08:00
Tim Abbott e40e756d47 echo: Fix local echo sending a message to "yourself, ".
Previously, this would incorrectly include a user with name and email
"" in the recipients list shown in the local echo code path.

We fix this and add a test for the issue.
2016-11-14 21:43:13 -08:00
Steve Howell 59750a1cb9 Move more unread logic out of stream_list.js.
There are two split-outs code of the code here:

    - Animation stuff is in unread_ui.js.
    - PM unread counts get handled by pm_list.js.
2016-11-14 17:50:55 -08:00
Steve Howell 7c1711179c Rename subject_count class to topic-unread-count. 2016-11-14 16:16:55 -08:00
Steve Howell 72b8200b0b refactor: Extract update_unread_count() in topic_list.js.
This function does the "heavy" lifting of updating an unread
count.  (It's not exactly heavy lifting, but it makes it so
the parent just needs to find the outer element of the unread
div, using whatever method makes sense for the parent.)
2016-11-14 16:16:55 -08:00
Steve Howell e7a2b51647 Consolidate people searches (buddy list/subscribers).
We now use the same people-filtering code for the buddy
list that we use in subscriber search.
2016-11-14 16:01:13 -08:00
Steve Howell 71d93207cd Match "Charles Dickens" with "ch di" in subscriber search. 2016-11-14 16:01:13 -08:00
Steve Howell 6eb1dc3e73 Refactor filter_people_by_search_terms().
Build individual matchers for each search term.
2016-11-14 16:01:13 -08:00
Steve Howell 2746518f3c Make subscriber filter match on emails.
We will match emails that start with search terms.
2016-11-14 16:01:13 -08:00
Steve Howell 8fa519ded6 Remove some dead code in stream_list.js.
I forgot to remove this code in a recent refactoring that copied
this code into activity.js.  It should not have caused any errors,
but it's no longer needed.
2016-11-14 15:53:23 -08:00
Steve Howell 47ef26fa55 refactoring: Let activity.js manage its own unread counts.
This change breaks a needless dependency of activity.js on
stream_list.js.
2016-11-11 12:27:03 -08:00
Steve Howell f3373d62e1 stream sidebar: Clean up unsubscribe logic.
From subs.js we don't redundantly try to remove an element
from ths sidebar; we just trigger the event.

In stream_list.js we continue to remove the element from
the DOM, and we also remove the widget from our internal
Dict of sidebar rows, so that if we re-subscribe, we know
we'll automatically re-build the widget from the template
and the latest data from stream_data.js.
2016-11-11 12:12:13 -08:00
Steve Howell d867cba90b Add stream_list.stream_sidebar() class.
This new class lets us store sidebar rows inside of stream_list.js
instead of putting them on sub objects from stream_data.js.
2016-11-11 12:12:13 -08:00
Steve Howell 7b0c6459b4 Extract static/js/pm_list.js.
This handles most of the details of building the Private Messages
section in the upper left corner of the app.
2016-11-11 12:12:13 -08:00
Steve Howell af794bec7a Remove unused stream_list.get_count(). 2016-11-11 12:12:13 -08:00
Steve Howell 6a3254f83f Clean up how we build individual stream sidebar rows.
We used to have hacky code where various functions would call
build_stream_sidebar_row() to get a jQuery object, and then they
would attach the jQuery object to the "sub" object from stream_data.js.

Now build_stream_sidebar_row() localizes the hack of attaching
a UI object to the "sub" object to just one function (and we can
clean this up in a follow-up commit).

Also, the UI object is now a JS object that can close on some useful
state information like the stream name and encapsulate how we
toggle the inactive_stream class.

Finally, we don't have build_stream_sidebar_row() needlessly append
list items to $('#stream_filters') when we know that our callers are
going to re-build the list anyway.
2016-11-11 12:12:13 -08:00
Steve Howell 13fbb96178 Remove unnecessary call to build_stream_list().
In refresh_pinned_or_unpinned_stream(), we no longer call
build_stream_list(), because that's already called in
update_streams_sidebar().
2016-11-11 12:12:13 -08:00
Steve Howell 16cb2bce8b Remove duplicate loop in build_stream_list().
The code removed in this commit added pinned streams to a list
of elems, only to have them added again by the next block of code
(but more concisely).  Through some strange quirk of appendTo() this
never created user-facing bugs, but you could clearly see in the console
that it was doing double work.
2016-11-11 12:12:13 -08:00
Steve Howell 06f4857221 buddy list: Make Group PMs appear more quickly.
It used to be the case that you would get new messages for a
huddle, but the huddle wouldn't show up on your buddy list until
the every-50-seconds mass update of the buddy list.

Now we make sure to work with non-stale jQuery objects, and,
more importantly, we resize ourselves if we add new huddles.

(The resize issue arises due to some complicated heuristics
where we don't want group PMs to take up too much of the buddy
list for users who don't have many in their history.)
2016-11-11 12:02:48 -08:00
Steve Howell 197edcca0e buddy list: Update huddles when you fetch PMs.
This fixes a bug with the group pm section of our
buddy list.  It wasn't updating when you fetched
old private messages.

We had been calling activity.process_loaded_messages() as
part of message_store.do_unread_count_updates(), which was
called sometimes unnecessarily and sometime not called when
we needed to get huddle info.

Now we call it when we need it most, which is when you
click on "Private Messages".
2016-11-11 10:41:18 -08:00
Steve Howell eef633efa0 minor: Make get_huddles() internal to activity.js. 2016-11-11 10:41:18 -08:00
Brock Whittaker d45c050994 message_edit: Restyle message_controls options to have better spacing.
This restyles the message_controls options to center them horizontally
while fixing them closer to the right side of the edge, along with just
replacing the edit button with a preview source button once editing is
disabled.
2016-11-10 19:47:26 -08:00
Brock Whittaker 5497416a36 Move edit button to underneath message timestamp.
This moves the edit button to underneath the timestamp such that when
you hover over a message now the timestamp hides itself and the edit
button appears (if editing is allowed).

Fixes #1733 and other annoying issues with this field.
2016-11-10 19:45:09 -08:00
paxapy ade3bda025 markdown: Fix stream link handler in corner cases.
* Fixes handling of multiple stream links and invalid stream names.
* Fixes text regex so it handle hash sign the right way.
* Adds tests for these stream link cases.
2016-11-10 19:22:19 -08:00
Igor Tokarev 852bc6b491 bugdown: Re-enable support for italics in bugdown.
Fixes: #1103.
2016-11-10 19:14:40 -08:00
Rishi Gupta eeca06ea08 message_edit: Fix message editing for messages that threw a backend error.
Changes editibility type from NONE to FULL, and makes Save and Cancel
buttons work. Exposes a new bug, which is that changing the topic changes
the topic for the recipient row, rather than the message. See #2278.
2016-11-10 16:45:18 -08:00
Steve Howell b0a8e4befe topic lists: Rebuild DOM when we zoom in or zoom out.
This change sets the stage to reload more topics from the back
end when we zoom in, and it slims the DOM for the typical use
case of being zoomed out.
2016-11-10 15:55:31 -08:00
Steve Howell f923320de8 topic lists: Add get_stream_name() to topic list widget. 2016-11-10 15:55:31 -08:00
Steve Howell d8b5558699 topic lists: Refactor handling of parent element.
The widget that gets built in topic_list.build_widget()
now knows how to add itself to its parent element and expose
an interface to retrieve the parent.
2016-11-10 15:55:31 -08:00
Steve Howell 3b7430ba82 topic lists: Refactor zoom-out logic for un-narrows.
For cases where we are zoomed in to a stream and then go
to a different narrow (Home, PMs, etc.), we now let
topic_list.zoom_out orchestrate the removal of the topic list
instead of stream_list.zoom_out.

This will help us when we move to a world where topic_list
redraws topic lists on zoom-in/zoom-out, because we won't
waste effort rebuilding lists that are about to be removed.
2016-11-10 15:55:31 -08:00
Steve Howell bfc6f57195 topic lists: Move some zooming logic into topic_list.js.
The flow for topic list zooming is kind of complicated now, but
it's mostly a consequence of the way the UI works.

* stream_list tells topic_list to set up the topic list
  click handlers to have callbacks to stream_list
* topic_list click handlers call to stream_list zoom methods
  to hide/show all the other streams
* stream_list zoom methods call back to topic_list methods to
  redraw topics as needed (this isn't happening yet, but allowing
  topic_list.js to know that it's zoomed will set the stage for
  this to happen in a more controlled manner)
2016-11-10 15:55:31 -08:00
Steve Howell 53eea250d0 topic lists: Formalize that we only ever have one widget.
We now only keep zero or one widgets around in memory, and
we don't need jQuery magic any more to find the DOM elements
to remove.
2016-11-10 15:55:31 -08:00
Steve Howell 06816d19e6 topic lists: Call narrow.topic() in topic_list.js.
We no longer need stream_list.js to pass in the currently
active topic to us; we just call narrow.topic() for it.
2016-11-10 15:55:31 -08:00
Steve Howell 853126344e Add narrow.topic() helper method.
This has similar semantics to narrow.stream().
2016-11-10 15:55:31 -08:00
Steve Howell e76422b946 Use narrow.stream() instead of stream_list.active_stream_name().
We no longer use active_stream_name(), which was mostly a
duplicate of narrow.stream().  For nonsensical queries like
"stream:foo stream:bar" the behavior may change slightly here.

We know that we don't handle non-sensical queries particularly
well, but at least if we always go through narrow.stream(),
the behavior will be consistent.

I did test this with some sensible compound narrows, like searching
for a keyword within a stream.
2016-11-10 15:55:31 -08:00
Steve Howell 16e37f8874 Limit compose at-mention typeaheads to realm users.
Fixes #2240
2016-11-09 19:20:58 -08:00
Steve Howell 5e51a93688 Change stream_data.remove_subscriber() to accept user ids. 2016-11-09 15:03:08 -08:00
Steve Howell 00068f3164 Extract stream_data.unsubscribe_myself(). 2016-11-09 15:03:08 -08:00
Steve Howell 537a3b8ca8 Change stream_data.add_subscriber() to accept user_ids.
We no longer require passing in an email to
stream_data.add_subscriber(), since we only track user ids
in stream_data.js.
2016-11-08 15:49:23 -08:00
Steve Howell a03a7d4c95 peer_remove: Send user_id, not email, for unsubscribe events. 2016-11-08 15:36:29 -08:00
Mohsen Ibrahim 44c8e4c58c streamLinkHandler: render stream links correctly.
After adding the ability to add stream links to messages using
the following pattern '#**stream_name**' there was a problem
with rendering this using our markdown engine because '**' means
bold text so that would render just to bold text.
To solve this I had to add regular expression in marked.js to match
that pattern and when it matches I call handleStreamLinks in echo.js
which will correctly render it to HTML.

Fixes #2218.

[tweaked by tabbott to url-encode the stream name in the URL and
adding the missing "#" in the display].
2016-11-08 13:52:31 -08:00
Meena Rajan 30acb23314 bugdown: Add support for strikethrough in markdown processor.
[Tweaked to move tests to bugdown_data.json, add additional tests, and
add frontend processor support by tabbott]
2016-11-07 22:26:38 -08:00
umkay f4c621ffe3 admin: Enable admins to toggle supported auth methods via UI.
Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
2016-11-06 16:29:35 -08:00
Steve Howell 06fe4bc943 Rename subject_box to pm-box/topic-box.
I'm not crazy about the names pm-box and topic-box, but they
are less confusing now.
2016-11-05 15:03:29 -07:00
Steve Howell 8b7e9101ca topic lists: Rename expanded_subjects -> topic-list. 2016-11-05 15:03:29 -07:00
Tim Abbott ee361cbe30 js: Eliminate process_loaded_for_unread global. 2016-11-05 11:33:04 -07:00
Tim Abbott d60ec24c1f js: Move set_user_statuses to activity.js initialization. 2016-11-05 11:33:04 -07:00
Tim Abbott 6daf2b1e46 js: Move pointer initialization code out of zulip.js. 2016-11-05 11:33:04 -07:00
Tim Abbott d76f9b09a3 unread: Move consider_bankruptcy into unread module. 2016-11-05 11:33:04 -07:00
Brock Whittaker 4400665a6d subs: Move stream settings into an independent overlay.
This replaces the scrolling stream settings feature with a stream
settings overlay.
2016-11-04 17:13:26 -07:00
Tim Abbott 78ec0341c4 subs: Fix color picker issue with subscribing. 2016-11-04 17:13:26 -07:00
Tim Abbott 73f020645f subs: Remove unnecessary update_stream_color call.
The color was already being updated in the response from the server.
2016-11-04 16:37:29 -07:00
Tim Abbott a70c5eb923 colorpicker: Migrate to use stream IDs to access things. 2016-11-04 16:37:29 -07:00
Tim Abbott ab6fd87161 subs: Fix rename stream handling of email addresses. 2016-11-04 16:37:29 -07:00
Tim Abbott e6734bfada subs: Cleanup stream rename logic. 2016-11-04 16:37:29 -07:00
Tim Abbott ee976a9bdc subs: Use subscription_settings when changing descriptions. 2016-11-04 16:37:29 -07:00
Tim Abbott 45c7945818 subs: Use sub_settings in subscriber add/remove flow. 2016-11-04 16:37:29 -07:00
Tim Abbott 8e522cd933 subs: Convert stream_home_view_clicked to use sub_settings. 2016-11-04 16:37:29 -07:00
Tim Abbott 2467f765ad subs: Stop using sub_row when rendering settings. 2016-11-04 16:37:29 -07:00
Tim Abbott 16408da823 subs: Cleanup change_stream_privacy.
We now:
(1) Only look up streams by ID

(2) Correctly look up both the stream-row and subscriptions_row after
the success handler returns.
2016-11-04 16:37:29 -07:00
Tim Abbott 32a571445a subs: Use settings_for_sub when redrawing privacy stuff. 2016-11-04 16:37:29 -07:00
Tim Abbott b67c0a4ad5 subs: Move settings_for_sub and button_for_sub earlier. 2016-11-04 16:37:28 -07:00
Tim Abbott b1a5d57405 subs: Update get_subscriber_list to use subscription_setings. 2016-11-04 16:37:28 -07:00
Tim Abbott 109287dceb subs: Update descriptions in settings separately from stream rows. 2016-11-04 16:37:11 -07:00
Tim Abbott 7a59ae591a subs: Fix get_stream_name to use IDs from the DOM.
We haven't added a data-stream-name to the subscription_settings
object yet, and ideally we'd be moving away from using
data-stream-name anywhere.
2016-11-04 16:16:07 -07:00
Brock Whittaker 7d51b6a454 subs: Create get_stream_name to get stream name from UI.
This accepts an arbitrary click target in the DOM inside a stream row
or stream settings element and returns the stream name.
2016-11-04 13:53:12 -07:00
Steve Howell 2088e8420f User user_id, not email, in peer_add events. 2016-11-04 11:37:14 -07:00
Steve Howell 17e39a88ef Remove people.test_set_people_name_dict().
We use a cleaner approach to setting up test data in echo.js to
allow us to remove the one call to test_set_people_name_dict().
2016-11-04 11:37:14 -07:00
Steve Howell 8c47f7f7db Remove people.test_set_people_dict(). 2016-11-04 11:37:14 -07:00
Steve Howell 472f049cae Alphabetize subscription event cases in server_events.js.
I also split up peer_add and peer_remove into their own cases,
since they do opposite things and didn't share that much code
in common.
2016-11-04 11:37:14 -07:00
Steve Howell 38f2789152 Remove page_params.email_dict. 2016-11-04 11:37:14 -07:00
Steve Howell 3941334d00 Use user_ids for subscribers in stream_data.js.
We still shim a lot of methods to keep using emails, but the
internal data structure now has user_ids.
2016-11-04 11:37:12 -07:00
Steve Howell 7509f73f02 Clean up stream renaming in the JS code.
We now use stream_id as our key to rename streams, which
should prevent a few race conditions long term.  (We are
still possibly contending with other events that use
stream_name as a key, so this is not perfect.)
2016-11-04 11:30:18 -07:00
Steve Howell e1372ddf5d Add people.get_user_id(). 2016-11-04 11:30:18 -07:00
Steve Howell 4ace9bbd77 Remove dead code related to subs.create_sub().
Since we started handling the stream/create event properly,
create_sub() became dead code.
2016-11-04 11:30:18 -07:00
Steve Howell 4cd39010d1 Add people.get_person_from_user_id().
This requires the introduction of people_by_user_id_dict
and changes to people.add() and people.remove().
2016-11-04 11:30:18 -07:00
Tim Abbott 368b585980 subs: Redesign the rows of the #subscriptions table. 2016-11-03 17:33:33 -07:00
Steve Howell e4930d73c4 Add user_id for new users who we discover in new messages.
This change also creates a copy of the objects so that we
don't couple ourselves to the message store.
2016-11-03 16:20:45 -07:00
Steve Howell 30e01306d9 Eliminate people.reify() and mostly ignore unknown users.
If I try to send a message to an unknown user (which is possible
for some types of realms), then I simply ignore them during the
send codepath, so that I don't later need to patch up their attributes.
2016-11-03 16:20:45 -07:00
Steve Howell 15d44f8d71 Encapsulate pm_recipient_count.
We no longer store pm_recipient_count on person objects, but we
instead use a Dict to store them.  Then the new API is this:

    people.get_recipient_count()
    people.incr_recipient_count()
2016-11-03 16:20:45 -07:00
Steve Howell 9b04ec7472 Send dicts for cross realm users to JS.
We now send dictionaries for cross-realm bots.  This led to the
following changes:

* Create get_cross_realm_dicts() in actions.py.
* Rename the page_params field to cross_realm_bots.
* Fix some back end tests.
* Add cross_realm_dict to people.js.
* Call people.add for cross-realm bots (if they are not already part of the realm).
* Remove hack to add in feedback@zulip.com on the client side.
* Add people.is_cross_realm_email() and use it in compose.js.
* Remove util.string_in_list_case_insensitive().
2016-11-03 09:51:23 -07:00
Tim Abbott ebe959f2b0 tutorial: Remove low-quality alert bar onboarding flow.
This alert bar thing was buggy and didn't look that good, so let's
just remove it.  We can always write a nicer thing advertising the
desktop app later.
2016-11-02 23:41:16 -07:00
Rishi Gupta a2b6793174 message_edit.js: Put cursor at end of input on initial focus. 2016-11-02 20:54:54 -07:00
Rishi Gupta 5251460eda message_edit.js: Remove edit_row from edit_message.
I believe row.find(..) and edit_row.find(..) are the same in all these
cases.
2016-11-02 20:54:54 -07:00
Rishi Gupta 8104485c41 message_edit.js: Refactor how edit_message accesses elements.
Currently, message_edit.edit_message accesses elements of
message_edit_form.handlebars by a number of different means, and in a number
of different places. This commit is the first of two that standardizes it.
2016-11-02 20:54:54 -07:00
Rishi Gupta 9ed45eb4a1 message_edit.js: Change disabled fields to readonly to allow copying text.
Previously we disabled fields in message_edit_form.handlebars that you
couldn't edit. This meant you could see the content of the field, but not
copy it. This commit marks those fields as readonly instead.
2016-11-02 17:49:04 -07:00
deekshaarul 05d252da71 compose.js: Add translation tag to empty_topic_placeholder.
Moves the variable definition from the top of the file to inside the export
since i18n seems not be loaded at the time the file is parsed.
2016-11-02 17:46:32 -07:00
deekshaarul 6624d4e56e message_edit.js: Fix message editing behavior around empty topics.
Previously,
* We displayed "(no topic)" in .message_edit_topic when there was no
  topic;this commit changes that to a placeholder.

* We showed the .message_edit_topic_propagate dropdown when the user
  cleared .message_edit_topic, despite the fact that one cannot save
  or propagate an empty topic. This commit fixes the behavior.

Fixes #1273.
2016-11-02 17:45:23 -07:00
paxapy 2f711a070d bugdown: Add autocomplete for #StreamName links.
Fixes #1858.
2016-11-01 20:19:44 -07:00
Tim Abbott acf43f91fa composebox_typeahead: Improve whitespace. 2016-11-01 20:15:57 -07:00
Tim Abbott 6c96f3f2c7 composebox_typeahead: Refactor @mentions logic to not block #streams. 2016-11-01 20:15:57 -07:00
Tim Abbott fe2aab7571 composebox_typeahead: Remove last_at variable. 2016-11-01 20:06:34 -07:00
Tim Abbott ae336ce8b5 composebox_typeahead: Extract autocomplete_checks. 2016-11-01 20:06:03 -07:00
Steve Howell a0dadfd40a Widgetize topic_list.set_count().
This change makes most of the logic on set_count() live
on our per-stream topic list widget.  We can find the
jQuery object directly now rather than using the
complicated iterate_to_find() method.
2016-11-01 19:30:41 -07:00
Steve Howell b7b6fedf12 Widgetize activate_topic() in topic_list.js.
The activate_topic() function now lives on the object created
by build_widget().
2016-11-01 19:30:41 -07:00
Steve Howell 8c9488a904 Add topic_list.build_widget().
This gets us closer to a component model for topic lists.
2016-11-01 19:30:41 -07:00
Steve Howell eacaa37754 Make update_count_in_dom() be private in topic_list.js.
I also moved the function in the file to be nearer to other
non-stream specific functions.
2016-11-01 19:30:41 -07:00
Steve Howell aca6ba182e Render topic list items individually.
This is a precursor to being able to find topic list
items without the complexity of iterate_to_find().
2016-11-01 19:30:41 -07:00
Steve Howell 148e1e6add subs: Avoid duplicate prepend_subscriber() call.
We don't want to prepend new subscribers to our list of
subscribers in the settings page when they hit enter; we
want to wait till we get the event from the server.

This is a fairly new regression that was added when we
live-updated peer subscriber changes.
2016-11-01 14:01:29 -07:00
Steve Howell a126be3db6 Call add_in_realm() when loading people from page_params. 2016-11-01 13:55:48 -07:00
Steve Howell d70ac2fc0d Remove obsolete code for page_params.people_list.
The only module that uses people_list now is people.js, and that's
only during the page load process.
2016-11-01 13:55:48 -07:00
Steve Howell 758c040558 Make stream-invite typeahead more dynamic and accurate.
The typeahead for inviting users to an existing stream now
uses a function, not a static list, and it now only shows
users from your realm.
2016-11-01 13:55:48 -07:00
Steve Howell aadc198510 Make PM typeaheads more dynamic.
We now set source as a function, not a static list, and we grab
persons from people.get_all_persons() instead of page_params.
2016-11-01 13:55:48 -07:00
Steve Howell 40ec0189e4 Use people.get_all_persons() in at-mention typeaheads.
This is more robust than using page_params.people_list.
2016-11-01 13:55:48 -07:00
Steve Howell 06d7012113 Use people.get_all_persons() for search_suggestion.js.
This is better than using page_params.people_list, which may
go out of sync when live updates happen.
2016-11-01 13:55:48 -07:00
Steve Howell 2d945d7296 Add people.get_realm_persons(). 2016-11-01 13:55:48 -07:00
Steve Howell aa07b32d58 Add people.get_all_persons(). 2016-11-01 13:55:48 -07:00
Tim Abbott 1bc9be7aed subs: Fix stream privacy changes not working after renaming.
This fixes and issue where the change_stream_privacy template had its
own duplicate copy of the data-stream-name attribute, which wasn't
updated when streams were renamed.

Fixes #2016.
2016-10-28 16:42:32 -07:00
Tim Abbott 6927a9bdc4 subs: Update subscription settings data when renaming streams. 2016-10-28 16:41:54 -07:00
Tim Abbott 0185764be7 subs: Fetch stream name from data-stream-name. 2016-10-28 16:12:50 -07:00
Tim Abbott 9507ed8a05 subs: Move show_settings_for earlier in file. 2016-10-28 16:10:59 -07:00
Tim Abbott c10fd243f1 subs: Rename subscriber_count class to subscriber-count.
Also remove the unused subscriber-count-row class.
2016-10-28 16:07:28 -07:00
Tim Abbott c0a774ef8c subs: Remove use of $-based variable names. 2016-10-28 16:07:02 -07:00
Tim Abbott b8304c3359 subs: Find elements using the new data-stream-id value.
This is preparation for no longer having the subscription inside the
subscription_row object.
2016-10-28 16:06:40 -07:00
Tim Abbott 3727ea6fb0 subs: rename .subscription_description to .description. 2016-10-28 14:47:23 -07:00
Tim Abbott dd2fab9374 subs: Rename data-subscription-id to data-stream-id. 2016-10-28 14:47:23 -07:00
Tim Abbott 66e2632809 subs: Rename .subscription_name to .stream-name. 2016-10-28 14:47:22 -07:00
Tim Abbott f18d53d46a subs: Rename .subscription_row to .stream_row.
The new name is clearer, since we show these rows for streams whether
or not you're subscribed.
2016-10-28 14:25:00 -07:00
Steve Howell eb64b32bc8 Fix "subjects" in JS comments. Say "topics" instead. 2016-10-28 13:52:25 -07:00
Steve Howell 5fd71a6381 Rename var in sidebar_subject_list.handlebars.
s/subjects/topics/
2016-10-28 13:52:25 -07:00
Steve Howell dba3ed3d90 Rename variables in topic_list.build_list().
(s/subjects/topics/ in a couple places)
2016-10-28 13:52:25 -07:00
Steve Howell 78861d4e01 Rename recent_subjects to recent_topics. 2016-10-28 13:52:25 -07:00
Steve Howell 0a4579711d Add stream_data.get_recent_topics().
This removes the last remaining references to
stream_data.recent_subjects() outside of stream_data.js.
2016-10-28 13:52:25 -07:00
Steve Howell 6a54dfc127 Remove recent_subjects from node tests.
We now use stream_data.populate_stream_topics_for_tests(),
which hides some of the implementation details of initializing
the data structure.
2016-10-28 13:52:25 -07:00
Steve Howell 8acdf718bc Move process_message_for_recent_topics() to stream_data.js. 2016-10-28 13:52:25 -07:00
Steve Howell c799ac3126 Extract stream_data.is_active(). 2016-10-28 13:51:21 -07:00
Steve Howell ecbd77d8a5 Flip conditional in stream_list.add_sidebar_li(). 2016-10-28 13:51:21 -07:00
Steve Howell 15602ee6bb Stop using /json/streams on the client.
We no longer need to fetch streams from the server when
we render the settings page.

The name populate_and_fill() may not be a great name any
more.
2016-10-28 13:44:46 -07:00
Steve Howell 10bc093375 Stop using server data to draw "Manage Streams".
We have all the data we need on the client side.
2016-10-28 13:44:46 -07:00
Steve Howell 9d4debd1eb Live-update added/removed subscribers. 2016-10-28 13:43:09 -07:00
Tim Abbott 01f0be27a7 subs: Combine another set of settings show handlers. 2016-10-27 22:24:40 -07:00
Tim Abbott 426f2b0405 subs: combine some settings show handlers. 2016-10-27 22:22:28 -07:00
Tim Abbott 3fd94cc58a subs: s/subrow/sub_row/ in variable names. 2016-10-27 22:19:30 -07:00
Tim Abbott 12331e2596 subs: Extract show_subscription_settings. 2016-10-27 22:06:56 -07:00
Tim Abbott 30c654f83f templates: Fix stack traces throwing handlebars errors.
This fixes the fact that we weren't using `throw` correctly, and also
the "handlerbars" typo.

Fixes #2143.
2016-10-27 22:06:56 -07:00
Steve Howell f98e605840 Extract topic_list.set_click_handlers(). 2016-10-27 15:49:25 -07:00
Steve Howell 8ebf48793c minor: Remove copy/pasted comment. 2016-10-27 15:49:25 -07:00
Steve Howell 9de7551f4f Extract topic_list.rebuild().
This was pulled from rebuild_recent_topics(), which still
exists to wrap passing in the stream_li parameter.
2016-10-27 15:49:25 -07:00
Steve Howell f7e6cfc892 Extract topic_list.build_list().
This used to be stream_list._build_subject_list().  The code
didn't change except for one s/subject/topic fix.
2016-10-27 15:49:25 -07:00
Steve Howell 8783a0e51d Move remove_expanded_topics() to topic_list.js. 2016-10-27 15:49:25 -07:00
Steve Howell 9b6b743a1a Move get_topic_filter_li to topic_list.js.
This also brought along:
    iterate_to_find (copied, see large comment explaining why)
    activate_topic (extracted from a one-liner)
    set_count (formerly stream_list.set_subject_count)

For get_topic_filter_li, we now pass in stream_li instead of
stream to decouple parent/child responsibilities between the
components.

Also, I made some s/subject/topic/ fixes.
2016-10-27 15:49:25 -07:00
Steve Howell 4f38cfdc7f Extract topic_list.update_count_in_dom().
This creates the new topic_list.js module, and the first
function that we extract is topic_list.update_count_in_dom().

This function needed to be decoupled from some non-topic-list
stuff which was overly complicated.
2016-10-27 15:49:25 -07:00
Steve Howell 65a2f012d4 Simplify pin/unpin code path.
I make server_events slimmer by not handling a specific
property when subs.update_subscription_properties() should
do all the dispatching (and mostly did).

And then since update_subscription_properties() has
a "sub" already, I can call directly to stream_list code
and remove a function from subs.js.  Since I lose the
wrapper function in subs.js, I rename the stream_list
function as part of this commit.

The only code that gets slightly heavier here is that
we have two lines in the 'pin_to_top' case instead of one.
2016-10-25 23:29:15 -07:00
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
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
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