Yep, pretty trivial stuff. Oh, except for that one part:
# # Insert code to record votes here #
Yeah, just that little bit of code that pretty much runs the whole site, the whole framework that just doesn't cut'n'paste into such a block very nicely. :)
The only "pretty easy" routes would be to either: A) render the whole page as usual and then, at or near the "last minute", throw all of that work away and instead output a redirect which would then have to render everything all over again; B) do something like you've written but try to yank aside the bits of processing that are required by the vote-casting code (parsing the cookie, loading your user information, the node cache, etc.). Note that (A) also presents a specific problem of rendering the XP Nodelet but then not displaying it; which means someone might miss an announcement of having gained new level powers (not a horrid problem, but something worth avoiding).
Actually, you are only talking about "vote", not any of the other POST situations at PerlMonks. Voting is handled by an opcode, which gets run fairly early in the whole request processing line, so we could switch to a redirect right after that if voting was POSTed. However, I believe we have forms that mix voting with node updates so we'd have to look into whether those would be messed up by such a change.
I'd rather do something like this for all POST operations -- why "fix" voting but not chatter, node creation, node updates, consideration, etc. But, despite assumptions about how easy something like this must surely be, I'm not convinced that it actually is easy. Certainly, it isn't trivial for me to even work out an easy way to implement it that I'm sure will work without some unfortunately consequences.
I encourage the appointed to look into such a scheme. I've outlined some possible approaches and some potential problems, so there might be a useful starting point there.
- tye
In reply to Re: Redirect after post for happy bookmarking and refreshing (easy)
by tye
in thread Redirect after post for happy bookmarking and refreshing
by dorward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |