Minor bug with drafts and entities

Nao

  • Madman
  • With a Box
  • If you say so.....
  • Posts: 13,071
Minor bug with drafts and entities
« on May 3rd, 2012, 10:11 AM »
Was looking into a draft bug (no biggie, presentational issue, I fixed it), and noticed two things in my drafts area.
First of all -- well, I still have recent (yesterday etc) drafts that should have been deleted after I submitted the final post... They're still there. Perhaps it's on my side though -- I have two posts from yesterday, then a post from April 30, then April 27 onwards was due to the earlier bug IIRC.

Secondly, my bug report for the cache key length had this code:

aeva-embed-link-[url=http://www.youtube.com/watch?v=OgCjpA03mOI#ws]B+ Episode 5 - باسم يوسف شو (مع تامر من غمرة) الحلقة ٥[/url]

However, in the draft area, it has this instead:

log_online-updateaeva-embed-link-[url=http://www.youtube.com/watch?v=OgCjpA03mOI#ws]B+ Episode 5 - باسم يوسف شو (مع تامر من غمرة) الحلقة ٥[/url]

I don't know if it's a bug in the draft saving code, or if it's due to my changing the location of weSaveEntities(). (But because it's in editor-func.js, it should be loaded on all topic pages as well...)
It's probably due to drafts not going through weSaveEntities() before saving the post, I guess. Or maybe I'm mistaken...
...« I say wedge wedge (in the butt) »
 « Everyone knows rock attained perfection in 1974. It's a scientific fact. » (Homer Simpson)

Arantor

  • With a Box
  • I'm a shooting star leaping through the skies, like a tiger defying the laws of gravity...
  • Posts: 13,999
Re: Minor bug with drafts and entities
« Reply #1 on May 3rd, 2012, 12:54 PM »
Does it do it if you save the draft manually? Maybe it doesn't call weSaveEntities at all, I can't remember.
  When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest.


Nao

  • Madman
  • With a Box
  • If you say so.....
  • Posts: 13,071
Re: Minor bug with drafts and entities
« Reply #2 on May 3rd, 2012, 02:05 PM »
I don't even know if it can... I mean, doesn't WSE actually modify the textarea to transform entities? In which case you don't wanna do it while you're typing...
(Unless we just rewrite it to do it differently.)
...« I say wedge wedge (in the butt) »
 « Everyone knows rock attained perfection in 1974. It's a scientific fact. » (Homer Simpson)

Arantor

  • With a Box
  • I'm a shooting star leaping through the skies, like a tiger defying the laws of gravity...
  • Posts: 13,999
Re: Minor bug with drafts and entities
« Reply #3 on May 3rd, 2012, 02:08 PM »
It's done onsubmit normally, so it's not like we couldn't pull the content into a variable, modify that in-place and then submit that content via the draft saving mechanism.

But there's also that debate over whether we actually want entities to be converted or not (as we mentioned elsewhere recently)
  When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest.


Nao

  • Madman
  • With a Box
  • If you say so.....
  • Posts: 13,071
Re: Minor bug with drafts and entities
« Reply #4 on January 25th, 10:48 AM »
Bumping two bugs with one stone :P

- Entities: reminder, need to fix the fact that Wedge seems to turn & nbsp; into an actual space at post save time.

- Drafts: I thought this was fixed LONG ago, but I just went into my draft section (which I don't visit often, but I was trying to get my earlier bug report which I'd deleted but Safari kindly prevented me from Ctrl-Z'ing it back into life...) (and yes, the draft area didn't have it either...), and it had about 20 messages, most of which were either empty (I thought we didn't save empty drafts...?!), or with the exact same contents as an existing post (such as a New Revs post)... Which should have been deleted at the time it was posted...

So, I'm thinking... Bug still there...? :-/
...« I say wedge wedge (in the butt) »
 « Everyone knows rock attained perfection in 1974. It's a scientific fact. » (Homer Simpson)

Arantor

  • With a Box
  • I'm a shooting star leaping through the skies, like a tiger defying the laws of gravity...
  • Posts: 13,999
Re: Minor bug with drafts and entities
« Reply #5 on January 25th, 11:42 AM »
The entity conversion happens at save time, normally... See what saveEntities is doing, whether it's being called etc.

As for drafts, I have two drafts only and judging by the content, they'd been saved just as I pressed send, but possibly before it had returned with a cache id.
  When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest.


Nao

  • Madman
  • With a Box
  • If you say so.....
  • Posts: 13,071
Re: Minor bug with drafts and entities
« Reply #6 on January 25th, 11:59 AM »
- weSaveEntities() is doing its work, but APPARENTLY it isn't called in quick reply... Maybe that's here...? But I seem to remember the bug happened in quick edit mode, too... Test é >   < – é<>... :edit: Yep, they're not converted... Another test -- quick edit -- &nbsp; &gt; &lt; :edit: Okay, looks like it's in quick reply only.

- I have 14 drafts, 6 of which are completely empty. That's a bug. Has to be... Others MIGHT be due to chance. But the empty drafts... I thought Wedge ensured these didn't get saved?
...« I say wedge wedge (in the butt) »
 « Everyone knows rock attained perfection in 1974. It's a scientific fact. » (Homer Simpson)

Arantor

  • With a Box
  • I'm a shooting star leaping through the skies, like a tiger defying the laws of gravity...
  • Posts: 13,999
Re: Minor bug with drafts and entities
« Reply #7 on January 25th, 02:17 PM »
It should be called for quick reply, but maybe not for entities.

If they're completely empty, they shouldn't be saved, certainly in the original implementation they wouldn't be sent in the first place, but I know it changed since then to be triggered by the events of typing something.
  When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest.