Mailing List Archive

Managing changes to keywords in stories
Faith and I have been doing some work on managing cover stories with keywords. We started with the work Philip documented here:

http://www.gossamer-threads.com/lists/bricolage/users/34387

And we've found a couple things. Maybe this isn't new. We're on 2.0.1. The first three really aren't specific to our project:

1. If a user deletes a keyword in the interface, it is removed from all the stories that it is on. That is, if you "check out" one of these stories, the keyword no longer appears to be associated. But it actually still is. If you do a story->list for stories with the deleted keyword, the stories still come up in the list even though its been deleted.

2. If a user tries to add a deleted keyword to a story, they get an error that keyword "already exists".

3. If a keyword gets re-activated via $keyword->activate, the keywords are displayed again on all the old stories. So the deleted keywords are still associated with the stories, you just cant see them.

4. If we delete a keyword cover page (as describe in Philip's thread), and then try to re-publish a blog entry with that keyword, the template BLOWS up. I assume this is because that story is deactivated, it is not available via the API when it checks if it exists, but the template dies because it can not reuse the URI.

My question is this: are the above scenarios how Bricolage *should* handle the problem? If not, what would be a better way? I think you can make an argument that #2 and #3 are perhaps not a bad behavior. I'm less certain about #1. In regards to #4, I think there's an open question of how something like that should be handled - automatically recreate the story, leave it alone, or prompt the user? Is there a reasonable way to check a deleted story and notify the user via the API or just regenerate?

Finally, there's the question of deleting keyword pages along with keywords that get deleted. I personally think that would be a "useful" thing, but I'm not sure how we could accomplish it at the moment.

Thanks,

Matt
Re: Managing changes to keywords in stories [ In reply to ]
On Jan 27, 2012, at 3:31 PM, Matthew Rolf wrote:

> 1. If a user deletes a keyword in the interface, it is removed from all the stories that it is on. That is, if you "check out" one of these stories, the keyword no longer appears to be associated. But it actually still is. If you do a story->list for stories with the deleted keyword, the stories still come up in the list even though its been deleted.

It’s deactivated.

> 2. If a user tries to add a deleted keyword to a story, they get an error that keyword "already exists".

Bug. Should probably re-activated the keyword.

> 3. If a keyword gets re-activated via $keyword->activate, the keywords are displayed again on all the old stories. So the deleted keywords are still associated with the stories, you just cant see them.

Right. One should filter out inactive keywords in templates. I always forget about that.

> 4. If we delete a keyword cover page (as describe in Philip's thread), and then try to re-publish a blog entry with that keyword, the template BLOWS up. I assume this is because that story is deactivated, it is not available via the API when it checks if it exists, but the template dies because it can not reuse the URI.

Dunno, but seems like the sort of thing you could code around in the template.

> My question is this: are the above scenarios how Bricolage *should* handle the problem? If not, what would be a better way? I think you can make an argument that #2 and #3 are perhaps not a bad behavior. I'm less certain about #1. In regards to #4, I think there's an open question of how something like that should be handled - automatically recreate the story, leave it alone, or prompt the user? Is there a reasonable way to check a deleted story and notify the user via the API or just regenerate?

You can’t prompt the user from a template, really. I would probably just re-generate, me. But it depends on the requirements in your environment.

> Finally, there's the question of deleting keyword pages along with keywords that get deleted. I personally think that would be a "useful" thing, but I'm not sure how we could accomplish it at the moment.

Yeah, they are independent things. Theoretically, one could do it with event hooks, but they've never been implemented.

Best,

David
Re: Managing changes to keywords in stories [ In reply to ]
> > 2. If a user tries to add a deleted keyword to a story, they get an error that keyword "already exists".
>
> Bug. Should probably re-activated the keyword.

I thought this sounded familiar. Check out the comments on this bug:
http://bricolage.lighthouseapp.com/projects/29601/tickets/206

I think I ended up going with a one-off script that scans for stories with deleted keywords and disassociates the keywords from the stories. Then if the keyword is ever reactivated, it's guaranteed to be "clean" and not attached to any existing stories.