denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)
Denise ([staff profile] denise) wrote in [site community profile] dw_dev2012-02-02 02:12 pm
Entry tags:

Code tour, 23 Jan - 1 Feb 2012

Hello, all! I realized today that our code tour generator had missed a bunch of bugs being resolved, and there had been a few resolved since the last code tour, so I kicked Bugzilla until it turned up all the ones that the code tour generator wasn't picking up.

Behind the cut: 16 bugs for you to peruse. None of these will be live until the next code push.



Bug 4302: Form for editing entry shows up even when you don't own the journal in question
Category: Making things make sense
Patch by: [personal profile] fu
Description: If you manually construct the URL to edit a public entry that isn't yours, you'll be shown the entry editing page with all the buttons greyed out. (You can't see locked entries this way -- only entries that you were already able to see -- but still.) This patch doublechecks that you own the entry (or can manage it somehow) and doesn't show you the form if you can't actually make any changes.

Bug 4262: Add Tumblr to Other Sites in Profile
Category: One-Stop Internet Shopping Identity
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] faye
Description: This will add Tumblr to the list of sites you can link to on your profile.

Bug 4262: Add Plurk to Other Sites in Profile
Category: One-Stop Internet Shopping Identity
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] stormy
Description: Same as above, only with Plurk.

Bug 4262: Add Pinboard to Other Sites in Profile
Category: One-Stop Internet Shopping Identity
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] helens78
Description: Same as above, only with Pinboard. (Sensing a theme here?)

Bug 4258: linking to pinboard accounts using the <user name> tag
Category: One Big Happy Internet
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] damalur
Description: This adds Pinboard to the services that can be used in the <user name=foo site=bar> tag.

Bug 4234: Linking to usernames on fanfiction.net
Category: One Big Happy Internet
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] xwingace
Description: And this does the same for fanfiction.net! (And as [personal profile] fu said when committing it, it looks so weird to see the site referred to as just 'fanfiction' without the '.net' in the backend code. Heh.)

Bug 4246: Manage Circle success page: separate links to access filters and subscription filters
Category: Making things make sense
Patch by: [personal profile] ninetydegrees
Suggested by: [personal profile] ninetydegrees
Description: This adds a link to managing reading filters onto the success page you get after making changes on your Manage Circle page. (Previously it was just a link to the posting filters.)

Bug 4230: Fix various my/if constructions
Category: Backend, avoiding future bugs
Patch by: [personal profile] sophie
Description: The short version of this bug: we fixed some code syntax to hopefully prevent glitches and weird bugs in the future.

The short version of this bug for coders: this caught a few of the other cases where variables were being declared with a postfix conditional, which is bad (perl assigns that a global scope and bad things happen).

