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

Already on GitHub? Sign in to your account

AO3-5279 - Deleting bookmarks causes error in BookmarkIndexer. #3201

Merged
merged 2 commits into from Dec 10, 2017

Conversation

Projects
None yet
4 participants
Contributor

tickinginstant commented Dec 10, 2017

Issue

https://otwarchive.atlassian.net/browse/AO3-5279

Purpose

When the BookmarkIndexer tries to look up a bookmark that's been deleted, the object associated with the deleted ID will be nil. The parent_id function tries to call object.id if the object is nil; instead, it should take the object's ID as an argument and use that to access the information it needs.

Testing

Try deleting a bookmark, wait a while, and then check the logs to see if there has been an error.

@@ -89,7 +89,7 @@ def document(object)
tag_ids: tags.map(&:id)
)
- unless parent_id(object).match("deleted")
+ unless parent_id(object.id, object).match("deleted")
@houndci-bot

houndci-bot Dec 10, 2017

Use =~ in places where the MatchData returned by #match will not be used.

@@ -143,7 +143,7 @@ def index_document(object)
body: document(object)
}
if respond_to?(:parent_id)
- info.merge!(routing: parent_id(object))
+ info.merge!(routing: parent_id(object.id, object))
@houndci-bot

houndci-bot Dec 10, 2017

Use info[:routing] = parent_id(object.id, object) instead of info.merge!(routing: parent_id(object.id, object)).

@sarken sarken merged commit ca34c88 into otwcode:master Dec 10, 2017

4 checks passed

Scrutinizer No new issues
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound 2 violations found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment