[dw-free] Revamp /update
[commit: http://hg.dwscoalition.org/dw-free/rev/394132d58cd6]
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Make exampleusername.dreamwidth.org/entry/new redirect to
www.dreamwidth.org/entry/exampleusername/new
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Make exampleusername.dreamwidth.org/entry/new redirect to
www.dreamwidth.org/entry/exampleusername/new
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/Controller/Entry.pm
-------------------------------------------------------------------------------- diff -r 1869b6232370 -r 394132d58cd6 cgi-bin/DW/Controller/Entry.pm --- a/cgi-bin/DW/Controller/Entry.pm Mon Dec 05 12:09:39 2011 +0800 +++ b/cgi-bin/DW/Controller/Entry.pm Mon Dec 05 12:11:00 2011 +0800 @@ -47,6 +47,15 @@ # /entry/username/ditemid/edit #DW::Routing->register_regex( '^/entry/(?:(.+)/)?(\d+)/edit$', \&edit_handler, app => 1 ); +DW::Routing->register_string( '/entry/new', \&_new_handler_userspace, user => 1 ); + +# redirect to app-space +sub _user_to_app_role { + my ( $path ) = @_; + return DW::Request->get->redirect( "$LJ::SITEROOT$path" ); +} + +sub _new_handler_userspace { return _user_to_app_role( "/entry/$_[0]->{username}/new" ) } =head2 C<< DW::Controller::Entry::new_handler( ) >> --------------------------------------------------------------------------------