Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: renaming a tiddler to an existing one #146

Closed
tobibeer opened this issue Aug 27, 2013 · 2 comments
Closed

Bug: renaming a tiddler to an existing one #146

tobibeer opened this issue Aug 27, 2013 · 2 comments

Comments

@tobibeer
Copy link
Contributor

Issue

Renaming a tiddler whilte overwriting an existing tiddler doesn't delete the one being renamed.

Test

  • Create tiddler [[Foo]].
  • Then create tiddler [[Bar]].
  • Then rename tiddler [[Bar]] to [[Foo]].

Here's an MTC: http://up.tiddlyspace.com — I have added Eric as a member to the space.

~

Also, deleting a tiddler doesn't seem to refresh the display. Meaning: tiddlyLinks appear as existing even though the tiddler has been deleted.

@YakovL
Copy link
Contributor

YakovL commented Jul 14, 2014

This issue is due to the behaviour of the Story.prototype.saveTiddler [1]. More precisely, in this case the line 604 is processed, which prevents the store.saveTiddler call [3] from seeing that the title was different from the newTitle.

Moreover, after the line [2] the changed var title is used 4 times and, as far as I can see, in each one it should be old title rather than new one.

So, my solution on fixing this is to remove the line [2]: instead of

if(store.tiddlerExists(newTitle) && newTitle != title) {
    if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()])))
        return null;
        title = newTitle;
}

(note also the wrong indentation), there should simply be

if(store.tiddlerExists(newTitle) && newTitle != title)
    if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()])))
        return null;

(I've already tested this a bit using a plugin that overwrites the Story.prototype.saveTiddler function)
Best regards,
Yakov.

[1] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Story.js#L590
[2] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Story.js#L604
[3] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Story.js#L629

YakovL added a commit that referenced this issue Aug 25, 2022
@YakovL
Copy link
Contributor

YakovL commented Aug 25, 2022

Fixed in c6a488c, will make it into the version after 2.9.3 (probably 2.9.4), so closing this now

@YakovL YakovL closed this as completed Aug 25, 2022
@YakovL YakovL mentioned this issue May 9, 2023
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants