Commit 5b605eab authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ce-to-ee' into 'master'

CE to EE for 8.11.0-rc1

See merge request !607
parents 9ae5e95d 70e2acea
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased) v 8.11.0 (unreleased)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Improve diff performance by eliminating redundant checks for text blobs
- Convert switch icon into icon font (ClemMakesApps)
- Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell) - Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell)
- Add support for relative links starting with ./ or / to RelativeLinkFilter (winniehell)
- Fix CI status icon link underline (ClemMakesApps) - Fix CI status icon link underline (ClemMakesApps)
- The Repository class is now instrumented
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Expand commit message width in repo view (ClemMakesApps)
- Cache highlighted diff lines for merge requests
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI' - Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
- Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable - Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable
- Optimize maximum user access level lookup in loading of notes - Optimize maximum user access level lookup in loading of notes
- Add "No one can push" as an option for protected branches. !5081 - Add "No one can push" as an option for protected branches. !5081
- Environments have an url to link to
- Limit git rev-list output count to one in forced push check - Limit git rev-list output count to one in forced push check
- Clean up unused routes (Josef Strzibny) - Clean up unused routes (Josef Strzibny)
- Add green outline to New Branch button. !5447 (winniehell) - Add green outline to New Branch button. !5447 (winniehell)
- Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects
- Remove delay when hitting "Reply..." button on page with a lot of discussions
- Retrieve rendered HTML from cache in one request - Retrieve rendered HTML from cache in one request
- Fix renaming repository when name contains invalid chararacters under project settings - Fix renaming repository when name contains invalid chararacters under project settings
- Optimize checking if a user has read access to a list of issues !5370
- Nokogiri's various parsing methods are now instrumented - Nokogiri's various parsing methods are now instrumented
- Add simple identifier to public SSH keys (muteor)
- Add a way to send an email and create an issue based on private personal token. Find the email address from issues page. !3363
- Fix filter input alignment (ClemMakesApps)
- Include old revision in merge request update hooks (Ben Boeckel)
- Add build event color in HipChat messages (David Eisner) - Add build event color in HipChat messages (David Eisner)
- Make fork counter always clickable. !5463 (winniehell) - Make fork counter always clickable. !5463 (winniehell)
- All created issues, API or WebUI, can be submitted to Akismet for spam check !5333 - All created issues, API or WebUI, can be submitted to Akismet for spam check !5333
- The overhead of instrumented method calls has been reduced
- Remove `search_id` of labels dropdown filter to fix 'Missleading URI for labels in Merge Requests and Issues view'. !5368 (Scott Le) - Remove `search_id` of labels dropdown filter to fix 'Missleading URI for labels in Merge Requests and Issues view'. !5368 (Scott Le)
- Load project invited groups and members eagerly in `ProjectTeam#fetch_members` - Load project invited groups and members eagerly in `ProjectTeam#fetch_members`
- Bump gitlab_git to speedup DiffCollection iterations
- Make branches sortable without push permission !5462 (winniehell) - Make branches sortable without push permission !5462 (winniehell)
- Check for Ci::Build artifacts at database level on pipeline partial
- Convert image diff background image to CSS (ClemMakesApps)
- Make "New issue" button in Issue page less obtrusive !5457 (winniehell)
- Gitlab::Metrics.current_transaction needs to be public for RailsQueueDuration
- Fix search for notes which belongs to deleted objects
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska) - Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska)
- Allow branch names ending with .json for graph and network page !5579 (winniehell)
- Add the `sprockets-es6` gem - Add the `sprockets-es6` gem
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska) - Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
- Profile requests when a header is passed - Profile requests when a header is passed
- Avoid calculation of line_code and position for _line partial when showing diff notes on discussion tab.
- Speedup DiffNote#active? on discussions, preloading noteables and avoid touching git repository to return diff_refs when possible
- Add commit stats in commit api. !5517 (dixpac)
- Add CI configuration button on project page
- Make error pages responsive (Takuya Noguchi) - Make error pages responsive (Takuya Noguchi)
- Change requests_profiles resource constraint to catch virtually any file - Change requests_profiles resource constraint to catch virtually any file
- Reduce number of queries made for merge_requests/:id/diffs
v 8.10.3 (unreleased) - Sensible state specific default sort order for issues and merge requests !5453 (tomb0y)
- Fix RequestProfiler::Middleware error when code is reloaded in development
- Catch what warden might throw when profiling requests to re-throw it
- Speed up and reduce memory usage of Commit#repo_changes, Repository#expire_avatar_cache and IrkerWorker
v 8.10.3
- Fix Import/Export issue importing milestones and labels not associated properly. !5426
- Fix timing problems running imports on production. !5523
- Add a log message when a project is scheduled for destruction for debugging. !5540
- Fix hooks missing on imported GitLab projects. !5549
- Properly abort a merge when merge conflicts occur. !5569
- Fix importer for GitHub Pull Requests when a branch was removed. !5573
- Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured. !5584
- Trim extra displayed carriage returns in diffs and files with CRLFs. !5588
v 8.10.2 v 8.10.2
- User can now search branches by name. !5144 - User can now search branches by name. !5144
......
...@@ -41,6 +41,8 @@ abbreviation. ...@@ -41,6 +41,8 @@ abbreviation.
If you have read this guide and want to know how the GitLab [core team] If you have read this guide and want to know how the GitLab [core team]
operates please see [the GitLab contributing process](PROCESS.md). operates please see [the GitLab contributing process](PROCESS.md).
- [GitLab Inc engineers should refer to the engineering workflow document](https://about.gitlab.com/handbook/engineering/workflow/)
## Contributor license agreement ## Contributor license agreement
By submitting code as an individual you agree to the By submitting code as an individual you agree to the
......
...@@ -57,7 +57,7 @@ gem 'browser', '~> 2.2' ...@@ -57,7 +57,7 @@ gem 'browser', '~> 2.2'
# Extracting information from a git repository # Extracting information from a git repository
# Provide access to Gitlab::Git library # Provide access to Gitlab::Git library
gem 'gitlab_git', '~> 10.3.2' gem 'gitlab_git', '~> 10.4.3'
# LDAP Auth # LDAP Auth
# GitLab fork with several improvements to original library. For full list of changes # GitLab fork with several improvements to original library. For full list of changes
......
...@@ -300,7 +300,7 @@ GEM ...@@ -300,7 +300,7 @@ GEM
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-license (1.0.0) gitlab-license (1.0.0)
gitlab_git (10.3.2) gitlab_git (10.4.3)
activesupport (~> 4.0) activesupport (~> 4.0)
charlock_holmes (~> 0.7.3) charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
...@@ -901,7 +901,7 @@ DEPENDENCIES ...@@ -901,7 +901,7 @@ DEPENDENCIES
gitlab-elasticsearch-git (~> 0.0.15) gitlab-elasticsearch-git (~> 0.0.15)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
gitlab_git (~> 10.3.2) gitlab_git (~> 10.4.3)
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (~> 1.2.1) gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.2) gollum-lib (~> 4.2)
......
...@@ -8,6 +8,8 @@ treatment, etc.). And so that maintainers know what to expect from contributors ...@@ -8,6 +8,8 @@ treatment, etc.). And so that maintainers know what to expect from contributors
(use the latest version, ensure that the issue is addressed, friendly treatment, (use the latest version, ensure that the issue is addressed, friendly treatment,
etc.). etc.).
- [GitLab Inc engineers should refer to the engineering workflow document](https://about.gitlab.com/handbook/engineering/workflow/)
## Common actions ## Common actions
### Issue team ### Issue team
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
$date = $('.js-artifacts-remove'); $date = $('.js-artifacts-remove');
if ($date.length) { if ($date.length) {
date = $date.text(); date = $date.text();
return $date.text($.timefor(new Date(date), ' ')); return $date.text($.timefor(new Date(date.replace(/-/g, '/')), ' '));
} }
}; };
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
} }
} }
}, },
setup: function(wrap) { setup: function(input) {
this.input = $('.js-gfm-input'); this.input = input || $('.js-gfm-input');
this.destroyAtWho(); this.destroyAtWho();
this.setupAtWho(); this.setupAtWho();
if (this.dataSource) { if (this.dataSource) {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
this.form.find('.div-dropzone').remove(); this.form.find('.div-dropzone').remove();
this.form.addClass('gfm-form'); this.form.addClass('gfm-form');
disableButtonIfEmptyField(this.form.find('.js-note-text'), this.form.find('.js-comment-button')); disableButtonIfEmptyField(this.form.find('.js-note-text'), this.form.find('.js-comment-button'));
GitLab.GfmAutoComplete.setup(); GitLab.GfmAutoComplete.setup(this.form.find('.js-gfm-input'));
new DropzoneInput(this.form); new DropzoneInput(this.form);
autosize(this.textarea); autosize(this.textarea);
this.addEventListeners(); this.addEventListeners();
......
function md5 (str) {
// http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + namespaced by: Michael White (http://getsprink.com)
// + tweaked by: Jack
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// - depends on: utf8_encode
// * example 1: md5('Kevin van Zonneveld');
// * returns 1: '6e658d4bfcb59cc13f96c14450ac40b9'
var xl;
var rotateLeft = function (lValue, iShiftBits) {
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
};
var addUnsigned = function (lX, lY) {
var lX4, lY4, lX8, lY8, lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
lX4 = (lX & 0x40000000);
lY4 = (lY & 0x40000000);
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
if (lX4 & lY4) {
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
}
if (lX4 | lY4) {
if (lResult & 0x40000000) {
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
} else {
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
}
} else {
return (lResult ^ lX8 ^ lY8);
}
};
var _F = function (x, y, z) {
return (x & y) | ((~x) & z);
};
var _G = function (x, y, z) {
return (x & z) | (y & (~z));
};
var _H = function (x, y, z) {
return (x ^ y ^ z);
};
var _I = function (x, y, z) {
return (y ^ (x | (~z)));
};
var _FF = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_F(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _GG = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_G(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _HH = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_H(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _II = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_I(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var convertToWordArray = function (str) {
var lWordCount;
var lMessageLength = str.length;
var lNumberOfWords_temp1 = lMessageLength + 8;
var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
var lWordArray = new Array(lNumberOfWords - 1);
var lBytePosition = 0;
var lByteCount = 0;
while (lByteCount < lMessageLength) {
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition));
lByteCount++;
}
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
return lWordArray;
};
var wordToHex = function (lValue) {
var wordToHexValue = "",
wordToHexValue_temp = "",
lByte, lCount;
for (lCount = 0; lCount <= 3; lCount++) {
lByte = (lValue >>> (lCount * 8)) & 255;
wordToHexValue_temp = "0" + lByte.toString(16);
wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length - 2, 2);
}
return wordToHexValue;
};
var x = [],
k, AA, BB, CC, DD, a, b, c, d, S11 = 7,
S12 = 12,
S13 = 17,
S14 = 22,
S21 = 5,
S22 = 9,
S23 = 14,
S24 = 20,
S31 = 4,
S32 = 11,
S33 = 16,
S34 = 23,
S41 = 6,
S42 = 10,
S43 = 15,
S44 = 21;
str = this.utf8_encode(str);
x = convertToWordArray(str);
a = 0x67452301;
b = 0xEFCDAB89;
c = 0x98BADCFE;
d = 0x10325476;
xl = x.length;
for (k = 0; k < xl; k += 16) {
AA = a;
BB = b;
CC = c;
DD = d;
a = _FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
d = _FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
c = _FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
b = _FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
a = _FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
d = _FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
c = _FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
b = _FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
a = _FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
d = _FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
c = _FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
b = _FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
a = _FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
d = _FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
c = _FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
b = _FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
a = _GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
d = _GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
c = _GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
b = _GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
a = _GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
d = _GG(d, a, b, c, x[k + 10], S22, 0x2441453);
c = _GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
b = _GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
a = _GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
d = _GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
c = _GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
b = _GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
a = _GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
d = _GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
c = _GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
b = _GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
a = _HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
d = _HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
c = _HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
b = _HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
a = _HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
d = _HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
c = _HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
b = _HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
a = _HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
d = _HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
c = _HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
b = _HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
a = _HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
d = _HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
c = _HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
b = _HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
a = _II(a, b, c, d, x[k + 0], S41, 0xF4292244);
d = _II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
c = _II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
b = _II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
a = _II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
d = _II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
c = _II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
b = _II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
a = _II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
d = _II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
c = _II(c, d, a, b, x[k + 6], S43, 0xA3014314);
b = _II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
a = _II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
d = _II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
c = _II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
b = _II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
a = addUnsigned(a, AA);
b = addUnsigned(b, BB);
c = addUnsigned(c, CC);
d = addUnsigned(d, DD);
}
var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
return temp.toLowerCase();
}
function utf8_encode (argString) {
// http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: sowberry
// + tweaked by: Jack
// + bugfixed by: Onno Marsman
// + improved by: Yves Sucaet
// + bugfixed by: Onno Marsman
// + bugfixed by: Ulrich
// + bugfixed by: Rafal Kukawski
// + improved by: kirilloid
// + bugfixed by: kirilloid
// * example 1: utf8_encode('Kevin van Zonneveld');
// * returns 1: 'Kevin van Zonneveld'
if (argString === null || typeof argString === "undefined") {
return "";
}
var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
var utftext = '',
start, end, stringl = 0;
start = end = 0;
stringl = string.length;
for (var n = 0; n < stringl; n++) {
var c1 = string.charCodeAt(n);
var enc = null;
if (c1 < 128) {
end++;
} else if (c1 > 127 && c1 < 2048) {
enc = String.fromCharCode(
(c1 >> 6) | 192,
( c1 & 63) | 128
);
} else if (c1 & 0xF800 != 0xD800) {
enc = String.fromCharCode(
(c1 >> 12) | 224,
((c1 >> 6) & 63) | 128,
( c1 & 63) | 128
);
} else { // surrogate pairs
if (c1 & 0xFC00 != 0xD800) { throw new RangeError("Unmatched trail surrogate at " + n); }
var c2 = string.charCodeAt(++n);
if (c2 & 0xFC00 != 0xDC00) { throw new RangeError("Unmatched lead surrogate at " + (n-1)); }
c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000;
enc = String.fromCharCode(
(c1 >> 18) | 240,
((c1 >> 12) & 63) | 128,
((c1 >> 6) & 63) | 128,
( c1 & 63) | 128
);
}
if (enc !== null) {
if (end > start) {
utftext += string.slice(start, end);
}
utftext += enc;
start = end = n + 1;
}
}
if (end > start) {
utftext += string.slice(start, stringl);
}
return utftext;
}
...@@ -182,7 +182,6 @@ ...@@ -182,7 +182,6 @@
> form { > form {
display: inline-block; display: inline-block;
margin-top: -1px;
} }
.icon-label { .icon-label {
...@@ -193,7 +192,6 @@ ...@@ -193,7 +192,6 @@
height: 35px; height: 35px;
display: inline-block; display: inline-block;
position: relative; position: relative;
top: 2px;
margin-right: $gl-padding-top; margin-right: $gl-padding-top;
/* Medium devices (desktops, 992px and up) */ /* Medium devices (desktops, 992px and up) */
......
.commits-compare-switch { .commits-compare-switch {
@include btn-default; @include btn-default;
@include btn-white; @include btn-white;
background: image-url("switch_icon.png") no-repeat center center;
text-indent: -9999px;
float: left; float: left;
margin-right: 9px; margin-right: 9px;
} }
...@@ -61,6 +59,10 @@ ...@@ -61,6 +59,10 @@
font-size: 0; font-size: 0;
} }
.ci-status-link {
display: inline-block;
}
.btn-clipboard, .btn-transparent { .btn-clipboard, .btn-transparent {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
......
...@@ -164,7 +164,10 @@ ...@@ -164,7 +164,10 @@
line-height: 0; line-height: 0;
img { img {
border: 1px solid #fff; border: 1px solid #fff;
background: image-url('trans_bg.gif'); background-image: linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5 100%),
linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5 100%);
background-size: 10px 10px;
background-position: 0 0, 5px 5px;
max-width: 100%; max-width: 100%;
} }
&.deleted { &.deleted {
......
...@@ -99,3 +99,33 @@ form.edit-issue { ...@@ -99,3 +99,33 @@ form.edit-issue {
.issue-form .select2-container { .issue-form .select2-container {
width: 250px !important; width: 250px !important;
} }
.issues-footer {
padding-top: $gl-padding;
padding-bottom: 37px;
}
.issue-email-modal-btn {
padding: 0;
color: $gl-link-color;
background-color: transparent;
border: 0;
outline: 0;
&:hover {
text-decoration: underline;
}
}
.email-modal-input-group {
margin-bottom: 10px;
.form-control {
background-color: $white-light;
}
.btn {
background-color: $background-color;
border: 1px solid $border-gray-light;
}
}
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
.btn { .btn {
margin: 4px; margin: 4px;
} }
.table.builds {
min-width: 1200px;
}
} }
.content-list { .content-list {
...@@ -35,7 +39,7 @@ ...@@ -35,7 +39,7 @@
} }
.table.builds { .table.builds {
min-width: 1200px; min-width: 900px;
&.pipeline { &.pipeline {
min-width: 650px; min-width: 650px;
...@@ -128,7 +132,7 @@ ...@@ -128,7 +132,7 @@
.icon-container { .icon-container {
display: inline-block; display: inline-block;
text-align: right; text-align: right;
width: 20px; width: 15px;
.fa { .fa {
position: relative; position: relative;
......
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
.tree_commit { .tree_commit {
max-width: 320px; max-width: 320px;
.str-truncated {
max-width: 100%;
}
} }
.tree_time_ago { .tree_time_ago {
......
...@@ -373,24 +373,4 @@ class ApplicationController < ActionController::Base ...@@ -373,24 +373,4 @@ class ApplicationController < ActionController::Base
def u2f_app_id def u2f_app_id
request.base_url request.base_url
end end
private
def set_default_sort
key = if is_a_listing_page_for?('issues') || is_a_listing_page_for?('merge_requests')
'issuable_sort'
end
cookies[key] = params[:sort] if key && params[:sort].present?
params[:sort] = cookies[key] if key
params[:sort] ||= 'id_desc'
end
def is_a_listing_page_for?(page_type)
controller_name, action_name = params.values_at(:controller, :action)
(controller_name == "projects/#{page_type}" && action_name == 'index') ||
(controller_name == 'groups' && action_name == page_type) ||
(controller_name == 'dashboard' && action_name == page_type)
end
end end
module DiffForPath module DiffForPath
extend ActiveSupport::Concern extend ActiveSupport::Concern
def render_diff_for_path(diffs, diff_refs, project) def render_diff_for_path(diffs)
diff_file = safe_diff_files(diffs, diff_refs: diff_refs, repository: project.repository).find do |diff| diff_file = diffs.diff_files.find do |diff|
diff.old_path == params[:old_path] && diff.new_path == params[:new_path] diff.old_path == params[:old_path] && diff.new_path == params[:new_path]
end end
...@@ -14,7 +14,7 @@ module DiffForPath ...@@ -14,7 +14,7 @@ module DiffForPath
locals = { locals = {
diff_file: diff_file, diff_file: diff_file,
diff_commit: diff_commit, diff_commit: diff_commit,
diff_refs: diff_refs, diff_refs: diffs.diff_refs,
blob: blob, blob: blob,
project: project project: project
} }
......
module IssuableCollections
extend ActiveSupport::Concern
include SortingHelper
included do
helper_method :issues_finder
helper_method :merge_requests_finder
end
private
def issues_collection
issues_finder.execute
end
def merge_requests_collection
merge_requests_finder.execute
end
def issues_finder
@issues_finder ||= issuable_finder_for(IssuesFinder)
end
def merge_requests_finder
@merge_requests_finder ||= issuable_finder_for(MergeRequestsFinder)
end
def issuable_finder_for(finder_class)
finder_class.new(current_user, filter_params)
end
def filter_params
set_sort_order_from_cookie
set_default_scope
set_default_state
@filter_params = params.dup
@filter_params[:sort] ||= default_sort_order
@sort = @filter_params[:sort]
if @project
@filter_params[:project_id] = @project.id
elsif @group
@filter_params[:group_id] = @group.id
else
# TODO: this filter ignore issues/mr created in public or
# internal repos where you are not a member. Enable this filter
# or improve current implementation to filter only issues you
# created or assigned or mentioned
# @filter_params[:authorized_only] = true
end
@filter_params
end
def set_default_scope
params[:scope] = 'all' if params[:scope].blank?
end
def set_default_state
params[:state] = 'opened' if params[:state].blank?
end
def set_sort_order_from_cookie
key = 'issuable_sort'
cookies[key] = params[:sort] if params[:sort].present?
params[:sort] = cookies[key]
end
def default_sort_order
case params[:state]
when 'opened', 'all' then sort_value_recently_created
when 'merged', 'closed' then sort_value_recently_updated
else sort_value_recently_created
end
end
end
module IssuesAction module IssuesAction
extend ActiveSupport::Concern extend ActiveSupport::Concern
include IssuableCollections
def issues def issues
@issues = get_issues_collection.non_archived @label = issues_finder.labels.first
@issues = @issues.page(params[:page])
@issues = @issues.preload(:author, :project)
@label = @issuable_finder.labels.first @issues = issues_collection
.non_archived
.preload(:author, :project)
.page(params[:page])
respond_to do |format| respond_to do |format|
format.html format.html
......
module MergeRequestsAction module MergeRequestsAction
extend ActiveSupport::Concern extend ActiveSupport::Concern
include IssuableCollections
def merge_requests def merge_requests
@merge_requests = get_merge_requests_collection.non_archived @label = merge_requests_finder.labels.first
@merge_requests = @merge_requests.page(params[:page])
@merge_requests = @merge_requests.preload(:author, :target_project)
@label = @issuable_finder.labels.first @merge_requests = merge_requests_collection
.non_archived
.preload(:author, :target_project)
.page(params[:page])
end end
end end
...@@ -6,6 +6,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -6,6 +6,7 @@ class Projects::BranchesController < Projects::ApplicationController
before_action :authorize_push_code!, only: [:new, :create, :destroy] before_action :authorize_push_code!, only: [:new, :create, :destroy]
def index def index
@sort = params[:sort].presence || 'name'
@branches = BranchesFinder.new(@repository, params).execute @branches = BranchesFinder.new(@repository, params).execute
@branches = Kaminari.paginate_array(@branches).page(params[:page]) @branches = Kaminari.paginate_array(@branches).page(params[:page])
......
...@@ -28,7 +28,7 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -28,7 +28,7 @@ class Projects::CommitController < Projects::ApplicationController
end end
def diff_for_path def diff_for_path
render_diff_for_path(@diffs, @commit.diff_refs, @project) render_diff_for_path(@commit.diffs(diff_options))
end end
def builds def builds
......
...@@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
def diff_for_path def diff_for_path
return render_404 unless @compare return render_404 unless @compare
render_diff_for_path(@diffs, @diff_refs, @project) render_diff_for_path(@compare.diffs(diff_options))
end end
def create def create
...@@ -40,18 +40,12 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -40,18 +40,12 @@ class Projects::CompareController < Projects::ApplicationController
@compare = CompareService.new.execute(@project, @head_ref, @project, @start_ref) @compare = CompareService.new.execute(@project, @head_ref, @project, @start_ref)
if @compare if @compare
@commits = Commit.decorate(@compare.commits, @project) @commits = @compare.commits
@start_commit = @compare.start_commit
@start_commit = @project.commit(@start_ref) @commit = @compare.commit
@commit = @project.commit(@head_ref) @base_commit = @compare.base_commit
@base_commit = @project.merge_base_commit(@start_ref, @head_ref)
@diffs = @compare.diffs(diff_options) @diffs = @compare.diffs(diff_options)
@diff_refs = Gitlab::Diff::DiffRefs.new(
base_sha: @base_commit.try(:sha),
start_sha: @start_commit.try(:sha),
head_sha: @commit.try(:sha)
)
@diff_notes_disabled = true @diff_notes_disabled = true
@grouped_diff_discussions = {} @grouped_diff_discussions = {}
......
...@@ -2,8 +2,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -2,8 +2,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
layout 'project' layout 'project'
before_action :authorize_read_environment! before_action :authorize_read_environment!
before_action :authorize_create_environment!, only: [:new, :create] before_action :authorize_create_environment!, only: [:new, :create]
before_action :authorize_update_environment!, only: [:destroy] before_action :authorize_update_environment!, only: [:edit, :update, :destroy]
before_action :environment, only: [:show, :destroy] before_action :environment, only: [:show, :edit, :update, :destroy]
def index def index
@environments = project.environments @environments = project.environments
...@@ -17,13 +17,24 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -17,13 +17,24 @@ class Projects::EnvironmentsController < Projects::ApplicationController
@environment = project.environments.new @environment = project.environments.new
end end
def edit
end
def create def create
@environment = project.environments.create(create_params) @environment = project.environments.create(environment_params)
if @environment.persisted? if @environment.persisted?
redirect_to namespace_project_environment_path(project.namespace, project, @environment) redirect_to namespace_project_environment_path(project.namespace, project, @environment)
else else
render 'new' render :new
end
end
def update
if @environment.update(environment_params)
redirect_to namespace_project_environment_path(project.namespace, project, @environment)
else
render :edit
end end
end end
...@@ -39,8 +50,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -39,8 +50,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
private private
def create_params def environment_params
params.require(:environment).permit(:name) params.require(:environment).permit(:name, :external_url)
end end
def environment def environment
......
...@@ -3,7 +3,9 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -3,7 +3,9 @@ class Projects::IssuesController < Projects::ApplicationController
include ToggleSubscriptionAction include ToggleSubscriptionAction
include IssuableActions include IssuableActions
include ToggleAwardEmoji include ToggleAwardEmoji
include IssuableCollections
before_action :redirect_to_external_issue_tracker, only: [:index, :new]
before_action :module_enabled before_action :module_enabled
before_action :issue, only: [:edit, :update, :show, :referenced_merge_requests, before_action :issue, only: [:edit, :update, :show, :referenced_merge_requests,
:related_branches, :can_create_branch] :related_branches, :can_create_branch]
...@@ -24,7 +26,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -24,7 +26,7 @@ class Projects::IssuesController < Projects::ApplicationController
def index def index
terms = params['issue_search'] terms = params['issue_search']
@issues = get_issues_collection @issues = issues_collection
if terms.present? if terms.present?
if terms =~ /\A#(\d+)\z/ if terms =~ /\A#(\d+)\z/
...@@ -206,6 +208,18 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -206,6 +208,18 @@ class Projects::IssuesController < Projects::ApplicationController
return render_404 unless @project.issues_enabled && @project.default_issues_tracker? return render_404 unless @project.issues_enabled && @project.default_issues_tracker?
end end
def redirect_to_external_issue_tracker
external = @project.external_issue_tracker
return unless external
if action_name == 'new'
redirect_to external.new_issue_path
else
redirect_to external.issues_url
end
end
# Since iids are implemented only in 6.1 # Since iids are implemented only in 6.1
# user may navigate to issue page using old global ids. # user may navigate to issue page using old global ids.
# #
......
...@@ -5,6 +5,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -5,6 +5,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
include IssuableActions include IssuableActions
include NotesHelper include NotesHelper
include ToggleAwardEmoji include ToggleAwardEmoji
include IssuableCollections
before_action :module_enabled before_action :module_enabled
before_action :merge_request, only: [ before_action :merge_request, only: [
...@@ -30,7 +31,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -30,7 +31,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def index def index
terms = params['issue_search'] terms = params['issue_search']
@merge_requests = get_merge_requests_collection @merge_requests = merge_requests_collection
if terms.present? if terms.present?
if terms =~ /\A[#!](\d+)\z/ if terms =~ /\A[#!](\d+)\z/
...@@ -85,7 +86,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -85,7 +86,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html { define_discussion_vars } format.html { define_discussion_vars }
format.json { render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") } } format.json do
@diffs = @merge_request.diffs(diff_options)
render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") }
end
end end
end end
...@@ -103,9 +108,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -103,9 +108,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
define_commit_vars define_commit_vars
diffs = @merge_request.diffs(diff_options)
render_diff_for_path(diffs, @merge_request.diff_refs, @merge_request.project) render_diff_for_path(@merge_request.diffs(diff_options))
end end
def commits def commits
...@@ -153,7 +157,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -153,7 +157,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@commits = @merge_request.compare_commits.reverse @commits = @merge_request.compare_commits.reverse
@commit = @merge_request.diff_head_commit @commit = @merge_request.diff_head_commit
@base_commit = @merge_request.diff_base_commit @base_commit = @merge_request.diff_base_commit
@diffs = @merge_request.compare.diffs(diff_options) if @merge_request.compare @diffs = @merge_request.diffs(diff_options) if @merge_request.compare
@diff_notes_disabled = true @diff_notes_disabled = true
@pipeline = @merge_request.pipeline @pipeline = @merge_request.pipeline
...@@ -417,6 +421,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -417,6 +421,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
fresh. fresh.
discussions discussions
preload_noteable_for_regular_notes(@discussions.flat_map(&:notes))
# This is not executed lazily # This is not executed lazily
@notes = Banzai::NoteRenderer.render( @notes = Banzai::NoteRenderer.render(
@discussions.flat_map(&:notes), @discussions.flat_map(&:notes),
...@@ -447,7 +453,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -447,7 +453,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
} }
@use_legacy_diff_notes = !@merge_request.support_new_diff_notes? @use_legacy_diff_notes = !@merge_request.support_new_diff_notes?
@grouped_diff_discussions = @merge_request.notes.grouped_diff_discussions @grouped_diff_discussions = @merge_request.notes.inc_author_project_award_emoji.grouped_diff_discussions
Banzai::NoteRenderer.render( Banzai::NoteRenderer.render(
@grouped_diff_discussions.values.flat_map(&:notes), @grouped_diff_discussions.values.flat_map(&:notes),
......
...@@ -98,7 +98,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -98,7 +98,7 @@ class ProjectsController < Projects::ApplicationController
end end
if @project.pending_delete? if @project.pending_delete?
flash[:alert] = "Project queued for delete." flash[:alert] = "Project #{@project.name} queued for deletion."
end end
respond_to do |format| respond_to do |format|
......
...@@ -110,7 +110,7 @@ class IssuableFinder ...@@ -110,7 +110,7 @@ class IssuableFinder
scope.where(title: params[:milestone_title]) scope.where(title: params[:milestone_title])
else else
nil Milestone.none
end end
end end
......
...@@ -248,7 +248,6 @@ module ApplicationHelper ...@@ -248,7 +248,6 @@ module ApplicationHelper
milestone_title: params[:milestone_title], milestone_title: params[:milestone_title],
assignee_id: params[:assignee_id], assignee_id: params[:assignee_id],
author_id: params[:author_id], author_id: params[:author_id],
sort: params[:sort],
issue_search: params[:issue_search], issue_search: params[:issue_search],
label_name: params[:label_name] label_name: params[:label_name]
} }
......
...@@ -13,7 +13,7 @@ module BlobHelper ...@@ -13,7 +13,7 @@ module BlobHelper
blob = project.repository.blob_at(ref, path) rescue nil blob = project.repository.blob_at(ref, path) rescue nil
return unless blob && blob_text_viewable?(blob) return unless blob
from_mr = options[:from_merge_request_id] from_mr = options[:from_merge_request_id]
link_opts = {} link_opts = {}
......
...@@ -206,10 +206,10 @@ module CommitsHelper ...@@ -206,10 +206,10 @@ module CommitsHelper
end end
end end
def view_file_btn(commit_sha, diff, project) def view_file_btn(commit_sha, diff_new_path, project)
link_to( link_to(
namespace_project_blob_path(project.namespace, project, namespace_project_blob_path(project.namespace, project,
tree_join(commit_sha, diff.new_path)), tree_join(commit_sha, diff_new_path)),
class: 'btn view-file js-view-file btn-file-option' class: 'btn view-file js-view-file btn-file-option'
) do ) do
raw('View file @') + content_tag(:span, commit_sha[0..6], raw('View file @') + content_tag(:span, commit_sha[0..6],
......
...@@ -30,11 +30,7 @@ module DiffHelper ...@@ -30,11 +30,7 @@ module DiffHelper
options[:paths] = params.values_at(:old_path, :new_path) options[:paths] = params.values_at(:old_path, :new_path)
end end
Commit.max_diff_options.merge(options) options
end
def safe_diff_files(diffs, diff_refs: nil, repository: nil)
diffs.decorate! { |diff| Gitlab::Diff::File.new(diff, diff_refs: diff_refs, repository: repository) }
end end
def unfold_bottom_class(bottom) def unfold_bottom_class(bottom)
......
...@@ -13,38 +13,6 @@ module IssuesHelper ...@@ -13,38 +13,6 @@ module IssuesHelper
OpenStruct.new(id: 0, title: 'None (backlog)', name: 'Unassigned') OpenStruct.new(id: 0, title: 'None (backlog)', name: 'Unassigned')
end end
def url_for_project_issues(project = @project, options = {})
return '' if project.nil?
url =
if options[:only_path]
project.issues_tracker.project_path
else
project.issues_tracker.project_url
end
# Ensure we return a valid URL to prevent possible XSS.
URI.parse(url).to_s
rescue URI::InvalidURIError
''
end
def url_for_new_issue(project = @project, options = {})
return '' if project.nil?
url =
if options[:only_path]
project.issues_tracker.new_issue_path
else
project.issues_tracker.new_issue_url
end
# Ensure we return a valid URL to prevent possible XSS.
URI.parse(url).to_s
rescue URI::InvalidURIError
''
end
def url_for_issue(issue_iid, project = @project, options = {}) def url_for_issue(issue_iid, project = @project, options = {})
return '' if project.nil? return '' if project.nil?
......
...@@ -92,6 +92,10 @@ module NotesHelper ...@@ -92,6 +92,10 @@ module NotesHelper
project.team.max_member_access_for_user_ids(user_ids) project.team.max_member_access_for_user_ids(user_ids)
end end
def preload_noteable_for_regular_notes(notes)
ActiveRecord::Associations::Preloader.new.preload(notes.select { |note| !note.for_commit? }, :noteable)
end
def note_max_access_for_user(note) def note_max_access_for_user(note)
note.project.team.human_max_access(note.author_id) note.project.team.human_max_access(note.author_id)
end end
......
...@@ -272,6 +272,10 @@ module ProjectsHelper ...@@ -272,6 +272,10 @@ module ProjectsHelper
filename_path(project, :version) filename_path(project, :version)
end end
def ci_configuration_path(project)
filename_path(project, :gitlab_ci_yml)
end
def project_wiki_path_with_version(proj, page, version, is_newest) def project_wiki_path_with_version(proj, page, version, is_newest)
url_params = is_newest ? {} : { version_id: version } url_params = is_newest ? {} : { version_id: version }
namespace_project_wiki_path(proj.namespace, proj, page, url_params) namespace_project_wiki_path(proj.namespace, proj, page, url_params)
......
...@@ -112,11 +112,11 @@ module SortingHelper ...@@ -112,11 +112,11 @@ module SortingHelper
end end
def sort_value_oldest_created def sort_value_oldest_created
'id_asc' 'created_asc'
end end
def sort_value_recently_created def sort_value_recently_created
'id_desc' 'created_desc'
end end
def sort_value_milestone_soon def sort_value_milestone_soon
......
...@@ -61,6 +61,16 @@ class Ability ...@@ -61,6 +61,16 @@ class Ability
end end
end end
# Returns an Array of Issues that can be read by the given user.
#
# issues - The issues to reduce down to those readable by the user.
# user - The User for which to check the issues
def issues_readable_by_user(issues, user = nil)
return issues if user && user.admin?
issues.select { |issue| issue.visible_to_user?(user) }
end
# List of possible abilities for anonymous user # List of possible abilities for anonymous user
def anonymous_abilities(user, subject) def anonymous_abilities(user, subject)
if subject.is_a?(PersonalSnippet) if subject.is_a?(PersonalSnippet)
......
...@@ -13,6 +13,7 @@ module Ci ...@@ -13,6 +13,7 @@ module Ci
scope :unstarted, ->() { where(runner_id: nil) } scope :unstarted, ->() { where(runner_id: nil) }
scope :ignore_failures, ->() { where(allow_failure: false) } scope :ignore_failures, ->() { where(allow_failure: false) }
scope :with_artifacts, ->() { where.not(artifacts_file: [nil, '']) } scope :with_artifacts, ->() { where.not(artifacts_file: [nil, '']) }
scope :with_artifacts_not_expired, ->() { with_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) }
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) }
scope :manual_actions, ->() { where(when: :manual) } scope :manual_actions, ->() { where(when: :manual) }
...@@ -331,7 +332,7 @@ module Ci ...@@ -331,7 +332,7 @@ module Ci
end end
def valid_token?(token) def valid_token?(token)
project.valid_runners_token? token project.valid_runners_token?(token)
end end
def has_tags? def has_tags?
......
...@@ -104,7 +104,7 @@ class Commit ...@@ -104,7 +104,7 @@ class Commit
end end
def diff_line_count def diff_line_count
@diff_line_count ||= Commit::diff_line_count(self.diffs) @diff_line_count ||= Commit::diff_line_count(raw_diffs)
@diff_line_count @diff_line_count
end end
...@@ -123,15 +123,17 @@ class Commit ...@@ -123,15 +123,17 @@ class Commit
# In case this first line is longer than 100 characters, it is cut off # In case this first line is longer than 100 characters, it is cut off
# after 80 characters and ellipses (`&hellp;`) are appended. # after 80 characters and ellipses (`&hellp;`) are appended.
def title def title
title = safe_message full_title.length > 100 ? full_title[0..79] << "…" : full_title
end
return no_commit_message if title.blank? # Returns the full commits title
def full_title
return @full_title if @full_title
title_end = title.index("\n") if safe_message.blank?
if (!title_end && title.length > 100) || (title_end && title_end > 100) @full_title = no_commit_message
title[0..79] << "…"
else else
title.split("\n", 2).first @full_title = safe_message.split("\n", 2).first
end end
end end
...@@ -178,7 +180,18 @@ class Commit ...@@ -178,7 +180,18 @@ class Commit
end end
def author def author
@author ||= User.find_by_any_email(author_email.downcase) if RequestStore.active?
key = "commit_author:#{author_email.downcase}"
# nil is a valid value since no author may exist in the system
if RequestStore.store.has_key?(key)
@author = RequestStore.store[key]
else
@author = find_author_by_any_email
RequestStore.store[key] = @author
end
else
@author ||= find_author_by_any_email
end
end end
def committer def committer
...@@ -304,12 +317,24 @@ class Commit ...@@ -304,12 +317,24 @@ class Commit
nil nil
end end
def raw_diffs(*args)
raw.diffs(*args)
end
def diffs(diff_options = nil)
Gitlab::Diff::FileCollection::Commit.new(self, diff_options: diff_options)
end
private private
def find_author_by_any_email
User.find_by_any_email(author_email.downcase)
end
def repo_changes def repo_changes
changes = { added: [], modified: [], removed: [] } changes = { added: [], modified: [], removed: [] }
diffs.each do |diff| raw_diffs(deltas_only: true).each do |diff|
if diff.deleted_file if diff.deleted_file
changes[:removed] << diff.old_path changes[:removed] << diff.old_path
elsif diff.renamed_file || diff.new_file elsif diff.renamed_file || diff.new_file
......
class Compare
delegate :same, :head, :base, to: :@compare
attr_reader :project
def self.decorate(compare, project)
if compare.is_a?(Compare)
compare
else
self.new(compare, project)
end
end
def initialize(compare, project)
@compare = compare
@project = project
end
def commits
@commits ||= Commit.decorate(@compare.commits, project)
end
def start_commit
return @start_commit if defined?(@start_commit)
commit = @compare.base
@start_commit = commit ? ::Commit.new(commit, project) : nil
end
def head_commit
return @head_commit if defined?(@head_commit)
commit = @compare.head
@head_commit = commit ? ::Commit.new(commit, project) : nil
end
alias_method :commit, :head_commit
def base_commit
return @base_commit if defined?(@base_commit)
@base_commit = if start_commit && head_commit
project.merge_base_commit(start_commit.id, head_commit.id)
else
nil
end
end
def raw_diffs(*args)
@compare.diffs(*args)
end
def diffs(diff_options = nil)
Gitlab::Diff::FileCollection::Compare.new(self,
project: project,
diff_options: diff_options,
diff_refs: diff_refs)
end
def diff_refs
Gitlab::Diff::DiffRefs.new(
base_sha: base_commit.try(:sha),
start_sha: start_commit.try(:sha),
head_sha: commit.try(:sha)
)
end
end
...@@ -17,7 +17,7 @@ module Issuable ...@@ -17,7 +17,7 @@ module Issuable
belongs_to :assignee, class_name: "User" belongs_to :assignee, class_name: "User"
belongs_to :updated_by, class_name: "User" belongs_to :updated_by, class_name: "User"
belongs_to :milestone belongs_to :milestone
has_many :notes, as: :noteable, dependent: :destroy do has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :destroy do
def authors_loaded? def authors_loaded?
# We check first if we're loaded to not load unnecessarily. # We check first if we're loaded to not load unnecessarily.
loaded? && to_a.all? { |note| note.association(:author).loaded? } loaded? && to_a.all? { |note| note.association(:author).loaded? }
......
...@@ -67,7 +67,7 @@ class DiffNote < Note ...@@ -67,7 +67,7 @@ class DiffNote < Note
return false unless supported? return false unless supported?
return true if for_commit? return true if for_commit?
diff_refs ||= self.noteable.diff_refs diff_refs ||= noteable_diff_refs
self.position.diff_refs == diff_refs self.position.diff_refs == diff_refs
end end
...@@ -78,6 +78,14 @@ class DiffNote < Note ...@@ -78,6 +78,14 @@ class DiffNote < Note
!self.for_merge_request? || self.noteable.support_new_diff_notes? !self.for_merge_request? || self.noteable.support_new_diff_notes?
end end
def noteable_diff_refs
if noteable.respond_to?(:diff_sha_refs)
noteable.diff_sha_refs
else
noteable.diff_refs
end
end
def set_original_position def set_original_position
self.original_position = self.position.dup self.original_position = self.position.dup
end end
...@@ -96,7 +104,7 @@ class DiffNote < Note ...@@ -96,7 +104,7 @@ class DiffNote < Note
self.project, self.project,
nil, nil,
old_diff_refs: self.position.diff_refs, old_diff_refs: self.position.diff_refs,
new_diff_refs: self.noteable.diff_refs, new_diff_refs: noteable_diff_refs,
paths: self.position.paths paths: self.position.paths
).execute(self) ).execute(self)
end end
......
...@@ -49,6 +49,12 @@ class Discussion ...@@ -49,6 +49,12 @@ class Discussion
self.noteable == target && !diff_discussion? self.noteable == target && !diff_discussion?
end end
def active?
return @active if defined?(@active)
@active = first_note.active?
end
def expanded? def expanded?
!diff_discussion? || active? !diff_discussion? || active?
end end
......
...@@ -3,6 +3,8 @@ class Environment < ActiveRecord::Base ...@@ -3,6 +3,8 @@ class Environment < ActiveRecord::Base
has_many :deployments has_many :deployments
before_validation :nullify_external_url
validates :name, validates :name,
presence: true, presence: true,
uniqueness: { scope: :project_id }, uniqueness: { scope: :project_id },
...@@ -10,7 +12,17 @@ class Environment < ActiveRecord::Base ...@@ -10,7 +12,17 @@ class Environment < ActiveRecord::Base
format: { with: Gitlab::Regex.environment_name_regex, format: { with: Gitlab::Regex.environment_name_regex,
message: Gitlab::Regex.environment_name_regex_message } message: Gitlab::Regex.environment_name_regex_message }
validates :external_url,
uniqueness: { scope: :project_id },
length: { maximum: 255 },
allow_nil: true,
addressable_url: true
def last_deployment def last_deployment
deployments.last deployments.last
end end
def nullify_external_url
self.external_url = nil if self.external_url.blank?
end
end end
...@@ -244,6 +244,34 @@ class Issue < ActiveRecord::Base ...@@ -244,6 +244,34 @@ class Issue < ActiveRecord::Base
self.closed_by_merge_requests(current_user).empty? self.closed_by_merge_requests(current_user).empty?
end end
# Returns `true` if the current issue can be viewed by either a logged in User
# or an anonymous user.
def visible_to_user?(user = nil)
user ? readable_by?(user) : publicly_visible?
end
# Returns `true` if the given User can read the current Issue.
def readable_by?(user)
if user.admin?
true
elsif project.owner == user
true
elsif confidential?
author == user ||
assignee == user ||
project.team.member?(user, Gitlab::Access::REPORTER)
else
project.public? ||
project.internal? && !user.external? ||
project.team.member?(user)
end
end
# Returns `true` if this Issue is visible to everybody.
def publicly_visible?
project.public? && !confidential?
end
def overdue? def overdue?
due_date.try(:past?) || false due_date.try(:past?) || false
end end
......
...@@ -28,8 +28,9 @@ class Key < ActiveRecord::Base ...@@ -28,8 +28,9 @@ class Key < ActiveRecord::Base
end end
def publishable_key def publishable_key
# Removes anything beyond the keytype and key itself # Strip out the keys comment so we don't leak email addresses
self.key.split[0..1].join(' ') # Replace with simple ident of user_name (hostname)
self.key.split[0..1].push("#{self.user_name} (#{Gitlab.config.gitlab.host})").join(' ')
end end
# projects that has this key # projects that has this key
......
class LabelLink < ActiveRecord::Base class LabelLink < ActiveRecord::Base
include Importable
belongs_to :target, polymorphic: true belongs_to :target, polymorphic: true
belongs_to :label belongs_to :label
validates :target, presence: true validates :target, presence: true, unless: :importing?
validates :label, presence: true validates :label, presence: true, unless: :importing?
end end
...@@ -25,6 +25,14 @@ class LegacyDiffNote < Note ...@@ -25,6 +25,14 @@ class LegacyDiffNote < Note
@discussion_id ||= self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code) @discussion_id ||= self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code)
end end
def project_repository
if RequestStore.active?
RequestStore.fetch("project:#{project_id}:repository") { self.project.repository }
else
self.project.repository
end
end
def diff_file_hash def diff_file_hash
line_code.split('_')[0] if line_code line_code.split('_')[0] if line_code
end end
...@@ -34,7 +42,7 @@ class LegacyDiffNote < Note ...@@ -34,7 +42,7 @@ class LegacyDiffNote < Note
end end
def diff_file def diff_file
@diff_file ||= Gitlab::Diff::File.new(diff, repository: self.project.repository) if diff @diff_file ||= Gitlab::Diff::File.new(diff, repository: project_repository) if diff
end end
def diff_line def diff_line
...@@ -77,7 +85,7 @@ class LegacyDiffNote < Note ...@@ -77,7 +85,7 @@ class LegacyDiffNote < Note
return nil unless noteable return nil unless noteable
return @diff if defined?(@diff) return @diff if defined?(@diff)
@diff = noteable.diffs(Commit.max_diff_options).find do |d| @diff = noteable.raw_diffs(Commit.max_diff_options).find do |d|
d.new_path && Digest::SHA1.hexdigest(d.new_path) == diff_file_hash d.new_path && Digest::SHA1.hexdigest(d.new_path) == diff_file_hash
end end
end end
...@@ -108,7 +116,7 @@ class LegacyDiffNote < Note ...@@ -108,7 +116,7 @@ class LegacyDiffNote < Note
# Find the diff on noteable that matches our own # Find the diff on noteable that matches our own
def find_noteable_diff def find_noteable_diff
diffs = noteable.diffs(Commit.max_diff_options) diffs = noteable.raw_diffs(Commit.max_diff_options)
diffs.find { |d| d.new_path == self.diff.new_path } diffs.find { |d| d.new_path == self.diff.new_path }
end end
end end
...@@ -169,8 +169,16 @@ class MergeRequest < ActiveRecord::Base ...@@ -169,8 +169,16 @@ class MergeRequest < ActiveRecord::Base
merge_request_diff ? merge_request_diff.first_commit : compare_commits.first merge_request_diff ? merge_request_diff.first_commit : compare_commits.first
end end
def diffs(*args) def raw_diffs(*args)
merge_request_diff ? merge_request_diff.diffs(*args) : compare.diffs(*args) merge_request_diff ? merge_request_diff.raw_diffs(*args) : compare.raw_diffs(*args)
end
def diffs(diff_options = nil)
if self.compare
self.compare.diffs(diff_options)
else
Gitlab::Diff::FileCollection::MergeRequest.new(self, diff_options: diff_options)
end
end end
def diff_size def diff_size
...@@ -243,11 +251,11 @@ class MergeRequest < ActiveRecord::Base ...@@ -243,11 +251,11 @@ class MergeRequest < ActiveRecord::Base
end end
def target_branch_sha def target_branch_sha
target_branch_head.try(:sha) @target_branch_sha || target_branch_head.try(:sha)
end end
def source_branch_sha def source_branch_sha
source_branch_head.try(:sha) @source_branch_sha || source_branch_head.try(:sha)
end end
def diff_refs def diff_refs
...@@ -260,6 +268,19 @@ class MergeRequest < ActiveRecord::Base ...@@ -260,6 +268,19 @@ class MergeRequest < ActiveRecord::Base
) )
end end
# Return diff_refs instance trying to not touch the git repository
def diff_sha_refs
if merge_request_diff && merge_request_diff.diff_refs_by_sha?
return Gitlab::Diff::DiffRefs.new(
base_sha: merge_request_diff.base_commit_sha,
start_sha: merge_request_diff.start_commit_sha,
head_sha: merge_request_diff.head_commit_sha
)
else
diff_refs
end
end
def validate_branches def validate_branches
if target_project == source_project && target_branch == source_branch if target_project == source_project && target_branch == source_branch
errors.add :branch_conflict, "You can not use same project/branch for source and target" errors.add :branch_conflict, "You can not use same project/branch for source and target"
...@@ -321,6 +342,8 @@ class MergeRequest < ActiveRecord::Base ...@@ -321,6 +342,8 @@ class MergeRequest < ActiveRecord::Base
merge_request_diff.reload_content merge_request_diff.reload_content
MergeRequests::MergeRequestDiffCacheService.new.execute(self)
new_diff_refs = self.diff_refs new_diff_refs = self.diff_refs
update_diff_notes_positions( update_diff_notes_positions(
...@@ -786,7 +809,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -786,7 +809,7 @@ class MergeRequest < ActiveRecord::Base
end end
def support_new_diff_notes? def support_new_diff_notes?
diff_refs && diff_refs.complete? diff_sha_refs && diff_sha_refs.complete?
end end
def update_diff_notes_positions(old_diff_refs:, new_diff_refs:) def update_diff_notes_positions(old_diff_refs:, new_diff_refs:)
......
...@@ -33,12 +33,12 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -33,12 +33,12 @@ class MergeRequestDiff < ActiveRecord::Base
end end
def size def size
real_size.presence || diffs.size real_size.presence || raw_diffs.size
end end
def diffs(options={}) def raw_diffs(options={})
if options[:ignore_whitespace_change] if options[:ignore_whitespace_change]
@diffs_no_whitespace ||= begin @raw_diffs_no_whitespace ||= begin
compare = Gitlab::Git::Compare.new( compare = Gitlab::Git::Compare.new(
repository.raw_repository, repository.raw_repository,
self.start_commit_sha || self.target_branch_sha, self.start_commit_sha || self.target_branch_sha,
...@@ -47,8 +47,8 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -47,8 +47,8 @@ class MergeRequestDiff < ActiveRecord::Base
compare.diffs(options) compare.diffs(options)
end end
else else
@diffs ||= {} @raw_diffs ||= {}
@diffs[options] ||= load_diffs(st_diffs, options) @raw_diffs[options] ||= load_diffs(st_diffs, options)
end end
end end
...@@ -82,6 +82,10 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -82,6 +82,10 @@ class MergeRequestDiff < ActiveRecord::Base
project.commit(self.head_commit_sha) project.commit(self.head_commit_sha)
end end
def diff_refs_by_sha?
base_commit_sha? && head_commit_sha? && start_commit_sha?
end
def compare def compare
@compare ||= @compare ||=
begin begin
......
...@@ -697,6 +697,13 @@ class Project < ActiveRecord::Base ...@@ -697,6 +697,13 @@ class Project < ActiveRecord::Base
web_url.split('://')[1] web_url.split('://')[1]
end end
def new_issue_address(author)
if Gitlab::IncomingEmail.enabled? && author
Gitlab::IncomingEmail.reply_address(
"#{path_with_namespace}+#{author.authentication_token}")
end
end
def build_commit_note(commit) def build_commit_note(commit)
notes.new(commit_id: commit.id, noteable_type: 'Commit') notes.new(commit_id: commit.id, noteable_type: 'Commit')
end end
...@@ -1283,7 +1290,10 @@ class Project < ActiveRecord::Base ...@@ -1283,7 +1290,10 @@ class Project < ActiveRecord::Base
def schedule_delete!(user_id, params) def schedule_delete!(user_id, params)
# Queue this task for after the commit, so once we mark pending_delete it will run # Queue this task for after the commit, so once we mark pending_delete it will run
run_after_commit { ProjectDestroyWorker.perform_async(id, user_id, params) } run_after_commit do
job_id = ProjectDestroyWorker.perform_async(id, user_id, params)
Rails.logger.info("User #{user_id} scheduled destruction of project #{path_with_namespace} with job ID #{job_id}")
end
update_attribute(:pending_delete, true) update_attribute(:pending_delete, true)
end end
...@@ -1470,6 +1480,16 @@ class Project < ActiveRecord::Base ...@@ -1470,6 +1480,16 @@ class Project < ActiveRecord::Base
authorized_for_user_by_shared_projects?(user, min_access_level) authorized_for_user_by_shared_projects?(user, min_access_level)
end end
def append_or_update_attribute(name, value)
old_values = public_send(name.to_s)
if Project.reflect_on_association(name).try(:macro) == :has_many && old_values.any?
update_attribute(name, old_values + value)
else
update_attribute(name, value)
end
end
private private
def authorized_for_user_by_group?(user, min_access_level) def authorized_for_user_by_group?(user, min_access_level)
......
...@@ -140,8 +140,13 @@ class ProjectTeam ...@@ -140,8 +140,13 @@ class ProjectTeam
def max_member_access_for_user_ids(user_ids) def max_member_access_for_user_ids(user_ids)
user_ids = user_ids.uniq user_ids = user_ids.uniq
key = "max_member_access:#{project.id}" key = "max_member_access:#{project.id}"
RequestStore.store[key] ||= {}
access = RequestStore.store[key] access = {}
if RequestStore.active?
RequestStore.store[key] ||= {}
access = RequestStore.store[key]
end
# Lookup only the IDs we need # Lookup only the IDs we need
user_ids = user_ids - access.keys user_ids = user_ids - access.keys
......
...@@ -81,7 +81,12 @@ class Repository ...@@ -81,7 +81,12 @@ class Repository
def commit(ref = 'HEAD') def commit(ref = 'HEAD')
return nil unless exists? return nil unless exists?
commit = Gitlab::Git::Commit.find(raw_repository, ref) commit =
if ref.is_a?(Gitlab::Git::Commit)
ref
else
Gitlab::Git::Commit.find(raw_repository, ref)
end
commit = ::Commit.new(commit, @project) if commit commit = ::Commit.new(commit, @project) if commit
commit commit
rescue Rugged::OdbError rescue Rugged::OdbError
...@@ -179,7 +184,7 @@ class Repository ...@@ -179,7 +184,7 @@ class Repository
before_remove_branch before_remove_branch
branch = find_branch(branch_name) branch = find_branch(branch_name)
oldrev = branch.try(:target) oldrev = branch.try(:target).try(:id)
newrev = Gitlab::Git::BLANK_SHA newrev = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name
...@@ -236,7 +241,9 @@ class Repository ...@@ -236,7 +241,9 @@ class Repository
def remote_tags(remote) def remote_tags(remote)
gitlab_shell.list_remote_tags(storage_path, path_with_namespace, remote).map do |name, target| gitlab_shell.list_remote_tags(storage_path, path_with_namespace, remote).map do |name, target|
Gitlab::Git::Tag.new(name, target) # Is the tag annotated or lightweight?
object = target.is_a?(Rugged::Tag::Annotation) ? target : nil
Gitlab::Git::Tag.new(raw_repository, object, name, target)
end end
end end
...@@ -322,10 +329,10 @@ class Repository ...@@ -322,10 +329,10 @@ class Repository
# Rugged seems to throw a `ReferenceError` when given branch_names rather # Rugged seems to throw a `ReferenceError` when given branch_names rather
# than SHA-1 hashes # than SHA-1 hashes
number_commits_behind = raw_repository. number_commits_behind = raw_repository.
count_commits_between(branch.target, root_ref_hash) count_commits_between(branch.target.sha, root_ref_hash)
number_commits_ahead = raw_repository. number_commits_ahead = raw_repository.
count_commits_between(root_ref_hash, branch.target) count_commits_between(root_ref_hash, branch.target.sha)
{ behind: number_commits_behind, ahead: number_commits_ahead } { behind: number_commits_behind, ahead: number_commits_ahead }
end end
...@@ -430,7 +437,7 @@ class Repository ...@@ -430,7 +437,7 @@ class Repository
# We don't want to flush the cache if the commit didn't actually make any # We don't want to flush the cache if the commit didn't actually make any
# changes to any of the possible avatar files. # changes to any of the possible avatar files.
if revision && commit = self.commit(revision) if revision && commit = self.commit(revision)
return unless commit.diffs. return unless commit.raw_diffs(deltas_only: true).
any? { |diff| AVATAR_FILES.include?(diff.new_path) } any? { |diff| AVATAR_FILES.include?(diff.new_path) }
end end
...@@ -678,11 +685,11 @@ class Repository ...@@ -678,11 +685,11 @@ class Repository
case value case value
when 'name' when 'name'
branches.sort_by(&:name) branches.sort_by(&:name)
when 'recently_updated' when 'updated_desc'
branches.sort do |a, b| branches.sort do |a, b|
commit(b.target).committed_date <=> commit(a.target).committed_date commit(b.target).committed_date <=> commit(a.target).committed_date
end end
when 'last_updated' when 'updated_asc'
branches.sort do |a, b| branches.sort do |a, b|
commit(a.target).committed_date <=> commit(b.target).committed_date commit(a.target).committed_date <=> commit(b.target).committed_date
end end
...@@ -751,9 +758,7 @@ class Repository ...@@ -751,9 +758,7 @@ class Repository
end end
def local_branches def local_branches
@local_branches ||= rugged.branches.each(:local).map do |branch| @local_branches ||= raw_repository.local_branches
Gitlab::Git::Branch.new(branch.name, branch.target)
end
end end
alias_method :branches, :local_branches alias_method :branches, :local_branches
...@@ -765,7 +770,7 @@ class Repository ...@@ -765,7 +770,7 @@ class Repository
name = ref.name.sub(/\Arefs\/remotes\/#{remote_name}\//, '') name = ref.name.sub(/\Arefs\/remotes\/#{remote_name}\//, '')
begin begin
branches << Gitlab::Git::Branch.new(name, ref.target) branches << Gitlab::Git::Branch.new(raw_repository, name, ref.target)
rescue Rugged::ReferenceError rescue Rugged::ReferenceError
# Omit invalid branch # Omit invalid branch
end end
...@@ -887,16 +892,19 @@ class Repository ...@@ -887,16 +892,19 @@ class Repository
end end
end end
def ff_merge(user, source_sha, target_branch, options = {}) def ff_merge(user, source, target_branch, options = {})
our_commit = rugged.branches[target_branch].target our_commit = rugged.branches[target_branch].target
their_commit = rugged.lookup(source_sha) their_commit =
if source.is_a?(Gitlab::Git::Commit)
source.raw_commit
else
rugged.lookup(source)
end
raise "Invalid merge target" if our_commit.nil? raise "Invalid merge target" if our_commit.nil?
raise "Invalid merge source" if their_commit.nil? raise "Invalid merge source" if their_commit.nil?
commit_with_hooks(user, target_branch) do commit_with_hooks(user, target_branch) { their_commit.oid }
source_sha
end
end end
def merge(user, merge_request, options = {}) def merge(user, merge_request, options = {})
...@@ -922,7 +930,7 @@ class Repository ...@@ -922,7 +930,7 @@ class Repository
end end
def revert(user, commit, base_branch, revert_tree_id = nil) def revert(user, commit, base_branch, revert_tree_id = nil)
source_sha = find_branch(base_branch).target source_sha = find_branch(base_branch).target.sha
revert_tree_id ||= check_revert_content(commit, base_branch) revert_tree_id ||= check_revert_content(commit, base_branch)
return false unless revert_tree_id return false unless revert_tree_id
...@@ -939,7 +947,7 @@ class Repository ...@@ -939,7 +947,7 @@ class Repository
end end
def cherry_pick(user, commit, base_branch, cherry_pick_tree_id = nil) def cherry_pick(user, commit, base_branch, cherry_pick_tree_id = nil)
source_sha = find_branch(base_branch).target source_sha = find_branch(base_branch).target.sha
cherry_pick_tree_id ||= check_cherry_pick_content(commit, base_branch) cherry_pick_tree_id ||= check_cherry_pick_content(commit, base_branch)
return false unless cherry_pick_tree_id return false unless cherry_pick_tree_id
...@@ -960,7 +968,7 @@ class Repository ...@@ -960,7 +968,7 @@ class Repository
end end
def check_revert_content(commit, base_branch) def check_revert_content(commit, base_branch)
source_sha = find_branch(base_branch).target source_sha = find_branch(base_branch).target.sha
args = [commit.id, source_sha] args = [commit.id, source_sha]
args << { mainline: 1 } if commit.merge_commit? args << { mainline: 1 } if commit.merge_commit?
...@@ -974,7 +982,7 @@ class Repository ...@@ -974,7 +982,7 @@ class Repository
end end
def check_cherry_pick_content(commit, base_branch) def check_cherry_pick_content(commit, base_branch)
source_sha = find_branch(base_branch).target source_sha = find_branch(base_branch).target.sha
args = [commit.id, source_sha] args = [commit.id, source_sha]
args << 1 if commit.merge_commit? args << 1 if commit.merge_commit?
...@@ -1164,7 +1172,7 @@ class Repository ...@@ -1164,7 +1172,7 @@ class Repository
was_empty = empty? was_empty = empty?
if !was_empty && target_branch if !was_empty && target_branch
oldrev = target_branch.target oldrev = target_branch.target.id
end end
# Make commit # Make commit
...@@ -1184,7 +1192,7 @@ class Repository ...@@ -1184,7 +1192,7 @@ class Repository
after_create_branch after_create_branch
else else
# Update head # Update head
current_head = find_branch(branch).target current_head = find_branch(branch).target.id
# Make sure target branch was not changed during pre-receive hook # Make sure target branch was not changed during pre-receive hook
if current_head == oldrev if current_head == oldrev
...@@ -1248,7 +1256,7 @@ class Repository ...@@ -1248,7 +1256,7 @@ class Repository
end end
def tags_sorted_by_committed_date def tags_sorted_by_committed_date
tags.sort_by { |tag| commit(tag.target).committed_date } tags.sort_by { |tag| tag.target.committed_date }
end end
def keep_around_ref_name(sha) def keep_around_ref_name(sha)
......
...@@ -20,10 +20,12 @@ class CompareService ...@@ -20,10 +20,12 @@ class CompareService
) )
end end
Gitlab::Git::Compare.new( raw_compare = Gitlab::Git::Compare.new(
target_project.repository.raw_repository, target_project.repository.raw_repository,
target_branch, target_branch,
source_sha, source_sha
) )
Compare.new(raw_compare, target_project)
end end
end end
...@@ -40,6 +40,6 @@ class DeleteBranchService < BaseService ...@@ -40,6 +40,6 @@ class DeleteBranchService < BaseService
def build_push_data(branch) def build_push_data(branch)
Gitlab::PushDataBuilder Gitlab::PushDataBuilder
.build(project, current_user, branch.target, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}", []) .build(project, current_user, branch.target.sha, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::BRANCH_REF_PREFIX}#{branch.name}", [])
end end
end end
...@@ -34,6 +34,6 @@ class DeleteTagService < BaseService ...@@ -34,6 +34,6 @@ class DeleteTagService < BaseService
def build_push_data(tag) def build_push_data(tag)
Gitlab::PushDataBuilder Gitlab::PushDataBuilder
.build(project, current_user, tag.target, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", []) .build(project, current_user, tag.target.sha, Gitlab::Git::BLANK_SHA, "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", [])
end end
end end
...@@ -31,8 +31,8 @@ class GitTagPushService < BaseService ...@@ -31,8 +31,8 @@ class GitTagPushService < BaseService
unless Gitlab::Git.blank_ref?(params[:newrev]) unless Gitlab::Git.blank_ref?(params[:newrev])
tag_name = Gitlab::Git.ref_name(params[:ref]) tag_name = Gitlab::Git.ref_name(params[:ref])
tag = project.repository.find_tag(tag_name) tag = project.repository.find_tag(tag_name)
if tag && tag.target == params[:newrev] if tag && tag.object_sha == params[:newrev]
commit = project.commit(tag.target) commit = project.commit(tag.target)
commits = [commit].compact commits = [commit].compact
message = tag.message message = tag.message
......
...@@ -17,16 +17,19 @@ module MergeRequests ...@@ -17,16 +17,19 @@ module MergeRequests
end end
end end
def hook_data(merge_request, action) def hook_data(merge_request, action, oldrev = nil)
hook_data = merge_request.to_hook_data(current_user) hook_data = merge_request.to_hook_data(current_user)
hook_data[:object_attributes][:url] = Gitlab::UrlBuilder.build(merge_request) hook_data[:object_attributes][:url] = Gitlab::UrlBuilder.build(merge_request)
hook_data[:object_attributes][:action] = action hook_data[:object_attributes][:action] = action
if oldrev && !Gitlab::Git.blank_ref?(oldrev)
hook_data[:object_attributes][:oldrev] = oldrev
end
hook_data hook_data
end end
def execute_hooks(merge_request, action = 'open') def execute_hooks(merge_request, action = 'open', oldrev = nil)
if merge_request.project if merge_request.project
merge_data = hook_data(merge_request, action) merge_data = hook_data(merge_request, action, oldrev)
merge_request.project.execute_hooks(merge_data, :merge_request_hooks) merge_request.project.execute_hooks(merge_data, :merge_request_hooks)
merge_request.project.execute_services(merge_data, :merge_request_hooks) merge_request.project.execute_services(merge_data, :merge_request_hooks)
end end
......
...@@ -34,7 +34,7 @@ module MergeRequests ...@@ -34,7 +34,7 @@ module MergeRequests
# At this point we decide if merge request can be created # At this point we decide if merge request can be created
# If we have at least one commit to merge -> creation allowed # If we have at least one commit to merge -> creation allowed
if commits.present? if commits.present?
merge_request.compare_commits = Commit.decorate(commits, merge_request.source_project) merge_request.compare_commits = commits
merge_request.can_be_created = true merge_request.can_be_created = true
merge_request.compare = compare merge_request.compare = compare
else else
......
module MergeRequests
class MergeRequestDiffCacheService
def execute(merge_request)
# Executing the iteration we cache all the highlighted diff information
merge_request.diffs.diff_files.to_a
end
end
end
...@@ -59,7 +59,13 @@ module MergeRequests ...@@ -59,7 +59,13 @@ module MergeRequests
} }
commit_id = repository.merge(current_user, merge_request, options) commit_id = repository.merge(current_user, merge_request, options)
merge_request.update(merge_commit_sha: commit_id)
if commit_id
merge_request.update(merge_commit_sha: commit_id)
else
merge_request.update(merge_error: 'Conflicts detected during merge')
false
end
rescue GitHooksService::PreReceiveError => e rescue GitHooksService::PreReceiveError => e
merge_request.update(merge_error: e.message) merge_request.update(merge_error: e.message)
false false
......
...@@ -152,7 +152,7 @@ module MergeRequests ...@@ -152,7 +152,7 @@ module MergeRequests
# Call merge request webhook with update branches # Call merge request webhook with update branches
def execute_mr_web_hooks def execute_mr_web_hooks
merge_requests_for_source_branch.each do |merge_request| merge_requests_for_source_branch.each do |merge_request|
execute_hooks(merge_request, 'update') execute_hooks(merge_request, 'update', @oldrev)
end end
end end
......
...@@ -36,7 +36,7 @@ module Projects ...@@ -36,7 +36,7 @@ module Projects
local_branch = local_branches[name] local_branch = local_branches[name]
if local_branch.nil? if local_branch.nil?
result = CreateBranchService.new(project, current_user).execute(name, upstream_branch.target) result = CreateBranchService.new(project, current_user).execute(name, upstream_branch.target.sha)
if result[:status] == :error if result[:status] == :error
errors << result[:message] errors << result[:message]
end end
...@@ -73,16 +73,17 @@ module Projects ...@@ -73,16 +73,17 @@ module Projects
tags.each do |tag| tags.each do |tag|
old_tag = old_tags[tag.name] old_tag = old_tags[tag.name]
old_tag_target = old_tag ? old_tag.target : Gitlab::Git::BLANK_SHA tag_target = tag.target.sha
old_tag_target = old_tag ? old_tag.target.sha : Gitlab::Git::BLANK_SHA
next if old_tag_target == tag.target next if old_tag_target == tag_target
GitTagPushService.new( GitTagPushService.new(
project, project,
current_user, current_user,
{ {
oldrev: old_tag_target, oldrev: old_tag_target,
newrev: tag.target, newrev: tag_target,
ref: "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}", ref: "#{Gitlab::Git::TAG_REF_PREFIX}#{tag.name}",
mirror_update: true mirror_update: true
} }
......
...@@ -11,16 +11,18 @@ ...@@ -11,16 +11,18 @@
- else - else
%span.build-link ##{build.id} %span.build-link ##{build.id}
- if build.stuck?
%i.fa.fa-warning.text-warning
- if build.ref - if build.ref
.icon-container
= build.tag? ? icon('tag') : icon('code-fork')
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref), class: "monospace branch-name" = link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref), class: "monospace branch-name"
- else - else
.light none .light none
= custom_icon("icon_commit") .icon-container
= custom_icon("icon_commit")
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace commit-id" = link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace commit-id"
- if build.stuck?
%i.fa.fa-warning.text-warning
.label-container .label-container
- if build.tags.any? - if build.tags.any?
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
%li %li
%a Sort by date %a Sort by date
= link_to 'New issue', '#', class: 'btn btn-new' = link_to 'New issue', '#', class: 'btn btn-new btn-inverted'
.lead .lead
Only nav links without button and search Only nav links without button and search
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
- if project_nav_tab? :issues - if project_nav_tab? :issues
= nav_link(controller: [:issues, :labels, :milestones]) do = nav_link(controller: [:issues, :labels, :milestones]) do
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do = link_to namespace_project_issues_path(@project.namespace, @project), title: 'Issues', class: 'shortcuts-issues' do
%span %span
Issues Issues
- if @project.default_issues_tracker? - if @project.default_issues_tracker?
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
- if current_user - if current_user
.btn-group{ role: "group" } .btn-group{ role: "group" }
= lock_file_link(html_options: {class: 'btn btn-sm path-lock'}) = lock_file_link(html_options: {class: 'btn btn-sm path-lock'})
= edit_blob_link - if blob_text_viewable?(@blob)
= edit_blob_link
= replace_blob_link = replace_blob_link
= delete_blob_link = delete_blob_link
......
.branch-commit .branch-commit
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-id monospace" = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-id monospace"
&middot; &middot;
%span.str-truncated %span.str-truncated
= link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message"
......
...@@ -14,18 +14,15 @@ ...@@ -14,18 +14,15 @@
.dropdown.inline .dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
%span.light %span.light
- if params[:sort].present? = projects_sort_options_hash[@sort]
= params[:sort].humanize
- else
Name
%b.caret %b.caret
%ul.dropdown-menu.dropdown-menu-align-right %ul.dropdown-menu.dropdown-menu-align-right
%li %li
= link_to filter_branches_path(sort: nil) do = link_to filter_branches_path(sort: sort_value_name) do
= sort_title_name = sort_title_name
= link_to filter_branches_path(sort: 'recently_updated') do = link_to filter_branches_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated = sort_title_recently_updated
= link_to filter_branches_path(sort: 'last_updated') do = link_to filter_branches_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated = sort_title_oldest_updated
- if can? current_user, :push_code, @project - if can? current_user, :push_code, @project
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
- if can_create_issue - if can_create_issue
%li %li
= link_to url_for_new_issue(@project, only_path: true) do = link_to new_namespace_project_issue_path(@project.namespace, @project) do
= icon('exclamation-circle fw') = icon('exclamation-circle fw')
New issue New issue
......
...@@ -13,13 +13,6 @@ ...@@ -13,13 +13,6 @@
- else - else
%span ##{build.id} %span ##{build.id}
- if build.stuck?
.icon-container
= icon('warning', class: 'text-warning has-tooltip', title: 'Build is stuck. Check runners.')
- if defined?(retried) && retried
.icon-container
= icon('warning', class: 'text-warning has-tooltip', title: 'Build was retried.')
- if defined?(ref) && ref - if defined?(ref) && ref
- if build.ref - if build.ref
.icon-container .icon-container
...@@ -33,6 +26,11 @@ ...@@ -33,6 +26,11 @@
- if defined?(commit_sha) && commit_sha - if defined?(commit_sha) && commit_sha
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "commit-id monospace" = link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "commit-id monospace"
- if build.stuck?
= icon('warning', class: 'text-warning has-tooltip', title: 'Build is stuck. Check runners.')
- if defined?(retried) && retried
= icon('warning', class: 'text-warning has-tooltip', title: 'Build was retried.')
.label-container .label-container
- if build.tags.any? - if build.tags.any?
- build.tags.each do |tag| - build.tags.each do |tag|
...@@ -47,7 +45,6 @@ ...@@ -47,7 +45,6 @@
- if build.manual? - if build.manual?
%span.label.label-info manual %span.label.label-info manual
- if defined?(runner) && runner - if defined?(runner) && runner
%td %td
- if build.try(:runner) - if build.try(:runner)
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
%td.pipeline-actions %td.pipeline-actions
.controls.hidden-xs.pull-right .controls.hidden-xs.pull-right
- artifacts = pipeline.builds.latest.select { |b| b.artifacts? } - artifacts = pipeline.builds.latest.with_artifacts_not_expired
- actions = pipeline.manual_actions - actions = pipeline.manual_actions
- if artifacts.present? || actions.any? - if artifacts.present? || actions.any?
.btn-group.inline .btn-group.inline
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
= nav_link(path: 'commit#show') do = nav_link(path: 'commit#show') do
= link_to namespace_project_commit_path(@project.namespace, @project, @commit.id) do = link_to namespace_project_commit_path(@project.namespace, @project, @commit.id) do
Changes Changes
%span.badge= @diffs.count %span.badge= @diffs.size
= nav_link(path: 'commit#builds') do = nav_link(path: 'commit#builds') do
= link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id) do = link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id) do
Builds Builds
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= render "ci_menu" = render "ci_menu"
- else - else
%div.block-connector %div.block-connector
= render "projects/diffs/diffs", diffs: @diffs, project: @project, diff_refs: @commit.diff_refs = render "projects/diffs/diffs", diffs: @diffs
= render "projects/notes/notes_with_form" = render "projects/notes/notes_with_form"
- if can_collaborate_with_project? - if can_collaborate_with_project?
- %w(revert cherry-pick).each do |type| - %w(revert cherry-pick).each do |type|
......
= form_tag namespace_project_compare_index_path(@project.namespace, @project), method: :post, class: 'form-inline js-requires-input' do = form_tag namespace_project_compare_index_path(@project.namespace, @project), method: :post, class: 'form-inline js-requires-input' do
.clearfix .clearfix
- if params[:to] && params[:from] - if params[:to] && params[:from]
= link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has-tooltip', title: 'Switch base of comparison'} = link_to icon('exchange'), {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has-tooltip', title: 'Switch base of comparison'}
.form-group.dropdown.compare-form-group.js-compare-from-dropdown .form-group.dropdown.compare-form-group.js-compare-from-dropdown
.input-group.inline-input-group .input-group.inline-input-group
%span.input-group-addon from %span.input-group-addon from
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- if @commits.present? - if @commits.present?
= render "projects/commits/commit_list" = render "projects/commits/commit_list"
= render "projects/diffs/diffs", diffs: @diffs, project: @project, diff_refs: @diff_refs = render "projects/diffs/diffs", diffs: @diffs
- else - else
.light-well .light-well
.center .center
......
- show_whitespace_toggle = local_assigns.fetch(:show_whitespace_toggle, true) - show_whitespace_toggle = local_assigns.fetch(:show_whitespace_toggle, true)
- diff_files = diffs.diff_files
- if diff_view == 'parallel' - if diff_view == 'parallel'
- fluid_layout true - fluid_layout true
- diff_files = safe_diff_files(diffs, diff_refs: diff_refs, repository: project.repository)
.content-block.oneline-block.files-changed .content-block.oneline-block.files-changed
.inline-parallel-buttons .inline-parallel-buttons
- if !expand_all_diffs? && diff_files.any? { |diff_file| diff_file.collapsed? } - if !expand_all_diffs? && diff_files.any? { |diff_file| diff_file.collapsed? }
= link_to 'Expand all', url_for(params.merge(expand_all_diffs: 1, format: nil)), class: 'btn btn-default' = link_to 'Expand all', url_for(params.merge(expand_all_diffs: 1, format: nil)), class: 'btn btn-default'
- if show_whitespace_toggle - if show_whitespace_toggle
- if current_controller?(:commit) - if current_controller?(:commit)
= commit_diff_whitespace_link(@project, @commit, class: 'hidden-xs') = commit_diff_whitespace_link(diffs.project, @commit, class: 'hidden-xs')
- elsif current_controller?(:merge_requests) - elsif current_controller?(:merge_requests)
= diff_merge_request_whitespace_link(@project, @merge_request, class: 'hidden-xs') = diff_merge_request_whitespace_link(diffs.project, @merge_request, class: 'hidden-xs')
- elsif current_controller?(:compare) - elsif current_controller?(:compare)
= diff_compare_whitespace_link(@project, params[:from], params[:to], class: 'hidden-xs') = diff_compare_whitespace_link(diffs.project, params[:from], params[:to], class: 'hidden-xs')
.btn-group .btn-group
= inline_diff_btn = inline_diff_btn
= parallel_diff_btn = parallel_diff_btn
...@@ -23,12 +22,12 @@ ...@@ -23,12 +22,12 @@
- if diff_files.overflow? - if diff_files.overflow?
= render 'projects/diffs/warning', diff_files: diff_files = render 'projects/diffs/warning', diff_files: diff_files
.files{data: {can_create_note: (!@diff_notes_disabled && can?(current_user, :create_note, @project))}} .files{data: {can_create_note: (!@diff_notes_disabled && can?(current_user, :create_note, diffs.project))}}
- diff_files.each_with_index do |diff_file, index| - diff_files.each_with_index do |diff_file, index|
- diff_commit = commit_for_diff(diff_file) - diff_commit = commit_for_diff(diff_file)
- blob = diff_file.blob(diff_commit) - blob = diff_file.blob(diff_commit)
- next unless blob - next unless blob
- blob.load_all_data!(project.repository) unless blob.only_display_raw? - blob.load_all_data!(diffs.project.repository) unless blob.only_display_raw?
= render 'projects/diffs/file', i: index, project: project, = render 'projects/diffs/file', i: index, project: diffs.project,
diff_file: diff_file, diff_commit: diff_commit, blob: blob, diff_refs: diff_refs diff_file: diff_file, diff_commit: diff_commit, blob: blob
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
= icon('comment') = icon('comment')
\ \
- if editable_diff?(diff_file) - if editable_diff?(diff_file)
= edit_blob_link(@merge_request.source_project, = edit_blob_link(@merge_request.source_project,
@merge_request.source_branch, diff_file.new_path, @merge_request.source_branch, diff_file.new_path,
from_merge_request_id: @merge_request.id) from_merge_request_id: @merge_request.id,
skip_visible_check: true)
= view_file_btn(diff_commit.id, diff_file, project) = view_file_btn(diff_commit.id, diff_file.new_path, project)
= render 'projects/diffs/content', diff_file: diff_file, diff_commit: diff_commit, diff_refs: diff_refs, blob: blob, project: project = render 'projects/diffs/content', diff_file: diff_file, diff_commit: diff_commit, blob: blob, project: project
- plain = local_assigns.fetch(:plain, false) - plain = local_assigns.fetch(:plain, false)
- line_code = diff_file.line_code(line)
- position = diff_file.position(line)
- type = line.type - type = line.type
%tr.line_holder{ id: line_code, class: type } - line_code = diff_file.line_code(line) unless plain
%tr.line_holder{ plain ? { class: type} : { class: type, id: line_code } }
- case type - case type
- when 'match' - when 'match'
= render "projects/diffs/match_line", { line: line.text, = render "projects/diffs/match_line", { line: line.text,
...@@ -24,4 +23,4 @@ ...@@ -24,4 +23,4 @@
= link_text = link_text
- else - else
%a{href: "##{line_code}", data: { linenumber: link_text }} %a{href: "##{line_code}", data: { linenumber: link_text }}
%td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, position, type) unless plain) }= diff_line_content(line.text, type) %td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }= diff_line_content(line.text, type)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.commit-stat-summary .commit-stat-summary
Showing Showing
= link_to '#', class: 'js-toggle-button' do = link_to '#', class: 'js-toggle-button' do
%strong #{pluralize(diff_files.count, "changed file")} %strong #{pluralize(diff_files.size, "changed file")}
with with
%strong.cgreen #{diff_files.sum(&:added_lines)} additions %strong.cgreen #{diff_files.sum(&:added_lines)} additions
and and
......
...@@ -11,5 +11,5 @@ ...@@ -11,5 +11,5 @@
= link_to "Email patch", merge_request_path(@merge_request, format: :patch), class: "btn btn-sm" = link_to "Email patch", merge_request_path(@merge_request, format: :patch), class: "btn btn-sm"
%p %p
To preserve performance only To preserve performance only
%strong #{diff_files.count} of #{diff_files.real_size} %strong #{diff_files.size} of #{diff_files.real_size}
files are displayed. files are displayed.
= form_for @environment, url: namespace_project_environments_path(@project.namespace, @project), html: { class: 'col-lg-9' } do |f| .row.prepend-top-default.append-bottom-default
= form_errors(@environment) .col-lg-3
.form-group %h4.prepend-top-0
= f.label :name, 'Name', class: 'label-light' Environments
= f.text_field :name, required: true, class: 'form-control' %p
= f.submit 'Create environment', class: 'btn btn-create' Environments allow you to track deployments of your application
= link_to 'Cancel', namespace_project_environments_path(@project.namespace, @project), class: 'btn btn-cancel' = succeed "." do
= link_to "Read more about environments", help_page_path("ci/environments")
= form_for [@project.namespace.becomes(Namespace), @project, @environment], html: { class: 'col-lg-9' } do |f|
= form_errors(@environment)
.form-group
= f.label :name, 'Name', class: 'label-light'
= f.text_field :name, required: true, class: 'form-control'
.form-group
= f.label :external_url, 'External URL', class: 'label-light'
= f.url_field :external_url, class: 'form-control'
.form-actions
= f.submit 'Save', class: 'btn btn-save'
= link_to 'Cancel', namespace_project_environments_path(@project.namespace, @project), class: 'btn btn-cancel'
- page_title "Edit", @environment.name, "Environments"
%h3.page-title
Edit environment
%hr
= render 'form'
- page_title 'New Environment' - page_title 'New Environment'
.row.prepend-top-default.append-bottom-default %h3.page-title
.col-lg-3 New environment
%h4.prepend-top-0 %hr
New Environment = render 'form'
%p
Environments allow you to track deployments of your application
= succeed "." do
= link_to "Read more about environments", help_page_path("ci/environments")
= render 'form'
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
.top-area .top-area
.col-md-9 .col-md-9
%h3.page-title= @environment.name.capitalize %h3.page-title= @environment.name.capitalize
.col-md-3 .col-md-3
.nav-controls .nav-controls
- if can?(current_user, :update_environment, @environment) - if can?(current_user, :update_environment, @environment)
= link_to 'Edit', edit_namespace_project_environment_path(@project.namespace, @project, @environment), class: 'btn'
= link_to 'Destroy', namespace_project_environment_path(@project.namespace, @project, @environment), data: { confirm: 'Are you sure you want to delete this environment?' }, class: 'btn btn-danger', method: :delete = link_to 'Destroy', namespace_project_environment_path(@project.namespace, @project, @environment), data: { confirm: 'Are you sure you want to delete this environment?' }, class: 'btn btn-danger', method: :delete
- if @deployments.blank? - if @deployments.blank?
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
:javascript :javascript
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: location.href, url: "#{namespace_project_graph_path(@project.namespace, @project, current_ref, format: :json)}",
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
var graph = new ContributorsStatGraph(); var graph = new ContributorsStatGraph();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%ul{ class: (container_class) } %ul{ class: (container_class) }
- if project_nav_tab?(:issues) && !current_controller?(:merge_requests) - if project_nav_tab?(:issues) && !current_controller?(:merge_requests)
= nav_link(controller: :issues) do = nav_link(controller: :issues) do
= link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do = link_to namespace_project_issues_path(@project.namespace, @project), title: 'Issues' do
%span %span
Issues Issues
......
.issues-footer.text-center
%button.issue-email-modal-btn{ type: "button", data: { toggle: "modal", target: "#issue-email-modal" } }
Email a new issue to this project
#issue-email-modal.modal.fade{ tabindex: "-1", role: "dialog" }
.modal-dialog{ role: "document" }
.modal-content
.modal-header
%button.close{ type: "button", data: { dismiss: "modal" }, aria: { label: "close" } }
%span{ aria: { hidden: "true" } }= icon("times")
%h4.modal-title
Create new issue by email
.modal-body
%p
Write an email to the below email address. (This is a private email address, so keep it secret.)
.email-modal-input-group.input-group
= text_field_tag :issue_email, email, class: "monospace js-select-on-focus form-control", readonly: true
.input-group-btn
= clipboard_button(clipboard_target: '#issue_email')
%p
Send an email to this address to create an issue.
%p
Use the subject line as the title of your issue.
%p
Use the message as the body of your issue (feel free to include some nice
= succeed ")." do
= link_to "Markdown", help_page_path('markdown', 'markdown')
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
%ul.unstyled-list %ul.unstyled-list
- @related_branches.each do |branch| - @related_branches.each do |branch|
%li %li
- sha = @project.repository.find_branch(branch).target - target = @project.repository.find_branch(branch).target
- pipeline = @project.pipeline(sha, branch) if sha - pipeline = @project.pipeline(target.sha, branch) if target
- if pipeline - if pipeline
%span.related-branch-ci-status %span.related-branch-ci-status
= render_pipeline_status(pipeline) = render_pipeline_status(pipeline)
......
- @no_container = true - @no_container = true
- page_title "Issues" - page_title "Issues"
- new_issue_email = @project.new_issue_address(current_user)
= render "projects/issues/head" = render "projects/issues/head"
= content_for :meta_tags do = content_for :meta_tags do
...@@ -18,12 +19,20 @@ ...@@ -18,12 +19,20 @@
Subscribe Subscribe
= render 'shared/issuable/search_form', path: namespace_project_issues_path(@project.namespace, @project) = render 'shared/issuable/search_form', path: namespace_project_issues_path(@project.namespace, @project)
- if can? current_user, :create_issue, @project - if can? current_user, :create_issue, @project
= link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: @issuable_finder.assignee.try(:id), milestone_id: @issuable_finder.milestones.try(:first).try(:id) }), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do = link_to new_namespace_project_issue_path(@project.namespace,
@project,
issue: { assignee_id: issues_finder.assignee.try(:id),
milestone_id: issues_finder.milestones.first.try(:id) }),
class: "btn btn-new",
title: "New Issue",
id: "new_issue_link" do
New Issue New Issue
= render 'shared/issuable/filter', type: :issues = render 'shared/issuable/filter', type: :issues
.issues-holder .issues-holder
= render "issues" = render 'issues'
- if new_issue_email
= render 'issue_by_email', email: new_issue_email
- else - else
.blank-state.blank-state-welcome .blank-state.blank-state-welcome
%h2.blank-state-title.blank-state-welcome-title %h2.blank-state-title.blank-state-welcome-title
...@@ -40,3 +49,5 @@ ...@@ -40,3 +49,5 @@
- if can? current_user, :create_issue, @project - if can? current_user, :create_issue, @project
= link_to new_namespace_project_issue_path(@project.namespace, @project), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do = link_to new_namespace_project_issue_path(@project.namespace, @project), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do
New Issue New Issue
- if new_issue_email
= render 'issue_by_email', email: new_issue_email
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
%li %li
= link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue) = link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue)
- if can?(current_user, :create_issue, @project) - if can?(current_user, :create_issue, @project)
= link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'hidden-xs hidden-sm btn btn-grouped new-issue-link btn-success', title: 'New issue', id: 'new_issue_link' do = link_to new_namespace_project_issue_path(@project.namespace, @project), class: 'hidden-xs hidden-sm btn btn-grouped new-issue-link btn-new btn-inverted', title: 'New issue', id: 'new_issue_link' do
New issue New issue
- if can?(current_user, :update_issue, @issue) - if can?(current_user, :update_issue, @issue)
= link_to 'Reopen issue', issue_path(@issue, issue: { state_event: :reopen }, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "hidden-xs hidden-sm btn btn-grouped btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Reopen issue', issue_path(@issue, issue: { state_event: :reopen }, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "hidden-xs hidden-sm btn btn-grouped btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
%h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
%p To preserve performance the line changes are not shown. %p To preserve performance the line changes are not shown.
- else - else
= render "projects/diffs/diffs", diffs: @diffs, project: @project, diff_refs: @merge_request.diff_refs, show_whitespace_toggle: false = render "projects/diffs/diffs", diffs: @diffs, show_whitespace_toggle: false
- if @pipeline - if @pipeline
#builds.builds.tab-pane #builds.builds.tab-pane
= render "projects/merge_requests/show/builds" = render "projects/merge_requests/show/builds"
......
- if @merge_request_diff.collected? - if @merge_request_diff.collected?
= render "projects/diffs/diffs", diffs: @merge_request.diffs(diff_options), = render "projects/diffs/diffs", diffs: @diffs
project: @merge_request.project, diff_refs: @merge_request.diff_refs
- elsif @merge_request_diff.empty? - elsif @merge_request_diff.empty?
.nothing-here-block Nothing to merge from #{@merge_request.source_branch} into #{@merge_request.target_branch} .nothing-here-block Nothing to merge from #{@merge_request.source_branch} into #{@merge_request.target_branch}
- else - else
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
%li %li
= link_to 'Contribution guide', contribution_guide_path(@project) = link_to 'Contribution guide', contribution_guide_path(@project)
- if @repository.gitlab_ci_yml
%li
= link_to 'CI configuration', ci_configuration_path(@project)
- if current_user && can_push_branch?(@project, @project.default_branch) - if current_user && can_push_branch?(@project, @project.default_branch)
- unless @repository.changelog - unless @repository.changelog
%li.missing %li.missing
......
%span.str-truncated %span.str-truncated
= link_to_gfm commit.title, namespace_project_commit_path(@project.namespace, @project, commit.id), class: "tree-commit-link" = link_to_gfm commit.full_title, namespace_project_commit_path(@project.namespace, @project, commit.id), class: "tree-commit-link"
- project = note.project - project = note.project
- note_url = Gitlab::UrlBuilder.build(note) - note_url = Gitlab::UrlBuilder.build(note)
- noteable_identifier = note.noteable.try(:iid) || note.noteable.id - noteable_identifier = note.noteable.try(:iid) || note.noteable.try(:id)
.search-result-row .search-result-row
%h5.note-search-caption.str-truncated %h5.note-search-caption.str-truncated
%i.fa.fa-comment %i.fa.fa-comment
...@@ -10,7 +11,10 @@ ...@@ -10,7 +11,10 @@
&middot; &middot;
- if note.for_commit? - if note.for_commit?
= link_to "Commit #{truncate_sha(note.commit_id)}", note_url = link_to_if(noteable_identifier, "Commit #{truncate_sha(note.commit_id)}", note_url) do
= truncate_sha(note.commit_id)
%span.light Commit deleted
- else - else
%span #{note.noteable_type.titleize} ##{noteable_identifier} %span #{note.noteable_type.titleize} ##{noteable_identifier}
&middot; &middot;
......
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" xmlns:xlink="http://www.w3.org/1999/xlink"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
<defs> <g fill="#5C5C5C" fill-rule="evenodd">
<circle id="a" cx="7" cy="7" r="7"/> <path d="M12.5,7 C12.5,3.96243388 10.0375661,1.5 7,1.5 C3.96243388,1.5 1.5,3.96243388 1.5,7 C1.5,10.0375661 3.96243388,12.5 7,12.5 C10.0375661,12.5 12.5,10.0375661 12.5,7 Z M0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,10.8659932 10.8659932,14 7,14 C3.13400675,14 0,10.8659932 0,7 Z"/>
<mask id="b" width="14" height="14" x="0" y="0" fill="white"> <rect width="8" height="2" x="3" y="6" transform="rotate(45 7 7)" rx=".5"/>
<use xlink:href="#a"/>
</mask>
</defs>
<g fill="none" fill-rule="evenodd">
<use stroke="#5C5C5C" stroke-width="2" mask="url(#b)" xlink:href="#a"/>
<rect width="10" height="1" x="2" y="6.5" fill="#5C5C5C" transform="rotate(45 7 7)" rx=".3"/>
</g> </g>
</svg> </svg>
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.
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.
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.
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.
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.
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