350dotorg / localpower

Web platform and social network for mapping and connecting distributed communities around collaborative actions.
http://350.org
Other
6 stars 2 forks source link

Infer user location from associated community location if necessary #4

Open ejucovy opened 13 years ago

ejucovy commented 13 years ago

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.

ejucovy commented 13 years ago

Implemented in bce1379 -- for users joining groups. I haven't yet implemented it for events.

Also, it's somewhat overeager: the code will fire any time a user's group associations change, which includes becoming an admin of the group. That seems fine to me, since we want to be aggressive about collecting user locations.

abea commented 13 years ago

As long as it's not writing over what's already there in any case, this should be fine.