Commit Graph

13667 Commits

Author SHA1 Message Date
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
umkay dc8463e09c analytics: Remove incorrect filter args for stat.
The filter args dictionary applies to the X table in a count X by Y query,
which in this case is the zerver_message table. This stat had an incorrect set
of arguments meant for the zerver_userprofile table.
2016-11-10 12:25:21 -08:00
paxapy 4438a09b30 Add migration to create attachments for old uploads.
This migration ensures that all historically uploaded files from
before we started tracking files in the Zulip database via the
Attachment model have Attachment objects.

This has been tested by tabbott against a production server to ensure
that it results in all old uploaded files having corresponding
attachment objects.

Merging this change is a key prerequisite for making our adding
attachment access controls in an enforcing fashion.
2016-11-10 12:14:08 -08:00
Umair Khan 07d73996d4 Django 1.10: Add tool to check urls.
Checking urls through linter was proving to be difficult as
the urls can span multiple lines.
2016-11-10 16:20:04 +05:00
Umair Khan 86b75aade2 Django 1.10: Fix i18n tests.
SimpleCookie does not accept unicode strings and the name of
Simplified Chinese is changed to zh-HANS.
2016-11-10 16:20:03 +05:00
Umair Khan ee3ec96f38 Django 1.10: Suppress logs. 2016-11-10 16:20:03 +05:00
Umair Khan 1e91b946d9 Django 1.10: Sign google oauth requests using csrf token.
In Django 1.10, the get_token function returns a salted version of
csrf token which changes whenever get_token is called. This gives
us wrong result when we compare the state after returning from
Google authentication servers. The solution is to unsalt the token
and use that token to find the HMAC so that we get the same value
as long as t he token is same.
2016-11-10 16:20:03 +05:00
Umair Khan d837753d4b Django 1.10: Update analytics urls. 2016-11-10 16:20:03 +05:00
Umair Khan e127325fce Django 1.10: Update zilencer urls. 2016-11-10 16:20:03 +05:00
Umair Khan da78f27934 Django 1.10: Upgrade zproject urls. 2016-11-10 16:20:03 +05:00
Umair Khan 010ab0637d Django 1.10: Upgrade integration urls. 2016-11-10 16:20:03 +05:00
Umair Khan fa6b607fc2 Django 1.10: Upgrade legacy urls. 2016-11-10 16:20:02 +05:00
Umair Khan f8e569cb69 Django 1.10: Upgrade urls of dev_urls.py. 2016-11-10 16:20:02 +05:00
Tim Abbott 46a601c4c4 Import the user documentation guide into new user docs system.
This is an import of
https://github.com/brannerchinese/zulip_user_documentation
into the main Zulip repository.  Important changes include:

* Removed trailing whitespace.
* Changed URLs for images to work properly.
2016-11-09 21:39:55 -08:00
Tim Abbott 02855498e9 render_markdown_path: Add fenced code and codehilite support.
This also causes us to only initialize the extensions once per process.
2016-11-09 21:39:55 -08:00
Tim Abbott 08043ff9a0 render_markdown_path: Add anchors for table-of-contents. 2016-11-09 21:39:55 -08:00
Tim Abbott 0568ade496 render_markdown_path: Decode UTF-8 after reading from disk.
This is required to support unicode characters in our markdown filesq.
2016-11-09 21:39:55 -08:00
Tim Abbott cf2007d4e0 docs: Add a simple markdown-based help center.
The plan is to use this for adding user documentation to Zulip.
2016-11-09 21:39:55 -08:00
Tim Abbott a715f083bb render_markdown_path: Allow HTML in templates. 2016-11-09 21:12:44 -08:00
Tim Abbott d9b1a5a417 render_markdown_path: Don't cache in development.
That caching made the edit/refresh cycle for docs annoying.
2016-11-09 21:12:44 -08:00
Brock Whittaker 129d88825c messages: Wrap inline code blocks on long lines.
In 25b28bf82c and then
cb1bc70ab0, we attempted to make long
code blocks scroll in a reasonable fashion, without much success.

This change causes code blocks to be line-wrapped, without needing to
set `overflow-y: hidden` for paragraphs (which cause problems with
taller elements like emoji that overlfowed wrong).  Our octopi finally
have legs again.

