{"action":"created","issue":{"url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/759","labels_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/759/labels{/name}","comments_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/759/comments","events_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/759/events","html_url":"https://github.com/AlchemyCMS/alchemy_cms/issues/759","id":66750795,"number":759,"title":"Page#set_urlname and Page#update_urlname! generate different urlnames.","user":{"login":"Domenoth","id":147903,"avatar_url":"https://avatars.githubusercontent.com/u/147903?v=3","gravatar_id":"","url":"https://api.github.com/users/Domenoth","html_url":"https://github.com/Domenoth","followers_url":"https://api.github.com/users/Domenoth/followers","following_url":"https://api.github.com/users/Domenoth/following{/other_user}","gists_url":"https://api.github.com/users/Domenoth/gists{/gist_id}","starred_url":"https://api.github.com/users/Domenoth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Domenoth/subscriptions","organizations_url":"https://api.github.com/users/Domenoth/orgs","repos_url":"https://api.github.com/users/Domenoth/repos","events_url":"https://api.github.com/users/Domenoth/events{/privacy}","received_events_url":"https://api.github.com/users/Domenoth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-07T02:04:40Z","updated_at":"2015-04-10T06:12:38Z","closed_at":null,"body":"The [update_urlname!](https://github.com/AlchemyCMS/alchemy_cms/blob/master/app/models/alchemy/page/page_naming.rb#L40) method respects visible/invisible ancestors (not just `Config.get(:url_nesting)`). But the [set_urlname (via parent_urlname)](https://github.com/AlchemyCMS/alchemy_cms/blob/master/app/models/alchemy/page/page_naming.rb#L105) method does not.\r\n\r\nI Suggest doing something like:\r\n```ruby\r\ndef parent_urlname\r\n  return if parent.nil? || parent.language_root? || parent.root? || !parent.visible?\r\n  parent.urlname\r\nend\r\n```\r\nThis might cause inconsistencies with invisible parents alongside visible grandparents but I'm not sure if that sort of thing is allowed. If it is allowed you might want to abandon ```parent_urlname``` altogether and change it to something like ```ancestor_urlname``` which you could then share across both the `update_urlname!` and `set_urlname` methods."},"comment":{"url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/comments/91444355","html_url":"https://github.com/AlchemyCMS/alchemy_cms/issues/759#issuecomment-91444355","issue_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/759","id":91444355,"user":{"login":"tvdeyen","id":42868,"avatar_url":"https://avatars.githubusercontent.com/u/42868?v=3","gravatar_id":"","url":"https://api.github.com/users/tvdeyen","html_url":"https://github.com/tvdeyen","followers_url":"https://api.github.com/users/tvdeyen/followers","following_url":"https://api.github.com/users/tvdeyen/following{/other_user}","gists_url":"https://api.github.com/users/tvdeyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tvdeyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvdeyen/subscriptions","organizations_url":"https://api.github.com/users/tvdeyen/orgs","repos_url":"https://api.github.com/users/tvdeyen/repos","events_url":"https://api.github.com/users/tvdeyen/events{/privacy}","received_events_url":"https://api.github.com/users/tvdeyen/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T06:12:38Z","updated_at":"2015-04-10T06:12:38Z","body":"Yes, this should be refactored so that 'update_urlname' and 'set_urlname' call the same method with consistent behavior. Would you send a pull request? Thanks"}}