• Welcome to Simple Machines Community Forum. Please login or sign up.
November 27, 2021, 09:34:44 PM

News:

SMF 2.1 RC4 has been released! Try it out and help us test! :) Read more.


SMF 2.1 RC4: .inline_mod_check has style="display: none;" in Display.php array.

Started by Antechinus, September 01, 2021, 05:12:33 PM

Previous topic - Next topic

Antechinus

Not sure why anyone thought this was a clever idea. The 'custom' => 'style="display: none;"', overrides the show permissions, with the result that even if someone has the ability to remove their post the li with the checkbox will not display.

Note that this also borks presentation, because although it is not visible or accessible the hidden li is still in the markup, and is therefore the last child of the ul. That means the border-radius for the last-child li is applied to the hidden li, not to the last visible li.

Problem is here:
Code ("Sources/Display.php - LInes 1639 to 1645") Select
        'quickmod' => array(
            'class' => 'inline_mod_check',
            'id' => 'in_topic_mod_check_'. $output['id'],
            'custom' => 'style="display: none;"',
            'content' => '',
            'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $output['can_remove']
        )

ETA: If .inline_mod_check is supposed to be deprecated now (which seems likely given the lack of li content) then markup and CSS for it should be removed before FInal.

Arantor

Think you'll find it's actually not legacy, but instead a checkbox that's hidden by default but exposed when JavaScript is present so that you can select multiple messages and have the delete-these-messages button enable with JavaScript (only). Ditto for split. And it's hidden by default unless JS is available so that you get nice graceful degrading if JS is disabled.

Only valid when quick moderation is turned on and set to checkboxes which is probably why you don't see it because it's (still) not set that way by default.
No good deed goes unpunished
All helpful urges should be circumvented

Antechinus

Ah, but obviously I went into my profile and turned on quick moderation via checkbox, then went and had a look at one of my posts that was still editable (ie: within site time limits).

Anyway, the way it is done now screws presentation, so is a tad on the doofus side. And you can't select back up the markup with CSS. No can do. So, screwed is screwed.

It would be better to not have that li in the markup at all if it is going to be hidden. So if it is running off some js somewhere anyway, it might make sense to use said js to inject the thing into the DOM when it is needed.

Alternatively, bung it somewhere else in the markup. If it was first instead of last then you could do this:

.inline_mod_check[style*="none"] + li {
    border-radius: 3px 0 0 3px;
}

Which would look the way it was meant to. Or you could bung the thing anywhere else in the ul. It's just having it as last-child that is problematic. :)

ETA: Just found a somewhat related bug, in the "Topic Summary" on the post modify page. The .quickbutton li there is missing its left border radii too. Yay! Easy fix for that:

Code (FInd) Select
#post_modify {
    border-radius: 4px;
}
Code (FInd) Select
#post_modify, #post_modify a {
    border-radius: 4px;
}

And, every "Quote" button there has id="post_modify" for its li, so that means a validation error for every post in the topic summary.

Which is so simple it should never have got this far. :P

Arantor

It's not about being *editable*, that's not the permission at work here. Being able to split and delete is the relevant permission.

Fully agree with you about it not being in an li though, as that's what I did on mine a long time ago, though I thought it looked stupid with a button background when it wasn't a button so...
No good deed goes unpunished
All helpful urges should be circumvented

Antechinus

Ok, well here's the funny thing: while my posts here are still editable, .inline_mod_check is in the markup but set to display: none;

Once the edit timeout here kicks in, .inline_mod_check is no longer in the markup at all. So, permissions in Display.php must be affecting the markup even if you do not have split and delete permissions.

            'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $output['can_remove']
Obviously I have the first and second all the time. It must be the thrid one that is playing up.

Antechinus

Y'know, if this bloody checkbox is really only intended for moderators, which seems to be the case, then isn't it obvious to do the show permissions like this?

'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && allowedTo('moderate_forum')
That way it should not screw anyone around. If someone can use it, and has the option set in their profile, they'll get it. For anyone else it will never be in the markup. Sorted.

Advertisement: