Scenario:
- image is unpublished
- image is attached to published node

For anon user (and, I assume, users without enough rights), no image shows on the node. This is correct.
For admin, image DOES show. This is misleading -- the admin doesn't see the node as other users do, and there's no indication of this difference. Best fix might be to mark the image in some way, or show something like "[unpublished image]" in its place.

Comments

drewish’s picture

Status: Active » Closed (works as designed)

everything is working correctly. uid=1 can see everything... you could get this functionality by using views though.

joachim’s picture

Don't you think uid=1 should get some sort of hint, the same way unpublished pages are pink?

joachim’s picture

Status: Closed (works as designed) » Active

I'm reopening this, as I think you've missed my point.
Uid can see everything. But, by design, unpublished nodes are marked so the site admin is informed that he is viewing unpublished content.
Hence, the same marking should apply to unpublished images attached to a published node.

joachim’s picture

Title: don't show attached unpublished images, even for admin » mark attached unpublished images similarly to unpublished nodes
Version: 5.x-1.7 » 6.x-1.x-dev

Better title.
Bump & move to 6.x.

drewish’s picture

please roll a patch for 6.x ;)

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.44 KB

Done :)

Wasn't sure whether to use the existing 'node-unpublished' class and therefore get the background colour from core or themes. But the padding is needed, and there's no way to grab a .node-unpublished that is only an image (as IE6 doesn't do multiple class selectors properly).
So I've gone with 'image-unpublished'.

drewish’s picture

Status: Needs review » Needs work

humm... it seems like it would be better to use the existing class so that it matches the theme... i'm not going to code to IE6 since this is only for uid=1 and hopefully admins would have the good sense to use a better browser.

joachim’s picture

Status: Needs work » Needs review

ROTFL.

Works out fine anyway, as I forgot to make the changes to teasers...

When I look at doing stuff with the theme layer I'll neaten this up a bit, but as you say, uid 1 should have better taste. If not, they'll just get some extra padding.

drewish’s picture

Status: Needs review » Fixed

went ahead and committed this to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

joachim’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new962 bytes

I forgot to add this class for teasers too...

sun’s picture

Status: Needs review » Needs work

- We should rename both instances of $published into $class, because that is what the variable contains.

- In addition, defining an empty variable is pretty ugly. Can we also move the "image-attach-<style>" part into the $class variable and just concatenate it into the resulting markup? (note: also in both places)

joachim’s picture

Status: Needs work » Needs review
StatusFileSize
new1.74 KB

Done.

sun’s picture

Close to completion. :)

- Inline if statements should always wrap the entire statement in braces to ensure the proper logic and also help in readability, ie. $foo = $bar . ($baz ? $bee : $boo);

- You changed the string concatenation to the new standards for $class (good), but not for $info on the same line (bad). :)

- Please add your first changelog entry. :)

joachim’s picture

StatusFileSize
new2.3 KB

I didn't touch $info because of the 'one patch, one change' rule...

sun’s picture

Sorry for being nitpicky.

The changelog entry should form a proper sentence, not necessarily equaling the issue title, and start with "Fixed" (for bugs), "Added" (for features), "Changed" (for tasks), or "Updated" (for changes that only 'react' to external conditions such as changes in Drupal core).

Exactly same changelog entry is used as commit message.

As mentioned in the handbook page, phrasing an entry can be a challenge. In this case, I'd propose something like

Fixed no CSS class applied to unpublished attached images.
joachim’s picture

"Fixed no css class" really isn't proper grammar... ;)

Fixed missing CSS class on unpublished attached images.
sun’s picture

Status: Needs review » Reviewed & tested by the community

Here we go.

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Committed to both HEAD and 5-2 branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.