Bug #563
Edited template not going green, editing sid = -2
| Status: | Closed | Start: | 12/05/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | Ryan Gordon | % Done: | 100% |
|
| Category: | Admin Control Panel | |||
| Target version: | 1.4.11 | |||
| Reproducibility: | Always | Browser: | ||
| Reported In MyBB Version: | 1.4.10 | Database Type: | MySQLi | |
| PHP Version: | 5.3.0 | Database Version: | 5.1.40 |
Description
OK, this is slightly odd.
I edited a template, typed 'test' in it. As I saved, the nav at the top broke, it said:
Home » Template Sets »
I then went back to the list of templates, the template name wasn't in green, it was the same as other template names. I went to edit it again, the change was there, the nav was OK again. Nav was:
Home » Template Sets » Test
Looked in the database, it's edited the template with sid -2, not adding a new one.
Associated revisions
Fixes Editing template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
Fixes Edited template not going green, editing sid = -2 (fixes:563)
History
Updated by Matt Rogowski 4 months ago
Appears to be, it happens every time I edit a template. I can only assume it's a regression, I edited a template fine on 1.4.9, and three people have reported this behavior on the community forums. Maybe it's related to Issue #457??
The people who reported this also said it edited all templates with the same name across all template sets, which I imagine it would if the -2 template is being changed, however it didn't update all templates like this for me.
Updated by Tom Moore 3 months ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset r4583.
Updated by Ryan Gordon 3 months ago
- Target version set to 1.4.10
Updated by Dennis Tsang 3 months ago
- Target version changed from 1.4.10 to 1.4.11
Updated by Michael Schlechtinger 3 months ago
- Status changed from Closed to Feedback
It's working in the branch but not the trunk. If you edit a template in the trunk version it's stored in the db correctly but the color of the name does not change in your ACP.
Updated by Stefan T. 3 months ago
No, after you edited a template with sid -2 there is no entry with sid -2 for it anymore.
Updated by Michael Schlechtinger 3 months ago
Are you sure? On my test installation I have two templates (sid=-2 and sid=1) which is correct.
Updated by Stefan T. 3 months ago
Try to enter a different name. Than the original template is missing...
Updated by Ryan Gordon 3 months ago
How many developers and SQA people does it take to fix 1 bug?
lol :p
I'll look into this.
Updated by Ryan Gordon 3 months ago
I was able to reproduce Michael's problem. The regression was from r4317 - For some reason $template['gid'] was never set.
I was also able to reproduce Matt's/Stefan's issue with the master template still being updated. I'll try to repro again and fix it.
Updated by Ryan Gordon 3 months ago
I've also been able to fix Stefan's issue.
Reproduction Instructions for Matt's issue (master templates being overridden)
1. Open any template and edit it template
2. Click "Save and Return to Listing"
3. Stop the browser from redirecting to the template listing but only AFTER it inserts the database record (You can simulate this by putting the php code "die();" in right before the admin_redirect function.
4. Press the refresh button on the browser (Say okay to any POST data transfer prompts)
This basically is a double submit problem. Because we originally relied on the tid being updated in the POST data from the form after the master template was updated in order to execute updates to the modified template, not updating the tid caused it to update the master template instead. I've also included safeguards to make sure this can't happen for any reason in the future as well.
P.S., please note michael you could only reproduce your issue on the trunk because it had to do with a new feature in MyBB 1.6 in the template lists.
Updated by Ryan Gordon 3 months ago
SQA, please do an in-depth test of all the "edit" functionality of the template pages in this new commit
Updated by Ryan Gordon 3 months ago
- Status changed from Feedback to Resolved
Applied in changeset r4637.
Updated by Matt Rogowski 3 months ago
Ryan Gordon wrote:
Reproduction Instructions for Matt's issue (master templates being overridden) ...
Awesome, very happy to finally know what causes this!! That explains it perfectly, why it was rare and intermittent, it wouldn't be very often that it'd be interrupted.
Updated by Michael Schlechtinger 3 months ago
The mentioned issues seem to be fixed. But I found another thing: You cannot move a custom template from a template set to the global templates.
Steps to reproduce:
1. Create a new template in a template set (not the global templates).
2. Edit this template and change the set it belongs to to "Global Templates".
3. Click "Save and return to listing".
4. You get redirected to the global templates list but your template isn't there.
Updated by Michael Schlechtinger 3 months ago
- Status changed from Resolved to Feedback
Updated by Ryan Gordon 3 months ago
- Assigned to changed from Tom Moore to Ryan Gordon
Updated by Ryan Gordon 3 months ago
- Status changed from Feedback to Resolved
Applied in changeset r4652.
Updated by Ryan Gordon 3 months ago
SQA, just going to need a overall functionality test on the edit functionality in the template pages to confirm this.
Updated by Michael Schlechtinger 3 months ago
- Status changed from Resolved to Feedback
I tested the trunk version and you cannot edit the default templates anymore. If you save the template you get a success message but the template is not stored in the database.
Updated by Ryan Gordon 3 months ago
- Status changed from Feedback to Resolved
Applied in changeset r4659.
Updated by Ryan Gordon 3 months ago
This should definately fix everything. Even found another bug where if you had a global template called the same as a default template, it would show up as "green/modified" in the default template listing.
Updated by Michael Schlechtinger 3 months ago
- Status changed from Resolved to Feedback
1) If you want to add a new template with the name of a default template you get this error message: "The template title is already in use. Please use a different title." If you edit a template and you enter the name of a default template there's no message and the template gets stored.
2) I don't know if this is intentional: If you move a template from the global templates into a template set the template also remains in the global templates list. There are 2 entries in the database (sid=-1 and sid=x).
Apart from that everything is working fine now. But I would like someone else to test this to make sure that there are no other flaws.
Updated by Ryan Gordon 3 months ago
- Status changed from Feedback to Resolved
Applied in changeset r4662.
Updated by Imad Jomaa 3 months ago
- Status changed from Resolved to Closed
Updated by Ryan Gordon 3 months ago
- Status changed from Closed to Resolved
This only fixes issue 2 of michael's posted issues. Issue issue 1 is NAB
Updated by Michael Schlechtinger 3 months ago
- Status changed from Resolved to Closed