1) I have fixed the bugs & pushed changes related to forge to the same branch
in that repo
2) before_save approach for EmailAddress doesn't work for us, since it is a)
called only when you actually save it to the database b) although it is getting
called during flush, the actual saved data is not right in the resulting saved
object.(looks like that changes I do to data does not reflect on the model) c)
In some cases we need to generate an object without saving to DB & it won't be
canonical, thus I've just renamed upsert -> create
3)I have updated the migration script with raw mongo JS. The approach is the
following:
~~~~~~
//1) Copy to the new collection with data updates - 8min for 3m records on the
sandbox
db.email_address.find().snapshot().forEach(function(e){
e.email = e._id;
e._id = new ObjectId();
db.email_address_new.insert(e);
db.email_address.update({'_id': e._id}, {'migrated': true})
});
//2) pull new code to production
//3) Rename collections - takes no time
db.email_address.renameCollection("email_address_old", {dropTarget: true})
db.email_address_new.renameCollection("email_address", {dropTarget: true})
//4) Post Migration - copy/update all the object which were created between
1)&2)
// Should be quick, is done just in case if any data was pushed to
email_address while we are deploying.
db.email_address_old.find({'migrated': {'$not':
false}}).snapshot().forEach(function(e){
e.email = e._id;
e._id = new ObjectId();
db.email_address.insert(e);
db.email_address_old.update({'_id': e._id}, {'migrated': true})
});
// Optional - we can remove the old collection in case the push is success.
db.email_address_old.drop()
~~~~~~
---
** [tickets:#7527] Email address associations need better user associations**
**Status:** in-progress
**Milestone:** forge-aug-8
**Created:** Wed Jul 02, 2014 09:08 PM UTC by Dave Brondsema
**Last Updated:** Fri Jul 25, 2014 04:56 PM UTC
**Owner:** Alexander Luberg
A user can claim any address and even if they don't verify it, that still
blocks someone else from trying to claim it. This can be fixed in auth.py like:
~~~~
::diff
- if M.EmailAddress.query.get(_id=new_addr['addr']):
+ if M.EmailAddress.query.get(_id=new_addr['addr'],
confirmed=True):
~~~~
However this leads to another problem, if multiple users have the same email
address claimed (but not verified). One user sees a "verify" link, but the
other sees "Unknown addr obj [email protected]", on the preferences page.
There probably are more issues when it gets to verification, too.
---
Sent from sourceforge.net because [email protected] is subscribed to
https://sourceforge.net/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/allura/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.