Commit 6dee8b41 authored by Rémy Coutable's avatar Rémy Coutable

Merge remote-tracking branch 'ce/master' into rc/ce-to-ee-friday

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parents 78ec4e8f 00cb8237
...@@ -426,7 +426,7 @@ merge request: ...@@ -426,7 +426,7 @@ merge request:
1. [Ruby](https://github.com/bbatsov/ruby-style-guide). 1. [Ruby](https://github.com/bbatsov/ruby-style-guide).
Important sections include [Source Code Layout][rss-source] and Important sections include [Source Code Layout][rss-source] and
[Naming][rss-naming]. Use: [Naming][rss-naming]. Use:
- multi-line method chaining style **Option B**: dot `.` on previous line - multi-line method chaining style **Option A**: dot `.` on the second line
- string literal quoting style **Option A**: single quoted by default - string literal quoting style **Option A**: single quoted by default
1. [Rails](https://github.com/bbatsov/rails-style-guide) 1. [Rails](https://github.com/bbatsov/rails-style-guide)
1. [Newlines styleguide][newlines-styleguide] 1. [Newlines styleguide][newlines-styleguide]
......
/* global Vue */
require('./issue_card_inner');
const Store = gl.issueBoards.BoardsStore;
module.exports = {
name: 'BoardsIssueCard',
template: `
<li class="card"
:class="{ 'user-can-drag': !disabled && issue.id, 'is-disabled': disabled || !issue.id, 'is-active': issueDetailVisible }"
:index="index"
:data-issue-id="issue.id"
@mousedown="mouseDown"
@mousemove="mouseMove"
@mouseup="showIssue($event)">
<issue-card-inner
:list="list"
:issue="issue"
:issue-link-base="issueLinkBase"
:root-path="rootPath" />
</li>
`,
components: {
'issue-card-inner': gl.issueBoards.IssueCardInner,
},
props: {
list: Object,
issue: Object,
issueLinkBase: String,
disabled: Boolean,
index: Number,
rootPath: String,
},
data() {
return {
showDetail: false,
detailIssue: Store.detail,
};
},
computed: {
issueDetailVisible() {
return this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id;
},
},
methods: {
mouseDown() {
this.showDetail = true;
},
mouseMove() {
this.showDetail = false;
},
showIssue(e) {
const targetTagName = e.target.tagName.toLowerCase();
if (targetTagName === 'a' || targetTagName === 'button') return;
if (this.showDetail) {
this.showDetail = false;
if (Store.detail.issue && Store.detail.issue.id === this.issue.id) {
Store.detail.issue = {};
} else {
Store.detail.issue = this.issue;
Store.detail.list = this.list;
}
}
},
},
};
/* eslint-disable comma-dangle, space-before-function-paren, dot-notation */
/* global Vue */
require('./issue_card_inner');
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardCard = Vue.extend({
template: '#js-board-list-card',
components: {
'issue-card-inner': gl.issueBoards.IssueCardInner,
},
props: {
list: Object,
issue: Object,
issueLinkBase: String,
disabled: Boolean,
index: Number,
rootPath: String,
},
data () {
return {
showDetail: false,
detailIssue: Store.detail
};
},
computed: {
issueDetailVisible () {
return this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id;
}
},
methods: {
mouseDown () {
this.showDetail = true;
},
mouseMove() {
this.showDetail = false;
},
showIssue (e) {
const targetTagName = e.target.tagName.toLowerCase();
if (targetTagName === 'a' || targetTagName === 'button') return;
if (this.showDetail) {
this.showDetail = false;
if (Store.detail.issue && Store.detail.issue.id === this.issue.id) {
Store.detail.issue = {};
} else {
Store.detail.issue = this.issue;
Store.detail.list = this.list;
}
}
}
}
});
})();
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* global Vue */ /* global Vue */
/* global Sortable */ /* global Sortable */
require('./board_card'); const boardCard = require('./board_card');
require('./board_new_issue'); require('./board_new_issue');
(() => { (() => {
...@@ -14,7 +14,7 @@ require('./board_new_issue'); ...@@ -14,7 +14,7 @@ require('./board_new_issue');
gl.issueBoards.BoardList = Vue.extend({ gl.issueBoards.BoardList = Vue.extend({
template: '#js-board-list-template', template: '#js-board-list-template',
components: { components: {
'board-card': gl.issueBoards.BoardCard, boardCard,
'board-new-issue': gl.issueBoards.BoardNewIssue 'board-new-issue': gl.issueBoards.BoardNewIssue
}, },
props: { props: {
......
require('./stat_graph_contributors_graph'); import ContributorsStatGraph from './stat_graph_contributors';
require('./stat_graph_contributors_util');
require('./stat_graph_contributors'); // export to global scope
require('./stat_graph'); window.ContributorsStatGraph = ContributorsStatGraph;
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-return-assign, max-len */
(function() {
this.StatGraph = (function() {
function StatGraph() {}
StatGraph.log = {};
StatGraph.get_log = function() {
return this.log;
};
StatGraph.set_log = function(data) {
return this.log = data;
};
return StatGraph;
})();
}).call(window);
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign, no-shadow */
/* global ContributorsGraph */
/* global ContributorsAuthorGraph */
/* global ContributorsMasterGraph */
/* global ContributorsStatGraphUtil */
/* global d3 */
window.d3 = require('d3'); import d3 from 'd3';
import { ContributorsGraph, ContributorsAuthorGraph, ContributorsMasterGraph } from './stat_graph_contributors_graph';
import ContributorsStatGraphUtil from './stat_graph_contributors_util';
(function() { export default (function() {
this.ContributorsStatGraph = (function() { function ContributorsStatGraph() {}
function ContributorsStatGraph() {}
ContributorsStatGraph.prototype.init = function(log) { ContributorsStatGraph.prototype.init = function(log) {
var author_commits, total_commits; var author_commits, total_commits;
this.parsed_log = ContributorsStatGraphUtil.parse_log(log); this.parsed_log = ContributorsStatGraphUtil.parse_log(log);
this.set_current_field("commits"); this.set_current_field("commits");
total_commits = ContributorsStatGraphUtil.get_total_data(this.parsed_log, this.field); total_commits = ContributorsStatGraphUtil.get_total_data(this.parsed_log, this.field);
author_commits = ContributorsStatGraphUtil.get_author_data(this.parsed_log, this.field); author_commits = ContributorsStatGraphUtil.get_author_data(this.parsed_log, this.field);
this.add_master_graph(total_commits); this.add_master_graph(total_commits);
this.add_authors_graph(author_commits); this.add_authors_graph(author_commits);
return this.change_date_header(); return this.change_date_header();
}; };
ContributorsStatGraph.prototype.add_master_graph = function(total_data) { ContributorsStatGraph.prototype.add_master_graph = function(total_data) {
this.master_graph = new ContributorsMasterGraph(total_data); this.master_graph = new ContributorsMasterGraph(total_data);
return this.master_graph.draw(); return this.master_graph.draw();
}; };
ContributorsStatGraph.prototype.add_authors_graph = function(author_data) { ContributorsStatGraph.prototype.add_authors_graph = function(author_data) {
var limited_author_data; var limited_author_data;
this.authors = []; this.authors = [];
limited_author_data = author_data.slice(0, 100); limited_author_data = author_data.slice(0, 100);
return _.each(limited_author_data, (function(_this) { return _.each(limited_author_data, (function(_this) {
return function(d) { return function(d) {
var author_graph, author_header; var author_graph, author_header;
author_header = _this.create_author_header(d); author_header = _this.create_author_header(d);
$(".contributors-list").append(author_header); $(".contributors-list").append(author_header);
_this.authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates); _this.authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates);
return author_graph.draw(); return author_graph.draw();
}; };
})(this)); })(this));
}; };
ContributorsStatGraph.prototype.format_author_commit_info = function(author) { ContributorsStatGraph.prototype.format_author_commit_info = function(author) {
var commits; var commits;
commits = $('<span/>', { commits = $('<span/>', {
"class": 'graph-author-commits-count' "class": 'graph-author-commits-count'
}); });
commits.text(author.commits + " commits"); commits.text(author.commits + " commits");
return $('<span/>').append(commits); return $('<span/>').append(commits);
}; };
ContributorsStatGraph.prototype.create_author_header = function(author) { ContributorsStatGraph.prototype.create_author_header = function(author) {
var author_commit_info, author_commit_info_span, author_email, author_name, list_item; var author_commit_info, author_commit_info_span, author_email, author_name, list_item;
list_item = $('<li/>', { list_item = $('<li/>', {
"class": 'person', "class": 'person',
style: 'display: block;' style: 'display: block;'
}); });
author_name = $('<h4>' + author.author_name + '</h4>'); author_name = $('<h4>' + author.author_name + '</h4>');
author_email = $('<p class="graph-author-email">' + author.author_email + '</p>'); author_email = $('<p class="graph-author-email">' + author.author_email + '</p>');
author_commit_info_span = $('<span/>', { author_commit_info_span = $('<span/>', {
"class": 'commits' "class": 'commits'
}); });
author_commit_info = this.format_author_commit_info(author); author_commit_info = this.format_author_commit_info(author);
author_commit_info_span.html(author_commit_info); author_commit_info_span.html(author_commit_info);
list_item.append(author_name); list_item.append(author_name);
list_item.append(author_email); list_item.append(author_email);
list_item.append(author_commit_info_span); list_item.append(author_commit_info_span);
return list_item; return list_item;
}; };
ContributorsStatGraph.prototype.redraw_master = function() { ContributorsStatGraph.prototype.redraw_master = function() {
var total_data; var total_data;
total_data = ContributorsStatGraphUtil.get_total_data(this.parsed_log, this.field); total_data = ContributorsStatGraphUtil.get_total_data(this.parsed_log, this.field);
this.master_graph.set_data(total_data); this.master_graph.set_data(total_data);
return this.master_graph.redraw(); return this.master_graph.redraw();
}; };
ContributorsStatGraph.prototype.redraw_authors = function() { ContributorsStatGraph.prototype.redraw_authors = function() {
var author_commits, x_domain; var author_commits, x_domain;
$("ol").html(""); $("ol").html("");
x_domain = ContributorsGraph.prototype.x_domain; x_domain = ContributorsGraph.prototype.x_domain;
author_commits = ContributorsStatGraphUtil.get_author_data(this.parsed_log, this.field, x_domain); author_commits = ContributorsStatGraphUtil.get_author_data(this.parsed_log, this.field, x_domain);
return _.each(author_commits, (function(_this) { return _.each(author_commits, (function(_this) {
return function(d) { return function(d) {
_this.redraw_author_commit_info(d); _this.redraw_author_commit_info(d);
$(_this.authors[d.author_name].list_item).appendTo("ol"); $(_this.authors[d.author_name].list_item).appendTo("ol");
_this.authors[d.author_name].set_data(d.dates); _this.authors[d.author_name].set_data(d.dates);
return _this.authors[d.author_name].redraw(); return _this.authors[d.author_name].redraw();
}; };
})(this)); })(this));
}; };
ContributorsStatGraph.prototype.set_current_field = function(field) { ContributorsStatGraph.prototype.set_current_field = function(field) {
return this.field = field; return this.field = field;
}; };
ContributorsStatGraph.prototype.change_date_header = function() { ContributorsStatGraph.prototype.change_date_header = function() {
var print, print_date_format, x_domain; var print, print_date_format, x_domain;
x_domain = ContributorsGraph.prototype.x_domain; x_domain = ContributorsGraph.prototype.x_domain;
print_date_format = d3.time.format("%B %e %Y"); print_date_format = d3.time.format("%B %e %Y");
print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]); print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]);
return $("#date_header").text(print); return $("#date_header").text(print);
}; };
ContributorsStatGraph.prototype.redraw_author_commit_info = function(author) { ContributorsStatGraph.prototype.redraw_author_commit_info = function(author) {
var author_commit_info, author_list_item; var author_commit_info, author_list_item;
author_list_item = $(this.authors[author.author_name].list_item); author_list_item = $(this.authors[author.author_name].list_item);
author_commit_info = this.format_author_commit_info(author); author_commit_info = this.format_author_commit_info(author);
return author_list_item.find("span").html(author_commit_info); return author_list_item.find("span").html(author_commit_info);
}; };
return ContributorsStatGraph; return ContributorsStatGraph;
})(); })();
}).call(window);
/* eslint-disable func-names, space-before-function-paren, object-shorthand, no-var, one-var, camelcase, one-var-declaration-per-line, comma-dangle, no-param-reassign, no-return-assign, quotes, prefer-arrow-callback, wrap-iife, consistent-return, no-unused-vars, max-len, no-cond-assign, no-else-return, max-len */ /* eslint-disable func-names, space-before-function-paren, object-shorthand, no-var, one-var, camelcase, one-var-declaration-per-line, comma-dangle, no-param-reassign, no-return-assign, quotes, prefer-arrow-callback, wrap-iife, consistent-return, no-unused-vars, max-len, no-cond-assign, no-else-return, max-len */
(function() {
window.ContributorsStatGraphUtil = { export default {
parse_log: function(log) { parse_log: function(log) {
var by_author, by_email, data, entry, i, len, total, normalized_email; var by_author, by_email, data, entry, i, len, total, normalized_email;
total = {}; total = {};
by_author = {}; by_author = {};
by_email = {}; by_email = {};
for (i = 0, len = log.length; i < len; i += 1) { for (i = 0, len = log.length; i < len; i += 1) {
entry = log[i]; entry = log[i];
if (total[entry.date] == null) { if (total[entry.date] == null) {
this.add_date(entry.date, total); this.add_date(entry.date, total);
}
normalized_email = entry.author_email.toLowerCase();
data = by_author[entry.author_name] || by_email[normalized_email];
if (data == null) {
data = this.add_author(entry, by_author, by_email);
}
if (!data[entry.date]) {
this.add_date(entry.date, data);
}
this.store_data(entry, total[entry.date], data[entry.date]);
}
total = _.toArray(total);
by_author = _.toArray(by_author);
return {
total: total,
by_author: by_author
};
},
add_date: function(date, collection) {
collection[date] = {};
return collection[date].date = date;
},
add_author: function(author, by_author, by_email) {
var data, normalized_email;
data = {};
data.author_name = author.author_name;
data.author_email = author.author_email;
normalized_email = author.author_email.toLowerCase();
by_author[author.author_name] = data;
by_email[normalized_email] = data;
return data;
},
store_data: function(entry, total, by_author) {
this.store_commits(total, by_author);
this.store_additions(entry, total, by_author);
return this.store_deletions(entry, total, by_author);
},
store_commits: function(total, by_author) {
this.add(total, "commits", 1);
return this.add(by_author, "commits", 1);
},
add: function(collection, field, value) {
if (collection[field] == null) {
collection[field] = 0;
}
return collection[field] += value;
},
store_additions: function(entry, total, by_author) {
if (entry.additions == null) {
entry.additions = 0;
} }
this.add(total, "additions", entry.additions); normalized_email = entry.author_email.toLowerCase();
return this.add(by_author, "additions", entry.additions); data = by_author[entry.author_name] || by_email[normalized_email];
}, if (data == null) {
store_deletions: function(entry, total, by_author) { data = this.add_author(entry, by_author, by_email);
if (entry.deletions == null) {
entry.deletions = 0;
} }
this.add(total, "deletions", entry.deletions); if (!data[entry.date]) {
return this.add(by_author, "deletions", entry.deletions); this.add_date(entry.date, data);
},
get_total_data: function(parsed_log, field) {
var log, total_data;
log = parsed_log.total;
total_data = this.pick_field(log, field);
return _.sortBy(total_data, function(d) {
return d.date;
});
},
pick_field: function(log, field) {
var total_data;
total_data = [];
_.each(log, function(d) {
return total_data.push(_.pick(d, [field, 'date']));
});
return total_data;
},
get_author_data: function(parsed_log, field, date_range) {
var author_data, log;
if (date_range == null) {
date_range = null;
}
log = parsed_log.by_author;
author_data = [];
_.each(log, (function(_this) {
return function(log_entry) {
var parsed_log_entry;
parsed_log_entry = _this.parse_log_entry(log_entry, field, date_range);
if (!_.isEmpty(parsed_log_entry.dates)) {
return author_data.push(parsed_log_entry);
}
};
})(this));
return _.sortBy(author_data, function(d) {
return d[field];
}).reverse();
},
parse_log_entry: function(log_entry, field, date_range) {
var parsed_entry;
parsed_entry = {};
parsed_entry.author_name = log_entry.author_name;
parsed_entry.author_email = log_entry.author_email;
parsed_entry.dates = {};
parsed_entry.commits = parsed_entry.additions = parsed_entry.deletions = 0;
_.each(_.omit(log_entry, 'author_name', 'author_email'), (function(_this) {
return function(value, key) {
if (_this.in_range(value.date, date_range)) {
parsed_entry.dates[value.date] = value[field];
parsed_entry.commits += value.commits;
parsed_entry.additions += value.additions;
return parsed_entry.deletions += value.deletions;
}
};
})(this));
return parsed_entry;
},
in_range: function(date, date_range) {
var ref;
if (date_range === null || (date_range[0] <= (ref = new Date(date)) && ref <= date_range[1])) {
return true;
} else {
return false;
} }
this.store_data(entry, total[entry.date], data[entry.date]);
}
total = _.toArray(total);
by_author = _.toArray(by_author);
return {
total: total,
by_author: by_author
};
},
add_date: function(date, collection) {
collection[date] = {};
return collection[date].date = date;
},
add_author: function(author, by_author, by_email) {
var data, normalized_email;
data = {};
data.author_name = author.author_name;
data.author_email = author.author_email;
normalized_email = author.author_email.toLowerCase();
by_author[author.author_name] = data;
by_email[normalized_email] = data;
return data;
},
store_data: function(entry, total, by_author) {
this.store_commits(total, by_author);
this.store_additions(entry, total, by_author);
return this.store_deletions(entry, total, by_author);
},
store_commits: function(total, by_author) {
this.add(total, "commits", 1);
return this.add(by_author, "commits", 1);
},
add: function(collection, field, value) {
if (collection[field] == null) {
collection[field] = 0;
}
return collection[field] += value;
},
store_additions: function(entry, total, by_author) {
if (entry.additions == null) {
entry.additions = 0;
}
this.add(total, "additions", entry.additions);
return this.add(by_author, "additions", entry.additions);
},
store_deletions: function(entry, total, by_author) {
if (entry.deletions == null) {
entry.deletions = 0;
}
this.add(total, "deletions", entry.deletions);
return this.add(by_author, "deletions", entry.deletions);
},
get_total_data: function(parsed_log, field) {
var log, total_data;
log = parsed_log.total;
total_data = this.pick_field(log, field);
return _.sortBy(total_data, function(d) {
return d.date;
});
},
pick_field: function(log, field) {
var total_data;
total_data = [];
_.each(log, function(d) {
return total_data.push(_.pick(d, [field, 'date']));
});
return total_data;
},
get_author_data: function(parsed_log, field, date_range) {
var author_data, log;
if (date_range == null) {
date_range = null;
}
log = parsed_log.by_author;
author_data = [];
_.each(log, (function(_this) {
return function(log_entry) {
var parsed_log_entry;
parsed_log_entry = _this.parse_log_entry(log_entry, field, date_range);
if (!_.isEmpty(parsed_log_entry.dates)) {
return author_data.push(parsed_log_entry);
}
};
})(this));
return _.sortBy(author_data, function(d) {
return d[field];
}).reverse();
},
parse_log_entry: function(log_entry, field, date_range) {
var parsed_entry;
parsed_entry = {};
parsed_entry.author_name = log_entry.author_name;
parsed_entry.author_email = log_entry.author_email;
parsed_entry.dates = {};
parsed_entry.commits = parsed_entry.additions = parsed_entry.deletions = 0;
_.each(_.omit(log_entry, 'author_name', 'author_email'), (function(_this) {
return function(value, key) {
if (_this.in_range(value.date, date_range)) {
parsed_entry.dates[value.date] = value[field];
parsed_entry.commits += value.commits;
parsed_entry.additions += value.additions;
return parsed_entry.deletions += value.deletions;
}
};
})(this));
return parsed_entry;
},
in_range: function(date, date_range) {
var ref;
if (date_range === null || (date_range[0] <= (ref = new Date(date)) && ref <= date_range[1])) {
return true;
} else {
return false;
} }
}; }
}).call(window); };
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
$value = $block.find('.value'); $value = $block.find('.value');
$loading = $block.find('.block-loading').fadeOut(); $loading = $block.find('.block-loading').fadeOut();
if (issueUpdateURL) { if (issueUpdateURL) {
milestoneLinkTemplate = _.template('<a href="/<%- namespace %>/<%- path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>'); milestoneLinkTemplate = _.template('<a href="/<%- full_path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>');
milestoneLinkNoneTemplate = '<span class="no-value">None</span>'; milestoneLinkNoneTemplate = '<span class="no-value">None</span>';
collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>'); collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>');
} }
...@@ -181,8 +181,7 @@ ...@@ -181,8 +181,7 @@
$selectbox.hide(); $selectbox.hide();
$value.css('display', ''); $value.css('display', '');
if (data.milestone != null) { if (data.milestone != null) {
data.milestone.namespace = _this.currentProject.namespace; data.milestone.full_path = _this.currentProject.full_path;
data.milestone.path = _this.currentProject.path;
data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date); data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date);
$value.html(milestoneLinkTemplate(data.milestone)); $value.html(milestoneLinkTemplate(data.milestone));
return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone)); return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone));
......
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
required: true, required: true,
}, },
}, },
updated() {
if (this.builds) {
this.stopDropdownClickPropagation();
}
},
methods: { methods: {
fetchBuilds(e) { fetchBuilds(e) {
const areaExpanded = e.currentTarget.attributes['aria-expanded']; const areaExpanded = e.currentTarget.attributes['aria-expanded'];
...@@ -37,17 +44,19 @@ ...@@ -37,17 +44,19 @@
return flash; return flash;
}); });
}, },
keepGraph(e) {
const { target } = e;
if (target.className.indexOf('js-ci-action-icon') >= 0) return null;
if (
target.parentElement &&
(target.parentElement.className.indexOf('js-ci-action-icon') >= 0)
) return null;
return e.stopPropagation(); /**
* When the user right clicks or cmd/ctrl + click in the job name
* the dropdown should not be closed and the link should open in another tab,
* so we stop propagation of the click event inside the dropdown.
*
* Since this component is rendered multiple times per page we need to guarantee we only
* target the click event of this component.
*/
stopDropdownClickPropagation() {
$(this.$el.querySelectorAll('.js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item')).on('click', (e) => {
e.stopPropagation();
});
}, },
}, },
computed: { computed: {
...@@ -76,13 +85,13 @@ ...@@ -76,13 +85,13 @@
template: ` template: `
<div> <div>
<button <button
@click='fetchBuilds($event)' @click="fetchBuilds($event)"
:class="triggerButtonClass" :class="triggerButtonClass"
:title='stage.title' :title="stage.title"
data-placement="top" data-placement="top"
data-toggle="dropdown" data-toggle="dropdown"
type="button" type="button"
:aria-label='stage.title' :aria-label="stage.title"
> >
<span v-html="svg" aria-hidden="true"></span> <span v-html="svg" aria-hidden="true"></span>
<i class="fa fa-caret-down" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
...@@ -90,7 +99,6 @@ ...@@ -90,7 +99,6 @@
<ul class="dropdown-menu mini-pipeline-graph-dropdown-menu js-builds-dropdown-container"> <ul class="dropdown-menu mini-pipeline-graph-dropdown-menu js-builds-dropdown-container">
<div class="arrow-up" aria-hidden="true"></div> <div class="arrow-up" aria-hidden="true"></div>
<div <div
@click='keepGraph($event)'
:class="dropdownClass" :class="dropdownClass"
class="js-builds-dropdown-list scrollable-menu" class="js-builds-dropdown-list scrollable-menu"
v-html="buildsOrSpinner" v-html="buildsOrSpinner"
......
...@@ -29,16 +29,14 @@ ...@@ -29,16 +29,14 @@
} }
} }
@media (min-width: $screen-sm-min) {
.content-wrapper {
padding-right: $gutter_collapsed_width;
}
}
.right-sidebar-collapsed { .right-sidebar-collapsed {
padding-right: 0; padding-right: 0;
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
.content-wrapper {
padding-right: $gutter_collapsed_width;
}
.merge-request-tabs-holder.affix { .merge-request-tabs-holder.affix {
right: $gutter_collapsed_width; right: $gutter_collapsed_width;
} }
...@@ -56,6 +54,12 @@ ...@@ -56,6 +54,12 @@
.right-sidebar-expanded { .right-sidebar-expanded {
padding-right: 0; padding-right: 0;
@media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
.content-wrapper {
padding-right: $gutter_collapsed_width;
}
}
@media (min-width: $screen-md-min) { @media (min-width: $screen-md-min) {
.content-wrapper { .content-wrapper {
padding-right: $gutter_width; padding-right: $gutter_width;
......
...@@ -92,6 +92,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -92,6 +92,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:akismet_api_key, :akismet_api_key,
:akismet_enabled, :akismet_enabled,
:container_registry_token_expire_delay, :container_registry_token_expire_delay,
:default_artifacts_expire_in,
:default_branch_protection, :default_branch_protection,
:default_group_visibility, :default_group_visibility,
:default_project_visibility, :default_project_visibility,
......
class Projects::BranchesController < Projects::ApplicationController class Projects::BranchesController < Projects::ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
include SortingHelper include SortingHelper
# Authorize # Authorize
before_action :require_non_empty_project before_action :require_non_empty_project, except: :create
before_action :authorize_download_code! before_action :authorize_download_code!
before_action :authorize_push_code!, only: [:new, :create, :destroy, :destroy_all_merged] before_action :authorize_push_code!, only: [:new, :create, :destroy, :destroy_all_merged]
...@@ -32,6 +33,8 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -32,6 +33,8 @@ class Projects::BranchesController < Projects::ApplicationController
branch_name = sanitize(strip_tags(params[:branch_name])) branch_name = sanitize(strip_tags(params[:branch_name]))
branch_name = Addressable::URI.unescape(branch_name) branch_name = Addressable::URI.unescape(branch_name)
redirect_to_autodeploy = project.empty_repo? && project.deployment_services.present?
result = CreateBranchService.new(project, current_user). result = CreateBranchService.new(project, current_user).
execute(branch_name, ref) execute(branch_name, ref)
...@@ -42,8 +45,15 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -42,8 +45,15 @@ class Projects::BranchesController < Projects::ApplicationController
if result[:status] == :success if result[:status] == :success
@branch = result[:branch] @branch = result[:branch]
redirect_to namespace_project_tree_path(@project.namespace, @project,
@branch.name) if redirect_to_autodeploy
redirect_to(
url_to_autodeploy_setup(project, branch_name),
notice: view_context.autodeploy_flash_notice(branch_name))
else
redirect_to namespace_project_tree_path(@project.namespace, @project,
@branch.name)
end
else else
@error = result[:message] @error = result[:message]
render action: 'new' render action: 'new'
...@@ -76,7 +86,19 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -76,7 +86,19 @@ class Projects::BranchesController < Projects::ApplicationController
ref_escaped = sanitize(strip_tags(params[:ref])) ref_escaped = sanitize(strip_tags(params[:ref]))
Addressable::URI.unescape(ref_escaped) Addressable::URI.unescape(ref_escaped)
else else
@project.default_branch @project.default_branch || 'master'
end end
end end
def url_to_autodeploy_setup(project, branch_name)
namespace_project_new_blob_path(
project.namespace,
project,
branch_name,
file_name: '.gitlab-ci.yml',
commit_message: 'Set up auto deploy',
target_branch: branch_name,
context: 'autodeploy'
)
end
end end
...@@ -52,7 +52,7 @@ module IssuablesHelper ...@@ -52,7 +52,7 @@ module IssuablesHelper
field_name: 'issuable_template', field_name: 'issuable_template',
selected: selected_template(issuable), selected: selected_template(issuable),
project_path: ref_project.path, project_path: ref_project.path,
namespace_path: ref_project.namespace.path namespace_path: ref_project.namespace.full_path
} }
} }
......
...@@ -150,6 +150,15 @@ module ProjectsHelper ...@@ -150,6 +150,15 @@ module ProjectsHelper
).html_safe ).html_safe
end end
def link_to_autodeploy_doc
link_to 'About auto deploy', help_page_path('ci/autodeploy/index'), target: '_blank'
end
def autodeploy_flash_notice(branch_name)
"Branch <strong>#{truncate(sanitize(branch_name))}</strong> was created. To set up auto deploy, \
choose a GitLab CI Yaml template and commit your changes. #{link_to_autodeploy_doc}".html_safe
end
private private
def repo_children_classes(field) def repo_children_classes(field)
......
...@@ -77,9 +77,17 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -77,9 +77,17 @@ class ApplicationSetting < ActiveRecord::Base
presence: true, presence: true,
numericality: { only_integer: true, greater_than: 0 } numericality: { only_integer: true, greater_than: 0 }
<<<<<<< HEAD
validates :repository_size_limit, validates :repository_size_limit,
presence: true, presence: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 } numericality: { only_integer: true, greater_than_or_equal_to: 0 }
=======
validates :max_artifacts_size,
presence: true,
numericality: { only_integer: true, greater_than: 0 }
validates :default_artifacts_expire_in, presence: true, duration: true
>>>>>>> ce/master
validates :container_registry_token_expire_delay, validates :container_registry_token_expire_delay,
presence: true, presence: true,
...@@ -187,6 +195,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -187,6 +195,7 @@ class ApplicationSetting < ActiveRecord::Base
after_sign_up_text: nil, after_sign_up_text: nil,
akismet_enabled: false, akismet_enabled: false,
container_registry_token_expire_delay: 5, container_registry_token_expire_delay: 5,
default_artifacts_expire_in: '30 days',
default_branch_protection: Settings.gitlab['default_branch_protection'], default_branch_protection: Settings.gitlab['default_branch_protection'],
default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'],
default_projects_limit: Settings.gitlab['default_projects_limit'], default_projects_limit: Settings.gitlab['default_projects_limit'],
...@@ -220,9 +229,9 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -220,9 +229,9 @@ class ApplicationSetting < ActiveRecord::Base
sign_in_text: nil, sign_in_text: nil,
signin_enabled: Settings.gitlab['signin_enabled'], signin_enabled: Settings.gitlab['signin_enabled'],
signup_enabled: Settings.gitlab['signup_enabled'], signup_enabled: Settings.gitlab['signup_enabled'],
terminal_max_session_time: 0,
two_factor_grace_period: 48, two_factor_grace_period: 48,
user_default_external: false, user_default_external: false
terminal_max_session_time: 0
} }
end end
...@@ -243,6 +252,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -243,6 +252,7 @@ class ApplicationSetting < ActiveRecord::Base
create(defaults) create(defaults)
end end
<<<<<<< HEAD
def update_mirror_cron_jobs def update_mirror_cron_jobs
Project.mirror.where('sync_time < ?', minimum_mirror_sync_time) Project.mirror.where('sync_time < ?', minimum_mirror_sync_time)
.update_all(sync_time: minimum_mirror_sync_time) .update_all(sync_time: minimum_mirror_sync_time)
...@@ -254,6 +264,14 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -254,6 +264,14 @@ class ApplicationSetting < ActiveRecord::Base
def elasticsearch_host def elasticsearch_host
read_attribute(:elasticsearch_host).split(',').map(&:strip) read_attribute(:elasticsearch_host).split(',').map(&:strip)
=======
def self.human_attribute_name(attr, _options = {})
if attr == :default_artifacts_expire_in
'Default artifacts expiration'
else
super
end
>>>>>>> ce/master
end end
def home_page_url_column_exist def home_page_url_column_exist
......
...@@ -485,7 +485,7 @@ module Ci ...@@ -485,7 +485,7 @@ module Ci
def artifacts_expire_in=(value) def artifacts_expire_in=(value)
self.artifacts_expire_at = self.artifacts_expire_at =
if value if value
Time.now + ChronicDuration.parse(value) ChronicDuration.parse(value)&.seconds&.from_now
end end
end end
......
...@@ -21,8 +21,6 @@ class Issue < ActiveRecord::Base ...@@ -21,8 +21,6 @@ class Issue < ActiveRecord::Base
DueThisWeek = DueDateStruct.new('Due This Week', 'week').freeze DueThisWeek = DueDateStruct.new('Due This Week', 'week').freeze
DueThisMonth = DueDateStruct.new('Due This Month', 'month').freeze DueThisMonth = DueDateStruct.new('Due This Month', 'month').freeze
ActsAsTaggableOn.strict_case_match = true
belongs_to :project belongs_to :project
belongs_to :moved_to, class_name: 'Issue' belongs_to :moved_to, class_name: 'Issue'
......
...@@ -64,8 +64,7 @@ class Project < ActiveRecord::Base ...@@ -64,8 +64,7 @@ class Project < ActiveRecord::Base
after_validation :check_pending_delete after_validation :check_pending_delete
ActsAsTaggableOn.strict_case_match = true acts_as_taggable
acts_as_taggable_on :tags
attr_accessor :new_default_branch attr_accessor :new_default_branch
attr_accessor :old_path_with_namespace attr_accessor :old_path_with_namespace
...@@ -399,7 +398,7 @@ class Project < ActiveRecord::Base ...@@ -399,7 +398,7 @@ class Project < ActiveRecord::Base
end end
def reference_pattern def reference_pattern
name_pattern = Gitlab::Regex::NAMESPACE_REGEX_STR name_pattern = Gitlab::Regex::FULL_NAMESPACE_REGEX_STR
%r{ %r{
((?<namespace>#{name_pattern})\/)? ((?<namespace>#{name_pattern})\/)?
...@@ -958,10 +957,6 @@ class Project < ActiveRecord::Base ...@@ -958,10 +957,6 @@ class Project < ActiveRecord::Base
gitlab_shell.url_to_repo(path_with_namespace) gitlab_shell.url_to_repo(path_with_namespace)
end end
def namespace_dir
namespace.try(:path) || ''
end
def repo_exists? def repo_exists?
@repo_exists ||= repository.exists? @repo_exists ||= repository.exists?
rescue rescue
...@@ -1015,8 +1010,8 @@ class Project < ActiveRecord::Base ...@@ -1015,8 +1010,8 @@ class Project < ActiveRecord::Base
def rename_repo def rename_repo
path_was = previous_changes['path'].first path_was = previous_changes['path'].first
old_path_with_namespace = File.join(namespace_dir, path_was) old_path_with_namespace = File.join(namespace.full_path, path_was)
new_path_with_namespace = File.join(namespace_dir, path) new_path_with_namespace = File.join(namespace.full_path, path)
Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}" Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}"
......
...@@ -364,7 +364,7 @@ class User < ActiveRecord::Base ...@@ -364,7 +364,7 @@ class User < ActiveRecord::Base
def reference_pattern def reference_pattern
%r{ %r{
#{Regexp.escape(reference_prefix)} #{Regexp.escape(reference_prefix)}
(?<user>#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}) (?<user>#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR})
}x }x
end end
......
class CreateBranchService < BaseService class CreateBranchService < BaseService
def execute(branch_name, ref) def execute(branch_name, ref)
create_master_branch if project.empty_repo?
result = ValidateNewBranchService.new(project, current_user) result = ValidateNewBranchService.new(project, current_user)
.execute(branch_name) .execute(branch_name)
...@@ -19,4 +21,16 @@ class CreateBranchService < BaseService ...@@ -19,4 +21,16 @@ class CreateBranchService < BaseService
def success(branch) def success(branch)
super().merge(branch: branch) super().merge(branch: branch)
end end
private
def create_master_branch
project.repository.commit_file(
current_user,
'/README.md',
'',
message: 'Add README.md',
branch_name: 'master',
update: false)
end
end end
# DurationValidator
#
# Validate the format conforms with ChronicDuration
#
# Example:
#
# class ApplicationSetting < ActiveRecord::Base
# validates :default_artifacts_expire_in, presence: true, duration: true
# end
#
class DurationValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
ChronicDuration.parse(value)
rescue ChronicDuration::DurationParseError
record.errors.add(attribute, "is not a correct duration")
end
end
...@@ -232,8 +232,16 @@ ...@@ -232,8 +232,16 @@
.col-sm-10 .col-sm-10
= f.number_field :max_artifacts_size, class: 'form-control' = f.number_field :max_artifacts_size, class: 'form-control'
.help-block .help-block
Set the maximum file size each jobs's artifacts can have Set the maximum file size for each job's artifacts
= link_to "(?)", help_page_path("user/admin_area/settings/continuous_integration", anchor: "maximum-artifacts-size") = link_to icon('question-circle'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'maximum-artifacts-size')
.form-group
= f.label :default_artifacts_expire_in, 'Default artifacts expiration', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :default_artifacts_expire_in, class: 'form-control'
.help-block
Set the default expiration time for each job's artifacts.
0 for unlimited.
= link_to icon('question-circle'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'default-artifacts-expiration')
- if Gitlab.config.registry.enabled - if Gitlab.config.registry.enabled
%fieldset %fieldset
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= f.text_field :name, class: "form-control top", required: true, title: "This field is required." = f.text_field :name, class: "form-control top", required: true, title: "This field is required."
.username.form-group .username.form-group
= f.label :username = f.label :username
= f.text_field :username, class: "form-control middle", pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE, required: true, title: 'Please create a username with only alphanumeric characters.' = f.text_field :username, class: "form-control middle", pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS, required: true, title: 'Please create a username with only alphanumeric characters.'
%p.validation-error.hide Username is already taken. %p.validation-error.hide Username is already taken.
%p.validation-success.hide Username is available. %p.validation-success.hide Username is available.
%p.validation-pending.hide Checking username availability... %p.validation-pending.hide Checking username availability...
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
= line_content = line_content
- when :parallel - when :parallel
%td.old_line.diff-line-num{ data: { linenumber: line_old } } %td.old_line.diff-line-num{ data: { linenumber: line_old } }
= link_to raw(line_old), "##{line_old}" %a{ href: "##{line_old}", data: { linenumber: line_old } }
= line_content = line_content
%td.new_line.diff-line-num{ data: { linenumber: line_new } } %td.new_line.diff-line-num{ data: { linenumber: line_new } }
= link_to raw(line_new), "##{line_new}" %a{ href: "##{line_new}", data: { linenumber: line_new } }
= line_content = line_content
- if @form.unfold? && @form.bottom? && @form.to < @blob.lines.size - if @form.unfold? && @form.bottom? && @form.to < @blob.lines.size
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
%script#js-board-template{ type: "text/x-template" }= render "projects/boards/components/board" %script#js-board-template{ type: "text/x-template" }= render "projects/boards/components/board"
%script#js-board-list-template{ type: "text/x-template" }= render "projects/boards/components/board_list" %script#js-board-list-template{ type: "text/x-template" }= render "projects/boards/components/board_list"
%script#js-board-list-card{ type: "text/x-template" }= render "projects/boards/components/card"
= render "projects/issues/head" = render "projects/issues/head"
......
%li.card{ ":class" => '{ "user-can-drag": !disabled && issue.id, "is-disabled": disabled || !issue.id, "is-active": issueDetailVisible }',
":index" => "index",
":data-issue-id" => "issue.id",
"@mousedown" => "mouseDown",
"@mousemove" => "mouseMove",
"@mouseup" => "showIssue($event)" }
%issue-card-inner{ ":list" => "list",
":issue" => "issue",
":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath" }
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
- if diff_file.renamed_file - if diff_file.renamed_file
- old_path, new_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path) - old_path, new_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path)
%strong.file-title-name.has-tooltip{ data: { title: old_path, container: 'body' } } %strong.file-title-name.has-tooltip{ data: { title: diff_file.old_path, container: 'body' } }
= old_path = old_path
&rarr; &rarr;
%strong.file-title-name.has-tooltip{ data: { title: new_path, container: 'body' } } %strong.file-title-name.has-tooltip{ data: { title: diff_file.new_path, container: 'body' } }
= new_path = new_path
- else - else
%strong.file-title-name.has-tooltip{ data: { title: diff_file.new_path, container: 'body' } } %strong.file-title-name.has-tooltip{ data: { title: diff_file.new_path, container: 'body' } }
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
.form-group .form-group
- if @project.avatar? - if @project.avatar?
.avatar-container.s160 .avatar-container.s160
= project_icon("#{@project.namespace.to_param}/#{@project.to_param}", alt: '', class: 'avatar project-avatar s160') = project_icon(@project.full_path, alt: '', class: 'avatar project-avatar s160')
%p.light %p.light
- if @project.avatar_in_git - if @project.avatar_in_git
Project avatar in repository: #{ @project.avatar_in_git } Project avatar in repository: #{ @project.avatar_in_git }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%strong= parent.full_path + '/' %strong= parent.full_path + '/'
= f.text_field :path, placeholder: 'open-source', class: 'form-control', = f.text_field :path, placeholder: 'open-source', class: 'form-control',
autofocus: local_assigns[:autofocus] || false, required: true, autofocus: local_assigns[:autofocus] || false, required: true,
pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE, pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS,
title: 'Please choose a group name with no special characters.' title: 'Please choose a group name with no special characters.'
- if parent - if parent
= f.hidden_field :parent_id, value: parent.id = f.hidden_field :parent_id, value: parent.id
......
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
:javascript :javascript
gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}'); gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}');
new gl.IssuableTimeTracking("#{escape_javascript(serialize_issuable(issuable))}"); new gl.IssuableTimeTracking("#{escape_javascript(serialize_issuable(issuable))}");
new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}'); new MilestoneSelect('{"full_path":"#{@project.full_path}"}');
new LabelsSelect(); new LabelsSelect();
new WeightSelect(); new WeightSelect();
new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}'); new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
......
---
title: Fixes job dropdown action throws error in js console
merge_request: 9182
author:
---
title: Add admin setting for default artifacts expiration
merge_request: 9219
author:
---
title: Disable unused tags count cache for Projects, Builds and Runners
merge_request:
author:
---
title: Remove markup that was showing in tooltip for renamed files
merge_request: 9374
author:
---
title: Fixes includes line number during unfold copy n paste in parallel diff view
merge_request: 9365
author:
---
title: Return 202 with JSON body on async removals on V4 API
merge_request:
author:
---
title: 'API: Remove /groups/owned endpoint'
merge_request: 9505
author: Robert Schilling
---
title: Creating a new branch from an issue will automatically initialize a repository if one doesn't already exist.
merge_request:
author:
ActsAsTaggableOn.strict_case_match = true
# tags_counter enables caching count of tags which results in an update whenever a tag is added or removed
# since the count is not used anywhere its better performance wise to disable this cache
ActsAsTaggableOn.tags_counter = false
class AddDefaultArtifactsExpirationToApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
add_column :application_settings,
:default_artifacts_expire_in, :string,
null: false, default: '0'
end
end
...@@ -120,7 +120,11 @@ ActiveRecord::Schema.define(version: 20170216141440) do ...@@ -120,7 +120,11 @@ ActiveRecord::Schema.define(version: 20170216141440) do
t.integer "shared_runners_minutes", default: 0, null: false t.integer "shared_runners_minutes", default: 0, null: false
t.integer "repository_size_limit", limit: 8, default: 0 t.integer "repository_size_limit", limit: 8, default: 0
t.integer "terminal_max_session_time", default: 0, null: false t.integer "terminal_max_session_time", default: 0, null: false
<<<<<<< HEAD
t.integer "minimum_mirror_sync_time", default: 15, null: false t.integer "minimum_mirror_sync_time", default: 15, null: false
=======
t.string "default_artifacts_expire_in", default: '0', null: false
>>>>>>> ce/master
end end
create_table "approvals", force: :cascade do |t| create_table "approvals", force: :cascade do |t|
......
...@@ -13,7 +13,7 @@ To enable the GitLab monitor exporter: ...@@ -13,7 +13,7 @@ To enable the GitLab monitor exporter:
1. Add or find and uncomment the following line, making sure it's set to `true`: 1. Add or find and uncomment the following line, making sure it's set to `true`:
```ruby ```ruby
gitlab_monitor_exporter['enable'] = true gitlab_monitor['enable'] = true
``` ```
1. Save the file and [reconfigure GitLab][reconfigure] for the changes to 1. Save the file and [reconfigure GitLab][reconfigure] for the changes to
......
...@@ -26,22 +26,24 @@ it works. ...@@ -26,22 +26,24 @@ it works.
--- ---
In the case of custom domains, the Pages daemon needs to listen on ports `80` In the case of [custom domains](#custom-domains) (but not
and/or `443`. For that reason, there is some flexibility in the way which you [wildcard domains](#wildcard-domains)), the Pages daemon needs to listen on
can set it up: ports `80` and/or `443`. For that reason, there is some flexibility in the way
which you can set it up:
1. Run the pages daemon in the same server as GitLab, listening on a secondary IP. 1. Run the Pages daemon in the same server as GitLab, listening on a secondary IP.
1. Run the pages daemon in a separate server. In that case, the 1. Run the Pages daemon in a separate server. In that case, the
[Pages path](#change-storage-path) must also be present in the server that [Pages path](#change-storage-path) must also be present in the server that
the pages daemon is installed, so you will have to share it via network. the Pages daemon is installed, so you will have to share it via network.
1. Run the pages daemon in the same server as GitLab, listening on the same IP 1. Run the Pages daemon in the same server as GitLab, listening on the same IP
but on different ports. In that case, you will have to proxy the traffic with but on different ports. In that case, you will have to proxy the traffic with
a loadbalancer. If you choose that route note that you should use TCP load a loadbalancer. If you choose that route note that you should use TCP load
balancing for HTTPS. If you use TLS-termination (HTTPS-load balancing) the balancing for HTTPS. If you use TLS-termination (HTTPS-load balancing) the
pages will not be able to be served with user provided certificates. For pages will not be able to be served with user provided certificates. For
HTTP it's OK to use HTTP or TCP load balancing. HTTP it's OK to use HTTP or TCP load balancing.
In this document, we will proceed assuming the first option. In this document, we will proceed assuming the first option. If you are not
supporting custom domains a secondary IP is not needed.
## Prerequisites ## Prerequisites
...@@ -54,6 +56,7 @@ Before proceeding with the Pages configuration, you will need to: ...@@ -54,6 +56,7 @@ Before proceeding with the Pages configuration, you will need to:
serve Pages under HTTPS. serve Pages under HTTPS.
1. (Optional but recommended) Enable [Shared runners](../../ci/runners/README.md) 1. (Optional but recommended) Enable [Shared runners](../../ci/runners/README.md)
so that your users don't have to bring their own. so that your users don't have to bring their own.
1. (Only for custom domains) Have a **secondary IP**.
### DNS configuration ### DNS configuration
...@@ -150,7 +153,7 @@ that without TLS certificates. ...@@ -150,7 +153,7 @@ that without TLS certificates.
> >
URL scheme: `http://page.example.io` and `http://domain.com` URL scheme: `http://page.example.io` and `http://domain.com`
In that case, the pages daemon is running, Nginx still proxies requests to In that case, the Pages daemon is running, Nginx still proxies requests to
the daemon but the daemon is also able to receive requests from the outside the daemon but the daemon is also able to receive requests from the outside
world. Custom domains are supported, but no TLS. world. Custom domains are supported, but no TLS.
...@@ -179,7 +182,7 @@ world. Custom domains are supported, but no TLS. ...@@ -179,7 +182,7 @@ world. Custom domains are supported, but no TLS.
> >
URL scheme: `https://page.example.io` and `https://domain.com` URL scheme: `https://page.example.io` and `https://domain.com`
In that case, the pages daemon is running, Nginx still proxies requests to In that case, the Pages daemon is running, Nginx still proxies requests to
the daemon but the daemon is also able to receive requests from the outside the daemon but the daemon is also able to receive requests from the outside
world. Custom domains and TLS are supported. world. Custom domains and TLS are supported.
......
...@@ -69,7 +69,9 @@ please consult [RFC 5322](https://tools.ietf.org/html/rfc5322#section-3.6.4). ...@@ -69,7 +69,9 @@ please consult [RFC 5322](https://tools.ietf.org/html/rfc5322#section-3.6.4).
If you want to use Gmail / Google Apps with Reply by email, make sure you have If you want to use Gmail / Google Apps with Reply by email, make sure you have
[IMAP access enabled](https://support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665018) [IMAP access enabled](https://support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665018)
and [allowed less secure apps to access the account](https://support.google.com/accounts/answer/6010255). and [allowed less secure apps to access the account](https://support.google.com/accounts/answer/6010255)
or [turn-on 2-step validation](https://support.google.com/accounts/answer/185839)
and use [an application password](https://support.google.com/mail/answer/185833).
To set up a basic Postfix mail server with IMAP access on Ubuntu, follow the To set up a basic Postfix mail server with IMAP access on Ubuntu, follow the
[Postfix setup documentation](reply_by_email_postfix_setup.md). [Postfix setup documentation](reply_by_email_postfix_setup.md).
......
...@@ -14,6 +14,7 @@ Parameters: ...@@ -14,6 +14,7 @@ Parameters:
| `order_by` | string | no | Order groups by `name` or `path`. Default is `name` | | `order_by` | string | no | Order groups by `name` or `path`. Default is `name` |
| `sort` | string | no | Order groups in `asc` or `desc` order. Default is `asc` | | `sort` | string | no | Order groups in `asc` or `desc` order. Default is `asc` |
| `statistics` | boolean | no | Include group statistics (admins only) | | `statistics` | boolean | no | Include group statistics (admins only) |
| `owned` | boolean | no | Limit by groups owned by the current user |
``` ```
GET /groups GET /groups
...@@ -40,20 +41,6 @@ GET /groups ...@@ -40,20 +41,6 @@ GET /groups
You can search for groups by name or path, see below. You can search for groups by name or path, see below.
## List owned groups
Get a list of groups which are owned by the authenticated user.
```
GET /groups/owned
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `statistics` | boolean | no | Include group statistics |
## List a group's projects ## List a group's projects
Get a list of projects in this group. Get a list of projects in this group.
......
...@@ -42,3 +42,5 @@ changes are in V4: ...@@ -42,3 +42,5 @@ changes are in V4:
- Remove `public` param from create and edit actions of projects [!8736](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8736) - Remove `public` param from create and edit actions of projects [!8736](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8736)
- Remove the ProjectGitHook API. Use the ProjectPushRule API instead [!1301](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1301) - Remove the ProjectGitHook API. Use the ProjectPushRule API instead [!1301](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1301)
- Notes do not return deprecated field `upvote` and `downvote` [!9384](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9384) - Notes do not return deprecated field `upvote` and `downvote` [!9384](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9384)
- Remove `GET /groups/owned`. Use `GET /groups?owned=true` instead [!9505](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9505)
- Return 202 with JSON body on async removals on V4 API (DELETE `/projects/:id/repository/merged_branches` and DELETE `/projects/:id`) [!9449](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9449)
\ No newline at end of file
...@@ -148,7 +148,8 @@ available in the build environment. It's the recommended method to use for ...@@ -148,7 +148,8 @@ available in the build environment. It's the recommended method to use for
storing things like passwords, secret keys and credentials. storing things like passwords, secret keys and credentials.
Secret variables can be added by going to your project's Secret variables can be added by going to your project's
**Settings ➔ Variables ➔ Add variable**. **Settings ➔ CI/CD Pipelines**, then finding the section called
**Secret Variables**.
Once you set them, they will be available for all subsequent jobs. Once you set them, they will be available for all subsequent jobs.
......
...@@ -54,7 +54,7 @@ for initial settings. ...@@ -54,7 +54,7 @@ for initial settings.
gitlab_rails['omniauth_providers'] = [ gitlab_rails['omniauth_providers'] = [
{ {
"name" => "auth0", "name" => "auth0",
"args" => { client_id: 'YOUR_AUTH0_CLIENT_ID'', "args" => { client_id: 'YOUR_AUTH0_CLIENT_ID',
client_secret: 'YOUR_AUTH0_CLIENT_SECRET', client_secret: 'YOUR_AUTH0_CLIENT_SECRET',
namespace: 'YOUR_AUTH0_DOMAIN' namespace: 'YOUR_AUTH0_DOMAIN'
} }
......
...@@ -74,7 +74,7 @@ in your SAML IdP: ...@@ -74,7 +74,7 @@ in your SAML IdP:
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8', idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp', idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com', issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}, },
label: 'Company Login' # optional label for SAML login button, defaults to "Saml" label: 'Company Login' # optional label for SAML login button, defaults to "Saml"
} }
...@@ -91,7 +91,7 @@ in your SAML IdP: ...@@ -91,7 +91,7 @@ in your SAML IdP:
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8', idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp', idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com', issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}, },
label: 'Company Login' # optional label for SAML login button, defaults to "Saml" label: 'Company Login' # optional label for SAML login button, defaults to "Saml"
} }
...@@ -172,7 +172,7 @@ tell GitLab which groups are external via the `external_groups:` element: ...@@ -172,7 +172,7 @@ tell GitLab which groups are external via the `external_groups:` element:
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8', idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp', idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com', issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
} } } }
``` ```
...@@ -251,7 +251,7 @@ args: { ...@@ -251,7 +251,7 @@ args: {
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8', idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp', idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com', issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
attribute_statements: { email: ['EmailAddress'] } attribute_statements: { email: ['EmailAddress'] }
} }
``` ```
...@@ -269,7 +269,7 @@ args: { ...@@ -269,7 +269,7 @@ args: {
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8', idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp', idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com', issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
attribute_statements: { email: ['EmailAddress'] }, attribute_statements: { email: ['EmailAddress'] },
allowed_clock_drift: 1 # for one second clock drift allowed_clock_drift: 1 # for one second clock drift
} }
......
...@@ -3,19 +3,20 @@ ...@@ -3,19 +3,20 @@
## Maximum artifacts size ## Maximum artifacts size
The maximum size of the [job artifacts][art-yml] can be set in the Admin area The maximum size of the [job artifacts][art-yml] can be set in the Admin area
of your GitLab instance. The value is in MB and the default is 100MB. Note that of your GitLab instance. The value is in *MB* and the default is 100MB. Note
this setting is set for each job. that this setting is set for each job.
1. Go to the **Admin area ➔ Settings** (`/admin/application_settings`). 1. Go to the **Admin area ➔ Settings** (`/admin/application_settings`).
![Admin area settings button](img/admin_area_settings_button.png) ![Admin area settings button](img/admin_area_settings_button.png)
1. Change the value of the maximum artifacts size (in MB): 1. Change the value of maximum artifacts size (in MB):
![Admin area maximum artifacts size](img/admin_area_maximum_artifacts_size.png) ![Admin area maximum artifacts size](img/admin_area_maximum_artifacts_size.png)
1. Hit **Save** for the changes to take effect. 1. Hit **Save** for the changes to take effect.
<<<<<<< HEAD
## Shared Runners build minutes quota ## Shared Runners build minutes quota
> [Introduced][ee-1078] in GitLab Enterprise Edition 8.16. > [Introduced][ee-1078] in GitLab Enterprise Edition 8.16.
...@@ -72,3 +73,25 @@ the group. ...@@ -72,3 +73,25 @@ the group.
[art-yml]: ../../../administration/job_artifacts.md [art-yml]: ../../../administration/job_artifacts.md
[ee-1078]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1078 [ee-1078]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1078
=======
## Default artifacts expiration
The default expiration time of the [job artifacts][art-yml] can be set in
the Admin area of your GitLab instance. The syntax of duration is described
in [artifacts:expire_in][duration-syntax]. The default is `30 days`. Note that
this setting is set for each job. Set it to 0 if you don't want default
expiration.
1. Go to **Admin area > Settings** (`/admin/application_settings`).
![Admin area settings button](img/admin_area_settings_button.png)
1. Change the value of default expiration time ([syntax][duration-syntax]):
![Admin area default artifacts expiration](img/admin_area_default_artifacts_expiration.png)
1. Hit **Save** for the changes to take effect.
[art-yml]: ../../../administration/job_artifacts.md
[duration-syntax]: ../../../ci/yaml/README.md#artifactsexpire_in
>>>>>>> ce/master
...@@ -10,6 +10,7 @@ module API ...@@ -10,6 +10,7 @@ module API
mount ::API::V3::Commits mount ::API::V3::Commits
mount ::API::V3::DeployKeys mount ::API::V3::DeployKeys
mount ::API::V3::Files mount ::API::V3::Files
mount ::API::V3::Groups
mount ::API::V3::Issues mount ::API::V3::Issues
mount ::API::V3::Labels mount ::API::V3::Labels
mount ::API::V3::Members mount ::API::V3::Members
......
...@@ -137,7 +137,7 @@ module API ...@@ -137,7 +137,7 @@ module API
delete ":id/repository/merged_branches" do delete ":id/repository/merged_branches" do
DeleteMergedBranchesService.new(user_project, current_user).async_execute DeleteMergedBranchesService.new(user_project, current_user).async_execute
status(200) accepted!
end end
end end
end end
......
...@@ -610,6 +610,7 @@ module API ...@@ -610,6 +610,7 @@ module API
expose :default_project_visibility expose :default_project_visibility
expose :default_snippet_visibility expose :default_snippet_visibility
expose :default_group_visibility expose :default_group_visibility
expose :default_artifacts_expire_in
expose :domain_whitelist expose :domain_whitelist
expose :domain_blacklist_enabled expose :domain_blacklist_enabled
expose :domain_blacklist expose :domain_blacklist
......
...@@ -44,12 +44,15 @@ module API ...@@ -44,12 +44,15 @@ module API
optional :skip_groups, type: Array[Integer], desc: 'Array of group ids to exclude from list' optional :skip_groups, type: Array[Integer], desc: 'Array of group ids to exclude from list'
optional :all_available, type: Boolean, desc: 'Show all group that you have access to' optional :all_available, type: Boolean, desc: 'Show all group that you have access to'
optional :search, type: String, desc: 'Search for a specific group' optional :search, type: String, desc: 'Search for a specific group'
optional :owned, type: Boolean, default: false, desc: 'Limit by owned by authenticated user'
optional :order_by, type: String, values: %w[name path], default: 'name', desc: 'Order by name or path' optional :order_by, type: String, values: %w[name path], default: 'name', desc: 'Order by name or path'
optional :sort, type: String, values: %w[asc desc], default: 'asc', desc: 'Sort by asc (ascending) or desc (descending)' optional :sort, type: String, values: %w[asc desc], default: 'asc', desc: 'Sort by asc (ascending) or desc (descending)'
use :pagination use :pagination
end end
get do get do
groups = if current_user.admin groups = if params[:owned]
current_user.owned_groups
elsif current_user.admin
Group.all Group.all
elsif params[:all_available] elsif params[:all_available]
GroupsFinder.new.execute(current_user) GroupsFinder.new.execute(current_user)
...@@ -64,17 +67,6 @@ module API ...@@ -64,17 +67,6 @@ module API
present_groups groups, statistics: params[:statistics] && current_user.is_admin? present_groups groups, statistics: params[:statistics] && current_user.is_admin?
end end
desc 'Get list of owned groups for authenticated user' do
success Entities::Group
end
params do
use :pagination
use :statistics_params
end
get '/owned' do
present_groups current_user.owned_groups, statistics: params[:statistics]
end
desc 'Create a group. Available only for users who can create groups.' do desc 'Create a group. Available only for users who can create groups.' do
success Entities::Group success Entities::Group
end end
......
...@@ -216,6 +216,10 @@ module API ...@@ -216,6 +216,10 @@ module API
render_api_error!('204 No Content', 204) render_api_error!('204 No Content', 204)
end end
def accepted!
render_api_error!('202 Accepted', 202)
end
def render_validation_error!(model) def render_validation_error!(model)
if model.errors.any? if model.errors.any?
render_api_error!(model.errors.messages || '400 Bad Request', 400) render_api_error!(model.errors.messages || '400 Bad Request', 400)
......
...@@ -288,6 +288,8 @@ module API ...@@ -288,6 +288,8 @@ module API
delete ":id" do delete ":id" do
authorize! :remove_project, user_project authorize! :remove_project, user_project
::Projects::DestroyService.new(user_project, current_user, {}).async_execute ::Projects::DestroyService.new(user_project, current_user, {}).async_execute
accepted!
end end
desc 'Mark this project as forked from another' desc 'Mark this project as forked from another'
......
...@@ -56,7 +56,8 @@ module API ...@@ -56,7 +56,8 @@ module API
given shared_runners_enabled: ->(val) { val } do given shared_runners_enabled: ->(val) { val } do
requires :shared_runners_text, type: String, desc: 'Shared runners text ' requires :shared_runners_text, type: String, desc: 'Shared runners text '
end end
optional :max_artifacts_size, type: Integer, desc: "Set the maximum file size each build's artifacts can have" optional :max_artifacts_size, type: Integer, desc: "Set the maximum file size for each job's artifacts"
optional :default_artifacts_expire_in, type: String, desc: "Set the default expiration time for each job's artifacts"
optional :max_pages_size, type: Integer, desc: 'Maximum size of pages in MB' optional :max_pages_size, type: Integer, desc: 'Maximum size of pages in MB'
optional :container_registry_token_expire_delay, type: Integer, desc: 'Authorization token duration (minutes)' optional :container_registry_token_expire_delay, type: Integer, desc: 'Authorization token duration (minutes)'
optional :metrics_enabled, type: Boolean, desc: 'Enable the InfluxDB metrics' optional :metrics_enabled, type: Boolean, desc: 'Enable the InfluxDB metrics'
...@@ -130,7 +131,9 @@ module API ...@@ -130,7 +131,9 @@ module API
:send_user_confirmation_email, :domain_whitelist, :domain_blacklist_enabled, :send_user_confirmation_email, :domain_whitelist, :domain_blacklist_enabled,
:after_sign_up_text, :signin_enabled, :require_two_factor_authentication, :after_sign_up_text, :signin_enabled, :require_two_factor_authentication,
:home_page_url, :after_sign_out_path, :sign_in_text, :help_page_text, :home_page_url, :after_sign_out_path, :sign_in_text, :help_page_text,
:shared_runners_enabled, :max_artifacts_size, :max_pages_size, :container_registry_token_expire_delay, :shared_runners_enabled, :max_artifacts_size,
:default_artifacts_expire_in, :max_pages_size,
:container_registry_token_expire_delay,
:metrics_enabled, :sidekiq_throttling_enabled, :recaptcha_enabled, :metrics_enabled, :sidekiq_throttling_enabled, :recaptcha_enabled,
:akismet_enabled, :admin_notification_email, :sentry_enabled, :akismet_enabled, :admin_notification_email, :sentry_enabled,
:repository_checks_enabled, :koding_enabled, :housekeeping_enabled, :terminal_max_session_time, :plantuml_enabled, :repository_checks_enabled, :koding_enabled, :housekeeping_enabled, :terminal_max_session_time, :plantuml_enabled,
......
...@@ -21,14 +21,9 @@ module API ...@@ -21,14 +21,9 @@ module API
unauthorized! unless trigger.project == project unauthorized! unless trigger.project == project
# validate variables # validate variables
variables = params[:variables] variables = params[:variables].to_h
if variables unless variables.all? { |key, value| key.is_a?(String) && value.is_a?(String) }
unless variables.all? { |key, value| key.is_a?(String) && value.is_a?(String) } render_api_error!('variables needs to be a map of key-valued strings', 400)
render_api_error!('variables needs to be a map of key-valued strings', 400)
end
# convert variables from Mash to Hash
variables = variables.to_h
end end
# create request and trigger builds # create request and trigger builds
......
...@@ -18,6 +18,13 @@ module API ...@@ -18,6 +18,13 @@ module API
present branches, with: ::API::Entities::RepoBranch, project: user_project present branches, with: ::API::Entities::RepoBranch, project: user_project
end end
desc 'Delete all merged branches'
delete ":id/repository/merged_branches" do
DeleteMergedBranchesService.new(user_project, current_user).async_execute
status(200)
end
end end
end end
end end
......
module API
module V3
class Groups < Grape::API
include PaginationParams
before { authenticate! }
helpers do
params :statistics_params do
optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
end
def present_groups(groups, options = {})
options = options.reverse_merge(
with: ::API::Entities::Group,
current_user: current_user,
)
groups = groups.with_statistics if options[:statistics]
present paginate(groups), options
end
end
resource :groups do
desc 'Get list of owned groups for authenticated user' do
success ::API::Entities::Group
end
params do
use :pagination
use :statistics_params
end
get '/owned' do
present_groups current_user.owned_groups, statistics: params[:statistics]
end
end
end
end
end
...@@ -167,7 +167,10 @@ module Ci ...@@ -167,7 +167,10 @@ module Ci
build.artifacts_file = artifacts build.artifacts_file = artifacts
build.artifacts_metadata = metadata build.artifacts_metadata = metadata
build.artifacts_expire_in = params['expire_in'] build.artifacts_expire_in =
params['expire_in'] ||
Gitlab::CurrentSettings.current_application_settings
.default_artifacts_expire_in
if build.save if build.save
present(build, with: Entities::BuildDetails) present(build, with: Entities::BuildDetails)
......
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
end end
def export_filename(project:) def export_filename(project:)
basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.namespace.full_path}_#{project.path}" basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.full_path.tr('/', '_')}"
"#{basename[0..FILENAME_LIMIT]}_export.tar.gz" "#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
end end
......
...@@ -5,17 +5,18 @@ module Gitlab ...@@ -5,17 +5,18 @@ module Gitlab
# The namespace regex is used in Javascript to validate usernames in the "Register" form. However, Javascript # The namespace regex is used in Javascript to validate usernames in the "Register" form. However, Javascript
# does not support the negative lookbehind assertion (?<!) that disallows usernames ending in `.git` and `.atom`. # does not support the negative lookbehind assertion (?<!) that disallows usernames ending in `.git` and `.atom`.
# Since this is a non-trivial problem to solve in Javascript (heavily complicate the regex, modify view code to # Since this is a non-trivial problem to solve in Javascript (heavily complicate the regex, modify view code to
# allow non-regex validatiions, etc), `NAMESPACE_REGEX_STR_SIMPLE` serves as a Javascript-compatible version of # allow non-regex validatiions, etc), `NAMESPACE_REGEX_STR_JS` serves as a Javascript-compatible version of
# `NAMESPACE_REGEX_STR`, with the negative lookbehind assertion removed. This means that the client-side validation # `NAMESPACE_REGEX_STR`, with the negative lookbehind assertion removed. This means that the client-side validation
# will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation. # will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation.
PATH_REGEX_STR = '[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*'.freeze PATH_REGEX_STR = '[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*'.freeze
NAMESPACE_REGEX_STR_SIMPLE = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze NAMESPACE_REGEX_STR_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze
NAMESPACE_REGEX_STR = '(?:' + NAMESPACE_REGEX_STR_SIMPLE + ')(?<!\.git|\.atom)'.freeze NO_SUFFIX_REGEX_STR = '(?<!\.git|\.atom)'.freeze
PROJECT_REGEX_STR = PATH_REGEX_STR + '(?<!\.git|\.atom)'.freeze NAMESPACE_REGEX_STR = "(?:#{NAMESPACE_REGEX_STR_JS})#{NO_SUFFIX_REGEX_STR}".freeze
PROJECT_REGEX_STR = "(?:#{PATH_REGEX_STR})#{NO_SUFFIX_REGEX_STR}".freeze
# Same as NAMESPACE_REGEX_STR but allows `/` in the path. # Same as NAMESPACE_REGEX_STR but allows `/` in the path.
# So `group/subgroup` will match this regex but not NAMESPACE_REGEX_STR # So `group/subgroup` will match this regex but not NAMESPACE_REGEX_STR
NAMESPACE_REF_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.\/]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])(?<!\.git|\.atom)'.freeze FULL_NAMESPACE_REGEX_STR = "(?:#{NAMESPACE_REGEX_STR}/)*#{NAMESPACE_REGEX_STR}".freeze
def namespace_regex def namespace_regex
@namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze
......
...@@ -19,8 +19,8 @@ describe Projects::BlobController do ...@@ -19,8 +19,8 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -50,8 +50,8 @@ describe Projects::BlobController do ...@@ -50,8 +50,8 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
controller.instance_variable_set(:@blob, nil) controller.instance_variable_set(:@blob, nil)
end end
......
...@@ -16,8 +16,8 @@ describe Projects::BlameController do ...@@ -16,8 +16,8 @@ describe Projects::BlameController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
......
...@@ -14,8 +14,8 @@ describe Projects::BlobController do ...@@ -14,8 +14,8 @@ describe Projects::BlobController do
render_views render_views
def do_get(opts = {}) def do_get(opts = {})
params = { namespace_id: project.namespace.to_param, params = { namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: 'master/CHANGELOG' } id: 'master/CHANGELOG' }
get :diff, params.merge(opts) get :diff, params.merge(opts)
end end
...@@ -40,8 +40,8 @@ describe Projects::BlobController do ...@@ -40,8 +40,8 @@ describe Projects::BlobController do
describe 'PUT update' do describe 'PUT update' do
let(:default_params) do let(:default_params) do
{ {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: 'master/CHANGELOG', id: 'master/CHANGELOG',
target_branch: 'master', target_branch: 'master',
content: 'Added changes', content: 'Added changes',
...@@ -96,8 +96,8 @@ describe Projects::BlobController do ...@@ -96,8 +96,8 @@ describe Projects::BlobController do
context 'when editing on the fork' do context 'when editing on the fork' do
before do before do
default_params[:namespace_id] = forked_project.namespace.to_param default_params[:namespace_id] = forked_project.namespace
default_params[:project_id] = forked_project.to_param default_params[:project_id] = forked_project
end end
it 'redirects to blob' do it 'redirects to blob' do
......
...@@ -90,7 +90,7 @@ describe Projects::Boards::IssuesController do ...@@ -90,7 +90,7 @@ describe Projects::Boards::IssuesController do
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list_id: list.try(:to_param) list_id: list.try(:to_param)
} }
...@@ -162,7 +162,7 @@ describe Projects::Boards::IssuesController do ...@@ -162,7 +162,7 @@ describe Projects::Boards::IssuesController do
sign_in(user) sign_in(user)
post :create, namespace_id: project.namespace.to_param, post :create, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list_id: list.to_param, list_id: list.to_param,
issue: { title: title }, issue: { title: title },
...@@ -225,7 +225,7 @@ describe Projects::Boards::IssuesController do ...@@ -225,7 +225,7 @@ describe Projects::Boards::IssuesController do
sign_in(user) sign_in(user)
patch :update, namespace_id: project.namespace.to_param, patch :update, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: issue.to_param, id: issue.to_param,
from_list_id: from_list_id, from_list_id: from_list_id,
......
...@@ -47,7 +47,7 @@ describe Projects::Boards::ListsController do ...@@ -47,7 +47,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
get :index, namespace_id: project.namespace.to_param, get :index, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
format: :json format: :json
end end
...@@ -104,7 +104,7 @@ describe Projects::Boards::ListsController do ...@@ -104,7 +104,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
post :create, namespace_id: project.namespace.to_param, post :create, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list: { label_id: label_id }, list: { label_id: label_id },
format: :json format: :json
...@@ -157,7 +157,7 @@ describe Projects::Boards::ListsController do ...@@ -157,7 +157,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
patch :update, namespace_id: project.namespace.to_param, patch :update, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: list.to_param, id: list.to_param,
list: { position: position }, list: { position: position },
...@@ -200,7 +200,7 @@ describe Projects::Boards::ListsController do ...@@ -200,7 +200,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
delete :destroy, namespace_id: project.namespace.to_param, delete :destroy, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: list.to_param, id: list.to_param,
format: :json format: :json
...@@ -244,7 +244,7 @@ describe Projects::Boards::ListsController do ...@@ -244,7 +244,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
post :generate, namespace_id: project.namespace.to_param, post :generate, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
format: :json format: :json
end end
......
...@@ -65,8 +65,8 @@ describe Projects::BoardsController do ...@@ -65,8 +65,8 @@ describe Projects::BoardsController do
end end
def list_boards(format: :html) def list_boards(format: :html)
get :index, namespace_id: project.namespace.to_param, get :index, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
format: format format: format
end end
end end
...@@ -130,8 +130,8 @@ describe Projects::BoardsController do ...@@ -130,8 +130,8 @@ describe Projects::BoardsController do
end end
def read_board(board:, format: :html) def read_board(board:, format: :html)
get :show, namespace_id: project.namespace.to_param, get :show, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: board.to_param, id: board.to_param,
format: format format: format
end end
......
...@@ -22,8 +22,8 @@ describe Projects::BranchesController do ...@@ -22,8 +22,8 @@ describe Projects::BranchesController do
sign_in(user) sign_in(user)
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
ref: ref ref: ref
end end
...@@ -68,7 +68,7 @@ describe Projects::BranchesController do ...@@ -68,7 +68,7 @@ describe Projects::BranchesController do
describe "created from the new branch button on issues" do describe "created from the new branch button on issues" do
let(:branch) { "1-feature-branch" } let(:branch) { "1-feature-branch" }
let!(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
before do before do
sign_in(user) sign_in(user)
...@@ -76,8 +76,8 @@ describe Projects::BranchesController do ...@@ -76,8 +76,8 @@ describe Projects::BranchesController do
it 'redirects' do it 'redirects' do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
...@@ -89,12 +89,49 @@ describe Projects::BranchesController do ...@@ -89,12 +89,49 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch") expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch")
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
end end
context 'repository-less project' do
let(:project) { create :empty_project }
it 'redirects to newly created branch' do
result = { status: :success, branch: double(name: branch) }
expect_any_instance_of(CreateBranchService).to receive(:execute).and_return(result)
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
branch_name: branch,
issue_iid: issue.iid
expect(response).to redirect_to namespace_project_tree_path(project.namespace, project, branch)
end
it 'redirects to autodeploy setup page' do
result = { status: :success, branch: double(name: branch) }
project.services << build(:kubernetes_service)
expect_any_instance_of(CreateBranchService).to receive(:execute).and_return(result)
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
branch_name: branch,
issue_iid: issue.iid
expect(response.location).to include(namespace_project_new_blob_path(project.namespace, project, branch))
expect(response).to have_http_status(302)
end
end
context 'without issue feature access' do context 'without issue feature access' do
before do before do
project.update!(visibility_level: Gitlab::VisibilityLevel::PUBLIC) project.update!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
...@@ -106,8 +143,8 @@ describe Projects::BranchesController do ...@@ -106,8 +143,8 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch) expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
end end
...@@ -126,8 +163,8 @@ describe Projects::BranchesController do ...@@ -126,8 +163,8 @@ describe Projects::BranchesController do
post :destroy, post :destroy,
format: :html, format: :html,
id: 'foo/bar/baz', id: 'foo/bar/baz',
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
expect(response).to have_http_status(303) expect(response).to have_http_status(303)
end end
...@@ -142,8 +179,8 @@ describe Projects::BranchesController do ...@@ -142,8 +179,8 @@ describe Projects::BranchesController do
post :destroy, post :destroy,
format: :js, format: :js,
id: branch, id: branch,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context "valid branch name, valid source" do context "valid branch name, valid source" do
...@@ -173,8 +210,8 @@ describe Projects::BranchesController do ...@@ -173,8 +210,8 @@ describe Projects::BranchesController do
describe "DELETE destroy_all_merged" do describe "DELETE destroy_all_merged" do
def destroy_all_merged def destroy_all_merged
delete :destroy_all_merged, delete :destroy_all_merged,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when user is allowed to push' do context 'when user is allowed to push' do
......
...@@ -17,8 +17,8 @@ describe Projects::CommitController do ...@@ -17,8 +17,8 @@ describe Projects::CommitController do
def go(extra_params = {}) def go(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :show, params.merge(extra_params) get :show, params.merge(extra_params)
...@@ -125,8 +125,8 @@ describe Projects::CommitController do ...@@ -125,8 +125,8 @@ describe Projects::CommitController do
it 'renders it' do it 'renders it' do
get(:show, get(:show,
namespace_id: fork_project.namespace.to_param, namespace_id: fork_project.namespace,
project_id: fork_project.to_param, project_id: fork_project,
id: commit.id) id: commit.id)
expect(response).to be_success expect(response).to be_success
...@@ -139,8 +139,8 @@ describe Projects::CommitController do ...@@ -139,8 +139,8 @@ describe Projects::CommitController do
commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e') commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e')
get(:branches, get(:branches,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: commit.id) id: commit.id)
expect(assigns(:branches)).to include("master", "feature_conflict") expect(assigns(:branches)).to include("master", "feature_conflict")
...@@ -152,8 +152,8 @@ describe Projects::CommitController do ...@@ -152,8 +152,8 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: commit.id) id: commit.id)
expect(response).not_to be_success expect(response).not_to be_success
...@@ -164,8 +164,8 @@ describe Projects::CommitController do ...@@ -164,8 +164,8 @@ describe Projects::CommitController do
context 'when the revert was successful' do context 'when the revert was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
...@@ -177,8 +177,8 @@ describe Projects::CommitController do ...@@ -177,8 +177,8 @@ describe Projects::CommitController do
context 'when the revert failed' do context 'when the revert failed' do
before do before do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
end end
...@@ -186,8 +186,8 @@ describe Projects::CommitController do ...@@ -186,8 +186,8 @@ describe Projects::CommitController do
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Reverting a commit that has been already reverted. # Reverting a commit that has been already reverted.
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
...@@ -201,8 +201,8 @@ describe Projects::CommitController do ...@@ -201,8 +201,8 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: master_pickable_commit.id) id: master_pickable_commit.id)
expect(response).not_to be_success expect(response).not_to be_success
...@@ -213,8 +213,8 @@ describe Projects::CommitController do ...@@ -213,8 +213,8 @@ describe Projects::CommitController do
context 'when the cherry-pick was successful' do context 'when the cherry-pick was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
...@@ -226,8 +226,8 @@ describe Projects::CommitController do ...@@ -226,8 +226,8 @@ describe Projects::CommitController do
context 'when the cherry_pick failed' do context 'when the cherry_pick failed' do
before do before do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
end end
...@@ -235,8 +235,8 @@ describe Projects::CommitController do ...@@ -235,8 +235,8 @@ describe Projects::CommitController do
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Cherry-picking a commit that has been already cherry-picked. # Cherry-picking a commit that has been already cherry-picked.
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
...@@ -249,8 +249,8 @@ describe Projects::CommitController do ...@@ -249,8 +249,8 @@ describe Projects::CommitController do
describe 'GET diff_for_path' do describe 'GET diff_for_path' do
def diff_for_path(extra_params = {}) def diff_for_path(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params.merge(extra_params)
...@@ -313,8 +313,8 @@ describe Projects::CommitController do ...@@ -313,8 +313,8 @@ describe Projects::CommitController do
describe 'GET pipelines' do describe 'GET pipelines' do
def get_pipelines(extra_params = {}) def get_pipelines(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :pipelines, params.merge(extra_params) get :pipelines, params.merge(extra_params)
......
...@@ -16,8 +16,8 @@ describe Projects::CommitsController do ...@@ -16,8 +16,8 @@ describe Projects::CommitsController do
context "when the ref does not exist with the suffix" do context "when the ref does not exist with the suffix" do
it "renders as atom" do it "renders as atom" do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: "master.atom") id: "master.atom")
expect(response).to be_success expect(response).to be_success
...@@ -33,8 +33,8 @@ describe Projects::CommitsController do ...@@ -33,8 +33,8 @@ describe Projects::CommitsController do
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit) allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: "master.atom") id: "master.atom")
end end
......
...@@ -13,8 +13,8 @@ describe Projects::CompareController do ...@@ -13,8 +13,8 @@ describe Projects::CompareController do
it 'compare shows some diffs' do it 'compare shows some diffs' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: ref_from, from: ref_from,
to: ref_to) to: ref_to)
...@@ -25,8 +25,8 @@ describe Projects::CompareController do ...@@ -25,8 +25,8 @@ describe Projects::CompareController do
it 'compare shows some diffs with ignore whitespace change option' do it 'compare shows some diffs with ignore whitespace change option' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '08f22f25', from: '08f22f25',
to: '66eceea0', to: '66eceea0',
w: 1) w: 1)
...@@ -43,8 +43,8 @@ describe Projects::CompareController do ...@@ -43,8 +43,8 @@ describe Projects::CompareController do
describe 'non-existent refs' do describe 'non-existent refs' do
it 'uses invalid source ref' do it 'uses invalid source ref' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: 'non-existent', from: 'non-existent',
to: ref_to) to: ref_to)
...@@ -55,8 +55,8 @@ describe Projects::CompareController do ...@@ -55,8 +55,8 @@ describe Projects::CompareController do
it 'uses invalid target ref' do it 'uses invalid target ref' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: ref_from, from: ref_from,
to: 'non-existent') to: 'non-existent')
...@@ -67,8 +67,8 @@ describe Projects::CompareController do ...@@ -67,8 +67,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:from] is empty and preserves params[:to]' do it 'redirects back to index when params[:from] is empty and preserves params[:to]' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '', from: '',
to: 'master') to: 'master')
...@@ -77,8 +77,8 @@ describe Projects::CompareController do ...@@ -77,8 +77,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:to] is empty and preserves params[:from]' do it 'redirects back to index when params[:to] is empty and preserves params[:from]' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: 'master', from: 'master',
to: '') to: '')
...@@ -87,8 +87,8 @@ describe Projects::CompareController do ...@@ -87,8 +87,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:from] and params[:to] are empty' do it 'redirects back to index when params[:from] and params[:to] are empty' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '', from: '',
to: '') to: '')
...@@ -99,8 +99,8 @@ describe Projects::CompareController do ...@@ -99,8 +99,8 @@ describe Projects::CompareController do
describe 'GET diff_for_path' do describe 'GET diff_for_path' do
def diff_for_path(extra_params = {}) def diff_for_path(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params.merge(extra_params)
......
...@@ -13,8 +13,8 @@ describe Projects::CycleAnalyticsController do ...@@ -13,8 +13,8 @@ describe Projects::CycleAnalyticsController do
context 'with no data' do context 'with no data' do
it 'is true' do it 'is true' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param) project_id: project)
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(true) expect(assigns(:cycle_analytics_no_data)).to eq(true)
...@@ -32,8 +32,8 @@ describe Projects::CycleAnalyticsController do ...@@ -32,8 +32,8 @@ describe Projects::CycleAnalyticsController do
it 'is false' do it 'is false' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param) project_id: project)
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(false) expect(assigns(:cycle_analytics_no_data)).to eq(false)
......
...@@ -17,8 +17,8 @@ describe Projects::FindFileController do ...@@ -17,8 +17,8 @@ describe Projects::FindFileController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -36,8 +36,8 @@ describe Projects::FindFileController do ...@@ -36,8 +36,8 @@ describe Projects::FindFileController do
describe "GET #list" do describe "GET #list" do
def go(format: 'json') def go(format: 'json')
get :list, get :list,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id, id: id,
format: format format: format
end end
......
...@@ -9,8 +9,8 @@ describe Projects::ForksController do ...@@ -9,8 +9,8 @@ describe Projects::ForksController do
describe 'GET index' do describe 'GET index' do
def get_forks def get_forks
get :index, get :index,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when fork is public' do context 'when fork is public' do
...@@ -71,8 +71,8 @@ describe Projects::ForksController do ...@@ -71,8 +71,8 @@ describe Projects::ForksController do
describe 'GET new' do describe 'GET new' do
def get_new def get_new
get :new, get :new,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when user is signed in' do context 'when user is signed in' do
...@@ -99,8 +99,8 @@ describe Projects::ForksController do ...@@ -99,8 +99,8 @@ describe Projects::ForksController do
describe 'POST create' do describe 'POST create' do
def post_create def post_create
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
namespace_key: user.namespace.id namespace_key: user.namespace.id
end end
......
...@@ -34,7 +34,7 @@ describe Projects::GraphsController do ...@@ -34,7 +34,7 @@ describe Projects::GraphsController do
end end
it 'sets the correct colour according to language' do it 'sets the correct colour according to language' do
get(:languages, namespace_id: project.namespace.path, project_id: project.path, id: 'master') get(:languages, namespace_id: project.namespace, project_id: project, id: 'master')
expected_values.each do |val| expected_values.each do |val|
expect(assigns(:languages)).to include(a_hash_including(val)) expect(assigns(:languages)).to include(a_hash_including(val))
......
...@@ -14,8 +14,8 @@ describe Projects::GroupLinksController do ...@@ -14,8 +14,8 @@ describe Projects::GroupLinksController do
describe '#create' do describe '#create' do
shared_context 'link project to group' do shared_context 'link project to group' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_id: group.id, link_group_id: group.id,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
...@@ -50,8 +50,8 @@ describe Projects::GroupLinksController do ...@@ -50,8 +50,8 @@ describe Projects::GroupLinksController do
context 'when project group id equal link group id' do context 'when project group id equal link group id' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_id: group2.id, link_group_id: group2.id,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
...@@ -69,8 +69,8 @@ describe Projects::GroupLinksController do ...@@ -69,8 +69,8 @@ describe Projects::GroupLinksController do
context 'when link group id is not present' do context 'when link group id is not present' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
......
...@@ -13,13 +13,13 @@ describe Projects::ImportsController do ...@@ -13,13 +13,13 @@ describe Projects::ImportsController do
end end
it 'renders template' do it 'renders template' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(response).to render_template :show expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do it 'sets flash.now if params is present' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'Started' } get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' }
expect(flash.now[:notice]).to eq 'Started' expect(flash.now[:notice]).to eq 'Started'
end end
...@@ -39,13 +39,13 @@ describe Projects::ImportsController do ...@@ -39,13 +39,13 @@ describe Projects::ImportsController do
end end
it 'renders template' do it 'renders template' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(response).to render_template :show expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do it 'sets flash.now if params is present' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'In progress' } get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' }
expect(flash.now[:notice]).to eq 'In progress' expect(flash.now[:notice]).to eq 'In progress'
end end
...@@ -57,7 +57,7 @@ describe Projects::ImportsController do ...@@ -57,7 +57,7 @@ describe Projects::ImportsController do
end end
it 'redirects to new_namespace_project_import_path' do it 'redirects to new_namespace_project_import_path' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(response).to redirect_to new_namespace_project_import_path(project.namespace, project) expect(response).to redirect_to new_namespace_project_import_path(project.namespace, project)
end end
...@@ -72,7 +72,7 @@ describe Projects::ImportsController do ...@@ -72,7 +72,7 @@ describe Projects::ImportsController do
it 'redirects to namespace_project_path' do it 'redirects to namespace_project_path' do
allow_any_instance_of(Project).to receive(:forked?).and_return(true) allow_any_instance_of(Project).to receive(:forked?).and_return(true)
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(flash[:notice]).to eq 'The project was successfully forked.' expect(flash[:notice]).to eq 'The project was successfully forked.'
expect(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
...@@ -81,7 +81,7 @@ describe Projects::ImportsController do ...@@ -81,7 +81,7 @@ describe Projects::ImportsController do
context 'when project is external' do context 'when project is external' do
it 'redirects to namespace_project_path' do it 'redirects to namespace_project_path' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(flash[:notice]).to eq 'The project was successfully imported.' expect(flash[:notice]).to eq 'The project was successfully imported.'
expect(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
...@@ -97,7 +97,7 @@ describe Projects::ImportsController do ...@@ -97,7 +97,7 @@ describe Projects::ImportsController do
end end
it 'redirects to params[:to]' do it 'redirects to params[:to]' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: params get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params
expect(flash[:notice]).to eq params[:notice] expect(flash[:notice]).to eq params[:notice]
expect(response).to redirect_to params[:to] expect(response).to redirect_to params[:to]
...@@ -111,7 +111,7 @@ describe Projects::ImportsController do ...@@ -111,7 +111,7 @@ describe Projects::ImportsController do
end end
it 'redirects to namespace_project_path' do it 'redirects to namespace_project_path' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param get :show, namespace_id: project.namespace.to_param, project_id: project
expect(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
end end
......
...@@ -12,7 +12,7 @@ describe Projects::IssuesController do ...@@ -12,7 +12,7 @@ describe Projects::IssuesController do
allow(project).to receive(:external_issue_tracker).and_return(external) allow(project).to receive(:external_issue_tracker).and_return(external)
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
get :index, namespace_id: project.namespace.path, project_id: project get :index, namespace_id: project.namespace, project_id: project
expect(response).to redirect_to('https://example.com/project') expect(response).to redirect_to('https://example.com/project')
end end
...@@ -27,13 +27,13 @@ describe Projects::IssuesController do ...@@ -27,13 +27,13 @@ describe Projects::IssuesController do
it_behaves_like "issuables list meta-data", :issue it_behaves_like "issuables list meta-data", :issue
it "returns index" do it "returns index" do
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
it "returns 301 if request path doesn't match project path" do it "returns 301 if request path doesn't match project path" do
get :index, namespace_id: project.namespace.path, project_id: project.path.upcase get :index, namespace_id: project.namespace, project_id: project.path.upcase
expect(response).to redirect_to(namespace_project_issues_path(project.namespace, project)) expect(response).to redirect_to(namespace_project_issues_path(project.namespace, project))
end end
...@@ -42,7 +42,7 @@ describe Projects::IssuesController do ...@@ -42,7 +42,7 @@ describe Projects::IssuesController do
project.issues_enabled = false project.issues_enabled = false
project.save project.save
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -50,7 +50,7 @@ describe Projects::IssuesController do ...@@ -50,7 +50,7 @@ describe Projects::IssuesController do
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
allow(project).to receive(:default_issues_tracker?).and_return(false) allow(project).to receive(:default_issues_tracker?).and_return(false)
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
end end
...@@ -67,8 +67,8 @@ describe Projects::IssuesController do ...@@ -67,8 +67,8 @@ describe Projects::IssuesController do
it 'redirects to last_page if page number is larger than number of pages' do it 'redirects to last_page if page number is larger than number of pages' do
get :index, get :index,
namespace_id: project.namespace.path.to_param, namespace_id: project.namespace.to_param,
project_id: project.path.to_param, project_id: project,
page: (last_page + 1).to_param page: (last_page + 1).to_param
expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope])) expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
...@@ -76,8 +76,8 @@ describe Projects::IssuesController do ...@@ -76,8 +76,8 @@ describe Projects::IssuesController do
it 'redirects to specified page' do it 'redirects to specified page' do
get :index, get :index,
namespace_id: project.namespace.path.to_param, namespace_id: project.namespace.to_param,
project_id: project.path.to_param, project_id: project,
page: last_page.to_param page: last_page.to_param
expect(assigns(:issues).current_page).to eq(last_page) expect(assigns(:issues).current_page).to eq(last_page)
...@@ -94,7 +94,7 @@ describe Projects::IssuesController do ...@@ -94,7 +94,7 @@ describe Projects::IssuesController do
end end
it 'builds a new issue' do it 'builds a new issue' do
get :new, namespace_id: project.namespace.path, project_id: project get :new, namespace_id: project.namespace, project_id: project
expect(assigns(:issue)).to be_a_new(Issue) expect(assigns(:issue)).to be_a_new(Issue)
end end
...@@ -104,7 +104,7 @@ describe Projects::IssuesController do ...@@ -104,7 +104,7 @@ describe Projects::IssuesController do
project_with_repository.team << [user, :developer] project_with_repository.team << [user, :developer]
mr = create(:merge_request_with_diff_notes, source_project: project_with_repository) mr = create(:merge_request_with_diff_notes, source_project: project_with_repository)
get :new, namespace_id: project_with_repository.namespace.path, project_id: project_with_repository, merge_request_for_resolving_discussions: mr.iid get :new, namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_for_resolving_discussions: mr.iid
expect(assigns(:issue).title).not_to be_empty expect(assigns(:issue).title).not_to be_empty
expect(assigns(:issue).description).not_to be_empty expect(assigns(:issue).description).not_to be_empty
...@@ -117,7 +117,7 @@ describe Projects::IssuesController do ...@@ -117,7 +117,7 @@ describe Projects::IssuesController do
allow(project).to receive(:external_issue_tracker).and_return(external) allow(project).to receive(:external_issue_tracker).and_return(external)
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
get :new, namespace_id: project.namespace.path, project_id: project get :new, namespace_id: project.namespace, project_id: project
expect(response).to redirect_to('https://example.com/issues/new') expect(response).to redirect_to('https://example.com/issues/new')
end end
...@@ -251,7 +251,7 @@ describe Projects::IssuesController do ...@@ -251,7 +251,7 @@ describe Projects::IssuesController do
def update_issue(issue_params = {}, additional_params = {}) def update_issue(issue_params = {}, additional_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: issue.iid, id: issue.iid,
issue: issue_params issue: issue_params
}.merge(additional_params) }.merge(additional_params)
...@@ -262,7 +262,7 @@ describe Projects::IssuesController do ...@@ -262,7 +262,7 @@ describe Projects::IssuesController do
def move_issue def move_issue
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: issue.iid, id: issue.iid,
issue: { title: 'New title' }, issue: { title: 'New title' },
move_to_project_id: another_project.id move_to_project_id: another_project.id
...@@ -342,7 +342,7 @@ describe Projects::IssuesController do ...@@ -342,7 +342,7 @@ describe Projects::IssuesController do
def get_issues def get_issues
get :index, get :index,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param project_id: project
end end
end end
...@@ -405,7 +405,7 @@ describe Projects::IssuesController do ...@@ -405,7 +405,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id id: id
end end
end end
...@@ -416,7 +416,7 @@ describe Projects::IssuesController do ...@@ -416,7 +416,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
get :edit, get :edit,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id id: id
end end
end end
...@@ -427,7 +427,7 @@ describe Projects::IssuesController do ...@@ -427,7 +427,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id, id: id,
issue: { title: 'New title' } issue: { title: 'New title' }
end end
...@@ -442,7 +442,7 @@ describe Projects::IssuesController do ...@@ -442,7 +442,7 @@ describe Projects::IssuesController do
post :create, { post :create, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
issue: { title: 'Title', description: 'Description' }.merge(issue_attrs) issue: { title: 'Title', description: 'Description' }.merge(issue_attrs)
}.merge(additional_params) }.merge(additional_params)
...@@ -464,7 +464,7 @@ describe Projects::IssuesController do ...@@ -464,7 +464,7 @@ describe Projects::IssuesController do
end end
def post_issue(issue_params) def post_issue(issue_params)
post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, issue: issue_params, merge_request_for_resolving_discussions: merge_request.iid post :create, namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_for_resolving_discussions: merge_request.iid
end end
it 'creates an issue for the project' do it 'creates an issue for the project' do
...@@ -607,8 +607,8 @@ describe Projects::IssuesController do ...@@ -607,8 +607,8 @@ describe Projects::IssuesController do
project.team << [admin, :master] project.team << [admin, :master]
sign_in(admin) sign_in(admin)
post :mark_as_spam, { post :mark_as_spam, {
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: issue.iid id: issue.iid
} }
end end
...@@ -624,7 +624,7 @@ describe Projects::IssuesController do ...@@ -624,7 +624,7 @@ describe Projects::IssuesController do
context "when the user is a developer" do context "when the user is a developer" do
before { sign_in(user) } before { sign_in(user) }
it "rejects a developer to destroy an issue" do it "rejects a developer to destroy an issue" do
delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
end end
...@@ -637,7 +637,7 @@ describe Projects::IssuesController do ...@@ -637,7 +637,7 @@ describe Projects::IssuesController do
before { sign_in(owner) } before { sign_in(owner) }
it "deletes the issue" do it "deletes the issue" do
delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
expect(response).to have_http_status(302) expect(response).to have_http_status(302)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now
...@@ -646,7 +646,7 @@ describe Projects::IssuesController do ...@@ -646,7 +646,7 @@ describe Projects::IssuesController do
it 'delegates the update of the todos count cache to TodoService' do it 'delegates the update of the todos count cache to TodoService' do
expect_any_instance_of(TodoService).to receive(:destroy_issue).with(issue, owner).once expect_any_instance_of(TodoService).to receive(:destroy_issue).with(issue, owner).once
delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
end end
end end
end end
...@@ -659,8 +659,8 @@ describe Projects::IssuesController do ...@@ -659,8 +659,8 @@ describe Projects::IssuesController do
it "toggles the award emoji" do it "toggles the award emoji" do
expect do expect do
post(:toggle_award_emoji, namespace_id: project.namespace.path, post(:toggle_award_emoji, namespace_id: project.namespace,
project_id: project.path, id: issue.iid, name: "thumbsup") project_id: project, id: issue.iid, name: "thumbsup")
end.to change { issue.award_emoji.count }.by(1) end.to change { issue.award_emoji.count }.by(1)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
...@@ -67,7 +67,7 @@ describe Projects::LabelsController do ...@@ -67,7 +67,7 @@ describe Projects::LabelsController do
end end
def list_labels def list_labels
get :index, namespace_id: project.namespace.to_param, project_id: project.to_param get :index, namespace_id: project.namespace.to_param, project_id: project
end end
end end
...@@ -76,7 +76,7 @@ describe Projects::LabelsController do ...@@ -76,7 +76,7 @@ describe Projects::LabelsController do
let(:personal_project) { create(:empty_project, namespace: user.namespace) } let(:personal_project) { create(:empty_project, namespace: user.namespace) }
it 'creates labels' do it 'creates labels' do
post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project.to_param post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project
expect(response).to have_http_status(302) expect(response).to have_http_status(302)
end end
...@@ -84,7 +84,7 @@ describe Projects::LabelsController do ...@@ -84,7 +84,7 @@ describe Projects::LabelsController do
context 'project belonging to a group' do context 'project belonging to a group' do
it 'creates labels' do it 'creates labels' do
post :generate, namespace_id: project.namespace.to_param, project_id: project.to_param post :generate, namespace_id: project.namespace.to_param, project_id: project
expect(response).to have_http_status(302) expect(response).to have_http_status(302)
end end
...@@ -109,7 +109,7 @@ describe Projects::LabelsController do ...@@ -109,7 +109,7 @@ describe Projects::LabelsController do
end end
def toggle_subscription(label) def toggle_subscription(label)
post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label.to_param post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project, id: label.to_param
end end
end end
...@@ -119,7 +119,7 @@ describe Projects::LabelsController do ...@@ -119,7 +119,7 @@ describe Projects::LabelsController do
context 'not group owner' do context 'not group owner' do
it 'denies access' do it 'denies access' do
post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -131,13 +131,13 @@ describe Projects::LabelsController do ...@@ -131,13 +131,13 @@ describe Projects::LabelsController do
end end
it 'gives access' do it 'gives access' do
post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
expect(response).to redirect_to(namespace_project_labels_path) expect(response).to redirect_to(namespace_project_labels_path)
end end
it 'promotes the label' do it 'promotes the label' do
post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
expect(Label.where(id: label_1.id)).to be_empty expect(Label.where(id: label_1.id)).to be_empty
expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil
...@@ -151,7 +151,7 @@ describe Projects::LabelsController do ...@@ -151,7 +151,7 @@ describe Projects::LabelsController do
end end
it 'returns to label list' do it 'returns to label list' do
post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
expect(response).to redirect_to(namespace_project_labels_path) expect(response).to redirect_to(namespace_project_labels_path)
end end
end end
......
...@@ -18,7 +18,7 @@ describe Projects::MattermostsController do ...@@ -18,7 +18,7 @@ describe Projects::MattermostsController do
it 'accepts the request' do it 'accepts the request' do
get(:new, get(:new,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param) project_id: project)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
...@@ -30,7 +30,7 @@ describe Projects::MattermostsController do ...@@ -30,7 +30,7 @@ describe Projects::MattermostsController do
subject do subject do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
mattermost: mattermost_params) mattermost: mattermost_params)
end end
......
...@@ -17,8 +17,8 @@ describe Projects::PipelinesController do ...@@ -17,8 +17,8 @@ describe Projects::PipelinesController do
create(:ci_empty_pipeline, status: 'created', project: project) create(:ci_empty_pipeline, status: 'created', project: project)
create(:ci_empty_pipeline, status: 'success', project: project) create(:ci_empty_pipeline, status: 'success', project: project)
get :index, namespace_id: project.namespace.path, get :index, namespace_id: project.namespace,
project_id: project.path, project_id: project,
format: :json format: :json
end end
...@@ -62,8 +62,8 @@ describe Projects::PipelinesController do ...@@ -62,8 +62,8 @@ describe Projects::PipelinesController do
end end
def get_stage(name) def get_stage(name)
get :stage, namespace_id: project.namespace.path, get :stage, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: pipeline.id, id: pipeline.id,
stage: name, stage: name,
format: :json format: :json
......
...@@ -4,7 +4,7 @@ describe Projects::ProtectedBranchesController do ...@@ -4,7 +4,7 @@ describe Projects::ProtectedBranchesController do
describe "GET #index" do describe "GET #index" do
let(:project) { create(:project_empty_repo, :public) } let(:project) { create(:project_empty_repo, :public) }
it "redirects empty repo to projects page" do it "redirects empty repo to projects page" do
get(:index, namespace_id: project.namespace.to_param, project_id: project.to_param) get(:index, namespace_id: project.namespace.to_param, project_id: project)
end end
end end
end end
...@@ -10,7 +10,7 @@ describe Projects::RawController do ...@@ -10,7 +10,7 @@ describe Projects::RawController do
it 'delivers ASCII file' do it 'delivers ASCII file' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -27,7 +27,7 @@ describe Projects::RawController do ...@@ -27,7 +27,7 @@ describe Projects::RawController do
it 'sets image content type header' do it 'sets image content type header' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -51,7 +51,7 @@ describe Projects::RawController do ...@@ -51,7 +51,7 @@ describe Projects::RawController do
expect(controller).to receive(:send_file).with("#{Gitlab.config.shared.path}/lfs-objects/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", filename: "lfs_object.iso", disposition: 'attachment') expect(controller).to receive(:send_file).with("#{Gitlab.config.shared.path}/lfs-objects/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", filename: "lfs_object.iso", disposition: 'attachment')
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -62,7 +62,7 @@ describe Projects::RawController do ...@@ -62,7 +62,7 @@ describe Projects::RawController do
it 'does not serve the file' do it 'does not serve the file' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
......
...@@ -13,7 +13,7 @@ describe Projects::RefsController do ...@@ -13,7 +13,7 @@ describe Projects::RefsController do
def default_get(format = :html) def default_get(format = :html)
get :logs_tree, get :logs_tree,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: 'master', id: 'master',
path: 'foo/bar/baz.html', path: 'foo/bar/baz.html',
format: format format: format
...@@ -23,7 +23,7 @@ describe Projects::RefsController do ...@@ -23,7 +23,7 @@ describe Projects::RefsController do
xhr :get, xhr :get,
:logs_tree, :logs_tree,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, id: 'master', project_id: project, id: 'master',
path: 'foo/bar/baz.html', format: format path: 'foo/bar/baz.html', format: format
end end
......
...@@ -16,7 +16,7 @@ describe Projects::ReleasesController do ...@@ -16,7 +16,7 @@ describe Projects::ReleasesController do
tag_id = release.tag tag_id = release.tag
project.releases.destroy_all project.releases.destroy_all
get :edit, namespace_id: project.namespace.path, project_id: project.path, tag_id: tag_id get :edit, namespace_id: project.namespace, project_id: project, tag_id: tag_id
release = assigns(:release) release = assigns(:release)
expect(release).not_to be_nil expect(release).not_to be_nil
...@@ -24,7 +24,7 @@ describe Projects::ReleasesController do ...@@ -24,7 +24,7 @@ describe Projects::ReleasesController do
end end
it 'retrieves an existing release' do it 'retrieves an existing release' do
get :edit, namespace_id: project.namespace.path, project_id: project.path, tag_id: release.tag get :edit, namespace_id: project.namespace, project_id: project, tag_id: release.tag
release = assigns(:release) release = assigns(:release)
expect(release).not_to be_nil expect(release).not_to be_nil
...@@ -48,7 +48,7 @@ describe Projects::ReleasesController do ...@@ -48,7 +48,7 @@ describe Projects::ReleasesController do
def update_release(description) def update_release(description)
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
tag_id: release.tag, tag_id: release.tag,
release: { description: description } release: { description: description }
end end
......
...@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do ...@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do
describe "GET archive" do describe "GET archive" do
context 'as a guest' do context 'as a guest' do
it 'responds with redirect in correct format' do it 'responds with redirect in correct format' do
get :archive, namespace_id: project.namespace.path, project_id: project.path, format: "zip" get :archive, namespace_id: project.namespace, project_id: project, format: "zip"
expect(response.header["Content-Type"]).to start_with('text/html') expect(response.header["Content-Type"]).to start_with('text/html')
expect(response).to be_redirect expect(response).to be_redirect
...@@ -22,7 +22,7 @@ describe Projects::RepositoriesController do ...@@ -22,7 +22,7 @@ describe Projects::RepositoriesController do
end end
it "uses Gitlab::Workhorse" do it "uses Gitlab::Workhorse" do
get :archive, namespace_id: project.namespace.path, project_id: project.path, ref: "master", format: "zip" get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end end
...@@ -33,7 +33,7 @@ describe Projects::RepositoriesController do ...@@ -33,7 +33,7 @@ describe Projects::RepositoriesController do
end end
it "renders Not Found" do it "renders Not Found" do
get :archive, namespace_id: project.namespace.path, project_id: project.path, ref: "master", format: "zip" get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip"
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
......
...@@ -17,16 +17,16 @@ describe Projects::SnippetsController do ...@@ -17,16 +17,16 @@ describe Projects::SnippetsController do
it 'redirects to last_page if page number is larger than number of pages' do it 'redirects to last_page if page number is larger than number of pages' do
get :index, get :index,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, page: (last_page + 1).to_param project_id: project, page: (last_page + 1).to_param
expect(response).to redirect_to(namespace_project_snippets_path(page: last_page)) expect(response).to redirect_to(namespace_project_snippets_path(page: last_page))
end end
it 'redirects to specified page' do it 'redirects to specified page' do
get :index, get :index,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, page: last_page.to_param project_id: project, page: last_page.to_param
expect(assigns(:snippets).current_page).to eq(last_page) expect(assigns(:snippets).current_page).to eq(last_page)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -38,7 +38,7 @@ describe Projects::SnippetsController do ...@@ -38,7 +38,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do context 'when anonymous' do
it 'does not include the private snippet' do it 'does not include the private snippet' do
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(assigns(:snippets)).not_to include(project_snippet) expect(assigns(:snippets)).not_to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -49,7 +49,7 @@ describe Projects::SnippetsController do ...@@ -49,7 +49,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'renders the snippet' do it 'renders the snippet' do
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(assigns(:snippets)).to include(project_snippet) expect(assigns(:snippets)).to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -60,7 +60,7 @@ describe Projects::SnippetsController do ...@@ -60,7 +60,7 @@ describe Projects::SnippetsController do
before { sign_in(user2) } before { sign_in(user2) }
it 'renders the snippet' do it 'renders the snippet' do
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
expect(assigns(:snippets)).to include(project_snippet) expect(assigns(:snippets)).to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -77,7 +77,7 @@ describe Projects::SnippetsController do ...@@ -77,7 +77,7 @@ describe Projects::SnippetsController do
post :create, { post :create, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params)
}.merge(additional_params) }.merge(additional_params)
end end
...@@ -152,7 +152,7 @@ describe Projects::SnippetsController do ...@@ -152,7 +152,7 @@ describe Projects::SnippetsController do
put :update, { put :update, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: snippet.id, id: snippet.id,
project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params)
}.merge(additional_params) }.merge(additional_params)
...@@ -281,8 +281,8 @@ describe Projects::SnippetsController do ...@@ -281,8 +281,8 @@ describe Projects::SnippetsController do
sign_in(admin) sign_in(admin)
post :mark_as_spam, post :mark_as_spam,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: snippet.id id: snippet.id
end end
...@@ -300,7 +300,7 @@ describe Projects::SnippetsController do ...@@ -300,7 +300,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do context 'when anonymous' do
it 'responds with status 404' do it 'responds with status 404' do
get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -310,7 +310,7 @@ describe Projects::SnippetsController do ...@@ -310,7 +310,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'renders the snippet' do it 'renders the snippet' do
get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -321,7 +321,7 @@ describe Projects::SnippetsController do ...@@ -321,7 +321,7 @@ describe Projects::SnippetsController do
before { sign_in(user2) } before { sign_in(user2) }
it 'renders the snippet' do it 'renders the snippet' do
get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -332,7 +332,7 @@ describe Projects::SnippetsController do ...@@ -332,7 +332,7 @@ describe Projects::SnippetsController do
context 'when the project snippet does not exist' do context 'when the project snippet does not exist' do
context 'when anonymous' do context 'when anonymous' do
it 'responds with status 404' do it 'responds with status 404' do
get action, namespace_id: project.namespace.path, project_id: project.path, id: 42 get action, namespace_id: project.namespace, project_id: project, id: 42
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -342,7 +342,7 @@ describe Projects::SnippetsController do ...@@ -342,7 +342,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'responds with status 404' do it 'responds with status 404' do
get action, namespace_id: project.namespace.path, project_id: project.path, id: 42 get action, namespace_id: project.namespace, project_id: project, id: 42
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -364,8 +364,8 @@ describe Projects::SnippetsController do ...@@ -364,8 +364,8 @@ describe Projects::SnippetsController do
context 'CRLF line ending' do context 'CRLF line ending' do
let(:params) do let(:params) do
{ {
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: project_snippet.to_param id: project_snippet.to_param
} }
end end
......
...@@ -6,7 +6,7 @@ describe Projects::TagsController do ...@@ -6,7 +6,7 @@ describe Projects::TagsController do
let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') } let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') }
describe 'GET index' do describe 'GET index' do
before { get :index, namespace_id: project.namespace.to_param, project_id: project.to_param } before { get :index, namespace_id: project.namespace.to_param, project_id: project }
it 'returns the tags for the page' do it 'returns the tags for the page' do
expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0']) expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0'])
...@@ -19,7 +19,7 @@ describe Projects::TagsController do ...@@ -19,7 +19,7 @@ describe Projects::TagsController do
end end
describe 'GET show' do describe 'GET show' do
before { get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, id: id } before { get :show, namespace_id: project.namespace.to_param, project_id: project, id: id }
context "valid tag" do context "valid tag" do
let(:id) { 'v1.0.0' } let(:id) { 'v1.0.0' }
......
...@@ -20,7 +20,7 @@ describe Projects::TemplatesController do ...@@ -20,7 +20,7 @@ describe Projects::TemplatesController do
describe '#show' do describe '#show' do
it 'renders template name and content as json' do it 'renders template name and content as json' do
get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project.path, format: :json) get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json)
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(body["name"]).to eq("bug") expect(body["name"]).to eq("bug")
...@@ -29,21 +29,21 @@ describe Projects::TemplatesController do ...@@ -29,21 +29,21 @@ describe Projects::TemplatesController do
it 'renders 404 when unauthorized' do it 'renders 404 when unauthorized' do
sign_in(user2) sign_in(user2)
get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project.path, format: :json) get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json)
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
it 'renders 404 when template type is not found' do it 'renders 404 when template type is not found' do
sign_in(user) sign_in(user)
get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project.path, format: :json) get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json)
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
it 'renders 404 without errors' do it 'renders 404 without errors' do
sign_in(user) sign_in(user)
expect { get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project.path, format: :json) }.not_to raise_error expect { get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json) }.not_to raise_error
end end
end end
end end
...@@ -12,8 +12,8 @@ describe Projects::TodosController do ...@@ -12,8 +12,8 @@ describe Projects::TodosController do
describe 'POST create' do describe 'POST create' do
def go def go
post :create, post :create,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
issuable_id: issue.id, issuable_id: issue.id,
issuable_type: 'issue', issuable_type: 'issue',
format: 'html' format: 'html'
...@@ -80,8 +80,8 @@ describe Projects::TodosController do ...@@ -80,8 +80,8 @@ describe Projects::TodosController do
describe 'POST create' do describe 'POST create' do
def go def go
post :create, post :create,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
issuable_id: merge_request.id, issuable_id: merge_request.id,
issuable_type: 'merge_request', issuable_type: 'merge_request',
format: 'html' format: 'html'
......
...@@ -18,7 +18,7 @@ describe Projects::TreeController do ...@@ -18,7 +18,7 @@ describe Projects::TreeController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -74,7 +74,7 @@ describe Projects::TreeController do ...@@ -74,7 +74,7 @@ describe Projects::TreeController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -94,7 +94,7 @@ describe Projects::TreeController do ...@@ -94,7 +94,7 @@ describe Projects::TreeController do
before do before do
post(:create_dir, post(:create_dir,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: 'master', id: 'master',
dir_name: path, dir_name: path,
target_branch: target_branch, target_branch: target_branch,
......
...@@ -16,7 +16,7 @@ describe Projects::UploadsController do ...@@ -16,7 +16,7 @@ describe Projects::UploadsController do
it "returns an error" do it "returns an error" do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
format: :json format: :json
expect(response).to have_http_status(422) expect(response).to have_http_status(422)
end end
...@@ -26,7 +26,7 @@ describe Projects::UploadsController do ...@@ -26,7 +26,7 @@ describe Projects::UploadsController do
before do before do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
file: jpg, file: jpg,
format: :json format: :json
end end
...@@ -41,7 +41,7 @@ describe Projects::UploadsController do ...@@ -41,7 +41,7 @@ describe Projects::UploadsController do
before do before do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
file: txt, file: txt,
format: :json format: :json
end end
...@@ -57,7 +57,7 @@ describe Projects::UploadsController do ...@@ -57,7 +57,7 @@ describe Projects::UploadsController do
let(:go) do let(:go) do
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
secret: "123456", secret: "123456",
filename: "image.jpg" filename: "image.jpg"
end end
......
...@@ -12,7 +12,7 @@ describe Projects::VariablesController do ...@@ -12,7 +12,7 @@ describe Projects::VariablesController do
describe 'POST #create' do describe 'POST #create' do
context 'variable is valid' do context 'variable is valid' do
it 'shows a success flash message' do it 'shows a success flash message' do
post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, post :create, namespace_id: project.namespace.to_param, project_id: project,
variable: { key: "one", value: "two" } variable: { key: "one", value: "two" }
expect(flash[:notice]).to include 'Variables were successfully updated.' expect(flash[:notice]).to include 'Variables were successfully updated.'
...@@ -22,7 +22,7 @@ describe Projects::VariablesController do ...@@ -22,7 +22,7 @@ describe Projects::VariablesController do
context 'variable is invalid' do context 'variable is invalid' do
it 'shows an alert flash message' do it 'shows an alert flash message' do
post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, post :create, namespace_id: project.namespace.to_param, project_id: project,
variable: { key: "..one", value: "two" } variable: { key: "..one", value: "two" }
expect(response).to render_template("projects/variables/show") expect(response).to render_template("projects/variables/show")
...@@ -40,7 +40,7 @@ describe Projects::VariablesController do ...@@ -40,7 +40,7 @@ describe Projects::VariablesController do
end end
it 'shows a success flash message' do it 'shows a success flash message' do
post :update, namespace_id: project.namespace.to_param, project_id: project.to_param, post :update, namespace_id: project.namespace.to_param, project_id: project,
id: variable.id, variable: { key: variable.key, value: 'two' } id: variable.id, variable: { key: variable.key, value: 'two' }
expect(flash[:notice]).to include 'Variable was successfully updated.' expect(flash[:notice]).to include 'Variable was successfully updated.'
...@@ -48,7 +48,7 @@ describe Projects::VariablesController do ...@@ -48,7 +48,7 @@ describe Projects::VariablesController do
end end
it 'renders the action #show if the variable key is invalid' do it 'renders the action #show if the variable key is invalid' do
post :update, namespace_id: project.namespace.to_param, project_id: project.to_param, post :update, namespace_id: project.namespace.to_param, project_id: project,
id: variable.id, variable: { key: '?', value: variable.value } id: variable.id, variable: { key: '?', value: variable.value }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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