Coder Social home page Coder Social logo

350dotorg / localpower Goto Github PK

View Code? Open in Web Editor NEW

This project forked from allianceforclimateprotection/repowerathome

6.0 6.0 2.0 74.25 MB

Web platform and social network for mapping and connecting distributed communities around collaborative actions.

Home Page: http://350.org

License: Other

Python 43.40% Shell 1.18% JavaScript 55.42%

localpower's People

Contributors

ejucovy avatar ericbuckley avatar jonlesser avatar joshsziegler avatar rmarianski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ejucovy woodhull

localpower's Issues

Add manage.py command for regenerating and syncing POT file

For the near term I'm going to be adding a lot of new translation strings. For Transifex integration (and generally to keep track of things) I find it useful to maintain a master POT file as well as per-language PO files. Currently I've been doing this by hacking the Django core manage.py makemessages command to regenerate and preserve the POT file after adding new translation strings, and then running tx push -s to update the project's Transifex database.

It would be more convenient to have a custom manage.py commands for the former, and possibly integrate the latter into the same step as well. This will involve copying and pasting a bunch of code from Django, unfortunately -- that could also result in an upstream patch to the makemessages command if it's worth it.

Action admin form: cannot add tags while creating new Action

Reproduction steps:

  • Log in as a site admin
  • Visit /admin/actions/action/add
  • Fill out all the fields to create a new Action
  • Click the checkboxes to select one or more available "tags" to associate with the new Action
  • Hit "save and continue editing"

Expected result: the tag checkboxes will be checked, indicating the associated tags.
Actual result: no tag checkboxes are checked -- no tags are associated.

I introduced this behavior of silent failure in the save method in f43750d -- because, if that commit is reverted, the same steps result in a server error instead. This is because we try to link the tags to the action instance before it's fully created (i.e. it has no primary key in the database yet) which causes an error.

Subscribe users to a specific ActionKit page

Users should be subscribed to a specific (configurable) ActionKit page, but only once:

  • If a user unsubscribes from the ActionKit page, future syncs of his data shouldn't resubscribe him to the ActionKit page.
  • If a user's information already exists in ActionKit before he creates a Local Power account, he should be subscribed to the ActionKit page when he creates his Local Power account, if and only if he's never been subscribed to the ActionKit page in question.

A number of templates try to extend a missing "base.html"

Various templates try to {% extend "base.html" %} which doesn't exist anywhere in the repo. As a result, these views seem to silently fail to render their expected output. (As an aside, I'm not sure why the failure is silent.) The views affected include Create Group Discussion, View/Respond to Group Discussion, Group Search Results, and others scattered around the codebase.

My guess is that there used to be a base.html template in the old codebase, but it was replaced with new and better base layouts during the big redesign/refactoring, and these templates haven't been updated yet?

egj@alcibiades:~/Code/localpower/localpower$ grep -r base.html .
./invite/templates/invite/welcome.html:{% extends "base.html" %}
./actions/templates/actions/action_cancel.html:{% extends "actions/base.html" %}
grep: ./messaging/.#models.py: No such file or directory
./templates/base/nav.html:{% extends "base/base.html" %}
./templates/500.html:{% extends "base/base.html" %}
./templates/admin/base_site.html:{% extends "admin/base.html" %}
./templates/rah/home_page.html:{% extends "base/base.html" %}
./records/templates/records/comment_mark_useful.html:{% extends "records/base.html" %}
./records/templates/records/comment_create.html:{% extends "records/base.html" %}
./records/templates/records/action_complete.html:{% extends "records/base.html" %}
./records/templates/records/action_commitment.html:{% extends "records/base.html" %}
./records/templates/records/mag_request_party_host_info.html:{% extends "records/base.html" %}
./records/templates/records/group_create.html:{% extends "records/base.html" %}
./records/templates/records/event_create.html:{% extends "records/base.html" %}
./records/templates/records/mag_tweet.html:{% extends "records/base.html" %}
./records/templates/records/mag_invite_friend.html:{% extends "records/base.html" %}
./records/templates/records/ask_to_share.html:{% extends "base.html" %}
./groups/templates/groups/_search_listing.html:{% extends "groups/base.html" %}
./groups/templates/groups/group_disc_list.html:{% extends "groups/base.html" %}
./groups/templates/groups/base.html:{% extends "base.html" %}
./commitments/templates/commitments/show.html:{% extends "commitments/base.html" %}
./commitments/templates/commitments/base.html:{% extends "base.html" %}
./commitments/templates/commitments/card.html:{% extends "commitments/base.html" %}
./tools/requirejs/tests/all.js:    doh.registerUrl("simple-badbase", "../simple-badbase.html");
./basic/blog/templates/blog/base_blog.html:{% extends "base.html" %}

Use django.core.signing to securely encode Reply-To header value

I've rolled my own code for stringifying, signing and hashing the data encoded in the Reply-To header for messages sent when Discussions are posted.

I just noticed that Django 1.4 will include a new django.core.signing module that does this itself. For the most part it looks equivalent to my hand-rolled code. But it has a few nice extra features like custom salts and optional zlib compression. More importantly, it's presumably been security-reviewed, and will be a standard implementation for this kind of thing.

