Feb. 20th, 2011

yvi: (Dreamwidth - Developer: winter)
[personal profile] yvi
Yes, I am still here. And actively working on "coming back".

Fuelled in part by [staff profile] denise's Suggestions Hackathon, I submitted three patches for bugs that came from [site community profile] dw_suggestions today.

1. Bug 3487 - improve the workflow while using the poll creator, from http://dw-suggestions.dreamwidth.org/411516.html

From my Bugzilla comment:

This is a bit different from what I originally had in mind.

The problem is: while we can add anchors to the page without problem, actually pointing to those anchors means modifying the URL, which therefore needs to be done before actually loading the page. Since where the from submission points to is not an attribute of the submit button, but of the form it submits (the action attribute), we would then have to have a different form with a different action for every one of the 'insert' buttons. However, that is also a nightmare as we actually *do* need to submit the whole form.

So, the last resort is leaving the page as it is, just with a way to determine where we would like out focus to be and then using JavaScript to focus on the correct anchor after loading, which is what I did here. The page without JS enabled works just like before

2. Bug 3469 - Don't show backdated entries on Latest Things, from http://dw-suggestions.dreamwidth.org/487878.html

This was straight-forward: make a function for checking whether an entry is backdated (I can't believe this didn't already exist), then not firing the LatestPage worker when the entry is backdated. I can't actually test my solution to this in action, but it was easy enough to just test the new function, so it should work.

3. Bug 1668 - Inbox should not open links in new windows , from http://dw-suggestions.dreamwidth.org/18026.html

Wow, this one's actually from summer 2009! But I'm not surprised nobody fixed this yet - it was a bit tricky, though when I realized what happened I headdesked a bit because I run into this all the time at work. From my Bugzilla comment:

As [personal profile] kareila said in http://bugs.dwscoalition.org/show_bug.cgi?id=1284#c3 , just loading the link into the same window would open a confirm dialog saying ""Logger popup window blocked. Using confirm() instead. no data". That error comes from devel.js, which is only included on dev servers and is trying to open a window to inform you of an error, but is blocked by a pop-up blocker :)

So, why is it throwing an error saying "no data"? Well, because AJAX doesn't work that way - in the code we were making the AJAX request and then opening a new window. But AJAX is asynchronous - the window was opened before the request was finished, which is fine when opening a new window, as the old window just gets the reply and everything works. If you open the link in the same window that means you make the request, and then navigate away from the page without waiting for the reply. The request is aborted and throws an error.

But thankfully, JS allows passing of functions, so that's my solution: pass the function that's supposed to be excuted and execute it when the request was successful.

And yes, today was a day for Bugzilla comment novellas.


Yvi's development braindump

February 2011


Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 25th, 2017 01:29 pm
Powered by Dreamwidth Studios