Groundwork for allowing stats like "Monthly Active Users".
CountStat.interval is no longer as clean a value as before, so removed it
from views.get_chart_data. It wasn't being used by the frontend anyway.
Removing interval from logger calls in counts.py is not a big loss since we
now include the frequency (which is typically also the interval) in
CountStat.property.
The comment explains this change is fairly good detail. This change
is designed to fix complaints that sometimes clicking on a message to
reply doesn't work, which we can reproduce as being caused by clicks
that happen simultaneous with a few pixels of mouse motion at the same
time as the click.
Comment and commit message rewritten by tabbott for clarity.
This fixes an issue with a nondeterministic number of database queries
being used in fetching bulk messages from the database. The source of
the problem was that we were fetching _all_ messages, not just the 600
that had been created by the test, and thus if the set of streams
present in messages in the test fixtures (which is random) changes,
the number of streams used (and thus number of queries) would change.
Apparently, Django's _destroy_test_db has a mostly unnecessary
sleep(1) before dropping the database, which obviously wastes a bunch
of time in the single-test runtime of their database teardown logic.
We work around this by monkey-patching that function to not do the sleep.
Instead of zulip_test, use zulip_test_template for backend DB. This
makes sure that the DB used by backend tests is different from the
DB, which will be zulip_test, used by Casper tests.
In backend tests, only call generate-fixtures when --generate-fixtures
is explicitly passed or is_template_database_current() returns False.
We don't need to flush cache for backend tests because we bounce the key
prefix used to create cache keys before running every test
The extraction here is straightforward, but where we put the
caller is a slightly subtle change. Instead of continuing to
invoke this code at the end of show_box(), we instead call it
at the beginning of complete_starting_tasks(). This change is
valid, because show_box() and complete_starting_tasks() are only
ever called from compose.start().
Show a user friendly message to the user if email is invalid.
Currently we show a generic message:
"Your username or password is incorrect."
The only backend which can accept a non-email username is LDAP.
So we check if it is enabled before showing the custom message.
The code in fixtures.py is only called from populate_analytics_db, and is
only used for generating pretty fixture data for manual testing. This commit
adds tests for a few things that were easy to add tests for, and provides
some minimal coverage of the file, but is not meant to be comprehensive.
Before this fix, if you scrolled back in your PM history for a
person that you've had recent conversations with, then we would
backdate the record of their most recent conversation, and this
would make the sort ordering under the "Private messages"
section incorrect.
This commit fixes this error by re-writing the function
message_store.insert_recent_private_message() to check any
prior timestamps for that user. It also optimizes the function
a bit to short-circuit in O(1) time for cases where a recipient
already has a more recent timestamp, by having a Dict keyed
on user_ids_string.
This function is slightly easier to unit test, and it isolates us
from changing message formats. This removes some extraneous
code that would ensure that message timestamps were >= 0 that
probaby dates back to some really old migrations.
This is mostly moving code, but we do add short-circuit logic
for some live-updating methods here.
Note that this affects two different sections of the admin app:
* Organization settings
* Authentication methods
We really want to move to one module per section, but there is some
legacy coupling that makes this difficult for now.
We had a bug for a while where if somebody subscribed you to a
stream, and you were narrowed to another stream, we'd show
a button in the "trailing bookend" to "Unsubscribe" from the
current stream. I'm not sure how long we had that bug, but it
was at least a couple months old, and I couldn't track down an
issue for it.
Now we make sure that the stream event for the subscription is
related to the current narrow.
Users should still see messages when they subscribe/unsubscribe
themselves or when another user re-subscribes them to the stream
that they are narrowed to.
This preserves the scrolltop state of the user when they enter into
an integration's specifics, so when they exit out it scrolls them
back down the page.
Fixes: #4424.
The pages in question are already cached automatically by Zulip, and
the lru_cache decorator doesn't work, since `context` might contain
unhashable objects.
This moves the logic to embed the translated string “(no topic)” to
only render in the handlebars template rather than saving in
localStorage and therefore being added to the message topic and
eventually put in the database if not changed.
Fixes: #4378.
This removes individual tests for realm properties and replaces them
with a generic do_set_realm_property_test function to test each
property in the Realm.property_types attribute.
Addresses part of #3854.
This replaces individual tests for realm properties with a generic
do_test_realm_update_api function to test each property in the
Realm.property_types attribute.
Addresses part of #3854.