We're using Django 1.2, but from a quick glance at https://code.djangoproject.com/browser/django/trunk/django/core/signing.py, it looks like it should work fine if it's just dropped in to a Django 1.2 file; it doesn't seem to have any complex external dependencies or (AFAICT) rely on any new Django features or APIs. So it should be straightforward to pull in that file to the source tree, or package it as a standalone library, and rewrite the header-building code to use it.

Extend Message/Stream system to receive optional Reply-To parameter

Currently the Message/Stream system never takes a "From" parameter. When it constructs an EmailMessage it always passes from_email=None (https://github.com/350org/localpower/blob/master/messaging/models.py#L210) which tells Django to set the mail's sender to the value of settings.DEFAULT_FROM_EMAIL.

In order to reply by email to discussions, we'd want to set the message's from/reply-to to some other address, which could receive replies and process them. We don't want all messages to have this special reply-to address, because system messages and notifications shouldn't be respondable -- and we may want a human at the other end in case users need to contact somebody about a system-level message they received.

So, the Message/Stream system should be extended to take an optional From parameter. This value would then be constructed and passed in from the code that alerts users to a new message in a group discussion (https://github.com/350org/localpower/blob/master/groups/models.py#L363)

Audit and create notification messages for Community Events and Challenges

Initial answers from Jon W. about who should be notified about Actions and Challenges -- might need further clarification for some of these:

  • Creation of an Event/Action/Challenge -- not linked to a Community

No email notification.

  • Creation of an Event/Action/Challenge -- linked to a Community

Emails to community for event and challenge

  • Linking of an existing Event/Action/Challenge to a Community

Emails to community for event and challenge

  • First-ever comment on an Event/Action/Challenge that is not linked to a Community

No email

  • First-ever comment on an Event/Action/Challenge linked to a Community

No email

  • Additional comments on an Event/Action/Challenge that is not linked to a Community

No email to community.

  • Additional comments on an Event/Action/Challenge linked to a Community

No email to community.

  • Other events related to Event/Action/Challenge -- user makes an Action commitment, signs a Challenge petition, rsvps to an Event, etc

No email to community.

Event detail page

Put event detail page into the right template and match comp.

There is an existing comp that needs to be attached to this ticket.

Flash messages need to be integrated into the page design

Flash messages are the things that show up at the top of the page with a warning, information, or a confirmation. They are built in and being generated, but they are not output in the templates.

They need to be designed and then coded in.

group settings page

Editing group settings page needs to be cleaned up. Not sure if implementing tabs is better than have have three separate stand alone forms linked from the group detail page.

After some work is done, maybe open more specific tickets.

Invite friends

There is functionality to invite friends to the site. It used to exist as a modal dialog, but should be moved to a full page form template.

Edit your profile links

On the logged in home page, Edit your profile link in the tab bar should point to profile edit screen. As should the link the left column.

There is a URL already defined for this.

Infer user location from associated community location if necessary

We don't want to require users to provide a zipcode when they register. However, collecting users' physical location (at least city and country) is pretty crucial to 350.org's ongoing organizing efforts.

We do require communities to provide a location ("Headquarters") -- and we also require events to provide a location ("Street Address")

So if a user doesn't provide a location, we can guess at that user's location based on his associations.

Whenever a user joins a community or an event, check if the user has a zipcode filled in on his profile; if he doesn't, set the zipcode on his profile to the zipcode of the community or event that he just joined.

By modifying the user record itself, the user post_save signal will fire, and this data will get pushed over to ActionKit as well.

Secure the App Engine -> Django relay view

The HTTP POST from App Engine to the Django site should be over HTTPS:

  • Is it straightforward to make an https request with App Engine's make_fetch_call?
  • How do we configure that particular Django view to receive calls over HTTPS instead of HTTP? It looks like the login view is already HTTPS on the dev server, and all other URLs redirect HTTPS to HTTP, so this is presumably already configured somewhere.

That is probably sufficient; but we may additionally want to ensure that only the trusted App Engine server can post messages to the Django site. For example:

  • We could only accept connections from a known IP address, but App Engine doesn't give you static IP.
  • We could sign the request with some shared secret.

recent badges earned

On the logged out home page, create list of "recent badges earned" and a button link to view all badges.

Complete My Calendar feature

First, remove from the logged in nav until this feature is complete

My Calendar is an ICS feed that contains project commitment dates and events. The idea is to get users to subscribe to it in their calendar program and then because we generate the feed dynamically, their calendar is always up-to-date with the site.

Links and downloads module

This module displays a list of relevant links. Authorized users (group managers, site admins, etc.) should be able to add links.

Image gallery module

Create a module for viewing and uploading images and videos. This needs more specification and some wireframes before coding.

Create Twitter and Facebook app IDs

Need to create facebook applications for local, dev, and production environments. The main difference between these is the application URLS (127.0.0.1, dev.groups.350.org, groups.350.org). This will result in three application IDs and three secrets. Send keys and secrets to jonlesser. Add [email protected], Jon W, and Ethan as developers on the facebook apps.

Similar procedure for twitter.

This is necessary for the Join/Login with facebook features to work.

Add keys to private bucket on S3 and add directly to the local_settings on the dev server.

Receive emails by HTTP POST

We need some way of receiving inbound email messages and translating them to an HTTP POST request to the primary Django project, where they'll be received, parsed, and built into a Discussion reply.

Ideally this component should:

  • do as little as possible -- so that debugging and logic can remain familiar and centralized in the primary Django project
  • be maintainable with minimal effort
  • be sufficiently generic that its infrastructure can be swapped out without any major disruptions to the rest of the stack

Then, there needs to be a Django view to receive them on the other end. For now, this can be very application-specific, and assume that all messages received by it are attempts to create a new Discussion reply.

Project commitment widget

Project commitment widget needs to work.

Consider changing interaction from date pick on a calendar to time frame selected from a drop down (1 day, 1 week, 2 weeks, 3 weeks, 1 month, 3 months, 6 months, 1 year).

Cancelling commitment isn't working either.

"When do you think you'll complete this project?" at the bottom of project detail pages is from this.

Admin site: user "change password form" link is broken

When you visit a user form in the admin site, and click on the "change password form" link to edit the user's password from the admin site, the link doesn't work -- it looks for a user with PK /password instead for some reason.

broaden featured users query

For the logged out homepage, broaden featured users selection query or get some pre-pilot users to sign up so there is some content there.

Update existing ActionKit record when email address changes

The naive implementation of pushing ActionKit user info will result in a new record being created when the user's email address is changed -- we have to use save explicitly instead of save_or_create:

>>> from actionkit_usersync.utils import get_client
>>> ak = get_client()
>>> id=ak.User.get({"email": "[email protected]"})['id']
>>> ak.User.save_or_create({'id': id, 'email': "[email protected]"})['id'] == id
False
>>> ak.User.save({'id': id, 'email': "[email protected]"})['id'] == id
True
>>> ak.User.get({'id': id})['email'] == "[email protected]"})
True

This means the current implementation of pushing records (which uses save_or_create always) isn't sufficient.

The simplest solution would be to check whether the email address is being changed, and use save explicitly only in that case. But Django's pre_save and post_save signals don't give access to the fields being modified, or their old values! This is a problem -- email address is the only way we're looking up ActionKit records at the moment, so we'd have no way of retrieving the old record.

Two possible approaches:

  • Try to put together a custom signal that bears more information
  • Add a new database field that stores the ActionKit user ID for each local record

I'd prefer the former, if possible, but I can't find any hints on Google, so I'm not very optimistic.

Projects tab on the logged in homepage

Projects tab on the logged in homepage should show all completed and committed projects in the center left column. (use identical nugget as projects landing page)

Google CSE for the site

The search functionality is based on a Google Custom Search Engine. Create a new CSE that searches groups.350.org and add the ID to the templates.

Should we just use 350's exiting CSE?
http://www.google.com/cse/home?cx=014706715754000189344:phzzho2nsim

Notes on CSEs:

The content of the site needs to be visible to Google for the indexing to happen. It can also take a day or two for new content to show up in the search results.

The search also will always search against the live production site, even if the search originates on a dev or local instance.

Profile edit pages needs to be fitted into a template.

Profile edit page (/user/edit/) needs to be stuffed into a form page template.

There are three sections to this page. Not sure if we should implement tabs or combine into one larger form. A similar problem exist for the group editing page.

featured groups

Create some groups that will appear in the featured groups module on the logged out home page.

Let site admins manually push updated Transifex translations to dev site

Jon W. would like to be able to push updated translations from Transifex to the site without intervention from a programmer/sysadmin. We could do this with a standalone web app, password-protected, that he can visit to push a "Deploy Translations" button. Behind the scenes, this would have to:

  • git clone the latest code
  • tx pull the translations from Transifex
  • manage.py compilemessages
  • git commit && git push the translations to the repo
  • fab staging deploy:translations_only=True (or something like that) which would just pull the latest PO and MO files and restart the uwsgi server

Build custom Reply-To for each "New Discussion" Message

In order for users to reply to a discussion via email, we need to set a custom Reply-To header for the email. This will involve:

  • Determining what information to embed in the reply-to field, and how to encode it; and building a method on the Discussion model which receives a user_object (email recipient) and returns an extra_headers dict
  • Associating that method with the "New Community Discussion" Message by adding a extra_headers_function, referring to the aforementioned new method, to the appropriate Message object in the database
  • Modifying the data fixture providing the "New Community Discussion" Message that ships with the application, to make sure it reflects the above change

See also #5.

While we're at it we could also set some mailing list headers (http://www.jamesshuggins.com/h/web1/list-email-headers.htm) -- this is purely a nice-to-have though.

Hook up WYSIWYG editor to action "content" field in admin form

The "content" field of actions (projects) accepts HTML (actually django-templated HTML with a soft requirement that at least one {% action_form %} tag be present) and is intended to be used by site staff to create and edit the text that appears to end-users.

Jon W. has requested making this field WYSIWYG for ease of use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.