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

Document method + fix typo #142

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/models/pull_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def add_comment(text)
update(eligible_for_comment: false)
end

##
# mock the method eligible_for_comment. We call it and check if it's nil
# in that case, we return true. That means you can create a comment there
# if it's not true, we call it again and return the value.
# eligible_for_comment from the above object is a getter/setter for the
# attribute. see db/schema.rb for details
def eligible_for_comment
return true if super.nil?

Expand All @@ -127,8 +133,8 @@ def eligible_for_comment
# We currently don't care about them

def validate(saved_changes)
# Don't run through the validaten, if only the eligable_for_comment attribute got updated
return if saved_changes.keys.sort == %w[updated_at eligable_for_comment].sort && !mergeable.nil?
# Don't run through the validaten, if only the eligible_for_comment attribute got updated
return if saved_changes.keys.sort == %w[updated_at eligible_for_comment].sort && !mergeable.nil?

# if the pull request is now closed, dont attach/remove labels/comments
return if closed?
Expand Down