{"action":"created","comment":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/comments/52047032","id":52047032,"diff_hunk":"@@ -347,7 +347,10 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {\n \t\t\t\t\t\"draft.title\": undefined,\n \t\t\t\t\t\"draft.of\": undefined\n \t\t\t\t},this.wiki.getModificationFields());\n+\t\t\t\t// th-saving-tiddler sets tiddler.renaming to the old title if renaming\n+\t\t\t\tif(isRename) newTiddler.renaming = draftOf;","path":"core/modules/widgets/navigator.js","position":5,"original_position":5,"commit_id":"312f92dd383db7075b56dcbafc87d21a9820d4c6","original_commit_id":"312f92dd383db7075b56dcbafc87d21a9820d4c6","user":{"login":"Jermolene","id":174761,"avatar_url":"https://avatars.githubusercontent.com/u/174761?v=3","gravatar_id":"","url":"https://api.github.com/users/Jermolene","html_url":"https://github.com/Jermolene","followers_url":"https://api.github.com/users/Jermolene/followers","following_url":"https://api.github.com/users/Jermolene/following{/other_user}","gists_url":"https://api.github.com/users/Jermolene/gists{/gist_id}","starred_url":"https://api.github.com/users/Jermolene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jermolene/subscriptions","organizations_url":"https://api.github.com/users/Jermolene/orgs","repos_url":"https://api.github.com/users/Jermolene/repos","events_url":"https://api.github.com/users/Jermolene/events{/privacy}","received_events_url":"https://api.github.com/users/Jermolene/received_events","type":"User","site_admin":false},"body":"Should use braces around the bodies of `if` statements.","created_at":"2016-02-05T17:36:34Z","updated_at":"2016-02-05T17:36:34Z","html_url":"https://github.com/Jermolene/TiddlyWiki5/pull/2247#discussion_r52047032","pull_request_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247","_links":{"self":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/comments/52047032"},"html":{"href":"https://github.com/Jermolene/TiddlyWiki5/pull/2247#discussion_r52047032"},"pull_request":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247"}}},"pull_request":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247","id":56809914,"html_url":"https://github.com/Jermolene/TiddlyWiki5/pull/2247","diff_url":"https://github.com/Jermolene/TiddlyWiki5/pull/2247.diff","patch_url":"https://github.com/Jermolene/TiddlyWiki5/pull/2247.patch","issue_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2247","number":2247,"state":"open","locked":false,"title":"Adds field tiddler.renaming to th-saving-tiddler hook.","user":{"login":"edrex","id":14615,"avatar_url":"https://avatars.githubusercontent.com/u/14615?v=3","gravatar_id":"","url":"https://api.github.com/users/edrex","html_url":"https://github.com/edrex","followers_url":"https://api.github.com/users/edrex/followers","following_url":"https://api.github.com/users/edrex/following{/other_user}","gists_url":"https://api.github.com/users/edrex/gists{/gist_id}","starred_url":"https://api.github.com/users/edrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edrex/subscriptions","organizations_url":"https://api.github.com/users/edrex/orgs","repos_url":"https://api.github.com/users/edrex/repos","events_url":"https://api.github.com/users/edrex/events{/privacy}","received_events_url":"https://api.github.com/users/edrex/received_events","type":"User","site_admin":false},"body":"This extends `th-saving-tiddler` to expose the old title as `tiddler.renaming` if the save is a rename. Read it as \"we are renaming this existing title, with tiddler.title set to the new title\".\r\n\r\nIt's not on `tiddler.fields` to avoid conflicts with existing fields, and is unset before saving.\r\n\r\nThis is so hook implementers can do things on rename like\r\n\r\n - retarget references in other tiddlers\r\n - display a modal UI for interactively updating references\r\n - access the old tiddler, and the one that is about to be overwritten if it exists (maybe to make a backup or something? idk).\r\n\r\nIt also extracts a wiki method `retargetReferences(from, to)` from `renameTiddler` which updates references in tags and lists without actually renaming the tiddler, as a convenience method for implementers of the hook as well as power users. It doesn't change the existing behavior of the **text-slicer** edition. Once there is a more general UX for retargeting references I think this special code path could be removed.\r\n\r\nIt doesn't add a default implementation of the hook.\r\n\r\nHere is an example implementation which uses the new field and wiki method to automatically retarget tags and lists on rename:\r\n\r\n```javascript\r\n  $tw.hooks.addHook(\"th-saving-tiddler\",function(tiddler) {\r\n    if (tiddler.renaming) {\r\n      $tw.wiki.retargetReferences(tiddler.renaming, tiddler.fields.title);\r\n    }\r\n    return tiddler;\r\n  });\r\n\r\n```\r\n\r\nI'm excited to see this go in, since I plan to use the hook to implement reference updating in gsd5, which makes heavy use of reference fields and tags to model application data.\r\n","created_at":"2016-01-21T21:13:01Z","updated_at":"2016-02-05T17:36:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b646c312023ac7b4a449aab461cefcf77ba1d8e7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247/commits","review_comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247/comments","review_comment_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2247/comments","statuses_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/statuses/312f92dd383db7075b56dcbafc87d21a9820d4c6","head":{"label":"edrex:th-saving-tiddler_renaming_field","ref":"th-saving-tiddler_renaming_field","sha":"312f92dd383db7075b56dcbafc87d21a9820d4c6","user":{"login":"edrex","id":14615,"avatar_url":"https://avatars.githubusercontent.com/u/14615?v=3","gravatar_id":"","url":"https://api.github.com/users/edrex","html_url":"https://github.com/edrex","followers_url":"https://api.github.com/users/edrex/followers","following_url":"https://api.github.com/users/edrex/following{/other_user}","gists_url":"https://api.github.com/users/edrex/gists{/gist_id}","starred_url":"https://api.github.com/users/edrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edrex/subscriptions","organizations_url":"https://api.github.com/users/edrex/orgs","repos_url":"https://api.github.com/users/edrex/repos","events_url":"https://api.github.com/users/edrex/events{/privacy}","received_events_url":"https://api.github.com/users/edrex/received_events","type":"User","site_admin":false},"repo":{"id":49678165,"name":"TiddlyWiki5","full_name":"edrex/TiddlyWiki5","owner":{"login":"edrex","id":14615,"avatar_url":"https://avatars.githubusercontent.com/u/14615?v=3","gravatar_id":"","url":"https://api.github.com/users/edrex","html_url":"https://github.com/edrex","followers_url":"https://api.github.com/users/edrex/followers","following_url":"https://api.github.com/users/edrex/following{/other_user}","gists_url":"https://api.github.com/users/edrex/gists{/gist_id}","starred_url":"https://api.github.com/users/edrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edrex/subscriptions","organizations_url":"https://api.github.com/users/edrex/orgs","repos_url":"https://api.github.com/users/edrex/repos","events_url":"https://api.github.com/users/edrex/events{/privacy}","received_events_url":"https://api.github.com/users/edrex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edrex/TiddlyWiki5","description":"A reboot of TiddlyWiki for the next 25 years","fork":true,"url":"https://api.github.com/repos/edrex/TiddlyWiki5","forks_url":"https://api.github.com/repos/edrex/TiddlyWiki5/forks","keys_url":"https://api.github.com/repos/edrex/TiddlyWiki5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edrex/TiddlyWiki5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edrex/TiddlyWiki5/teams","hooks_url":"https://api.github.com/repos/edrex/TiddlyWiki5/hooks","issue_events_url":"https://api.github.com/repos/edrex/TiddlyWiki5/issues/events{/number}","events_url":"https://api.github.com/repos/edrex/TiddlyWiki5/events","assignees_url":"https://api.github.com/repos/edrex/TiddlyWiki5/assignees{/user}","branches_url":"https://api.github.com/repos/edrex/TiddlyWiki5/branches{/branch}","tags_url":"https://api.github.com/repos/edrex/TiddlyWiki5/tags","blobs_url":"https://api.github.com/repos/edrex/TiddlyWiki5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edrex/TiddlyWiki5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edrex/TiddlyWiki5/git/refs{/sha}","trees_url":"https://api.github.com/repos/edrex/TiddlyWiki5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edrex/TiddlyWiki5/statuses/{sha}","languages_url":"https://api.github.com/repos/edrex/TiddlyWiki5/languages","stargazers_url":"https://api.github.com/repos/edrex/TiddlyWiki5/stargazers","contributors_url":"https://api.github.com/repos/edrex/TiddlyWiki5/contributors","subscribers_url":"https://api.github.com/repos/edrex/TiddlyWiki5/subscribers","subscription_url":"https://api.github.com/repos/edrex/TiddlyWiki5/subscription","commits_url":"https://api.github.com/repos/edrex/TiddlyWiki5/commits{/sha}","git_commits_url":"https://api.github.com/repos/edrex/TiddlyWiki5/git/commits{/sha}","comments_url":"https://api.github.com/repos/edrex/TiddlyWiki5/comments{/number}","issue_comment_url":"https://api.github.com/repos/edrex/TiddlyWiki5/issues/comments{/number}","contents_url":"https://api.github.com/repos/edrex/TiddlyWiki5/contents/{+path}","compare_url":"https://api.github.com/repos/edrex/TiddlyWiki5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edrex/TiddlyWiki5/merges","archive_url":"https://api.github.com/repos/edrex/TiddlyWiki5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edrex/TiddlyWiki5/downloads","issues_url":"https://api.github.com/repos/edrex/TiddlyWiki5/issues{/number}","pulls_url":"https://api.github.com/repos/edrex/TiddlyWiki5/pulls{/number}","milestones_url":"https://api.github.com/repos/edrex/TiddlyWiki5/milestones{/number}","notifications_url":"https://api.github.com/repos/edrex/TiddlyWiki5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edrex/TiddlyWiki5/labels{/name}","releases_url":"https://api.github.com/repos/edrex/TiddlyWiki5/releases{/id}","deployments_url":"https://api.github.com/repos/edrex/TiddlyWiki5/deployments","created_at":"2016-01-14T22:02:45Z","updated_at":"2016-01-14T22:02:51Z","pushed_at":"2016-01-21T22:19:19Z","git_url":"git://github.com/edrex/TiddlyWiki5.git","ssh_url":"git@github.com:edrex/TiddlyWiki5.git","clone_url":"https://github.com/edrex/TiddlyWiki5.git","svn_url":"https://github.com/edrex/TiddlyWiki5","homepage":"http://tiddlywiki.com/","size":25536,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Jermolene:master","ref":"master","sha":"94107dc64c620b69d691b8f2bba6267a382f43c7","user":{"login":"Jermolene","id":174761,"avatar_url":"https://avatars.githubusercontent.com/u/174761?v=3","gravatar_id":"","url":"https://api.github.com/users/Jermolene","html_url":"https://github.com/Jermolene","followers_url":"https://api.github.com/users/Jermolene/followers","following_url":"https://api.github.com/users/Jermolene/following{/other_user}","gists_url":"https://api.github.com/users/Jermolene/gists{/gist_id}","starred_url":"https://api.github.com/users/Jermolene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jermolene/subscriptions","organizations_url":"https://api.github.com/users/Jermolene/orgs","repos_url":"https://api.github.com/users/Jermolene/repos","events_url":"https://api.github.com/users/Jermolene/events{/privacy}","received_events_url":"https://api.github.com/users/Jermolene/received_events","type":"User","site_admin":false},"repo":{"id":2828239,"name":"TiddlyWiki5","full_name":"Jermolene/TiddlyWiki5","owner":{"login":"Jermolene","id":174761,"avatar_url":"https://avatars.githubusercontent.com/u/174761?v=3","gravatar_id":"","url":"https://api.github.com/users/Jermolene","html_url":"https://github.com/Jermolene","followers_url":"https://api.github.com/users/Jermolene/followers","following_url":"https://api.github.com/users/Jermolene/following{/other_user}","gists_url":"https://api.github.com/users/Jermolene/gists{/gist_id}","starred_url":"https://api.github.com/users/Jermolene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jermolene/subscriptions","organizations_url":"https://api.github.com/users/Jermolene/orgs","repos_url":"https://api.github.com/users/Jermolene/repos","events_url":"https://api.github.com/users/Jermolene/events{/privacy}","received_events_url":"https://api.github.com/users/Jermolene/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Jermolene/TiddlyWiki5","description":"A self-contained JavaScript wiki for the browser or Node.js","fork":false,"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5","forks_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/forks","keys_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/teams","hooks_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/hooks","issue_events_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/events{/number}","events_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/events","assignees_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/assignees{/user}","branches_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/branches{/branch}","tags_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/tags","blobs_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/statuses/{sha}","languages_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/languages","stargazers_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/stargazers","contributors_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/contributors","subscribers_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/subscribers","subscription_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/subscription","commits_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/contents/{+path}","compare_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/merges","archive_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/downloads","issues_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues{/number}","pulls_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls{/number}","milestones_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/milestones{/number}","notifications_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/labels{/name}","releases_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/releases{/id}","deployments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/deployments","created_at":"2011-11-22T14:26:07Z","updated_at":"2016-02-05T14:49:37Z","pushed_at":"2016-02-05T00:29:24Z","git_url":"git://github.com/Jermolene/TiddlyWiki5.git","ssh_url":"git@github.com:Jermolene/TiddlyWiki5.git","clone_url":"https://github.com/Jermolene/TiddlyWiki5.git","svn_url":"https://github.com/Jermolene/TiddlyWiki5","homepage":"http://tiddlywiki.com/","size":27425,"stargazers_count":1725,"watchers_count":1725,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":407,"mirror_url":null,"open_issues_count":600,"forks":407,"open_issues":600,"watchers":1725,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247"},"html":{"href":"https://github.com/Jermolene/TiddlyWiki5/pull/2247"},"issue":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2247"},"comments":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2247/comments"},"review_comments":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247/comments"},"review_comment":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/pulls/2247/commits"},"statuses":{"href":"https://api.github.com/repos/Jermolene/TiddlyWiki5/statuses/312f92dd383db7075b56dcbafc87d21a9820d4c6"}}}}