Refresh after using quickmodify

Started by Jotade29, January 11, 2024, 10:42:09 PM

Previous topic - Next topic

Jotade29

Hi!!!
My version is: 2.0.19

When a user modifies a message using "quickmodify", the new bbcs they add are not visible if the results are saved, unless they refresh the page.

I need that, once someone clicks quick modify, and saves, it refresh the page...


In topic.js
QuickModify.prototype.modifySave = function (sSessionId, sSessionVar)
{
// We cannot save if we weren't in edit mode.
if (!this.bInEditMode)
return true;

// Add backwards compatibility with old themes.
if (typeof(sSessionVar) == 'undefined')
sSessionVar = 'sesc';

var i, x = new Array();
x[x.length] = 'subject=' + escape(document.forms.quickModForm['subject'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");
x[x.length] = 'message=' + escape(document.forms.quickModForm['message'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");
x[x.length] = 'topic=' + parseInt(document.forms.quickModForm.elements['topic'].value);
x[x.length] = 'msg=' + parseInt(document.forms.quickModForm.elements['msg'].value);

// Send in the XMLhttp request and let's hope for the best.
ajax_indicator(true);
sendXMLDocument.call(this, smf_prepareScriptUrl(this.opt.sScriptUrl) + "action=jsmodify;topic=" + this.opt.iTopicId + ";" + sSessionVar + "=" + sSessionId + ";xml", x.join("&"), this.onModifyDone);

return false;
}

I have thought and tried using location.reload(), but the problem is that it does not save what i edited. I add the refresh before the return false.

How can i refresh the page once the function is executed?
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Kindred

It does so for me already...
 What theme are you using?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jotade29

Quote from: Kindred on January 11, 2024, 11:06:00 PMIt does so for me already...
 What theme are you using?

If i click to save it refreshes me what the fields are, not the web page itself... I don't know if that's what you're referring to.

I want refresh like i click f5...

I use musiconica for 2.0...

Thnx for help, Kind :)
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Arantor

What it's meant to do is replace the post with the formatted version once saved to the database without needing to reload the page.

If that's not happening your theme or mods are breaking something. First step is to look in the browser console to see if there are errors.

Kindred

Quote from: Jotade29 on January 11, 2024, 11:12:52 PM
Quote from: Kindred on January 11, 2024, 11:06:00 PMIt does so for me already...
 What theme are you using?

If i click to save it refreshes me what the fields are, not the web page itself... I don't know if that's what you're referring to.

I want refresh like i click f5...

I use musiconica for 2.0...

Thnx for help, Kind :)

It refreshes ONLY the post that you edited - and does so inline, without requiring a full page refresh.

Causing a full page refresh is a bad user experience.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jotade29

Quote from: Arantor on January 12, 2024, 05:02:14 AMWhat it's meant to do is replace the post with the formatted version once saved to the database without needing to reload the page.

If that's not happening your theme or mods are breaking something. First step is to look in the browser console to see if there are errors.

Thank you very much for your support, Arantor. Whenever there is some bad behavior, ii look at the console log, but in this case everything was correct (only some warnings), and simply when i saved something with the quick modification, the bccs were not displayed correctly, that's why i believed that the The best solution was a total refresh.

Quote from: Kindred on January 12, 2024, 06:33:38 AM
Quote from: Jotade29 on January 11, 2024, 11:12:52 PM
Quote from: Kindred on January 11, 2024, 11:06:00 PMIt does so for me already...
 What theme are you using?

If i click to save it refreshes me what the fields are, not the web page itself... I don't know if that's what you're referring to.

I want refresh like i click f5...

I use musiconica for 2.0...

Thnx for help, Kind :)

It refreshes ONLY the post that you edited - and does so inline, without requiring a full page refresh.

Causing a full page refresh is a bad user experience.

Thank you very much for your support, Kindred, unfortunately there are times when i have to make adjustments to the code, because with the current one, due to compatibility issues, it shows things inappropriaty (i dont know write this word  :-[ )

You tell me that doing that causes a bad experience, and i think it's quite the opposite, if i leave the code as is, when people use that function, they will see that the bbcodes do not work correctly.

For that reason i have already fixed the code, and i have desactivated the partial refresh for the total refresh, saving possible errors, desactivating the ajax at the end, and always after each refresh, it takes you to the refresh message. This way, when the user modifies something quickly, it loads the message correctly. I don't see any reason for only that message to be updated (only in case the messages were very heavy).

I would appreciate it if you could tell me how it could negatively affect the user experience, because maybe i'm not seeing it.

Thank you so much :)
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Arantor

Quote from: Jotade29 on January 12, 2024, 02:43:25 PMYou tell me that doing that causes a bad experience, and i think it's quite the opposite, if i leave the code as is, when people use that function, they will see that the bbcodes do not work correctly.

Then there's something wrong with your bbcodes because all the stock ones behave correctly - the save is made, the post is rendered and then updated with the bbcodes turned into normal HTML.

Forcing a full page reload when you only need to upload a tiny part of it is unnecessary, especially as it moves them somewhere else in the page.


EDIT: I just edited this post with quick edit - the edit loads (I get bbcode in the editor because it doesn't, and hasn't ever, loaded the full editor), I add my changes, I hit save, and I'm returned exactly as I expect it, with the quote bbcode rendered. And more importantly I'm not randomly thrown back up the page to the top, I'm left looking at the message I just edited.

Jotade29

Quote from: Arantor on January 12, 2024, 02:55:46 PM
Quote from: Jotade29 on January 12, 2024, 02:43:25 PMYou tell me that doing that causes a bad experience, and i think it's quite the opposite, if i leave the code as is, when people use that function, they will see that the bbcodes do not work correctly.

Then there's something wrong with your bbcodes because all the stock ones behave correctly - the save is made, the post is rendered and then updated with the bbcodes turned into normal HTML.

Forcing a full page reload when you only need to upload a tiny part of it is unnecessary, especially as it moves them somewhere else in the page.


EDIT: I just edited this post with quick edit - the edit loads (I get bbcode in the editor because it doesn't, and hasn't ever, loaded the full editor), I add my changes, I hit save, and I'm returned exactly as I expect it, with the quote bbcode rendered. And more importantly I'm not randomly thrown back up the page to the top, I'm left looking at the message I just edited.

Thanks for your response, Arantor. As I said at the beginning of the topic, i use version 2.0.19. If you tell me that you just edited this message quickly, ii understand that you tested it in 2.1.x.

Possibly it¡s s some compatibility issue with some BBC mods, but as I said, it didn't update well for me. Also, as i wrote in the message above, when i update the page with quickmodify it takes me to the see the modify message, and it doesn't just take you to the top of the page.

The solution i have put is something simple, yes, but it does everything the same as the partial modification, but in this case everything works. If, beyond the fact that it is unnecessary, there is any problem that could cause the total refresh, please, i would appreciate it if you could tell me.

Thank you so much :)
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Kindred

Well, it worked as it was intended then.  It's not supposed to take you to the top of the screen.

I'll tell you again,  the behavior you describe is not desirable and is a bad UX (user experience)

It really is.

It also puts more load on your servers
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

I tested it in 2.1 because I only had a 2.1 to hand, but the functionality has been in SMF since at least 2006 when I first started using SMF and it has *always* worked correctly for me.

If it does not work correctly for you, the problem is not SMF but the bbcode mods you have.

Advertisement: