Commit Graph

15772 Commits

Author SHA1 Message Date
Raghav Jajodia cd2d798498 admin: Added realm option to prevent users from changing their email.
A realm option to prevent users from changing their email address is added.
Fixes #3777.
2017-03-04 17:32:48 -08:00
Tim Abbott d25bfb88d3 lint: Ban importing zerver.models in database migrations.
This doesn't work correctly, but in a subtle way.
2017-03-04 17:32:48 -08:00
Tim Abbott 219c519186 migrations: Fix upgrade process for RealmAuditLog migration.
You aren't allowed to import from `zerver.models` in migrations.
2017-03-04 17:24:04 -08:00
Raghav Jajodia ec77aa0dfb user_settings: Add auth check before confirm_email_change.
This isn't strictly necessary, but adds a little bit of extra security
to the overall email change flow.
2017-03-04 17:05:25 -08:00
Rishi Gupta 35f854a2fd analytics: Add test for do_aggregate_to_summary_table. 2017-03-04 16:46:09 -08:00
Rishi Gupta 8feea6c598 analytics: Add LoggingCountStat for number of users. 2017-03-04 16:46:09 -08:00
Rishi Gupta 51b7677db7 Add RealmAuditLog table and record user activation/deactivation events.
The RealmAuditLog will make it easier for server admins to replay history.
2017-03-04 16:45:44 -08:00
hackerkid 3fdad8b64a Align message info action lines vertically. 2017-03-04 16:26:41 -08:00
hackerkid 2f073d9999 Remove sender name from message info action lines. 2017-03-04 16:25:29 -08:00
hackerkid dafee5abe5 Remove timestamp from message info popover. 2017-03-04 16:25:29 -08:00
Raghav Jajodia 4ef4026e6a requirements: Upgrade mypy to version 0.501. 2017-03-04 15:41:11 -08:00
Tim Abbott ab2ce9d5e9 lint: Fix whitespace error with recent mypy annotations. 2017-03-04 15:41:11 -08:00
Tim Abbott 34ade097ca mypy: Work around obnoxious async error. 2017-03-04 15:39:53 -08:00
Tim Abbott 0afe832fc7 check-rabbitmq-consumers: Fix typing import issue. 2017-03-04 15:35:26 -08:00
Tim Abbott 899b59e9d6 dev_settings: Fix linter error in recent mypy work. 2017-03-04 15:34:09 -08:00
Tim Abbott 75e81253f2 mypy: Work around several new mypy bugs in 0.501. 2017-03-04 15:33:39 -08:00
Raghav Jajodia a3a03bd6a5 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta 1453a5bfda Change string_id of test zephyr realm from mit to zephyr.
Also changes Realm.is_zephyr_mirror_realm to use string_id=zephyr instead of
domain=mit.edu.
Part of a larger migration away from Realm.domain.
2017-03-04 12:18:01 -08:00
Steve Howell b611ecfa1e Make get_user_id blueslip errors clear again.
We had a theory that get_user_id() errors were often due to race
conditions related to reloads, so we would only report missing
user ids if subsequent lookups failed 5 seconds later.  It turns
out we still get the blueslip errors, and now we don't get
meaningful tracebacks.  This change makes it so that errors
get reported immediately again.
2017-03-04 07:50:47 -08:00
Rishi Gupta 66371009e2 Set settings.TIME_ZONE to UTC.
If there are weird time-based regressions in the next couple of days, it's
probably due to this.
2017-03-03 19:00:02 -08:00
Rishi Gupta a1813e004e Remove local datetimes from webhook messages.
"Local" datetimes are local to the server (or rather, are using
settings.TIME_ZONE), which in most cases is not what the recipient of the
message is expecting.
2017-03-03 19:00:02 -08:00
adnrs96 9eb47f108c Refactor: Change upload_avatar_image to accept two user profiles.
In this commit we just change the upload_avatar_image function to accept
two user_profiles acting_user_profile and target_user_profile. Basically
email param is dropped for a target_user_profile so that avatar's could
be moved lateron to user id based storage.
2017-03-03 18:15:15 -08:00
Brock Whittaker 9ba0db29e4 Change the content-wrapper to be absolutely positioned.
Now because it isn’t floating left it won’t slide down to a level below
the rest of the content when there are pixel rounding errors with
browser zoom.
2017-03-03 18:10:41 -08:00
Feorlen 6494b84193 Update WordPress webhook to say self-installed blogs are experimental.
Reword the doc to be clear that WordPress.com blogs are supported and
self-installed blogs are experimental. Change the screen captures to show
WordPress.com.

For more details, see:
original issue https://github.com/zulip/zulip/issues/3245
original PR https://github.com/zulip/zulip/pull/2691
2017-03-03 17:15:32 -08:00
Rishi Gupta 8bea47d6b5 analytics: Do a stylistic cleanup of TestProcessCountStat. 2017-03-03 16:12:12 -08:00
Rishi Gupta 6c784d6321 analytics: Refactor COUNT_STATS declaration to not repeat itself. 2017-03-03 16:11:28 -08:00
Rishi Gupta 20255e48a4 analytics: Change messages_sent_to_stream to a daily stat.
Analytics database tables are getting big, and so we're likely moving to a
model where ~all stats are day stats, and we keep hourly stats only for the
last N days.

Also changed the name because:
* messages_sent_* suggests the counts (summed over subgroup) should be the
  same as the other messages_sent stats, but they are different (these don't
  include PMs).
* messages_sent_by_stream:is_bot:day is longer than 32 characters, the max
  allowable length for a BaseCount.property.

Includes a database migration to remove the old stat from the analytics
tables.
2017-03-03 16:11:28 -08:00
Steve Howell b8caf45262 Improve error checking for peer_add/peer_remove events.
If we get invalid events related to stream subscribers, we now
exit earlier to prevent ugly tracebacks.  We may eventually
want to upgrade some of these warnings to errors, once we fix some
of our live-update bugs.  In particular, we don't yet live-update
users when streams go from private to public, so if you add/remove
subscribers to a newly-public stream that a user still thinks is
private, they will not be able to handle the event through no
fault of the codepath that happens during the add/remove.
2017-03-03 16:03:50 -08:00
Sourav Badami 4616ee7762 Enable display of emoji as their alt codes in reactions.
This currently only supports this in emoji reactions, not in actual
emoji in message bodies, but it's a great start for people who want a
text-only view.

Tweaked to update the text by tabbott.

Fixes #3169.
2017-03-03 15:19:34 -08:00
Rishi Gupta 2bbfdeeb7b Fix more errors caught by mypy 0.501.
Another set of relatively easy to review changes.
2017-03-03 14:15:38 -08:00
Rishi Gupta 28d3af0965 Fix several new errors caught by mypy 0.501.
Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
2017-03-03 14:12:52 -08:00
Steve Howell 024168d85d bug fix: Fix hotkeys for compose preview.
We have special code for closing a "compose preview", but
it should only apply to the enter key.  Before this fix, we
would do the "enter" logic for other hotkeys like "j".
2017-03-03 12:22:57 -08:00
Steve Howell a6e1ab4fec hotkeys: Limit calls to ui.home_tab_obscured().
If you are typing a key like "q" in the compose box, there is no
need to check if the home tab is obscured, because the effect of
"q" is not limited by the message pane being opened.
2017-03-03 12:22:57 -08:00
Steve Howell bd6107cc1d hotkeys: Alphabetize switch/case code blocks. 2017-03-03 12:22:57 -08:00
Steve Howell 3c948be436 hotkeys: Extract focus_in_empty_compose().
This saves a bit of unnecessary computation when you type
non-arrow keys, which is especially important in the compose
box for characters that seem ordinary, like "j" and "q", but
which have mappings in some cases.
2017-03-03 12:22:57 -08:00
Steve Howell 64e0e65bac hotkeys: Limit calls to tab_up_down().
If you are not hitting an arrow key, we should prevent doing the
complex logic in tab_up_down().
2017-03-03 12:22:57 -08:00
Steve Howell a2653e3ff5 hotkeys: Process "ignored" hotkeys more efficiently. 2017-03-03 12:22:57 -08:00
Umair Khan d934863d12 i18n: Sort frontend translations.
This commit uses the change done in #3897 to sort the frontend
translations.
2017-03-03 12:32:42 +05:00
Umair Khan 87c5ace24d i18n: Use deterministic order in translations.json.
Fixes: #3897
2017-03-03 12:32:17 +05:00
Harshit Bansal 521e8700d7 emoji: Update NotoColorEmoji emoji set.
Update the existing NotoColorEmoji set to include emoji additions
like gendered professions, rainbow flag, single parent families etc.

Fixes: #3861.
2017-03-02 19:07:34 +05:30
Rishi Gupta 4dc791f393 Clean up timestamps.py and add a test. 2017-03-01 23:03:56 -08:00
Rishi Gupta 95f5c96bec Canonicalize how we convert timestamps to UTC datetimes.
No change in behavior with this commit, just making it easier to write a
future lint rule.
2017-03-01 23:03:56 -08:00
Rishi Gupta 3348083017 docs: Add code style section about naive datetime objects. 2017-03-01 23:03:56 -08:00
Rishi Gupta 9dfefa0a3f actions.py: Use UTC instead of server timezone to determine log directory.
Standardizing the Zulip codebase to use UTC everywhere. Note that unlike
many recent commits in this line, this changes does result in a change in
behavior.
2017-03-01 22:54:28 -08:00
Rishi Gupta 3d07ac0c49 Change timezone-naive datetimes to use timezone.now() where safe to do so.
Change timezone-naive datetimes to use timezone.now() in cases where there
is no change in behavior.
2017-03-01 22:54:28 -08:00
Rishi Gupta c388858e53 Fix timezone errors in ScheduledJob and digest creation filters.
datetime.utcnow() is a timezone-naive datetime. The Django ORM interprets it
in the settings.TIME_ZONE timezone (e.g. 'America/New_York' in the
development server). We perhaps haven't noticed errors yet since with
'America/New_York' all it means is that emails are sent 5 hours early, or a
slightly different set of messages are included in the digest.
2017-03-01 22:54:28 -08:00
Rishi Gupta 562bc6429c Replace datetime.now() with timezone.now() in Django ORM queries.
When you pass a naive datetime to the Django ORM, it uses settings.TIME_ZONE
for the time zone. In the development environment, both settings.TIME_ZONE
and datetime.now() use 'America/New_York', so there is no change in behavior
there. (fromtimestamp with no tz argument uses the same timezone as
datetime.now)

We are soon going to change settings.TIME_ZONE to UTC, so need to remove
naive datetimes from queries to the ORM.
2017-03-01 22:54:28 -08:00
Rishi Gupta 01a4615f6e Change datetime.now to timezone.now in active_user_stats_by_day.
This actually fixes previously broken behavior, since 'date' here gets
turned into the 'day' argument of seconds_active_during_day(day), where
tzinfo is set to UTC.
2017-03-01 22:54:28 -08:00
Rishi Gupta 0218422e96 Use time.time() instead of datetime.now() to measure elapsed time.
Both because it is more idiomatic and because we will soon start enforcing
that all datetimes in Zulip are timezone aware.
2017-03-01 22:54:28 -08:00
Rishi Gupta 2b2be8120f Change datetime.now(tz=X) to timezone.now().
datetime.now with a timezone set is equivalent to timezone.now() if it's
never being printed out, but the latter is cleaner and more idiomatic.
2017-03-01 22:54:28 -08:00