It's not clear that this is the final answer, but it's the best
version we've found so far.
2016-11-09 19:26:45 -08:00
Steve Howell 16e37f8874 Limit compose at-mention typeaheads to realm users.
Fixes #2240
2016-11-09 19:20:58 -08:00
Rishi Gupta 1c869c2287 models.email_allowed_for_realm: Use RealmAlias instead of domain. 2016-11-09 16:31:48 -08:00
Rishi Gupta 70ab79d056 accounts_register: Apply email_allowed_for_realm check to all code paths.
Needed in case the user was allowed to join the realm when they got the
confirmation email, but is no longer allowed to do so. Check was previously
applied to invited users (those with a prereg_user.referred_by), and is now
applied regardless of how they get to accounts_register.
2016-11-09 16:31:48 -08:00
Rishi Gupta d5f99c4438 views.accounts_register: Remove almost all dependence on domain. 2016-11-09 16:31:48 -08:00
Rishi Gupta 823915fa46 UserSignUpTest: Add tests for forms.HomepageForm. 2016-11-09 16:31:48 -08:00
Rishi Gupta 1e6ae537bd Remove special flow for open realm sign-up when realms have subdomains.
Redirects /register/<domain> to /accounts/register when
REALMS_HAVE_SUBDOMAINS.
2016-11-09 16:31:48 -08:00
Rishi Gupta b114690bd5 forms.HomepageForm: Rename subdomain to string_id.
No change to behavior.
2016-11-09 16:31:48 -08:00
Rishi Gupta 38f1ab325c forms.HomepageForm: No longer take a domain argument.
domain was unused. No change to behavior.
2016-11-09 16:31:48 -08:00
Rishi Gupta ff2fe0cf92 forms.HomepageForm: Improve error messages.
No change to behavior.
2016-11-09 16:31:48 -08:00
Rishi Gupta d1acc54b2f forms.HomepageForm: Stop users from signing up for realms they can't join.
We do this check in accounts_register as well, but might as well tell the
user now not to get their hopes up.
2016-11-09 16:31:48 -08:00
Rishi Gupta 82b60ad29e forms.HomepageForm: Disallow mit mailing lists from open mirroring realms.
I'm guessing the old behavior was unintended, rather than policy.
2016-11-09 16:31:48 -08:00
Rishi Gupta 78dee73511 forms.HomepageForm: Consolidate check for open realm.
Does change/fix behavior in various corner cases when the domain passed in
to HomepageForm and subdomain passed in to HomepageForm correspond to
different realms.
2016-11-09 16:31:48 -08:00
Rishi Gupta 01526677c4 forms.HomepageForm: Use string_id to determine intended signup realm.
If the user comes in to HomepageForm with a set subdomain, use that to
determine the signup realm instead of the email address.

In the non-REALMS_HAVE_SUBDOMAINS case, still allow using the email address
if no subdomain is passed.
2016-11-09 16:31:48 -08:00
Rishi Gupta eddd8fb5fe forms.HomepageForm: Reorder email checks for future edits.
No change to behavior.
2016-11-09 16:31:48 -08:00
Rishi Gupta 6e517b2dec models.py: Disable unique_open_realm feature when realms have subdomains. 2016-11-09 16:31:48 -08:00
Rishi Gupta 35481014a4 views.create_homepage_form: Ensure domain and subdomain match.
Ensure domain and subdomain correspond to the same realm when being passed
to forms.HomepageForm. Previously this was not the case when e.g. we got
here via the /register/<domain> endpoint.

This also effectively disables the register/<domain> endpoint when
REALMS_HAVE_SUBDOMAINS, or rather, foo.server.org/register/bar.com will try
to register you for the realm with string_id foo rather than realm with
domain bar.com.
2016-11-09 16:31:48 -08:00
Rishi Gupta 60b5b82b57 forms.py: Merge get_valid_realm into caller.
No change to behavior.
2016-11-09 16:31:48 -08:00
Tim Abbott f6d3c63a01 realm_alias: Access realm alias objects in lower-case. 2016-11-09 16:31:48 -08:00
Shashank 702d3cf103 Check provision version in run-dev.py.
Don't start run-dev.py if the provisioning version is
incorrect.
2016-11-09 16:06:16 -08:00
Umair Khan eade575267 Django 1.10: Redirect is not permanent by default. 2016-11-09 15:29:58 -08:00
Umair Khan cfded8b5af Django 1.10: Resolve QuerySet returned by model_to_dict.
Django 1.10 resolves ManyToManyField into a QuerySet in model_to_dict.
This commit further resolves the QuerySet to the primary keys.
2016-11-09 15:29:58 -08:00
Umair Khan f78752466c Django 1.10: URLs in response contain just the path.
The response object of the Django test client only contains the
path of the url.
2016-11-09 15:26:07 -08:00
Umair Khan dd174b537f Django 1.10: Update code according to new get_user function.
`django.contrib.auth.get_user` function is updated in Django 1.10, due to
which everytime we update the password of the user the password hash changes.
This causes authentication failure. Previously, our code worked correctly
because we use our own session middleware and the `get_user` code had a
conditional statement which allowed our code to bypass the authentication
code.
2016-11-09 15:26:07 -08:00
paxapy 6d93b3b60c lint: Fix E703 pep8 violations. 2016-11-09 15:18:35 -08:00