-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for Redmine 4 and rails 5.2. Also merged MR tracking from ogir-…
…ok (#1) * Added MR tracking * Display options * Updated. Not all params are required * Updated view * Label width * update if not exists * Fix for Redmine 4 and Rails 5.2 * Fix migrations for Redmine 4 and Rails 5.2
- Loading branch information
Showing
9 changed files
with
246 additions
and
16 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class GitlabTrackingMergeRequest < ActiveRecord::Base | ||
unloadable | ||
belongs_to :issue | ||
|
||
|
||
class << self | ||
|
||
def parse_merge_request_and_create(issue, merge_request, author, assignee) | ||
gtmr = find_or_create_by(gitlab_id: merge_request['id']) | ||
gtmr.issue = issue | ||
|
||
gtmr.source = merge_request['source_branch'] | ||
gtmr.target = merge_request['target_branch'] | ||
gtmr.title = merge_request['title'] | ||
|
||
gtmr.state = merge_request['state'] | ||
gtmr.merge_status = merge_request['merge_status'] | ||
|
||
gtmr.gitlab_url = merge_request['url'] | ||
|
||
if author | ||
gtmr.author_username = author['username'] | ||
gtmr.author_name = author['name'] | ||
end | ||
|
||
if assignee | ||
gtmr.assignee_username = assignee['username'] | ||
gtmr.assignee_name = assignee['name'] | ||
end | ||
|
||
gtmr.timestamp = Time.parse(merge_request['created_at']) | ||
gtmr.save | ||
end | ||
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class AddIndexToGitlabTrackingCommits < ActiveRecord::Migration | ||
class AddIndexToGitlabTrackingCommits < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] | ||
def change | ||
add_index :gitlab_tracking_commits, [:issue_id, :git_hash] | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class CreateGitlabTrackingMergeRequest < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] | ||
def change | ||
create_table :gitlab_tracking_merge_requests do |t| | ||
t.integer :issue_id | ||
t.integer :gitlab_id | ||
t.string :source | ||
t.string :target | ||
t.string :title | ||
|
||
t.string :state | ||
t.string :merge_status | ||
t.string :gitlab_url, :limit => 4096 | ||
|
||
|
||
t.string :author_username | ||
t.string :author_name | ||
|
||
t.string :assignee_username | ||
t.string :assignee_name | ||
|
||
t.timestamp :timestamp | ||
|
||
end | ||
|
||
add_index :gitlab_tracking_merge_requests, [:issue_id, :gitlab_id] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"object_attributes": { | ||
"source_branch": "ms-viewport", | ||
"source_project_id": 14, | ||
"author_id": 51, | ||
"assignee_id": 6, | ||
"title": "MS-Viewport", | ||
"created_at": "2013-12-03T17:23:34Z", | ||
"updated_at": "2013-12-03T17:23:34Z", | ||
"st_commits": null, | ||
"st_diffs": null, | ||
"milestone_id": null, | ||
"state": "opened", | ||
"merge_status": "unchecked", | ||
"target_project_id": 14, | ||
"iid": 1, | ||
"description": "", | ||
"source": { | ||
"name":"Awesome Project", | ||
"description":"Aut reprehenderit ut est.", | ||
"web_url":"http://example.com/awesome_space/awesome_project", | ||
"avatar_url":null, | ||
"git_ssh_url":"[email protected]:awesome_space/awesome_project.git", | ||
"git_http_url":"http://example.com/awesome_space/awesome_project.git", | ||
"namespace":"Awesome Space", | ||
"visibility_level":20, | ||
"path_with_namespace":"awesome_space/awesome_project", | ||
"default_branch":"master", | ||
"homepage":"http://example.com/awesome_space/awesome_project", | ||
"url":"http://example.com/awesome_space/awesome_project.git", | ||
"ssh_url":"[email protected]:awesome_space/awesome_project.git", | ||
"http_url":"http://example.com/awesome_space/awesome_project.git" | ||
}, | ||
"target": { | ||
"name":"Awesome Project", | ||
"description":"Aut reprehenderit ut est.", | ||
"web_url":"http://example.com/awesome_space/awesome_project", | ||
"avatar_url":null, | ||
"git_ssh_url":"[email protected]:awesome_space/awesome_project.git", | ||
"git_http_url":"http://example.com/awesome_space/awesome_project.git", | ||
"namespace":"Awesome Space", | ||
"visibility_level":20, | ||
"path_with_namespace":"awesome_space/awesome_project", | ||
"default_branch":"master", | ||
"homepage":"http://example.com/awesome_space/awesome_project", | ||
"url":"http://example.com/awesome_space/awesome_project.git", | ||
"ssh_url":"[email protected]:awesome_space/awesome_project.git", | ||
"http_url":"http://example.com/awesome_space/awesome_project.git" | ||
}, | ||
"last_commit": { | ||
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
"message": "fixed readme", | ||
"timestamp": "2012-01-03T23:36:29+02:00", | ||
"url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
"author": { | ||
"name": "GitLab dev user", | ||
"email": "gitlabdev@dv6700.(none)" | ||
} | ||
}, | ||
"work_in_progress": false, | ||
"url": "http://example.com/diaspora/merge_requests/1", | ||
"action": "open", | ||
"assignee": { | ||
"name": "User1", | ||
"username": "user1", | ||
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" | ||
} | ||
}, | ||
|
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