I'm doing Bug 216: Renaming, and maaaaaan.
It's kind of funny -- I studiously ignored most of the renaming support requests back on LJ, because it seemed complicated and I didn't want to dig into the code, and now here I am, writing similar logic from scratch *snickers*
I'm having great fun. This seemed like one of the projects where tests would have a great effect, so I spent some time figuring out how to write tests from scratch, rather than just trying to tweak existing tests.
My tests look kinda like this:
( tests )
I'm coding by first writing a bunch of tests, then writing code to make the tests pass. Every time I think of something new I should check for, I dash off a quick TODO block and then go back to writing either my test or my module. That helps me not lose my train of thought, but also means that I don't lose my ideas.
I'm starting with a small set of limited functionality, and then gradually expanding the scope. I actually started by disallowing everything except user-to-unregistered, and now I'm relaxing the rules as I add more. So far, I have personal-user-to-unregistered, with redirect and without redirect, and lots of checking for whether $fromu can rename to $tousername.
I'm in the middle of user-to-other-user, where the second user is just moved out of the way.
I estimate that I'm only about 10% of the way through -- I still need community-to-unregistered, community-to-other-community (or journal??), two-username-swap, keeping or removing various links -- subscriptions and the like, then catching edge cases (loops, openid attempts to rename, etc). And then I need to integrate it into the shop. And after that, I need to build a frontend so people can buy it from the shop *g*
At some point, I'll probably need to catch someone in chat to ask certain questions about the renaming process -- what should happen to usernames that were renamed away from, is swapping usernames one token or two, should you be able to rename a comm to a journal and vice versa, blah blah blah, buuut that can all wait a bit, because I'm sure I'll end up with still yet more questions.
It's kind of funny -- I studiously ignored most of the renaming support requests back on LJ, because it seemed complicated and I didn't want to dig into the code, and now here I am, writing similar logic from scratch *snickers*
I'm having great fun. This seemed like one of the projects where tests would have a great effect, so I spent some time figuring out how to write tests from scratch, rather than just trying to tweak existing tests.
My tests look kinda like this:
( tests )
I'm coding by first writing a bunch of tests, then writing code to make the tests pass. Every time I think of something new I should check for, I dash off a quick TODO block and then go back to writing either my test or my module. That helps me not lose my train of thought, but also means that I don't lose my ideas.
I'm starting with a small set of limited functionality, and then gradually expanding the scope. I actually started by disallowing everything except user-to-unregistered, and now I'm relaxing the rules as I add more. So far, I have personal-user-to-unregistered, with redirect and without redirect, and lots of checking for whether $fromu can rename to $tousername.
I'm in the middle of user-to-other-user, where the second user is just moved out of the way.
I estimate that I'm only about 10% of the way through -- I still need community-to-unregistered, community-to-other-community (or journal??), two-username-swap, keeping or removing various links -- subscriptions and the like, then catching edge cases (loops, openid attempts to rename, etc). And then I need to integrate it into the shop. And after that, I need to build a frontend so people can buy it from the shop *g*
At some point, I'll probably need to catch someone in chat to ask certain questions about the renaming process -- what should happen to usernames that were renamed away from, is swapping usernames one token or two, should you be able to rename a comm to a journal and vice versa, blah blah blah, buuut that can all wait a bit, because I'm sure I'll end up with still yet more questions.