Just before this is pushed to prod, we need to rename the Humbug
notification bot in the database using:
./manage.py change_user_email humbug+notifications@humbughq.comnotification-bot@zulip.com
/etc/init.d/memcached restart
No action is required on pushing this to staging, but in between when
this is pushed to staging and when it is pushed to prod (and that
transition performed), notifying users that they were subscribed to a
new stream will not work on staging.
(imported from commit a0555527dec7b210022b09d9b1d13a7c910a8f9f)
Because there's no guarantee that Hamlet has message IDs 1 and 2, and
the update_unread_counts function didn't return an error in the event
that you passed it a message that the user never received (it instead
silently succeeded), this test was mostly useless.
I just dumped the test_initial_counts function, because it didn't seem
to be doing anything useful.
(imported from commit 4d76104eb9f3b947727a1a030afc0b57054d0daf)
This adds two new functions for parsing out the domain and username
from an email address, and switches our backend to use them and
django.core.validators.valid_email() rather than custom parsing and
raw email.split("@").
(imported from commit 3d6e997d66908811eccb5f82f2f7fe349b40f238)
* Allow email addresses surrounded by <>
* Reject things that look like email addresses that have a path after them
This requires adding a new branch to the regex specifically for email addresses.
* Fix comment whitespace
(imported from commit 0383cd4067ae9ee31f3802e6777a200ba1cbccd6)
Be more restrictive on what characters can be part of a URL and what
characters can precede a URL to prevent linkifying other strings that
come just before a valid URL. Allow : and , before a URL.
(imported from commit f072980b39ff652edf20de0585f256f072d04e88)
save it. This fixes the "Humbug note:" error on old messages that
do not have rendered_content in the DB.
(imported from commit f4664d712fc40e4af9eb12eae74f37d100499def)
We use get_user_profile_by_email() in all our tests now, as it
gives us code coverage on the function itself, and it should be
faster for tests that call it multiple times.
(imported from commit 51ebffb193980fd6f81b0ef5574d96cd92e87364)
This uses a new configuration that enables memcache, but we have
to be careful to bounce KEY_PREFIX on every new test, since data
gets rolled back in the databases between tests, but not in
memcached. We had to break up one test to work around UserProfile
objects actually being cached.
(imported from commit f201cf9cd9e0e4c61d3c384fa8d2bbd5134161e8)
The goal here is to make it easier to do ad hoc profiling on
our codebase, particularly by running tests.
(imported from commit 71da06feb3a369dec8dc4d8391f7f40e4c2d02ff)
The message_stream_count() function uses Django's count() method,
which is more efficient than doing len() on array of full objects.
(imported from commit 9c20a89a2cd02d9d39341132330d03a7f6c8be25)
The tests in GetUpdatesTest had some callback logic that has
been dead code for at least three months. We now fully exercise
the callback codepath and make sure that the callbacks do happen.
(imported from commit f5d8fbab28ecc34dc81d3d0c29058b66c10f378f)
Since in the future we might want requests to add subscriptions to
include things like colors, in_home_view, etc., we're changing the
data format for the add_subscriptions API call to pass each stream as
a dictionary, giving a convenient place to put any added options.
The manual step required here is updating the API version in AFS
available for use with the zephyr_mirror.py system.
(imported from commit 364960cca582a0658f0d334668822045c001b92c)
The previous API was very redundant, which meant that any refactoring
would result in lots of unnecessary changes.
(imported from commit e04f6cbd87c8f65d4eebbe6972d26998faa28a56)
(Before it had been disabled only on prod/staging, but we are
removing it everywhere, motivated by making tests run faster.
In particular, the call to embedly_client.is_supported() was
expensive, as it went over the Internet.)
(imported from commit ea12bf6e7ae84ce7e8023a0d314ecc4c07cbc0a8)
This saves something like 15ms on our 1000 message get_old_messages
queries, and will save even more when we start sending JSON dumps into
our memcached system.
We need to install python-ujson on servers and dev instances before
pushing this to prod.
(imported from commit 373690b7c056d00d2299a7588a33f025104bfbca)