The long version of this bug, for non-coders: Before you use a variable in your code, you have to define it (in order to tell the computer that this isn't just a random word you're throwing in there, it's intended to be a variable). In Perl, you usually do this by declaring it with a "my" statement, and you can combine declaring the variable with assigning it an initial value: for instance, if I wanted to tell the computer I wanted to use the $community variable, and I wanted it to initially have the value of "dw-dev", the code might look something like my $community = "dw-dev";.

Sometimes, though, you want to only give a variable a certain value if something else is true -- let's say we only want $community to be "dw-dev" if another variable, $created, is true. The temptation is to write the variable definition and the truth check in the same line, like such: my $community = "dw-dev" if $created; If you do it that way, though, you run into a quirk in Perl where the variable is created with the wrong scope (scope is totally outside my capability to explain this in a simple way, heh) and doesn't get properly cleared when that section of code stops running. This can result in very weird things happening elsewhere in the code: if you tried to declare another local $community variable elsewhere, the code freaks out because it thinks it's already got a $community variable (with the wrong thing in it).

So, instead of declaring the variable and operating on it in the same line, you split it up into two lines: my $community; $community = "dw-dev" if $created; We'd previously fixed a lot of those my/if constructions when we first realized they were causing problems, but we missed a few; this catches the rest of them.

*insert "The more you know!" placard here*

Bug 4227: Dusty Foot: new themes
Category: The Pretty
Patch by: [personal profile] delladea
Themes by: [profile] nornoriel
Description: This adds six new themes for the Dusty Foot style.

Bug 4226: Practicality: new themes
Category: The Pretty
Patch by: [personal profile] delladea
Themes by: [personal profile] inoru_no_hoshi and [profile] nornoriel
Description: This adds five new themes for the Practicality style.

Bug 4212: Crisped: new themes
Category: The Pretty
Patch by: [personal profile] delladea
Themes by: [personal profile] timeasmymeasure and [profile] nornoriel
Description: Ten new themes for the Crisped style.

Bug 4188: Deleting Layers: use pop-up confirmation instead of loading a new page
Category: Usability
Patch by: [personal profile] ninetydegrees
Description: This switches the behavior when deleting a layer (in the customization area) to match the behavior when deleting a style, for consistency.

Bug 3996: add explicit comment hierarchy to S2
Category: Accessibility
Patch by: [personal profile] allen
Description: A while back, we added comment hierarchy indicators -- a numbered outline of which comment is a reply to which other comment, allowing screenreader users to have access to information that was previously only conveyed visually (by using indents). The first step was to add those outline indicators to comments when viewed in the site skin; this bug adds that information into custom comment pages as well. (You can turn on the comment hierarchy indicators on the Display tab of Manage Settings.)

Bug 3286: Style Comments Page with Outline Indicators in Place of Indents
Category: Accessibility
Patch by: [personal profile] allen
Description: And this is the bug for the comment indicators in general, which we'd previously resolved but which got reopened to add the indicators to collapsed comments also.

Bug 3719: Style custom /icons pages
Category: The Pretty
Patch by: [personal profile] ninetydegrees
Description: And with this patch, [personal profile] ninetydegrees gets the "annoying and tedious tons-of-work" award for this month! This is part of the effort to let you display your icons page in your journal style rather than the site skin (if you want; it'll be a setting). We needed to add in styling for that new page into every single style we have. Phew.

Bug 3581: jQuerify cut expander
Category: Modernization
Patch by: [personal profile] exor674
Description: This bug was actually patched a while ago, but we hadn't gotten around to resolving it! This updates the cut tag expander to use jQuery, a more modern javascript library.
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2012-02-02 07:50 pm (UTC)(link)
you run into a quirk in Perl where the variable is created with the wrong scope (scope is totally outside my capability to explain this in a simple way, heh) and doesn't get properly cleared when that section of code stops runnin


Wait, isn't the problem that if the "if" statement isn't true, you just never declare the variable and thus if you later check for its value the code goes all "What do you mean, $community? I have no idea what that means!"

exor674: Computer Science is my girlfriend (Default)

[personal profile] exor674 2012-02-02 08:02 pm (UTC)(link)
Nope -- this is a weird interaction with BML mostly.

In pure Perl, it seems fine and is treated as undef... in *BML*, it gets an old value.
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2012-02-03 01:18 am (UTC)(link)
Oh hm, I thought that the problem was with it being created as a global variable in Apache! I didn't realize that it was something only BML was doing.
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2012-02-03 01:16 am (UTC)(link)
Perl tries to be clever about it, and unless you have "use strict", it goes ahead and creates the variable anyway.

(A lot of our BML pages don't have use strict)
turlough: large orange flowers in lush green grass ((st tos) uhura rocks)

[personal profile] turlough 2012-02-02 10:03 pm (UTC)(link)
Bug 4262 & 4258 make me happy!
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2012-02-02 10:38 pm (UTC)(link)
If you happened to depend on constructing the edit link to see what the entry looks like when the code isn't rendered (like if a friend managed to somehow break their code on your reading page), fear not! Adding ?nohtml=1 to the entry's URL will show the mostly-raw contents (like viewing the HTML source for the page, except just for the entry and comments part). For example: http://dw-dev.dreamwidth.org/108392.html?nohtml=1 is this entry. (Happily, a lot of the code for this entry was typed up by [personal profile] sophie's handy-dandy code tour generator, which is very useful.)
Edited 2012-02-02 22:40 (UTC)
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2012-02-03 01:51 am (UTC)(link)
Hee! I recline corrected!