Commit bfb31a2a authored by Robert Speicher's avatar Robert Speicher

Merge branch 'master' into 8-3-stable

parents b6edaeba 9ede66f6
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.3.0 (unreleased) v 8.3.0 (unreleased)
- API support for starred projects for authorized user (Zeger-Jan van de Weg)
- Add open_issues_count to project API (Stan Hu) - Add open_issues_count to project API (Stan Hu)
- Expand character set of usernames created by Omniauth (Corey Hinshaw) - Expand character set of usernames created by Omniauth (Corey Hinshaw)
- Add button to automatically merge a merge request when the build succeeds (Zeger-Jan van de Weg) - Add button to automatically merge a merge request when the build succeeds (Zeger-Jan van de Weg)
......
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
= link_to url_for(params), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do = link_to url_for(params), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do
Commits Commits
%span.badge= @commits.size %span.badge= @commits.size
%li.diffs-tab.active
= link_to url_for(params), data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'} do
Changes
%span.badge= @diffs.size
- if @ci_commit - if @ci_commit
%li.builds-tab.active %li.builds-tab.active
= link_to url_for(params), data: {target: 'div#builds', action: 'builds', toggle: 'tab'} do = link_to url_for(params), data: {target: 'div#builds', action: 'builds', toggle: 'tab'} do
Builds Builds
%span.badge= @statuses.size %span.badge= @statuses.size
%li.diffs-tab.active
= link_to url_for(params), data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'} do
Changes
%span.badge= @diffs.size
.tab-content .tab-content
#commits.commits.tab-pane #commits.commits.tab-pane
......
...@@ -53,25 +53,25 @@ ...@@ -53,25 +53,25 @@
= link_to commits_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do = link_to commits_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#commits', action: 'commits', toggle: 'tab'} do
Commits Commits
%span.badge= @commits.size %span.badge= @commits.size
%li.diffs-tab
= link_to diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'} do
Changes
%span.badge= @merge_request.diffs.size
- if @ci_commit - if @ci_commit
%li.builds-tab %li.builds-tab
= link_to builds_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: '#builds', action: 'builds', toggle: 'tab'} do = link_to builds_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: '#builds', action: 'builds', toggle: 'tab'} do
Builds Builds
%span.badge= @statuses.size %span.badge= @statuses.size
%li.diffs-tab
= link_to diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'} do
Changes
%span.badge= @merge_request.diffs.size
.tab-content .tab-content
#notes.notes.tab-pane.voting_notes #notes.notes.tab-pane.voting_notes
= render "projects/merge_requests/discussion" = render "projects/merge_requests/discussion"
#commits.commits.tab-pane #commits.commits.tab-pane
- # This tab is always loaded via AJAX - # This tab is always loaded via AJAX
#diffs.diffs.tab-pane
- # This tab is always loaded via AJAX
#builds.builds.tab-pane #builds.builds.tab-pane
- # This tab is always loaded via AJAX - # This tab is always loaded via AJAX
#diffs.diffs.tab-pane
- # This tab is always loaded via AJAX
.mr-loading-status .mr-loading-status
= spinner = spinner
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
.accept-action .accept-action
- if @ci_commit && @ci_commit.active? - if @ci_commit && @ci_commit.active?
%span.btn-group %span.btn-group
= link_to "#", class: "btn btn-create merge_when_build_succeeds" do = button_tag class: "btn btn-create js-merge-button merge_when_build_succeeds" do
Merge When Build Succeeds Merge When Build Succeeds
%a.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown' } = button_tag class: "btn btn-success dropdown-toggle", 'data-toggle' => 'dropdown' do
%span.caret %span.caret
%span.sr-only %span.sr-only
Select Merge Moment Select Merge Moment
%ul.dropdown-menu.dropdown-menu-right{ role: 'menu' } %ul.js-merge-dropdown.dropdown-menu.dropdown-menu-right{ role: 'menu' }
%li %li
= link_to "#", class: "merge_when_build_succeeds" do = link_to "#", class: "merge_when_build_succeeds" do
= icon('check fw') = icon('check fw')
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
= icon('warning fw') = icon('warning fw')
Merge Immediately Merge Immediately
- else - else
= f.button class: "btn btn-create btn-grouped accept_merge_request #{status_class}" do = f.button class: "btn btn-create btn-grouped js-merge-button accept_merge_request #{status_class}" do
Accept Merge Request Accept Merge Request
- if @merge_request.can_remove_source_branch?(current_user) - if @merge_request.can_remove_source_branch?(current_user)
.accept-control.checkbox .accept-control.checkbox
...@@ -42,21 +42,19 @@ ...@@ -42,21 +42,19 @@
= hidden_field_tag :merge_when_build_succeeds, "", autocomplete: "off" = hidden_field_tag :merge_when_build_succeeds, "", autocomplete: "off"
:javascript :javascript
$('.accept_merge_request').on('click', function() {
$(this).html("<i class='fa fa-spinner fa-spin'></i> Merge in progress");
});
$('.accept-mr-form').on('ajax:send', function() { $('.accept-mr-form').on('ajax:send', function() {
$(".accept-mr-form :input").disable(); $(".accept-mr-form :input").disable();
}); });
$('a.accept_merge_request').on('click', function(e) { $('.accept_merge_request').on('click', function() {
e.preventDefault(); $('.js-merge-button').html("<i class='fa fa-spinner fa-spin'></i> Merge in progress");
$(this).closest("form").submit();
}); });
$('a.merge_when_build_succeeds').on('click', function(e) { $('.merge_when_build_succeeds').on('click', function() {
e.preventDefault();
$("#merge_when_build_succeeds").val("1"); $("#merge_when_build_succeeds").val("1");
});
$('.js-merge-dropdown a').on('click', function(e) {
e.preventDefault();
$(this).closest("form").submit(); $(this).closest("form").submit();
}); });
...@@ -139,6 +139,21 @@ Parameters: ...@@ -139,6 +139,21 @@ Parameters:
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc` - `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
- `search` (optional) - Return list of authorized projects according to a search criteria - `search` (optional) - Return list of authorized projects according to a search criteria
### List starred projects
Get a list of projects which are starred by the authenticated user.
```
GET /projects/starred
```
Parameters:
- `archived` (optional) - if passed, limit by archived status
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
- `search` (optional) - Return list of authorized projects according to a search criteria
### List ALL projects ### List ALL projects
Get a list of all GitLab projects (admin only). Get a list of all GitLab projects (admin only).
......
This diff is collapsed.
...@@ -70,7 +70,7 @@ module API ...@@ -70,7 +70,7 @@ module API
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ |project, options| project.forked? } expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ |project, options| project.forked? }
expose :avatar_url expose :avatar_url
expose :star_count, :forks_count expose :star_count, :forks_count
expose :open_issues_count, if: lambda { | project, options | project.issues_enabled? && project.default_issues_tracker? } expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? }
end end
class ProjectMember < UserBasic class ProjectMember < UserBasic
......
...@@ -39,6 +39,17 @@ module API ...@@ -39,6 +39,17 @@ module API
present @projects, with: Entities::Project present @projects, with: Entities::Project
end end
# Gets starred project for the authenticated user
#
# Example Request:
# GET /projects/starred
get '/starred' do
@projects = current_user.starred_projects
@projects = filter_projects(@projects)
@projects = paginate @projects
present @projects, with: Entities::Project
end
# Get all projects for admin user # Get all projects for admin user
# #
# Example Request: # Example Request:
......
...@@ -21,12 +21,12 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -21,12 +21,12 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
end end
it 'displays the Merge When Build Succeeds button' do it 'displays the Merge When Build Succeeds button' do
expect(page).to have_link "Merge When Build Succeeds" expect(page).to have_button "Merge When Build Succeeds"
end end
context "Merge When Build succeeds enabled" do context "Merge When Build succeeds enabled" do
before do before do
click_link "Merge When Build Succeeds" click_button "Merge When Build Succeeds"
end end
it 'activates Merge When Build Succeeds feature' do it 'activates Merge When Build Succeeds feature' do
...@@ -58,7 +58,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -58,7 +58,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
it 'cancels the automatic merge' do it 'cancels the automatic merge' do
click_link "Cancel Automatic Merge" click_link "Cancel Automatic Merge"
expect(page).to have_link "Merge When Build Succeeds" expect(page).to have_button "Merge When Build Succeeds"
visit_merge_request(merge_request) # Needed to refresh the page visit_merge_request(merge_request) # Needed to refresh the page
expect(page).to have_content "Canceled the automatic merge" expect(page).to have_content "Canceled the automatic merge"
......
...@@ -139,6 +139,25 @@ describe API::API, api: true do ...@@ -139,6 +139,25 @@ describe API::API, api: true do
end end
end end
describe 'GET /projects/starred' do
before do
admin.starred_projects << project
admin.save!
end
it 'should return the starred projects' do
get api('/projects/all', admin)
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response).to satisfy do |response|
response.one? do |entry|
entry['name'] == project.name
end
end
end
end
describe 'POST /projects' do describe 'POST /projects' do
context 'maximum number of projects reached' do context 'maximum number of projects reached' do
it 'should not create new project and respond with 403' do it 'should not create new project and respond with 403' do
...@@ -471,7 +490,7 @@ describe API::API, api: true do ...@@ -471,7 +490,7 @@ describe API::API, api: true do
end end
end end
describe 'PUT /projects/:id/snippets/:shippet_id' do describe 'PUT /projects/:id/snippets/:snippet_id' do
it 'should update an existing project snippet' do it 'should update an existing project snippet' do
put api("/projects/#{project.id}/snippets/#{snippet.id}", user), put api("/projects/#{project.id}/snippets/#{snippet.id}", user),
code: 'updated code' code: 'updated code'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment