Commit Graph

5076 Commits

Author SHA1 Message Date
Luke Faraone cfe9e268f4 Do not specify cascade=True in deactivate_user_backend.
This was mistakenly included from a previous iteration of the do_deactivate()
function's interface.

(imported from commit 0a6ddc5ba1dfe944f2cc0087c590046da6a73531)
2013-07-08 15:44:01 -07:00
Tim Abbott 7540ad6234 Fix tracebacks from prepending messages after narrowing.
(imported from commit 6bed33975ee80c324270b518e0dcb807c1f1df41)
2013-07-08 18:18:48 -04:00
Luke Faraone 2c83d015a9 Refactor bot deactivation view to cover all users and expose via REST
(imported from commit 9f7afb3b43ed14db0bb4217dbae4114846bb840b)
2013-07-08 18:00:28 -04:00
Allen Rabinovich d4da8570bd Change the unread message style to a top-left corner marker and a full messagebox diagonal overlay gradient
(imported from commit dd171437bdd40219584774bc38c77798fa1568e2)
2013-07-08 14:36:55 -07:00
Tim Abbott 54c32992fd Fix hitting down-arrow at bottom of message list.
Previously the viewport.scrollTop() command that we ran in this case
would actually scroll far off the bottom of the site; it only did
something that looked reasonable because bottom_whitespace was small
and thus the scroll was truncated.

This version scrolls to 10% of the viewport away from the top.  We may
need to tweak that to instead be a fixed number of pixels or something.

(imported from commit 0176bf6e3662dfa24887f41b110b429bd8054cb0)
2013-07-08 17:32:18 -04:00
Tim Abbott 0e8c55395c Fix save/restoring scroll position when toggling in_home_view.
Previously the code to save/restore the scroll position when toggling
a stream in/out of the home view would only work if you were currently
not in the home tab -- because you used to only be able to do this
from other pages.

(imported from commit 4002a3980dfd87dabd570abee3ebc63417a78cc5)
2013-07-08 17:32:18 -04:00
Tim Abbott 641377e7e0 Add messages at bottom when message list is empty.
(imported from commit d15ff7ddb39e30ca08dd9d0eccf3dae75414a3ef)
2013-07-08 17:32:18 -04:00
Tim Abbott 43279b99ff message_list: Clear rendering window when clearing message list.
(imported from commit 5eefbced42e9ab987e4e2d60332f1d416df605af)
2013-07-08 17:32:18 -04:00
Tim Abbott 166a9c9635 Return the viewport to a corresponding position when unnarrowing.
(imported from commit d1cb35b175a23e18ed79537843ce7940ec370cf3)
2013-07-08 17:32:18 -04:00
Tim Abbott 0d5469f6ab Preserve the location of the selected message when narrowing.
(imported from commit 38230a79d3bb2c403e20ed9b40b04731c0312325)
2013-07-08 17:32:18 -04:00
Tim Abbott 9145246ace message_list: Don't leak date row headers when prepending messages.
(imported from commit 794c668dd79f89000e6559c0d96c78832e4e43d0)
2013-07-08 17:32:17 -04:00
Tim Abbott bdaacc5393 Don't call msg_list.append/prepend with empty arguments lists.
This can cause unnecessary work to be done.

(imported from commit a33d69598531b6a99520f92cbbac1fdb7eb9ee49)
2013-07-08 17:32:17 -04:00
Tim Abbott a158ee233a message_list: Preserve the scroll position when prepending.
Previously, we had some ugly complicated logic through which we
attempted to keep the selected message on screen when prepending
messages, but we didn't actually preserve the scroll position -- the
selected message would jump on the screen.  This fixes that, by just
saving/restoring the scroll position of the selected message.

This perhaps makes our model/view split even less clear, but at least
it's correct.

(imported from commit 0a01450bbbcdf1b45c891d0570c9fcfb11769315)
2013-07-08 17:32:17 -04:00
Tim Abbott 24055e894e message_list: Fix prepending of messages.
message_list.prepend() now actually only rerenders the new messages
when prepending using the where="top" functionality (previously it
would erroneously just adjust the message database and then wait for
message_list.append() to call _maybe_rerender(), determine that things
are awry, and rerender the whole message list).

(imported from commit c64b7b540a4f5332ad792de0fad9f20750e6db1c)
2013-07-08 17:32:17 -04:00
Tim Abbott e5c96fb3ad Increase bottom_whitespace to be most of the viewport height.
This has two benefits:

(1) Users can scroll their last message to near the top of the screen,
which decreases how often one needs to scroll down to track current
messages.

(2) It makes scrolling bugs near the bottom of the screen a lot easier
to find, because scrolling down too far isn't blocked by being unable
to scroll messages off the screen.

We should probably later convert this to some formula that varies
dynamically based on the height of the last message.

(imported from commit 41954fecd9efb43820ed1ccb5210283c17752f51)
2013-07-08 17:32:17 -04:00
Tim Abbott f48097b609 recenter_view: Always place the initial pointer at the center.
It turns out that this code tries to place the initial pointer 1/7
from the top; the only reason something reasonable happened
historically is that bottom_whitespace was only 40% of the screen, so
the pointer message ends up landing in the center anyway.

