Catch and educate users posting code without properly formatting it

Yes sounds like a plan, if you are comfortable with this being client only then it can be done as a theme component which is awesome cause you will be able to reach lots more people.

6 Likes

Nice! Didn’t even know that feature existed. Looks like it could be perfect for this use case. The only caveat is that I can’t see any way to attach a new custom user field (has_dismissed_code_notice) without access to the back end. I guess there might be some hacky way of achieving the same effect? Alternatively, there’s always localStorage, but that doesn’t persist between devices.

1 Like

Yeah theme user settings has been on our list for a while, we need it in quite a few spots now. We will get to it.

1 Like

Is that something you’d welcome pull requests for? If so, I’d be happy to give it a go. I’m assuming something like a remote version of localStorage would cut it (string-only key-value pairs). Values set and retrieved using a tuple of theme ID, user ID, and key. User ID must be current user if the field is set to private. Is there anything missing from that picture?

Sorry but a pr for this is not going to work, I started looking at this yesterday and getting this to work just right with minimal cost is very very fiddly, I am rather stickler about minimizing queries on first load, doing so here is hard mode ++

I do really want this change so I may plug at it a bit more over the next few days

4 Likes

Theme component topic is here.

5 Likes

So I just did this for my site mostly as a joke , but it works well and it is effective (thus far)
It doesn’t automatically catch the offenders, but when I (or any of the leaders) see it we set a tag on the post of “formatcode”
Then this happens the next time that user logs in


It sticks around until they correct the problem and remove the tag, so far we’ve throw it at a few people and the code ALWAYS gets cleaned up. It only shows up for the author of the post.

Anyways I thought it was fun, I haven’t made a plugin out of it (I don’t have the time) but its fairly straight forward javascript. If someone wants it let me know and I’ll post it

17 Likes

OMG this is an epic thing you have done here :rofl:

4 Likes

Here’s the code in case someone else wants to mess with it

9 Likes