-
Notifications
You must be signed in to change notification settings - Fork 145
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
Commit lock author #901
Merged
Merged
Commit lock author #901
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5c82516
Add lock_author_id to commits
davidcornu 7051412
Add lock_author relation and lock/unlock methods
davidcornu d4cd849
Add CastValue.to_boolean
davidcornu ef9d2b2
Use lock/unlock instead of update
davidcornu 4ad50a2
Show who locked the commit in the tooltip
davidcornu 722d972
Preload the lock_author for commits
davidcornu fbd52bf
Add Commit.lock_all
davidcornu 5bd2709
Add test coverage for lock_reverted_commits!
davidcornu 22403f4
Refactor reverted commit locking to set the lock author
davidcornu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddLockAuthorIdToCommits < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column(:commits, :lock_author_id, :integer, limit: 4) | ||
davidcornu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Shipit | ||
module CastValue | ||
def to_boolean(value) | ||
ActiveModel::Type::Boolean.new.serialize(value) | ||
end | ||
|
||
module_function :to_boolean | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -10,7 +10,7 @@ | |||
# | ||||
# It's strongly recommended that you check this file into your version control system. | ||||
|
||||
ActiveRecord::Schema.define(version: 2018_10_10_150947) do | ||||
ActiveRecord::Schema.define(version: 2019_05_02_020249) do | ||||
|
||||
create_table "api_clients", force: :cascade do |t| | ||||
t.text "permissions", limit: 65535 | ||||
|
@@ -76,6 +76,7 @@ | |||
t.string "pull_request_title", limit: 1024 | ||||
t.integer "pull_request_id" | ||||
t.boolean "locked", default: false, null: false | ||||
t.integer "lock_author_id", limit: 4 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done to match shipit-engine/test/dummy/db/schema.rb Line 206 in 5458ffe
|
||||
t.index ["author_id"], name: "index_commits_on_author_id" | ||||
t.index ["committer_id"], name: "index_commits_on_committer_id" | ||||
t.index ["created_at"], name: "index_commits_on_created_at" | ||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@casperisfine thoughts on this change? I refactored the logic to lock in batches rather than all at once so the
lock_author
can be set to the revert commit author.Tests are gonna fail. Will fix after work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'd use
affected_rows
rather thanaffected
though /nitpick.