(imported from commit 56d4c2acd018d9a87551c82a43c214c6d80bfb90)
2013-07-08 17:32:17 -04:00
Tim Abbott f10d3d5517 Only autoscroll for messages that arrived via get_updates.
Previously we incorrectly would sometimes trigger autoscroll when
messages arrived via get_old_messages (i.e. we loaded some historical
messages from the server).  This resulted in some confusing and
erroneous scrolling behavior.

I kinda hate the fact that we need to pass these values all the way
through the rendering process, but fundamentally there's no other way
for _render to find out, and pushing the autoscrolling higher up in
the stack is hard since we don't return anything like the block of new
messages.

(imported from commit c5ed27f1b21691a21c68ed7e09cff8e3e4a75e76)
2013-07-08 17:32:17 -04:00
Steve Howell a90a155e03 Make narrow.by_recipient 'read' a message.
(imported from commit aadefa6be8f04a033d278050eb1d5135d5b1bdc5)
2013-07-08 17:12:32 -04:00
Steve Howell 0908f15109 Make narrow.by_subject 'read' its message.
(imported from commit e81140c440fecd283443eab46f0c65faffee8df1)
2013-07-08 17:12:32 -04:00
Steve Howell 465728da37 Move functions inside zephyr.js (cosmetic).
This is purely cosmetic, and just puts some similar functions
together in a way that JS lint won't complain about calling a
function before it was defined.

(imported from commit 8a5a81ae5b7ca7dbaa60147ae4f32f50b1cbbf3a)
2013-07-08 17:12:32 -04:00
Steve Howell 01d96ee7fb Mark messages as read when beginning a reply.
(imported from commit 9743e044dbb7570edcb341ca726369a673fc3db9)
2013-07-08 17:12:32 -04:00
Luke Faraone 09249ffa3b knight should dry-run unless you specify -f
(imported from commit fd0e5af1d941c6fadcbc14ff7f86f71a170a503e)
2013-07-08 17:07:55 -04:00
Luke Faraone 2daf8db3a5 Add a parameter to knight.py to remove user rights.
(imported from commit 4527955f688298ba56296e9f24d42e33f7d04948)
2013-07-08 17:07:55 -04:00
Luke Faraone f22abf2b8a Add a management command to create realm administrators.
(imported from commit ab2dd580a206f29086c0d5a4e717c1bfd65a7435)
2013-07-08 17:07:55 -04:00
Luke Faraone ae03ff408b [manual] Define realm.administer permission
To apply this to your system, run:
    python manage.py update_permissions

A rebuilt database will already have the correct permission defined.

(imported from commit 5b826b940257e14b3e9e44f9c32b20ed0183dedf)
2013-07-08 17:07:55 -04:00
Luke Faraone 6988490980 Add a management command to create objects for newly defined permissions
This script does not remove permissions that already exist.

(imported from commit 15d18266a05a84b9cac6cc7d2104668b41b48f35)
2013-07-08 17:07:55 -04:00
Luke Faraone 9a866ce5be [schema] [manual] Add django-guardian to INSTALLED_APPS
On a Debian/Ubuntu system with the Ops repo installed, you can add this
dependency by running:
    sudo apt-get install python-django-guardian

We use a slightly modified version of the package, so users of other
systems should manually download the source from my GitHub fork and
install it as they would any other Python library:
    https://github.com/lfaraone/django-guardian/archive/lfaraone-noanon.zip

guardian uses South for migrations. To apply the guardian schema to your
database, run:
    python manage.py migrate guardian

(imported from commit 12eaf4ded91e180c3245a44bacfb5b98b660147d)
2013-07-08 17:07:55 -04:00
Luke Faraone 93ce1ff431 [schema] Add PermissionsMixin to UserProfile
This creates the required model fields to use the Django permissions
framework or various other third-party frameworks.

To apply this commit, run:

    python manage.py migrate zephyr

(imported from commit a14fa7552c5389522d15edecedfd8a34418bb23d)
2013-07-08 17:07:55 -04:00
Kevin Mehall 9cb5c23da9 Removed unused rendered_content argument
(imported from commit 214d0dac63bb4e7fc4fd477ab1e22a0f2e65227d)
2013-07-08 16:53:13 -04:00
Kevin Mehall a7c91bce1b If there is no rendered_content in the database, render it and
save it. This fixes the "Humbug note:" error on old messages that
do not have rendered_content in the DB.

(imported from commit f4664d712fc40e4af9eb12eae74f37d100499def)
2013-07-08 16:53:13 -04:00
Jessica McKellar dd53c1fbe3 Keep the compose box open on a buddy list-initiative PM.
(imported from commit aabfec328a3c1b64aab653ddcbe04568f5742727)
2013-07-08 16:36:32 -04:00
Allen Rabinovich 0e28fd608c Prevent mention overlaps
(imported from commit e39e9e00f7304d4b811169a5075c5dd98dadad61)
2013-07-08 13:03:31 -07:00
Allen Rabinovich 126f5e37e3 Lighten the appearance of mentions -- lighter colors, no inversion, no bolding, prevent white space wrap
(imported from commit e0acfce3332ce0693d15e8e1c6f22330c760028f)
2013-07-08 13:03:31 -07:00
acrefoot fdb597b4d3 v1 Emoji autocomplete
(imported from commit 0b0d4b004936ce4abc37f44317aec414451f3a8e)
2013-07-08 15:26:39 -04:00
Luke Faraone ddf0189307 Make REST API urls available under /json/
Now we can begin the transition of the app to the same interface that our
API clients use.

(imported from commit 5b5001237722692f27f5de687f01d97fa0b87ed0)
2013-07-08 14:30:20 -04:00
Luke Faraone b6cfb40140 Allow for rest_dispatch-backed webapp API calls
(imported from commit 7813f1911bda92f76921159ef67dd60de9ca6465)
2013-07-08 14:30:20 -04:00
Luke Faraone 6a49e8aa1b Deactivate bots in deactivate_user.py
Closes trac #1434.

(imported from commit d60e338f77b5ee38a43c6cd3edb9b3de0cd0cacf)
2013-07-08 14:30:20 -04:00
Luke Faraone 29cb701444 Allow deactivations to cascade to bots
(imported from commit 1c42013dab02a8f264e814fef63c84cd03102458)
2013-07-08 14:30:20 -04:00
Luke Faraone 37edb61b67 Don't set an unusable password during deactivation.
This would have made reactivations hard, and doesn't really buy us much
additional security.

During deactivation, all a user's current sessions are deactivated and
they are marked as not active. This prevents them from logging in via
the web UI, and makes their API key unusable.

Randomizing their password is probably gratuitious, especially as we
start to allow authorized end-users to deactivate others.

(imported from commit c63d23816da0452a1df821f2fa6c1db2761733da)
2013-07-08 14:00:19 -04:00
Luke Faraone 573bb8e5fd Add populate_db support for deactivating users.
Prior to this commit, populate_db would crash if you had ever deactivated
a user in your development instance's message log.

(imported from commit 227b2c0226a46ef5680443d3dbf62a13ce961e64)
2013-07-08 14:00:19 -04:00
Luke Faraone e5031e5a0f Perform JS validation of the login form.
This reduces roundtrips hopefully and will provide a friendlier error
message than what would otherwise be produced by Django.

(imported from commit 034aeef00043e3bf059583770f6c08c4f73ceeb5)
2013-07-08 14:00:19 -04:00
Luke Faraone c646d95b7a Display specific error messages on the login screen.
This allows us to inform users that the reason they are unable to log in
is because their account has been deactivated. This message (generated by
Django) is only shown when the correct credentials are used and is_active
is False.

(imported from commit 754a4c9af6ec05e8f18cf183bc08b67bacdeb3e0)
2013-07-08 14:00:19 -04:00
Luke Faraone b715cd2034 Block API usage by deactivated users.
Previously we rested on the safety of randomised API keys to ensure that
deactivated users could not use the product. Here, we add an explicit check
to prevent that.

(imported from commit e32f355fb35b898d43503b96efb291f795aac881)
2013-07-08 14:00:19 -04:00
Allen Rabinovich 1b670f0f69 Desaturate background by 75%, lighten by 50%
(imported from commit 8b7ace11d0ecb776c33421ecda0eb31c9e24c07c)
2013-07-08 08:39:32 -07:00
Jessica McKellar fd4205d5cd tutorial: tweak the language of some of the popover titles.
(imported from commit 9a6ebdb39049c56137925dd30ff94b852256a0ba)
2013-07-07 19:30:12 -04:00
Jessica McKellar 867647a230 tutorial: don't try to restore event handlers added during the tutorial.
They end up being duplicate blueslip handlers, and they cause hotkeys
to not work.

(imported from commit 6240d1f2b00b3fe9f02ed2e64f2406b22fa4f6ea)
2013-07-07 19:30:12 -04:00
Jessica McKellar b535037d25 Always show the onboarding checklist if it's unfinished.
(imported from commit da5a84f7b70f5240f9bdd54b25719c3ed88fc1ee)
2013-07-07 19:30:12 -04:00
Jessica McKellar 03d6ec0819 tutorial: add missing info to un-collapse senders in the fake PM conversation.
(imported from commit 60518a9c704ab0a4a1ecc0ad6f5f506e9417437c)
2013-07-07 19:30:12 -04:00
Steve Howell 7a9d7aff0f Restyle list of bots.
(imported from commit 858f0c58b391d92f98b25cf9661543b7bac61865)
2013-07-06 09:49:23 -04:00
Steve Howell 9f95f3f07b Use handlebars for bot rows.
(imported from commit 0dfdb5dd49ec9e553bee0ef837b1010288cb1ea4)
2013-07-06 09:49:22 -04:00