Commit 0528ac63 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ce_upstream' into 'master'

CE upstream

See merge request !39
parents 1296d965 b3314704
...@@ -5,17 +5,42 @@ v 8.1.0 ...@@ -5,17 +5,42 @@ v 8.1.0
v 8.0.1 v 8.0.1
v 8.1.0 (unreleased) v 8.1.0 (unreleased)
v 8.2.0 (unreleased)
- Improved performance of replacing references in comments
- Show last project commit to default branch on project home page
- Highlight comment based on anchor in URL
- Adds ability to remove the forked relationship from project settings screen. (Han Loong Liauw)
- Improved performance of sorting milestone issues
- Allow users to select the Files view as default project view (Cristian Bica)
- Show "Empty Repository Page" for repository without branches (Artem V. Navrotskiy)
v 8.1.0
- Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu)
- Fix duplicate repositories in GitHub import page (Stan Hu)
- Redirect to a default path if HTTP_REFERER is not set (Stan Hu)
- Fix CSS for runner status
- Send an email to admin email when a user is reported for spam (Jonathan Rochkind)
- Show notifications button when user is member of group rather than project (Grzegorz Bizon)
- Fix bug preventing mentioned issued from being closed when MR is merged using fast-forward merge.
- Fix nonatomic database update potentially causing project star counts to go negative (Stan Hu)
- Don't show "Add README" link in an empty repository if user doesn't have access to push (Stan Hu)
- Fix error preventing displaying of commit data for a directory with a leading dot (Stan Hu) - Fix error preventing displaying of commit data for a directory with a leading dot (Stan Hu)
- Speed up load times of issue detail pages by roughly 1.5x - Speed up load times of issue detail pages by roughly 1.5x
- Require CI jobs to be named
- If a merge request is to close an issue, show this on the issue page (Zeger-Jan van de Weg)
- Add a system note and update relevant merge requests when a branch is deleted or re-added (Stan Hu)
- Make diff file view easier to use on mobile screens (Stan Hu) - Make diff file view easier to use on mobile screens (Stan Hu)
- Improved performance of finding users by username or Email address - Improved performance of finding users by username or Email address
- Fix 500 when editing CI service
- Fix bug where merge request comments created by API would not trigger notifications (Stan Hu) - Fix bug where merge request comments created by API would not trigger notifications (Stan Hu)
- Add support for creating directories from Files page (Stan Hu) - Add support for creating directories from Files page (Stan Hu)
- Allow removing of project without confirmation when JavaScript is disabled (Stan Hu) - Allow removing of project without confirmation when JavaScript is disabled (Stan Hu)
- Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters (Stan Hu) - Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters (Stan Hu)
- Improved performance of the trending projects page - Improved performance of the trending projects page
- Remove CI migration task
- Improved performance of finding projects by their namespace - Improved performance of finding projects by their namespace
- Fix bug where transferring a project would result in stale commit links (Stan Hu) - Fix bug where transferring a project would result in stale commit links (Stan Hu)
- Fix build trace updating
- Include full path of source and target branch names in New Merge Request page (Stan Hu) - Include full path of source and target branch names in New Merge Request page (Stan Hu)
- Add user preference to view activities as default dashboard (Stan Hu) - Add user preference to view activities as default dashboard (Stan Hu)
- Add option to admin area to sign in as a specific user (Pavel Forkert) - Add option to admin area to sign in as a specific user (Pavel Forkert)
...@@ -50,7 +75,7 @@ v 8.1.0 (unreleased) ...@@ -50,7 +75,7 @@ v 8.1.0 (unreleased)
- Move CI web hooks page to project settings area - Move CI web hooks page to project settings area
- Fix User Identities API. It now allows you to properly create or update user's identities. - Fix User Identities API. It now allows you to properly create or update user's identities.
- Add user preference to change layout width (Peter Göbel) - Add user preference to change layout width (Peter Göbel)
- Use commit status in merge request widget as preffered source of CI status - Use commit status in merge request widget as preferred source of CI status
- Integrate CI commit and build pages into project pages - Integrate CI commit and build pages into project pages
- Move CI services page to project settings area - Move CI services page to project settings area
- Add "Quick Submit" behavior to input fields throughout the application. Use - Add "Quick Submit" behavior to input fields throughout the application. Use
...@@ -58,6 +83,8 @@ v 8.1.0 (unreleased) ...@@ -58,6 +83,8 @@ v 8.1.0 (unreleased)
- Fix position of hamburger in header for smaller screens (Han Loong Liauw) - Fix position of hamburger in header for smaller screens (Han Loong Liauw)
- Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji) - Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji)
- Persist filters when sorting on admin user page (Jerry Lukins) - Persist filters when sorting on admin user page (Jerry Lukins)
- Update style of snippets pages (Han Loong Liauw)
- Allow dashboard and group issues/MRs to be filtered by label
- Add spellcheck=false to certain input fields - Add spellcheck=false to certain input fields
- Invalidate stored service password if the endpoint URL is changed - Invalidate stored service password if the endpoint URL is changed
- Project names are not fully shown if group name is too big, even on group page view - Project names are not fully shown if group name is too big, even on group page view
...@@ -66,6 +93,14 @@ v 8.1.0 (unreleased) ...@@ -66,6 +93,14 @@ v 8.1.0 (unreleased)
- Only render 404 page from /public - Only render 404 page from /public
- Hide passwords from services API (Alex Lossent) - Hide passwords from services API (Alex Lossent)
- Fix: Images cannot show when projects' path was changed - Fix: Images cannot show when projects' path was changed
- Let gitlab-git-http-server generate and serve 'git archive' downloads
- Optimize query when filtering on issuables (Zeger-Jan van de Weg)
- Fix padding of outdated discussion item.
- Animate the logo on hover
v 8.0.5
- Correct lookup-by-email for LDAP logins
- Fix loading spinner sometimes not being hidden on Merge Request tab switches
v 8.0.4 v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu) - Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
<g id="Fill-1-+-Group-24"> <g id="Fill-1-+-Group-24">
<g id="Group-24"> <g id="Group-24">
<g id="Group"> <g id="Group">
<path d="M105.0614,193.655 L105.0614,193.655 L143.7014,74.734 L66.4214,74.734 L105.0614,193.655 L105.0614,193.655 Z" id="Fill-4" fill="#E24329"></path> <path d="M105.0614,193.655 L105.0614,193.655 L143.7014,74.734 L66.4214,74.734 L105.0614,193.655 L105.0614,193.655 Z" id="Fill-4" fill="#E24329" class="tanuki-shape"></path>
<path d="M105.0614,193.6548 L66.4214,74.7338 L12.2684,74.7338 L105.0614,193.6548 L105.0614,193.6548 Z" id="Fill-8" fill="#FC6D26"></path> <path d="M105.0614,193.6548 L66.4214,74.7338 L12.2684,74.7338 L105.0614,193.6548 L105.0614,193.6548 Z" id="Fill-8" fill="#FC6D26" class="tanuki-shape"></path>
<path d="M12.2685,74.7341 L12.2685,74.7341 L0.5265,110.8731 C-0.5445,114.1691 0.6285,117.7801 3.4325,119.8171 L105.0615,193.6551 L12.2685,74.7341 L12.2685,74.7341 Z" id="Fill-12" fill="#FCA326"></path> <path d="M12.2685,74.7341 L12.2685,74.7341 L0.5265,110.8731 C-0.5445,114.1691 0.6285,117.7801 3.4325,119.8171 L105.0615,193.6551 L12.2685,74.7341 L12.2685,74.7341 Z" id="Fill-12" fill="#FCA326" class="tanuki-shape"></path>
<path d="M12.2685,74.7342 L66.4215,74.7342 L43.1485,3.1092 C41.9515,-0.5768 36.7375,-0.5758 35.5405,3.1092 L12.2685,74.7342 L12.2685,74.7342 Z" id="Fill-16" fill="#E24329"></path> <path d="M12.2685,74.7342 L66.4215,74.7342 L43.1485,3.1092 C41.9515,-0.5768 36.7375,-0.5758 35.5405,3.1092 L12.2685,74.7342 L12.2685,74.7342 Z" id="Fill-16" fill="#E24329" class="tanuki-shape"></path>
<path d="M105.0614,193.6548 L143.7014,74.7338 L197.8544,74.7338 L105.0614,193.6548 L105.0614,193.6548 Z" id="Fill-18" fill="#FC6D26"></path> <path d="M105.0614,193.6548 L143.7014,74.7338 L197.8544,74.7338 L105.0614,193.6548 L105.0614,193.6548 Z" id="Fill-18" fill="#FC6D26" class="tanuki-shape"></path>
<path d="M197.8544,74.7341 L197.8544,74.7341 L209.5964,110.8731 C210.6674,114.1691 209.4944,117.7801 206.6904,119.8171 L105.0614,193.6551 L197.8544,74.7341 L197.8544,74.7341 Z" id="Fill-20" fill="#FCA326"></path> <path d="M197.8544,74.7341 L197.8544,74.7341 L209.5964,110.8731 C210.6674,114.1691 209.4944,117.7801 206.6904,119.8171 L105.0614,193.6551 L197.8544,74.7341 L197.8544,74.7341 Z" id="Fill-20" fill="#FCA326" class="tanuki-shape"></path>
<path d="M197.8544,74.7342 L143.7014,74.7342 L166.9744,3.1092 C168.1714,-0.5768 173.3854,-0.5758 174.5824,3.1092 L197.8544,74.7342 L197.8544,74.7342 Z" id="Fill-22" fill="#E24329"></path> <path d="M197.8544,74.7342 L143.7014,74.7342 L166.9744,3.1092 C168.1714,-0.5768 173.3854,-0.5758 174.5824,3.1092 L197.8544,74.7342 L197.8544,74.7342 Z" id="Fill-22" fill="#E24329" class="tanuki-shape"></path>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>
\ No newline at end of file
...@@ -22,7 +22,7 @@ class CiBuild ...@@ -22,7 +22,7 @@ class CiBuild
# Only valid for runnig build when output changes during time # Only valid for runnig build when output changes during time
# #
CiBuild.interval = setInterval => CiBuild.interval = setInterval =>
if window.location.href is build_url if window.location.href.split("#").first() is build_url
$.ajax $.ajax
url: build_url url: build_url
dataType: "json" dataType: "json"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
line-height: 36px; line-height: 36px;
} }
.content-block,
.gray-content-block { .gray-content-block {
margin: -$gl-padding; margin: -$gl-padding;
background-color: $background-color; background-color: $background-color;
...@@ -27,6 +28,10 @@ ...@@ -27,6 +28,10 @@
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
color: $gl-gray; color: $gl-gray;
&.white {
background-color: white;
}
&.top-block { &.top-block {
border-top: none; border-top: none;
} }
...@@ -60,3 +65,48 @@ ...@@ -60,3 +65,48 @@
line-height: 42px; line-height: 42px;
} }
} }
.cover-block {
text-align: center;
background: #f7f8fa;
margin: -$gl-padding;
margin-bottom: 0;
padding: 44px $gl-padding;
border-bottom: 1px solid $border-color;
position: relative;
.avatar-holder {
margin-bottom: 16px;
.avatar, .identicon {
margin: 0 auto;
float: none;
}
.identicon {
@include border-radius(50%);
}
}
.cover-title {
color: $gl-header-color;
margin: 0;
font-size: 23px;
font-weight: normal;
margin: 16px 0 5px 0;
color: #4c4e54;
font-size: 23px;
line-height: 1.1;
}
.cover-desc {
padding: 0 $gl-padding;
color: $gl-text-color;
}
.cover-controls {
position: absolute;
top: 10px;
right: 10px;
}
}
...@@ -162,10 +162,21 @@ ...@@ -162,10 +162,21 @@
border-color: #e7e9ed; border-color: #e7e9ed;
width: 140px; width: 140px;
.badge {
font-weight: normal;
background-color: #eee;
color: #78a;
}
&.active { &.active {
border-color: $gl-info; border-color: $gl-info;
background: $gl-info; background: $gl-info;
color: #fff; color: #fff;
.badge {
color: $gl-info;
background-color: white;
}
} }
} }
} }
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
border-bottom: 1px solid #E7E9EE; border-bottom: 1px solid #E7E9EE;
margin-bottom: 1em; margin-bottom: 1em;
&.readme-holder {
border-bottom: 0;
}
table { table {
@extend .table; @extend .table;
} }
...@@ -94,7 +98,6 @@ ...@@ -94,7 +98,6 @@
border-right: none; border-right: none;
} }
background: #fff; background: #fff;
padding: 10px $gl-padding;
} }
.lines { .lines {
pre { pre {
......
...@@ -107,7 +107,7 @@ ul.content-list { ...@@ -107,7 +107,7 @@ ul.content-list {
> li { > li {
padding: $gl-padding; padding: $gl-padding;
border-color: #f1f2f4; border-color: $table-border-color;
margin-left: -$gl-padding; margin-left: -$gl-padding;
margin-right: -$gl-padding; margin-right: -$gl-padding;
color: $gl-gray; color: $gl-gray;
......
...@@ -147,14 +147,8 @@ ...@@ -147,14 +147,8 @@
.badge { .badge {
font-weight: normal; font-weight: normal;
background-color: #fff;
background-color: #eee; background-color: #eee;
color: #78a; color: #78a;
} }
} }
} }
.fa-align {
top: 20px;
position: relative;
}
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
} }
.select2-results .select2-result-label { .select2-results .select2-result-label {
padding: 16px; padding: 9px;
} }
.select2-drop{ .select2-drop{
...@@ -152,4 +152,4 @@ ...@@ -152,4 +152,4 @@
.ajax-users-dropdown { .ajax-users-dropdown {
min-width: 250px !important; min-width: 250px !important;
} }
\ No newline at end of file
...@@ -242,6 +242,9 @@ ...@@ -242,6 +242,9 @@
img { img {
width: 36px; width: 36px;
height: 36px; height: 36px;
}
#tanuki-logo, img {
float: left; float: left;
} }
...@@ -265,3 +268,13 @@ ...@@ -265,3 +268,13 @@
} }
} }
} }
.tanuki-shape {
transition: all 0.8s;
&:hover {
fill: rgb(255, 255, 255);
transition: all 0.1s;
}
}
.table-holder {
margin: -$gl-padding;
margin-top: 0;
margin-bottom: 0;
}
table { table {
&.table { &.table {
.dropdown-menu a { .dropdown-menu a {
...@@ -18,15 +24,17 @@ table { ...@@ -18,15 +24,17 @@ table {
tr { tr {
td, th { td, th {
padding: 8px 10px; padding: 10px $gl-padding;
line-height: 20px; line-height: 20px;
vertical-align: middle; vertical-align: middle;
} }
th { th {
font-weight: normal; font-weight: normal;
font-size: 15px; font-size: 15px;
border-bottom: 1px solid $border-color !important; border-bottom: 1px solid $border-color !important;
} }
td { td {
border-color: $table-border-color !important; border-color: $table-border-color !important;
border-bottom: 1px solid; border-bottom: 1px solid;
......
...@@ -6,13 +6,17 @@ ...@@ -6,13 +6,17 @@
.timeline-entry { .timeline-entry {
padding: $gl-padding; padding: $gl-padding;
border-color: #f1f2f4; border-color: $table-border-color;
margin-left: -$gl-padding; margin-left: -$gl-padding;
margin-right: -$gl-padding; margin-right: -$gl-padding;
color: $gl-gray; color: $gl-gray;
border-bottom: 1px solid #ECEEF1; border-bottom: 1px solid #ECEEF1;
border-right: 1px solid #ECEEF1; border-right: 1px solid #ECEEF1;
&:target {
background: $hover;
}
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
......
@mixin md-typography { @mixin md-typography {
color: $md-text-color; color: $md-text-color;
word-wrap: break-word;
a { a {
color: $md-link-color; color: $md-link-color;
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
font-family: $monospace_font; font-family: $monospace_font;
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
padding: 1px 2px;
} }
kbd { kbd {
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
} }
blockquote { blockquote {
color: #7f8fa4;
font-size: inherit;
padding: 8px 21px; padding: 8px 21px;
margin: 12px 0 12px; margin: 12px 0 12px;
border-left: 3px solid #e7e9ed; border-left: 3px solid #e7e9ed;
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
blockquote p { blockquote p {
color: #7f8fa4 !important; color: #7f8fa4 !important;
font-size: 15px; font-size: inherit;
line-height: 1.5; line-height: 1.5;
} }
...@@ -112,9 +114,9 @@ ...@@ -112,9 +114,9 @@
font-weight: inherit; font-weight: inherit;
} }
ul, ol {
ul { padding: 0;
color: #5c5d5e; margin: 6px 0 6px 18px !important;
} }
li { li {
...@@ -136,6 +138,33 @@ ...@@ -136,6 +138,33 @@
text-decoration: none; text-decoration: none;
} }
} }
/* Link to current header. */
h1, h2, h3, h4, h5, h6 {
position: relative;
a.anchor {
// Setting `display: none` would prevent the anchor being scrolled to, so
// instead we set the height to 0 and it gets updated on hover.
height: 0;
}
&:hover > a.anchor {
$size: 16px;
position: absolute;
right: 100%;
top: 50%;
margin-top: -$size/2;
margin-right: 0px;
padding-right: 20px;
display: inline-block;
width: $size;
height: $size;
background-image: image-url("icon-link.png");
background-size: contain;
background-repeat: no-repeat;
}
}
} }
...@@ -202,53 +231,11 @@ a > code { ...@@ -202,53 +231,11 @@ a > code {
} }
/** /**
* Wiki typography * Apply Markdown typography
* *
*/ */
.wiki { .wiki {
@include md-typography; @include md-typography;
word-wrap: break-word;
padding: 7px;
/* Link to current header. */
h1, h2, h3, h4, h5, h6 {
position: relative;
a.anchor {
// Setting `display: none` would prevent the anchor being scrolled to, so
// instead we set the height to 0 and it gets updated on hover.
height: 0;
}
&:hover > a.anchor {
$size: 16px;
position: absolute;
right: 100%;
top: 50%;
margin-top: -$size/2;
margin-right: 0px;
padding-right: 20px;
display: inline-block;
width: $size;
height: $size;
background-image: image-url("icon-link.png");
background-size: contain;
background-repeat: no-repeat;
}
}
ul,ol {
padding: 0;
margin: 6px 0 6px 18px !important;
}
ol {
color: #5c5d5e;
}
}
.md-area {
@include md-typography;
} }
.md { .md {
...@@ -261,6 +248,7 @@ a > code { ...@@ -261,6 +248,7 @@ a > code {
*/ */
textarea.js-gfm-input { textarea.js-gfm-input {
font-family: $monospace_font; font-family: $monospace_font;
color: $gl-text-color;
} }
.md-preview { .md-preview {
......
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
line-height: 1.5; line-height: 1.5;
} }
.wide-table-holder {
margin-left: -$gl-padding;
margin-right: -$gl-padding;
}
.builds, .builds,
.projects-table { .projects-table {
.light { .light {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
padding: $gl-padding; padding: $gl-padding;
margin-left: -$gl-padding; margin-left: -$gl-padding;
margin-right: -$gl-padding; margin-right: -$gl-padding;
border-bottom: 1px solid #f1f2f4; border-bottom: 1px solid $table-border-color;
color: #7f8fa4; color: #7f8fa4;
&.event-inline { &.event-inline {
......
...@@ -68,3 +68,7 @@ body.modal-open { ...@@ -68,3 +68,7 @@ body.modal-open {
.modal .modal-dialog { .modal .modal-dialog {
width: 860px; width: 860px;
} }
.documentation {
padding: 7px;
}
...@@ -80,3 +80,11 @@ ...@@ -80,3 +80,11 @@
} }
} }
} }
.issuable-filter-count {
span {
display: block;
margin-bottom: -16px;
padding: 13px 0;
}
}
...@@ -132,6 +132,11 @@ form.edit-issue { ...@@ -132,6 +132,11 @@ form.edit-issue {
} }
} }
.issue-closed-by-widget {
padding: 16px 0;
margin: 0px;
}
.issue-form .select2-container { .issue-form .select2-container {
width: 250px !important; width: 250px !important;
} }
...@@ -30,7 +30,6 @@ ul.notes { ...@@ -30,7 +30,6 @@ ul.notes {
.discussion-header, .discussion-header,
.note-header { .note-header {
@extend .cgray; @extend .cgray;
padding-bottom: 15px;
a:hover { a:hover {
text-decoration: none; text-decoration: none;
...@@ -75,6 +74,10 @@ ul.notes { ...@@ -75,6 +74,10 @@ ul.notes {
} }
} }
.discussion-body {
padding-top: 15px;
}
.discussion { .discussion {
overflow: hidden; overflow: hidden;
display: block; display: block;
......
...@@ -47,3 +47,9 @@ ...@@ -47,3 +47,9 @@
} }
} }
} }
.calendar-hint {
margin-top: -12px;
float: right;
font-size: 12px;
}
...@@ -50,7 +50,17 @@ ...@@ -50,7 +50,17 @@
} }
.project-home-dropdown { .project-home-dropdown {
margin: 11px 3px 0; margin: 13px 0px 0;
}
.notifications-btn {
.fa-bell {
margin-right: 6px;
}
.fa-angle-down {
margin-left: 6px;
}
} }
.project-home-desc { .project-home-desc {
...@@ -85,6 +95,7 @@ ...@@ -85,6 +95,7 @@
color: inherit; color: inherit;
} }
} }
.input-group { .input-group {
display: inline-table; display: inline-table;
position: relative; position: relative;
...@@ -233,23 +244,11 @@ ...@@ -233,23 +244,11 @@
} }
} }
.fa-fw { i {
margin-right: 8px; margin-right: 8px;
} }
} }
.fa-bell {
margin-right: 6px;
}
.fa-angle-down {
margin-left: 6px;
}
.project-home-panel .project-home-dropdown {
margin: 13px 0px 0;
}
.project-visibility-level-holder { .project-visibility-level-holder {
.radio { .radio {
margin-bottom: 10px; margin-bottom: 10px;
...@@ -457,7 +456,7 @@ pre.light-well { ...@@ -457,7 +456,7 @@ pre.light-well {
.project-row { .project-row {
padding: $gl-padding; padding: $gl-padding;
border-color: #f1f2f4; border-color: $table-border-color;
margin-left: -$gl-padding; margin-left: -$gl-padding;
margin-right: -$gl-padding; margin-right: -$gl-padding;
...@@ -511,3 +510,46 @@ pre.light-well { ...@@ -511,3 +510,46 @@ pre.light-well {
margin-top: -1px; margin-top: -1px;
} }
} }
.project-last-commit {
margin: 0 7px;
.ci-status {
margin-right: 16px;
}
.commit-row-message {
color: $gl-gray;
}
.commit_short_id {
margin-right: 5px;
color: $gl-link-color;
font-weight: 600;
}
.commit-author-link {
margin-left: 7px;
text-decoration: none;
.avatar {
float: none;
margin-right: 4px;
}
.commit-author-name {
font-weight: 600;
}
}
}
.project-show-readme .readme-holder {
margin-left: -$gl-padding;
margin-right: -$gl-padding;
padding: ($gl-padding + 7px);
border-top: 0;
.edit-project-readme {
z-index: 100;
position: relative;
}
}
.ci-body { .runner-state {
.runner-state { padding: 6px 12px;
padding: 6px 12px; margin-right: 10px;
margin-right: 10px; color: #FFF;
color: #FFF;
&.runner-state-shared { &.runner-state-shared {
background: #32b186; background: #32b186;
}
&.runner-state-specific {
background: #3498db;
}
} }
&.runner-state-specific {
.runner-status-online { background: #3498db;
color: green;
} }
}
.runner-status-offline { .runner-status-online {
color: gray; color: green;
} }
.runner-status-paused { .runner-status-offline {
color: red; color: gray;
} }
.runner-status-paused {
color: red;
}
.runner { .runner {
.btn { .btn {
padding: 1px 6px; padding: 1px 6px;
} }
h4 { h4 {
font-weight: normal; font-weight: normal;
}
} }
} }
.my-snippets li:first-child {
h4 { margin-top: 0; }
padding-top: 0;
}
.snippet-form-holder .file-holder .file-title { .snippet-form-holder .file-holder .file-title {
padding: 2px; padding: 2px;
} }
...@@ -30,3 +25,58 @@ ...@@ -30,3 +25,58 @@
} }
} }
} }
.snippet-holder {
.snippet-details {
.page-title {
margin-top: -15px;
padding: 10px 0;
margin-bottom: 0;
color: #5c5d5e;
font-size: 16px;
.author {
color: #5c5d5e;
}
.snippet-id {
color: #5c5d5e;
}
}
.snippet-title {
margin: 0;
font-size: 23px;
color: #313236;
}
@media (max-width: $screen-md-max) {
.new-snippet-link {
display: none;
}
}
@media (max-width: $screen-sm-max) {
.creator,
.page-title .btn-close {
display: none;
}
}
}
.file-holder {
border-top: 0;
}
}
.snippet-box {
@include border-radius(2px);
display: inline-block;
padding: 10px $gl-padding;
font-weight: normal;
margin-right: 10px;
font-size: $gl-font-size;
border: 1px solid;
}
.tree-holder { .tree-holder {
.tree-table-holder {
margin-left: -$gl-padding;
margin-right: -$gl-padding;
}
.tree_progress {
display: none;
margin: 20px;
&.loading {
display: block;
}
}
.tree-table { .tree-table {
margin-bottom: 0; margin-bottom: 0;
tr { tr {
> td, > th { > td, > th {
padding: 10px $gl-padding; line-height: 28px;
line-height: 32px;
border-color: $table-border-color !important;
} }
&:hover { &:hover {
......
...@@ -9,6 +9,10 @@ class AbuseReportsController < ApplicationController ...@@ -9,6 +9,10 @@ class AbuseReportsController < ApplicationController
@abuse_report.reporter = current_user @abuse_report.reporter = current_user
if @abuse_report.save if @abuse_report.save
if current_application_settings.admin_notification_email.present?
AbuseReportMailer.delay.notify(@abuse_report.id)
end
message = "Thank you for your report. A GitLab administrator will look into it shortly." message = "Thank you for your report. A GitLab administrator will look into it shortly."
redirect_to root_path, notice: message redirect_to root_path, notice: message
else else
......
...@@ -56,6 +56,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -56,6 +56,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:default_snippet_visibility, :default_snippet_visibility,
:restricted_signup_domains_raw, :restricted_signup_domains_raw,
:version_check_enabled, :version_check_enabled,
:admin_notification_email,
:user_oauth_applications, :user_oauth_applications,
restricted_visibility_levels: [], restricted_visibility_levels: [],
import_sources: [] import_sources: []
......
...@@ -19,7 +19,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController ...@@ -19,7 +19,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
BroadcastMessage.find(params[:id]).destroy BroadcastMessage.find(params[:id]).destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to :back } format.html { redirect_back_or_default(default: { action: 'index' }) }
format.js { render nothing: true } format.js { render nothing: true }
end end
end end
......
...@@ -35,7 +35,7 @@ class Admin::HooksController < Admin::ApplicationController ...@@ -35,7 +35,7 @@ class Admin::HooksController < Admin::ApplicationController
} }
@hook.execute(data, 'system_hooks') @hook.execute(data, 'system_hooks')
redirect_to :back redirect_back_or_default
end end
def hook_params def hook_params
......
...@@ -33,33 +33,33 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -33,33 +33,33 @@ class Admin::UsersController < Admin::ApplicationController
def block def block
if user.block if user.block
redirect_to :back, notice: "Successfully blocked" redirect_back_or_admin_user(notice: "Successfully blocked")
else else
redirect_to :back, alert: "Error occurred. User was not blocked" redirect_back_or_admin_user(alert: "Error occurred. User was not blocked")
end end
end end
def unblock def unblock
if user.activate if user.activate
redirect_to :back, notice: "Successfully unblocked" redirect_back_or_admin_user(notice: "Successfully unblocked")
else else
redirect_to :back, alert: "Error occurred. User was not unblocked" redirect_back_or_admin_user(alert: "Error occurred. User was not unblocked")
end end
end end
def unlock def unlock
if user.unlock_access! if user.unlock_access!
redirect_to :back, alert: "Successfully unlocked" redirect_back_or_admin_user(alert: "Successfully unlocked")
else else
redirect_to :back, alert: "Error occurred. User was not unlocked" redirect_back_or_admin_user(alert: "Error occurred. User was not unlocked")
end end
end end
def confirm def confirm
if user.confirm if user.confirm
redirect_to :back, notice: "Successfully confirmed" redirect_back_or_admin_user(notice: "Successfully confirmed")
else else
redirect_to :back, alert: "Error occurred. User was not confirmed" redirect_back_or_admin_user(alert: "Error occurred. User was not confirmed")
end end
end end
...@@ -138,7 +138,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -138,7 +138,7 @@ class Admin::UsersController < Admin::ApplicationController
user.update_secondary_emails! user.update_secondary_emails!
respond_to do |format| respond_to do |format|
format.html { redirect_to :back, notice: "Successfully removed email." } format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") }
format.js { render nothing: true } format.js { render nothing: true }
end end
end end
...@@ -157,4 +157,12 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -157,4 +157,12 @@ class Admin::UsersController < Admin::ApplicationController
:projects_limit, :can_create_group, :admin, :key_id :projects_limit, :can_create_group, :admin, :key_id
) )
end end
def redirect_back_or_admin_user(options = {})
redirect_back_or_default(default: default_route, options: options)
end
def default_route
[:admin, @user]
end
end end
...@@ -33,6 +33,10 @@ class ApplicationController < ActionController::Base ...@@ -33,6 +33,10 @@ class ApplicationController < ActionController::Base
render_404 render_404
end end
def redirect_back_or_default(default: root_path, options: {})
redirect_to request.referer.present? ? :back : default, options
end
protected protected
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example # From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
...@@ -120,7 +124,6 @@ class ApplicationController < ActionController::Base ...@@ -120,7 +124,6 @@ class ApplicationController < ActionController::Base
project_path = "#{namespace}/#{id}" project_path = "#{namespace}/#{id}"
@project = Project.find_with_namespace(project_path) @project = Project.find_with_namespace(project_path)
if @project and can?(current_user, :read_project, @project) if @project and can?(current_user, :read_project, @project)
if @project.path_with_namespace != project_path if @project.path_with_namespace != project_path
redirect_to request.original_url.gsub(project_path, @project.path_with_namespace) and return redirect_to request.original_url.gsub(project_path, @project.path_with_namespace) and return
......
module Ci module Ci
class ProjectsController < Ci::ApplicationController class ProjectsController < Ci::ApplicationController
before_action :project before_action :project, except: [:index]
before_action :authenticate_user!, except: [:build, :badge] before_action :authenticate_user!, except: [:index, :build, :badge]
before_action :authorize_access_project!, except: [:badge] before_action :authorize_access_project!, except: [:index, :badge]
before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml] before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml]
before_action :no_cache, only: [:badge] before_action :no_cache, only: [:badge]
protect_from_forgery protect_from_forgery
def show
# Temporary compatibility with CI badges pointing to CI project page
redirect_to namespace_project_path(project.gl_project.namespace, project.gl_project)
end
# Project status badge # Project status badge
# Image with build status for sha or ref # Image with build status for sha or ref
def badge def badge
......
...@@ -11,10 +11,6 @@ class Import::GithubController < Import::BaseController ...@@ -11,10 +11,6 @@ class Import::GithubController < Import::BaseController
def status def status
@repos = client.repos @repos = client.repos
client.orgs.each do |org|
@repos += client.org_repos(org.login)
end
@already_added_projects = current_user.created_projects.where(import_type: "github") @already_added_projects = current_user.created_projects.where(import_type: "github")
already_added_projects_names = @already_added_projects.pluck(:import_source) already_added_projects_names = @already_added_projects.pluck(:import_source)
......
...@@ -10,18 +10,18 @@ class Import::GoogleCodeController < Import::BaseController ...@@ -10,18 +10,18 @@ class Import::GoogleCodeController < Import::BaseController
dump_file = params[:dump_file] dump_file = params[:dump_file]
unless dump_file.respond_to?(:read) unless dump_file.respond_to?(:read)
return redirect_to :back, alert: "You need to upload a Google Takeout archive." return redirect_back_or_default(options: { alert: "You need to upload a Google Takeout archive." })
end end
begin begin
dump = JSON.parse(dump_file.read) dump = JSON.parse(dump_file.read)
rescue rescue
return redirect_to :back, alert: "The uploaded file is not a valid Google Takeout archive." return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." })
end end
client = Gitlab::GoogleCodeImport::Client.new(dump) client = Gitlab::GoogleCodeImport::Client.new(dump)
unless client.valid? unless client.valid?
return redirect_to :back, alert: "The uploaded file is not a valid Google Takeout archive." return redirect_back_or_default(options: { alert: "The uploaded file is not a valid Google Takeout archive." })
end end
session[:google_code_dump] = dump session[:google_code_dump] = dump
......
...@@ -14,7 +14,7 @@ class InvitesController < ApplicationController ...@@ -14,7 +14,7 @@ class InvitesController < ApplicationController
redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}." redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}."
else else
redirect_to :back, alert: "The invitation could not be accepted." redirect_back_or_default(options: { alert: "The invitation could not be accepted." })
end end
end end
...@@ -31,7 +31,7 @@ class InvitesController < ApplicationController ...@@ -31,7 +31,7 @@ class InvitesController < ApplicationController
redirect_to path, notice: "You have declined the invitation to join #{label}." redirect_to path, notice: "You have declined the invitation to join #{label}."
else else
redirect_to :back, alert: "The invitation could not be declined." redirect_back_or_default(options: { alert: "The invitation could not be declined." })
end end
end end
......
...@@ -29,7 +29,7 @@ class Profiles::NotificationsController < Profiles::ApplicationController ...@@ -29,7 +29,7 @@ class Profiles::NotificationsController < Profiles::ApplicationController
flash[:alert] = "Failed to save new settings" flash[:alert] = "Failed to save new settings"
end end
redirect_to :back redirect_back_or_default(default: profile_notifications_path)
end end
format.js format.js
......
...@@ -26,7 +26,7 @@ class ProfilesController < Profiles::ApplicationController ...@@ -26,7 +26,7 @@ class ProfilesController < Profiles::ApplicationController
end end
respond_to do |format| respond_to do |format|
format.html { redirect_to :back } format.html { redirect_back_or_default(default: { action: 'show' }) }
end end
end end
......
...@@ -14,23 +14,23 @@ class Projects::CiServicesController < Projects::ApplicationController ...@@ -14,23 +14,23 @@ class Projects::CiServicesController < Projects::ApplicationController
end end
def update def update
if @service.update_attributes(service_params) if service.update_attributes(service_params)
redirect_to edit_namespace_project_ci_service_path(@project, @project.namespace, @service.to_param) redirect_to edit_namespace_project_ci_service_path(@project.namespace, @project, service.to_param)
else else
render 'edit' render 'edit'
end end
end end
def test def test
last_build = @project.builds.last last_build = @project.ci_builds.last
if @service.execute(last_build) if service.execute(last_build)
message = { notice: 'We successfully tested the service' } message = { notice: 'We successfully tested the service' }
else else
message = { alert: 'We tried to test the service but error occurred' } message = { alert: 'We tried to test the service but error occurred' }
end end
redirect_to :back, message redirect_back_or_default(options: message)
end end
private private
......
...@@ -24,7 +24,7 @@ class Projects::CiWebHooksController < Projects::ApplicationController ...@@ -24,7 +24,7 @@ class Projects::CiWebHooksController < Projects::ApplicationController
def test def test
Ci::TestHookService.new.execute(hook, current_user) Ci::TestHookService.new.execute(hook, current_user)
redirect_to :back redirect_back_or_default(default: { action: 'index' })
end end
def destroy def destroy
......
...@@ -17,9 +17,10 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -17,9 +17,10 @@ class Projects::CompareController < Projects::ApplicationController
execute(@project, head_ref, @project, base_ref) execute(@project, head_ref, @project, base_ref)
if compare_result if compare_result
@commits = compare_result.commits @commits = Commit.decorate(compare_result.commits, @project)
@diffs = compare_result.diffs @diffs = compare_result.diffs
@commit = @commits.last @commit = @commits.last
@first_commit = @commits.first
@line_notes = [] @line_notes = []
end end
end end
......
...@@ -51,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -51,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
@project.deploy_keys_projects.find_by(deploy_key_id: params[:id]).destroy @project.deploy_keys_projects.find_by(deploy_key_id: params[:id]).destroy
log_audit_event(@key.title, action: :destroy) log_audit_event(@key.title, action: :destroy)
redirect_to :back redirect_back_or_default(default: { action: 'index' })
end end
protected protected
......
...@@ -37,7 +37,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -37,7 +37,7 @@ class Projects::HooksController < Projects::ApplicationController
flash[:alert] = 'Hook execution failed. Ensure the project has commits.' flash[:alert] = 'Hook execution failed. Ensure the project has commits.'
end end
redirect_to :back redirect_back_or_default(default: { action: 'index' })
end end
def destroy def destroy
......
...@@ -14,6 +14,9 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -14,6 +14,9 @@ class Projects::IssuesController < Projects::ApplicationController
# Allow issues bulk update # Allow issues bulk update
before_action :authorize_admin_issues!, only: [:bulk_update] before_action :authorize_admin_issues!, only: [:bulk_update]
# Cross-reference merge requests
before_action :closed_by_merge_requests, only: [:show]
respond_to :html respond_to :html
def index def index
...@@ -109,7 +112,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -109,7 +112,7 @@ class Projects::IssuesController < Projects::ApplicationController
def bulk_update def bulk_update
result = Issues::BulkUpdateService.new(project, current_user, bulk_update_params).execute result = Issues::BulkUpdateService.new(project, current_user, bulk_update_params).execute
redirect_to :back, notice: "#{result[:count]} issues updated" redirect_back_or_default(default: { action: 'index' }, options: { notice: "#{result[:count]} issues updated" })
end end
def toggle_subscription def toggle_subscription
...@@ -118,6 +121,10 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -118,6 +121,10 @@ class Projects::IssuesController < Projects::ApplicationController
render nothing: true render nothing: true
end end
def closed_by_merge_requests
@closed_by_merge_requests ||= @issue.closed_by_merge_requests(current_user)
end
protected protected
def issue def issue
......
...@@ -56,6 +56,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -56,6 +56,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def diffs def diffs
@commit = @merge_request.last_commit @commit = @merge_request.last_commit
@first_commit = @merge_request.first_commit
@comments_allowed = @reply_allowed = true @comments_allowed = @reply_allowed = true
@comments_target = { @comments_target = {
noteable_type: 'MergeRequest', noteable_type: 'MergeRequest',
...@@ -89,7 +91,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -89,7 +91,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@target_project = merge_request.target_project @target_project = merge_request.target_project
@source_project = merge_request.source_project @source_project = merge_request.source_project
@commits = @merge_request.compare_commits @commits = @merge_request.compare_commits
@commit = @merge_request.compare_commits.last @commit = @merge_request.last_commit
@first_commit = @merge_request.first_commit
@diffs = @merge_request.compare_diffs @diffs = @merge_request.compare_diffs
@note_counts = Note.where(commit_id: @commits.map(&:id)). @note_counts = Note.where(commit_id: @commits.map(&:id)).
group(:commit_id).count group(:commit_id).count
...@@ -301,7 +304,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -301,7 +304,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@commits = @merge_request.commits @commits = @merge_request.commits
@merge_request_diff = @merge_request.merge_request_diff @merge_request_diff = @merge_request.merge_request_diff
if @merge_request.locked_long_ago? if @merge_request.locked_long_ago?
@merge_request.unlock_mr @merge_request.unlock_mr
@merge_request.close @merge_request.close
......
...@@ -75,11 +75,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -75,11 +75,7 @@ class Projects::MilestonesController < Projects::ApplicationController
end end
def sort_issues def sort_issues
@issues = @milestone.issues.where(id: params['sortable_issue']) @milestone.sort_issues(params['sortable_issue'].map(&:to_i))
@issues.each do |issue|
issue.position = params['sortable_issue'].index(issue.id.to_s) + 1
issue.save
end
render json: { saved: true } render json: { saved: true }
end end
......
...@@ -25,7 +25,7 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -25,7 +25,7 @@ class Projects::NotesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.json { render_note_json(@note) } format.json { render_note_json(@note) }
format.html { redirect_to :back } format.html { redirect_back_or_default }
end end
end end
...@@ -34,7 +34,7 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -34,7 +34,7 @@ class Projects::NotesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.json { render_note_json(@note) } format.json { render_note_json(@note) }
format.html { redirect_to :back } format.html { redirect_back_or_default }
end end
end end
......
...@@ -83,7 +83,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -83,7 +83,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def leave def leave
if @project.namespace == current_user.namespace if @project.namespace == current_user.namespace
return redirect_to(:back, alert: 'You can not leave your own project. Transfer or delete the project.') message = 'You can not leave your own project. Transfer or delete the project.'
return redirect_back_or_default(default: { action: 'index' }, options: { alert: message })
end end
@project_member = @project.project_members.find_by(user_id: current_user) @project_member = @project.project_members.find_by(user_id: current_user)
......
...@@ -54,7 +54,7 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -54,7 +54,7 @@ class Projects::ServicesController < Projects::ApplicationController
message = { alert: error_message } message = { alert: error_message }
end end
redirect_to :back, message redirect_back_or_default(options: message)
end end
private private
......
...@@ -21,6 +21,7 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -21,6 +21,7 @@ class Projects::SnippetsController < Projects::ApplicationController
filter: :by_project, filter: :by_project,
project: @project project: @project
}) })
@snippets = @snippets.page(params[:page]).per(PER_PAGE)
end end
def new def new
......
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
include ExtractsPath
prepend_before_filter :render_go_import, only: [:show] prepend_before_filter :render_go_import, only: [:show]
skip_before_action :authenticate_user!, only: [:show, :activity] skip_before_action :authenticate_user!, only: [:show, :activity]
before_action :project, except: [:new, :create] before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create] before_action :repository, except: [:new, :create]
before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
# Authorize # Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] before_action :authorize_admin_project!, only: [:edit, :update]
before_action :event_filter, only: [:show, :activity] before_action :event_filter, only: [:show, :activity]
layout :determine_layout layout :determine_layout
...@@ -56,6 +59,8 @@ class ProjectsController < ApplicationController ...@@ -56,6 +59,8 @@ class ProjectsController < ApplicationController
end end
def transfer def transfer
return access_denied! unless can?(current_user, :change_namespace, @project)
namespace = Namespace.find_by(id: params[:new_namespace_id]) namespace = Namespace.find_by(id: params[:new_namespace_id])
::Projects::TransferService.new(project, current_user).execute(namespace) ::Projects::TransferService.new(project, current_user).execute(namespace)
...@@ -64,6 +69,15 @@ class ProjectsController < ApplicationController ...@@ -64,6 +69,15 @@ class ProjectsController < ApplicationController
end end
end end
def remove_fork
return access_denied! unless can?(current_user, :remove_fork_project, @project)
if @project.forked?
@project.forked_project_link.destroy
flash[:notice] = 'The fork relationship has been removed.'
end
end
def activity def activity
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -87,7 +101,7 @@ class ProjectsController < ApplicationController ...@@ -87,7 +101,7 @@ class ProjectsController < ApplicationController
render 'projects/empty' render 'projects/empty'
else else
if current_user if current_user
@membership = @project.project_member_by_id(current_user.id) @membership = @project.team.find_member(current_user.id)
end end
render :show render :show
...@@ -139,6 +153,7 @@ class ProjectsController < ApplicationController ...@@ -139,6 +153,7 @@ class ProjectsController < ApplicationController
def archive def archive
return access_denied! unless can?(current_user, :archive_project, @project) return access_denied! unless can?(current_user, :archive_project, @project)
@project.archive! @project.archive!
respond_to do |format| respond_to do |format|
...@@ -148,6 +163,7 @@ class ProjectsController < ApplicationController ...@@ -148,6 +163,7 @@ class ProjectsController < ApplicationController
def unarchive def unarchive
return access_denied! unless can?(current_user, :archive_project, @project) return access_denied! unless can?(current_user, :archive_project, @project)
@project.unarchive! @project.unarchive!
respond_to do |format| respond_to do |format|
...@@ -227,4 +243,14 @@ class ProjectsController < ApplicationController ...@@ -227,4 +243,14 @@ class ProjectsController < ApplicationController
render "go_import", layout: false render "go_import", layout: false
end end
def repo_exists?
project.repository_exists? && !project.empty_repo?
end
# Override get_id from ExtractsPath, which returns the branch and file path
# for the blob/tree, which in this case is just the root of the default branch.
def get_id
project.repository.root_ref
end
end end
...@@ -53,15 +53,36 @@ class IssuableFinder ...@@ -53,15 +53,36 @@ class IssuableFinder
end end
end end
def project?
params[:project_id].present?
end
def project def project
return @project if defined?(@project) return @project if defined?(@project)
@project = if project?
if params[:project_id].present? @project = Project.find(params[:project_id])
Project.find(params[:project_id])
else unless Ability.abilities.allowed?(current_user, :read_project, @project)
nil @project = nil
end end
else
@project = nil
end
@project
end
def projects
return @projects if defined?(@projects)
if project?
project
elsif current_user && params[:authorized_only].presence && !current_user_related?
current_user.authorized_projects
else
ProjectsFinder.new.execute(current_user)
end
end end
def search def search
...@@ -72,7 +93,7 @@ class IssuableFinder ...@@ -72,7 +93,7 @@ class IssuableFinder
params[:milestone_title].present? params[:milestone_title].present?
end end
def no_milestones? def filter_by_no_milestone?
milestones? && params[:milestone_title] == Milestone::None.title milestones? && params[:milestone_title] == Milestone::None.title
end end
...@@ -81,12 +102,22 @@ class IssuableFinder ...@@ -81,12 +102,22 @@ class IssuableFinder
@milestones = @milestones =
if milestones? if milestones?
Milestone.where(title: params[:milestone_title]) scope = Milestone.where(project_id: projects)
scope.where(title: params[:milestone_title])
else else
nil nil
end end
end end
def labels?
params[:label_name].present?
end
def filter_by_no_label?
labels? && params[:label_name] == Label::None.title
end
def assignee? def assignee?
params[:assignee_id].present? params[:assignee_id].present?
end end
...@@ -120,19 +151,7 @@ class IssuableFinder ...@@ -120,19 +151,7 @@ class IssuableFinder
private private
def init_collection def init_collection
table_name = klass.table_name klass.all
if project
if Ability.abilities.allowed?(current_user, :read_project, project)
project.send(table_name)
else
[]
end
elsif current_user && params[:authorized_only].presence && !current_user_related?
klass.of_projects(current_user.authorized_projects).references(:project)
else
klass.of_projects(ProjectsFinder.new.execute(current_user)).references(:project)
end
end end
def by_scope(items) def by_scope(items)
...@@ -170,7 +189,12 @@ class IssuableFinder ...@@ -170,7 +189,12 @@ class IssuableFinder
end end
def by_project(items) def by_project(items)
items = items.of_projects(project.id) if project items =
if projects
items.of_projects(projects).references(:project)
else
items.none
end
items items
end end
...@@ -185,18 +209,6 @@ class IssuableFinder ...@@ -185,18 +209,6 @@ class IssuableFinder
items.sort(params[:sort]) items.sort(params[:sort])
end end
def by_milestone(items)
if milestones?
if no_milestones?
items = items.where(milestone_id: [-1, nil])
else
items = items.where(milestone_id: milestones.try(:pluck, :id))
end
end
items
end
def by_assignee(items) def by_assignee(items)
if assignee? if assignee?
items = items.where(assignee_id: assignee.try(:id)) items = items.where(assignee_id: assignee.try(:id))
...@@ -213,20 +225,36 @@ class IssuableFinder ...@@ -213,20 +225,36 @@ class IssuableFinder
items items
end end
def by_label(items) def by_milestone(items)
if params[:label_name].present? if milestones?
if params[:label_name] == Label::None.title if filter_by_no_milestone?
item_ids = LabelLink.where(target_type: klass.name).pluck(:target_id) items = items.where(milestone_id: [-1, nil])
else
items = items.joins(:milestone).where(milestones: { title: params[:milestone_title] })
if projects
items = items.where(milestones: { project_id: projects })
end
end
end
items
end
items = items.where('id NOT IN (?)', item_ids) def by_label(items)
if labels?
if filter_by_no_label?
items = items.
joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{klass.name}' AND label_links.target_id = #{klass.table_name}.id").
where(label_links: { id: nil })
else else
label_names = params[:label_name].split(",") label_names = params[:label_name].split(",")
item_ids = LabelLink.joins(:label). items = items.joins(:labels).where(labels: { title: label_names })
where('labels.title in (?)', label_names).
where(target_type: klass.name).pluck(:target_id)
items = items.where(id: item_ids) if projects
items = items.where(labels: { project_id: projects })
end
end end
end end
......
...@@ -27,7 +27,7 @@ module AppearancesHelper ...@@ -27,7 +27,7 @@ module AppearancesHelper
if brand_item && brand_item.light_logo? if brand_item && brand_item.light_logo?
image_tag brand_item.light_logo image_tag brand_item.light_logo
else else
image_tag 'logo.svg' render 'shared/logo.svg'
end end
end end
end end
...@@ -170,7 +170,8 @@ module DiffHelper ...@@ -170,7 +170,8 @@ module DiffHelper
def commit_for_diff(diff) def commit_for_diff(diff)
if diff.deleted_file if diff.deleted_file
@merge_request ? @merge_request.commits.last : @commit.parents.first first_commit = @first_commit || @commit
first_commit.parent
else else
@commit @commit
end end
......
...@@ -19,7 +19,8 @@ module GitlabMarkdownHelper ...@@ -19,7 +19,8 @@ module GitlabMarkdownHelper
escape_once(body) escape_once(body)
end end
gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: current_user) user = current_user if defined?(current_user)
gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: user)
fragment = Nokogiri::HTML::DocumentFragment.parse(gfm_body) fragment = Nokogiri::HTML::DocumentFragment.parse(gfm_body)
if fragment.children.size == 1 && fragment.children[0].name == 'a' if fragment.children.size == 1 && fragment.children[0].name == 'a'
...@@ -45,29 +46,39 @@ module GitlabMarkdownHelper ...@@ -45,29 +46,39 @@ module GitlabMarkdownHelper
end end
def markdown(text, context = {}) def markdown(text, context = {})
return "" unless text.present?
context.reverse_merge!( context.reverse_merge!(
current_user: current_user,
path: @path, path: @path,
pipeline: :default,
project: @project, project: @project,
project_wiki: @project_wiki, project_wiki: @project_wiki,
ref: @ref ref: @ref
) )
Gitlab::Markdown.render(text, context) user = current_user if defined?(current_user)
html = Gitlab::Markdown.render(text, context)
Gitlab::Markdown.post_process(html, pipeline: context[:pipeline], project: @project, user: user)
end end
# TODO (rspeicher): Remove all usages of this helper and just call `markdown` # TODO (rspeicher): Remove all usages of this helper and just call `markdown`
# with a custom pipeline depending on the content being rendered # with a custom pipeline depending on the content being rendered
def gfm(text, options = {}) def gfm(text, options = {})
return "" unless text.present?
options.reverse_merge!( options.reverse_merge!(
current_user: current_user,
path: @path, path: @path,
pipeline: :default,
project: @project, project: @project,
project_wiki: @project_wiki, project_wiki: @project_wiki,
ref: @ref ref: @ref
) )
Gitlab::Markdown.gfm(text, options) user = current_user if defined?(current_user)
html = Gitlab::Markdown.gfm(text, options)
Gitlab::Markdown.post_process(html, pipeline: options[:pipeline], project: @project, user: user)
end end
def asciidoc(text) def asciidoc(text)
......
...@@ -83,6 +83,10 @@ module IssuesHelper ...@@ -83,6 +83,10 @@ module IssuesHelper
end end
end end
def merge_requests_sentence(merge_requests)
merge_requests.map(&:to_reference).to_sentence(last_word_connector: ', or ')
end
# Required for Gitlab::Markdown::IssueReferenceFilter # Required for Gitlab::Markdown::IssueReferenceFilter
module_function :url_for_issue module_function :url_for_issue
end end
...@@ -92,11 +92,19 @@ module LabelsHelper ...@@ -92,11 +92,19 @@ module LabelsHelper
end end
end end
def project_labels_options(project) def projects_labels_options
labels = project.labels.to_a labels =
labels.unshift(Label::None) if @project
labels.unshift(Label::Any) @project.labels
options_from_collection_for_select(labels, 'name', 'title', params[:label_name]) else
Label.where(project_id: @projects)
end
grouped_labels = Labels::GroupService.new(labels).execute
grouped_labels.unshift(Label::None)
grouped_labels.unshift(Label::Any)
options_from_collection_for_select(grouped_labels, 'name', 'title', params[:label_name])
end end
# Required for Gitlab::Markdown::LabelReferenceFilter # Required for Gitlab::Markdown::LabelReferenceFilter
......
...@@ -34,7 +34,8 @@ module PreferencesHelper ...@@ -34,7 +34,8 @@ module PreferencesHelper
def project_view_choices def project_view_choices
[ [
['Readme (default)', :readme], ['Readme (default)', :readme],
['Activity view', :activity] ['Activity view', :activity],
['Files view', :files]
] ]
end end
...@@ -46,8 +47,7 @@ module PreferencesHelper ...@@ -46,8 +47,7 @@ module PreferencesHelper
Gitlab::ColorSchemes.for_user(current_user).css_class Gitlab::ColorSchemes.for_user(current_user).css_class
end end
def prefer_readme? def default_project_view
!current_user || current_user ? current_user.project_view : 'readme'
current_user.project_view == 'readme'
end end
end end
...@@ -70,6 +70,10 @@ module ProjectsHelper ...@@ -70,6 +70,10 @@ module ProjectsHelper
"You are going to transfer #{project.name_with_namespace} to another owner. Are you ABSOLUTELY sure?" "You are going to transfer #{project.name_with_namespace} to another owner. Are you ABSOLUTELY sure?"
end end
def remove_fork_project_message(project)
"You are going to remove the fork relationship to source project #{@project.forked_from_project.name_with_namespace}. Are you ABSOLUTELY sure?"
end
def project_nav_tabs def project_nav_tabs
@nav_tabs ||= get_project_nav_tabs(@project, current_user) @nav_tabs ||= get_project_nav_tabs(@project, current_user)
end end
...@@ -113,7 +117,7 @@ module ProjectsHelper ...@@ -113,7 +117,7 @@ module ProjectsHelper
nav_tabs << :merge_requests nav_tabs << :merge_requests
end end
if can?(current_user, :read_build, project) if project.gitlab_ci? && can?(current_user, :read_build, project)
nav_tabs << :builds nav_tabs << :builds
end end
......
...@@ -110,22 +110,4 @@ module TabHelper ...@@ -110,22 +110,4 @@ module TabHelper
'active' 'active'
end end
end end
# Use nav_tab for save controller/action but different params
def nav_tab(key, value, &block)
o = {}
o[:class] = ""
if value.nil?
o[:class] << " active" if params[key].blank?
else
o[:class] << " active" if params[key] == value
end
if block_given?
content_tag(:li, capture(&block), o)
else
content_tag(:li, nil, o)
end
end
end end
class AbuseReportMailer < BaseMailer
include Gitlab::CurrentSettings
def notify(abuse_report_id)
@abuse_report = AbuseReport.find(abuse_report_id)
mail(
to: current_application_settings.admin_notification_email,
subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
)
end
end
...@@ -205,7 +205,8 @@ class Ability ...@@ -205,7 +205,8 @@ class Ability
:change_visibility_level, :change_visibility_level,
:rename_project, :rename_project,
:remove_project, :remove_project,
:archive_project :archive_project,
:remove_fork_project
] ]
end end
......
...@@ -45,6 +45,10 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -45,6 +45,10 @@ class ApplicationSetting < ActiveRecord::Base
allow_blank: true, allow_blank: true,
format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" } format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }
validates :admin_notification_email,
allow_blank: true,
email: true
validates_each :restricted_visibility_levels do |record, attr, value| validates_each :restricted_visibility_levels do |record, attr, value|
unless value.nil? unless value.nil?
value.each do |level| value.each do |level|
......
...@@ -2,13 +2,13 @@ class Commit ...@@ -2,13 +2,13 @@ class Commit
extend ActiveModel::Naming extend ActiveModel::Naming
include ActiveModel::Conversion include ActiveModel::Conversion
include Mentionable
include Participable include Participable
include Mentionable
include Referable include Referable
include StaticModel include StaticModel
attr_mentionable :safe_message attr_mentionable :safe_message
participant :author, :committer, :notes, :mentioned_users participant :author, :committer, :notes
attr_accessor :project attr_accessor :project
...@@ -164,6 +164,14 @@ class Commit ...@@ -164,6 +164,14 @@ class Commit
@committer ||= User.find_by_any_email(committer_email) @committer ||= User.find_by_any_email(committer_email)
end end
def parents
@parents ||= parent_ids.map { |id| project.commit(id) }
end
def parent
@parent ||= project.commit(self.parent_id) if self.parent_id
end
def notes def notes
project.notes.for_commit_id(self.id) project.notes.for_commit_id(self.id)
end end
...@@ -181,10 +189,6 @@ class Commit ...@@ -181,10 +189,6 @@ class Commit
@raw.short_id(7) @raw.short_id(7)
end end
def parents
@parents ||= Commit.decorate(super, project)
end
def ci_commit def ci_commit
project.ci_commit(sha) project.ci_commit(sha)
end end
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
# #
module Issuable module Issuable
extend ActiveSupport::Concern extend ActiveSupport::Concern
include Mentionable
include Participable include Participable
include Mentionable
included do included do
belongs_to :author, class_name: "User" belongs_to :author, class_name: "User"
...@@ -47,8 +47,7 @@ module Issuable ...@@ -47,8 +47,7 @@ module Issuable
prefix: true prefix: true
attr_mentionable :title, :description attr_mentionable :title, :description
participant :author, :assignee, :notes_with_associations
participant :author, :assignee, :notes_with_associations, :mentioned_users
end end
module ClassMethods module ClassMethods
...@@ -86,6 +85,10 @@ module Issuable ...@@ -86,6 +85,10 @@ module Issuable
assignee_id_changed? assignee_id_changed?
end end
def open?
opened? || reopened?
end
# #
# Votes # Votes
# #
......
...@@ -20,6 +20,12 @@ module Mentionable ...@@ -20,6 +20,12 @@ module Mentionable
end end
end end
included do
if self < Participable
participant ->(current_user) { mentioned_users(current_user, load_lazy_references: false) }
end
end
# Returns the text used as the body of a Note when this object is referenced # Returns the text used as the body of a Note when this object is referenced
# #
# By default this will be the class name and the result of calling # By default this will be the class name and the result of calling
...@@ -41,22 +47,22 @@ module Mentionable ...@@ -41,22 +47,22 @@ module Mentionable
self self
end end
def all_references(current_user = self.author, text = self.mentionable_text) def all_references(current_user = self.author, text = self.mentionable_text, load_lazy_references: true)
ext = Gitlab::ReferenceExtractor.new(self.project, current_user) ext = Gitlab::ReferenceExtractor.new(self.project, current_user, load_lazy_references: load_lazy_references)
ext.analyze(text) ext.analyze(text)
ext ext
end end
def mentioned_users(current_user = nil) def mentioned_users(current_user = nil, load_lazy_references: true)
all_references(current_user).users.uniq all_references(current_user, load_lazy_references: load_lazy_references).users
end end
# Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference. # Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference.
def referenced_mentionables(current_user = self.author, text = self.mentionable_text) def referenced_mentionables(current_user = self.author, text = self.mentionable_text, load_lazy_references: true)
return [] if text.blank? return [] if text.blank?
refs = all_references(current_user, text) refs = all_references(current_user, text, load_lazy_references: load_lazy_references)
(refs.issues + refs.merge_requests + refs.commits).uniq - [local_reference] (refs.issues + refs.merge_requests + refs.commits) - [local_reference]
end end
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+. # Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
# # ... # # ...
# #
# participant :author, :assignee, :mentioned_users, :notes # participant :author, :assignee, :notes, ->(current_user) { mentioned_users(current_user) }
# end # end
# #
# issue = Issue.last # issue = Issue.last
...@@ -27,7 +27,7 @@ module Participable ...@@ -27,7 +27,7 @@ module Participable
module ClassMethods module ClassMethods
def participant(*attrs) def participant(*attrs)
participant_attrs.concat(attrs.map(&:to_s)) participant_attrs.concat(attrs)
end end
def participant_attrs def participant_attrs
...@@ -37,33 +37,39 @@ module Participable ...@@ -37,33 +37,39 @@ module Participable
# Be aware that this method makes a lot of sql queries. # Be aware that this method makes a lot of sql queries.
# Save result into variable if you are going to reuse it inside same request # Save result into variable if you are going to reuse it inside same request
def participants(current_user = self.author) def participants(current_user = self.author, load_lazy_references: true)
self.class.participant_attrs.flat_map do |attr| participants = self.class.participant_attrs.flat_map do |attr|
meth = method(attr)
value = value =
if meth.arity == 1 || meth.arity == -1 if attr.respond_to?(:call)
meth.call(current_user) instance_exec(current_user, &attr)
else else
meth.call send(attr)
end end
participants_for(value, current_user) participants_for(value, current_user)
end.compact.uniq.select do |user| end.compact.uniq
user.can?(:read_project, self.project)
if load_lazy_references
participants = Gitlab::Markdown::ReferenceFilter::LazyReference.load(participants).uniq
participants.select! do |user|
user.can?(:read_project, project)
end
end end
participants
end end
private private
def participants_for(value, current_user = nil) def participants_for(value, current_user = nil)
case value case value
when User when User, Gitlab::Markdown::ReferenceFilter::LazyReference
[value] [value]
when Enumerable, ActiveRecord::Relation when Enumerable, ActiveRecord::Relation
value.flat_map { |v| participants_for(v, current_user) } value.flat_map { |v| participants_for(v, current_user) }
when Participable when Participable
value.participants(current_user) value.participants(current_user, load_lazy_references: false)
end end
end end
end end
class GroupLabel
attr_accessor :title, :labels
alias_attribute :name, :title
def initialize(title, labels)
@title = title
@labels = labels
end
end
class GroupMilestone class GroupMilestone
attr_accessor :title, :milestones
alias_attribute :name, :title alias_attribute :name, :title
def initialize(title, milestones) def initialize(title, milestones)
...@@ -7,18 +7,10 @@ class GroupMilestone ...@@ -7,18 +7,10 @@ class GroupMilestone
@milestones = milestones @milestones = milestones
end end
def title
@title
end
def safe_title def safe_title
@title.parameterize @title.parameterize
end end
def milestones
@milestones
end
def projects def projects
milestones.map { |milestone| milestone.project } milestones.map { |milestone| milestone.project }
end end
......
...@@ -95,4 +95,14 @@ class Issue < ActiveRecord::Base ...@@ -95,4 +95,14 @@ class Issue < ActiveRecord::Base
def source_project def source_project
project project
end end
# From all notes on this issue, we'll select the system notes about linked
# merge requests. Of those, the MRs closing `self` are returned.
def closed_by_merge_requests(current_user = nil)
return [] unless open?
notes.system.flat_map do |note|
note.all_references(current_user).merge_requests
end.uniq.select { |mr| mr.open? && mr.closes_issue?(self) }
end
end end
...@@ -42,7 +42,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -42,7 +42,7 @@ class MergeRequest < ActiveRecord::Base
after_create :create_merge_request_diff after_create :create_merge_request_diff
after_update :update_merge_request_diff after_update :update_merge_request_diff
delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil delegate :commits, :diffs, to: :merge_request_diff, prefix: nil
# When this attribute is true some MR validation is ignored # When this attribute is true some MR validation is ignored
# It allows us to close or modify broken merge requests # It allows us to close or modify broken merge requests
...@@ -159,6 +159,18 @@ class MergeRequest < ActiveRecord::Base ...@@ -159,6 +159,18 @@ class MergeRequest < ActiveRecord::Base
reference reference
end end
def last_commit
merge_request_diff ? merge_request_diff.last_commit : compare_commits.last
end
def first_commit
merge_request_diff ? merge_request_diff.first_commit : compare_commits.first
end
def last_commit_short_sha
last_commit.short_id
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"
...@@ -224,10 +236,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -224,10 +236,6 @@ class MergeRequest < ActiveRecord::Base
self.target_project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::CLOSED).last self.target_project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::CLOSED).last
end end
def open?
opened? || reopened?
end
def work_in_progress? def work_in_progress?
!!(title =~ /\A\[?WIP\]?:? /i) !!(title =~ /\A\[?WIP\]?:? /i)
end end
...@@ -296,6 +304,10 @@ class MergeRequest < ActiveRecord::Base ...@@ -296,6 +304,10 @@ class MergeRequest < ActiveRecord::Base
target_project target_project
end end
def closes_issue?(issue)
closes_issues.include?(issue)
end
# Return the set of issues that will be closed if this merge request is accepted. # Return the set of issues that will be closed if this merge request is accepted.
def closes_issues(current_user = self.author) def closes_issues(current_user = self.author)
if target_branch == project.default_branch if target_branch == project.default_branch
......
...@@ -55,6 +55,10 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -55,6 +55,10 @@ class MergeRequestDiff < ActiveRecord::Base
commits.first commits.first
end end
def first_commit
commits.last
end
def last_commit_short_sha def last_commit_short_sha
@last_commit_short_sha ||= last_commit.short_id @last_commit_short_sha ||= last_commit.short_id
end end
...@@ -163,7 +167,8 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -163,7 +167,8 @@ class MergeRequestDiff < ActiveRecord::Base
merge_request.fetch_ref merge_request.fetch_ref
# Get latest sha of branch from source project # Get latest sha of branch from source project
source_sha = merge_request.source_project.commit(source_branch).sha source_commit = merge_request.source_project.commit(source_branch)
source_sha = source_commit.try(:sha)
Gitlab::CompareResult.new( Gitlab::CompareResult.new(
Gitlab::Git::Compare.new( Gitlab::Git::Compare.new(
......
...@@ -105,4 +105,36 @@ class Milestone < ActiveRecord::Base ...@@ -105,4 +105,36 @@ class Milestone < ActiveRecord::Base
def author_id def author_id
nil nil
end end
# Sorts the issues for the given IDs.
#
# This method runs a single SQL query using a CASE statement to update the
# position of all issues in the current milestone (scoped to the list of IDs).
#
# Given the ids [10, 20, 30] this method produces a SQL query something like
# the following:
#
# UPDATE issues
# SET position = CASE
# WHEN id = 10 THEN 1
# WHEN id = 20 THEN 2
# WHEN id = 30 THEN 3
# ELSE position
# END
# WHERE id IN (10, 20, 30);
#
# This method expects that the IDs given in `ids` are already Fixnums.
def sort_issues(ids)
pairs = []
ids.each_with_index do |id, index|
pairs << id
pairs << index + 1
end
conditions = 'WHEN id = ? THEN ? ' * ids.length
issues.where(id: ids).
update_all(["position = CASE #{conditions} ELSE position END", *pairs])
end
end end
...@@ -22,14 +22,14 @@ require 'carrierwave/orm/activerecord' ...@@ -22,14 +22,14 @@ require 'carrierwave/orm/activerecord'
require 'file_size_validator' require 'file_size_validator'
class Note < ActiveRecord::Base class Note < ActiveRecord::Base
include Mentionable
include Gitlab::CurrentSettings include Gitlab::CurrentSettings
include Participable include Participable
include Mentionable
default_value_for :system, false default_value_for :system, false
attr_mentionable :note attr_mentionable :note
participant :author, :mentioned_users participant :author
belongs_to :project belongs_to :project
belongs_to :noteable, polymorphic: true belongs_to :noteable, polymorphic: true
......
...@@ -250,11 +250,12 @@ class Project < ActiveRecord::Base ...@@ -250,11 +250,12 @@ class Project < ActiveRecord::Base
# Use of unscoped ensures we're not secretly adding any ORDER BYs, which # Use of unscoped ensures we're not secretly adding any ORDER BYs, which
# have a negative impact on performance (and aren't needed for this # have a negative impact on performance (and aren't needed for this
# query). # query).
unscoped. projects = unscoped.
joins(:namespace). joins(:namespace).
iwhere('namespaces.path' => namespace_path). iwhere('namespaces.path' => namespace_path)
iwhere('projects.path' => project_path).
take projects.where('projects.path' => project_path).take ||
projects.iwhere('projects.path' => project_path).take
end end
def visibility_levels def visibility_levels
...@@ -587,7 +588,7 @@ class Project < ActiveRecord::Base ...@@ -587,7 +588,7 @@ class Project < ActiveRecord::Base
end end
def empty_repo? def empty_repo?
!repository.exists? || repository.empty? !repository.exists? || !repository.has_visible_content?
end end
def repo def repo
......
...@@ -8,6 +8,14 @@ class Repository ...@@ -8,6 +8,14 @@ class Repository
attr_accessor :raw_repository, :path_with_namespace, :project attr_accessor :raw_repository, :path_with_namespace, :project
def self.clean_old_archives
repository_downloads_path = Gitlab.config.gitlab.repository_downloads_path
return unless File.directory?(repository_downloads_path)
Gitlab::Popen.popen(%W(find #{repository_downloads_path} -not -path #{repository_downloads_path} -mmin +120 -delete))
end
def initialize(path_with_namespace, default_branch = nil, project = nil) def initialize(path_with_namespace, default_branch = nil, project = nil)
@path_with_namespace = path_with_namespace @path_with_namespace = path_with_namespace
@project = project @project = project
...@@ -36,6 +44,19 @@ class Repository ...@@ -36,6 +44,19 @@ class Repository
raw_repository.empty? raw_repository.empty?
end end
#
# Git repository can contains some hidden refs like:
# /refs/notes/*
# /refs/git-as-svn/*
# /refs/pulls/*
# This refs by default not visible in project page and not cloned to client side.
#
# This method return true if repository contains some content visible in project page.
#
def has_visible_content?
!raw_repository.branches.empty?
end
def commit(id = 'HEAD') def commit(id = 'HEAD')
return nil unless raw_repository return nil unless raw_repository
commit = Gitlab::Git::Commit.find(raw_repository, id) commit = Gitlab::Git::Commit.find(raw_repository, id)
...@@ -269,14 +290,6 @@ class Repository ...@@ -269,14 +290,6 @@ class Repository
end end
# Remove archives older than 2 hours # Remove archives older than 2 hours
def clean_old_archives
repository_downloads_path = Gitlab.config.gitlab.repository_downloads_path
return unless File.directory?(repository_downloads_path)
Gitlab::Popen.popen(%W(find #{repository_downloads_path} -not -path #{repository_downloads_path} -mmin +120 -delete))
end
def branches_sorted_by(value) def branches_sorted_by(value)
case value case value
when 'recently_updated' when 'recently_updated'
...@@ -312,13 +325,7 @@ class Repository ...@@ -312,13 +325,7 @@ class Repository
end end
def blob_for_diff(commit, diff) def blob_for_diff(commit, diff)
file = blob_at(commit.id, diff.new_path) blob_at(commit.id, diff.file_path)
unless file
file = prev_blob_for_diff(commit, diff)
end
file
end end
def prev_blob_for_diff(commit, diff) def prev_blob_for_diff(commit, diff)
...@@ -492,6 +499,10 @@ class Repository ...@@ -492,6 +499,10 @@ class Repository
end end
end end
def merge_base(first_commit_id, second_commit_id)
rugged.merge_base(first_commit_id, second_commit_id)
end
def search_files(query, ref) def search_files(query, ref)
offset = 2 offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref}) args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
......
...@@ -184,7 +184,7 @@ class User < ActiveRecord::Base ...@@ -184,7 +184,7 @@ class User < ActiveRecord::Base
# User's Project preference # User's Project preference
# Note: When adding an option, it MUST go on the end of the array. # Note: When adding an option, it MUST go on the end of the array.
enum project_view: [:readme, :activity] enum project_view: [:readme, :activity, :files]
alias_attribute :private_token, :authentication_token alias_attribute :private_token, :authentication_token
...@@ -739,12 +739,15 @@ class User < ActiveRecord::Base ...@@ -739,12 +739,15 @@ class User < ActiveRecord::Base
end end
def toggle_star(project) def toggle_star(project)
user_star_project = users_star_projects. UsersStarProject.transaction do
where(project: project, user: self).take user_star_project = users_star_projects.
if user_star_project where(project: project, user: self).lock(true).first
user_star_project.destroy
else if user_star_project
UsersStarProject.create!(project: project, user: self) user_star_project.destroy
else
UsersStarProject.create!(project: project, user: self)
end
end end
end end
......
...@@ -7,7 +7,7 @@ class ArchiveRepositoryService ...@@ -7,7 +7,7 @@ class ArchiveRepositoryService
end end
def execute(options = {}) def execute(options = {})
project.repository.clean_old_archives RepositoryArchiveCacheWorker.perform_async
metadata = project.repository.archive_metadata(ref, storage_path, format) metadata = project.repository.archive_metadata(ref, storage_path, format)
raise "Repository or ref not found" if metadata.empty? raise "Repository or ref not found" if metadata.empty?
......
...@@ -49,10 +49,13 @@ class GitPushService ...@@ -49,10 +49,13 @@ class GitPushService
elsif push_to_existing_branch?(ref, oldrev) elsif push_to_existing_branch?(ref, oldrev)
# Collect data for this git push # Collect data for this git push
@push_commits = project.repository.commits_between(oldrev, newrev) @push_commits = project.repository.commits_between(oldrev, newrev)
project.update_merge_requests(oldrev, newrev, ref, @user)
process_commit_messages(ref) process_commit_messages(ref)
end end
# Update merge requests that may be affected by this push. A new branch
# could cause the last commit of a merge request to change.
project.update_merge_requests(oldrev, newrev, ref, @user)
@push_data = build_push_data(oldrev, newrev, ref) @push_data = build_push_data(oldrev, newrev, ref)
# If CI was disabled but .gitlab-ci.yml file was pushed # If CI was disabled but .gitlab-ci.yml file was pushed
...@@ -76,7 +79,7 @@ class GitPushService ...@@ -76,7 +79,7 @@ class GitPushService
authors = Hash.new do |hash, commit| authors = Hash.new do |hash, commit|
email = commit.author_email email = commit.author_email
return hash[email] if hash.has_key?(email) next hash[email] if hash.has_key?(email)
hash[email] = commit_user(commit) hash[email] = commit_user(commit)
end end
......
module Labels
class GroupService < ::BaseService
def initialize(project_labels)
@project_labels = project_labels.group_by(&:title)
end
def execute
build(@project_labels)
end
def label(title)
if title
group_label = @project_labels[title].group_by(&:title)
build(group_label).first
else
nil
end
end
private
def build(label)
label.map { |title, labels| GroupLabel.new(title, labels) }
end
end
end
...@@ -6,6 +6,7 @@ module MergeRequests ...@@ -6,6 +6,7 @@ module MergeRequests
# #
class PostMergeService < MergeRequests::BaseService class PostMergeService < MergeRequests::BaseService
def execute(merge_request) def execute(merge_request)
close_issues(merge_request)
merge_request.mark_as_merged merge_request.mark_as_merged
create_merge_event(merge_request, current_user) create_merge_event(merge_request, current_user)
create_note(merge_request) create_note(merge_request)
...@@ -15,6 +16,15 @@ module MergeRequests ...@@ -15,6 +16,15 @@ module MergeRequests
private private
def close_issues(merge_request)
return unless merge_request.target_branch == project.default_branch
closed_issues = merge_request.closes_issues(current_user)
closed_issues.each do |issue|
Issues::CloseService.new(project, current_user, {}).execute(issue, merge_request)
end
end
def create_merge_event(merge_request, current_user) def create_merge_event(merge_request, current_user)
EventCreateService.new.merge_mr(merge_request, current_user) EventCreateService.new.merge_mr(merge_request, current_user)
end end
......
...@@ -5,13 +5,20 @@ module MergeRequests ...@@ -5,13 +5,20 @@ module MergeRequests
@oldrev, @newrev = oldrev, newrev @oldrev, @newrev = oldrev, newrev
@branch_name = Gitlab::Git.ref_name(ref) @branch_name = Gitlab::Git.ref_name(ref)
@fork_merge_requests = @project.fork_merge_requests.opened
@commits = @project.repository.commits_between(oldrev, newrev)
close_merge_requests find_new_commits
reload_merge_requests reload_merge_requests
# Leave a system note if a branch was deleted/added
if branch_added? || branch_removed?
comment_mr_branch_presence_changed
comment_mr_with_commits
else
comment_mr_with_commits
close_merge_requests
end
execute_mr_web_hooks execute_mr_web_hooks
comment_mr_with_commits
reset_approvals_for_merge_requests reset_approvals_for_merge_requests
true true
...@@ -32,7 +39,6 @@ module MergeRequests ...@@ -32,7 +39,6 @@ module MergeRequests
commit_ids.include?(merge_request.last_commit.id) commit_ids.include?(merge_request.last_commit.id)
end end
merge_requests.uniq.select(&:source_project).each do |merge_request| merge_requests.uniq.select(&:source_project).each do |merge_request|
MergeRequests::PostMergeService. MergeRequests::PostMergeService.
new(merge_request.target_project, @current_user). new(merge_request.target_project, @current_user).
...@@ -48,7 +54,7 @@ module MergeRequests ...@@ -48,7 +54,7 @@ module MergeRequests
# Note: we should update merge requests from forks too # Note: we should update merge requests from forks too
def reload_merge_requests def reload_merge_requests
merge_requests = @project.merge_requests.opened.by_branch(@branch_name).to_a merge_requests = @project.merge_requests.opened.by_branch(@branch_name).to_a
merge_requests += @fork_merge_requests.by_branch(@branch_name).to_a merge_requests += fork_merge_requests.by_branch(@branch_name).to_a
merge_requests = filter_merge_requests(merge_requests) merge_requests = filter_merge_requests(merge_requests)
merge_requests.each do |merge_request| merge_requests.each do |merge_request|
...@@ -85,13 +91,48 @@ module MergeRequests ...@@ -85,13 +91,48 @@ module MergeRequests
end end
end end
def find_new_commits
if branch_added?
@commits = []
merge_request = merge_requests_for_source_branch.first
return unless merge_request
last_commit = merge_request.last_commit
begin
# Since any number of commits could have been made to the restored branch,
# find the common root to see what has been added.
common_ref = @project.repository.merge_base(last_commit.id, @newrev)
# If the a commit no longer exists in this repo, gitlab_git throws
# a Rugged::OdbError. This is fixed in https://gitlab.com/gitlab-org/gitlab_git/merge_requests/52
@commits = @project.repository.commits_between(common_ref, @newrev) if common_ref
rescue
end
elsif branch_removed?
# No commits for a deleted branch.
@commits = []
else
@commits = @project.repository.commits_between(@oldrev, @newrev)
end
end
# Add comment about branches being deleted or added to merge requests
def comment_mr_branch_presence_changed
presence = branch_added? ? :add : :delete
merge_requests_for_source_branch.each do |merge_request|
SystemNoteService.change_branch_presence(
merge_request, merge_request.project, @current_user,
:source, @branch_name, presence)
end
end
# Add comment about pushing new commits to merge requests # Add comment about pushing new commits to merge requests
def comment_mr_with_commits def comment_mr_with_commits
merge_requests = @project.origin_merge_requests.opened.where(source_branch: @branch_name).to_a return unless @commits.present?
merge_requests += @fork_merge_requests.where(source_branch: @branch_name).to_a
merge_requests = filter_merge_requests(merge_requests)
merge_requests.each do |merge_request| merge_requests_for_source_branch.each do |merge_request|
mr_commit_ids = Set.new(merge_request.commits.map(&:id)) mr_commit_ids = Set.new(merge_request.commits.map(&:id))
new_commits, existing_commits = @commits.partition do |commit| new_commits, existing_commits = @commits.partition do |commit|
...@@ -106,14 +147,7 @@ module MergeRequests ...@@ -106,14 +147,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 = @project.origin_merge_requests.opened merge_requests_for_source_branch.each do |merge_request|
.where(source_branch: @branch_name)
.to_a
merge_requests += @fork_merge_requests.where(source_branch: @branch_name)
.to_a
merge_requests = filter_merge_requests(merge_requests)
merge_requests.each do |merge_request|
execute_hooks(merge_request, 'update') execute_hooks(merge_request, 'update')
end end
end end
...@@ -121,5 +155,25 @@ module MergeRequests ...@@ -121,5 +155,25 @@ module MergeRequests
def filter_merge_requests(merge_requests) def filter_merge_requests(merge_requests)
merge_requests.uniq.select(&:source_project) merge_requests.uniq.select(&:source_project)
end end
def merge_requests_for_source_branch
@source_merge_requests ||= begin
merge_requests = @project.origin_merge_requests.opened.where(source_branch: @branch_name).to_a
merge_requests += fork_merge_requests.where(source_branch: @branch_name).to_a
filter_merge_requests(merge_requests)
end
end
def fork_merge_requests
@fork_merge_requests ||= @project.fork_merge_requests.opened
end
def branch_added?
Gitlab::Git.blank_ref?(@oldrev)
end
def branch_removed?
Gitlab::Git.blank_ref?(@newrev)
end
end end
end end
...@@ -168,6 +168,31 @@ class SystemNoteService ...@@ -168,6 +168,31 @@ class SystemNoteService
create_note(noteable: noteable, project: project, author: author, note: body) create_note(noteable: noteable, project: project, author: author, note: body)
end end
# Called when a branch in Noteable is added or deleted
#
# noteable - Noteable object
# project - Project owning noteable
# author - User performing the change
# branch_type - :source or :target
# branch - branch name
# presence - :add or :delete
#
# Example Note text:
#
# "Restored target branch `feature`"
#
# Returns the created Note object
def self.change_branch_presence(noteable, project, author, branch_type, branch, presence)
verb =
if presence == :add
'restored'
else
'deleted'
end
body = "#{verb} #{branch_type.to_s} branch `#{branch}`".capitalize
create_note(noteable: noteable, project: project, author: author, note: body)
end
# Called when a Mentionable references a Noteable # Called when a Mentionable references a Noteable
# #
# noteable - Noteable object being referenced # noteable - Noteable object being referenced
...@@ -322,7 +347,7 @@ class SystemNoteService ...@@ -322,7 +347,7 @@ class SystemNoteService
commit_ids = if count == 1 commit_ids = if count == 1
existing_commits.first.short_id existing_commits.first.short_id
else else
if oldrev if oldrev && !Gitlab::Git.blank_ref?(oldrev)
"#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}" "#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}"
else else
"#{existing_commits.first.short_id}..#{existing_commits.last.short_id}" "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}"
......
%p
#{link_to @abuse_report.user.name, user_url(@abuse_report.user)}
(@#{@abuse_report.user.username}) was reported for abuse by
#{link_to @abuse_report.reporter.name, user_url(@abuse_report.reporter)}
(@#{@abuse_report.reporter.username}).
%blockquote
= @abuse_report.message
%p
= link_to "View details", abuse_reports_url
#{@abuse_report.user.name} (@#{@abuse_report.user.username}) was reported for abuse by #{@abuse_report.reporter.name} (@#{@abuse_report.reporter.username}).
\
> #{@abuse_report.message}
\
View details: #{admin_abuse_reports_url}
...@@ -2,16 +2,17 @@ ...@@ -2,16 +2,17 @@
%h3.page-title Abuse Reports %h3.page-title Abuse Reports
%hr %hr
- if @abuse_reports.present? - if @abuse_reports.present?
%table.table .table-holder
%thead %table.table
%tr %thead
%th Reported by %tr
%th Reported at %th Reported by
%th Message %th Reported at
%th User %th Message
%th Primary action %th User
%th %th Primary action
= render @abuse_reports %th
= render @abuse_reports
= paginate @abuse_reports = paginate @abuse_reports
- else - else
%h4 There are no abuse reports %h4 There are no abuse reports
...@@ -47,6 +47,12 @@ ...@@ -47,6 +47,12 @@
= f.label :version_check_enabled do = f.label :version_check_enabled do
= f.check_box :version_check_enabled = f.check_box :version_check_enabled
Version check enabled Version check enabled
.form-group
= f.label :admin_notification_email, class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :admin_notification_email, class: 'form-control'
.help-block
Abuse reports will be sent to this address if it is set. Abuse reports are always available in the admin area.
%fieldset %fieldset
%legend Account and Limit Settings %legend Account and Limit Settings
......
...@@ -3,25 +3,26 @@ ...@@ -3,25 +3,26 @@
Application: #{@application.name} Application: #{@application.name}
%table.table .table-holder
%tr %table.table
%td %tr
Application Id %td
%td Application Id
%code#application_id= @application.uid %td
%tr %code#application_id= @application.uid
%td %tr
Secret: %td
%td Secret:
%code#secret= @application.secret %td
%code#secret= @application.secret
%tr %tr
%td %td
Callback url Callback url
%td %td
- @application.redirect_uri.split.each do |uri| - @application.redirect_uri.split.each do |uri|
%div %div
%span.monospace= uri %span.monospace= uri
.form-actions .form-actions
= link_to 'Edit', edit_admin_application_path(@application), class: 'btn btn-primary wide pull-left' = link_to 'Edit', edit_admin_application_path(@application), class: 'btn btn-primary wide pull-left'
= render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10' = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10'
...@@ -12,24 +12,25 @@ ...@@ -12,24 +12,25 @@
%i.fa.fa-exclamation-triangle %i.fa.fa-exclamation-triangle
There are no running sidekiq processes. Please restart GitLab There are no running sidekiq processes. Please restart GitLab
- else - else
%table.table .table-holder
%thead %table.table
%th USER %thead
%th PID %th USER
%th CPU %th PID
%th MEM %th CPU
%th STATE %th MEM
%th START %th STATE
%th COMMAND %th START
%tbody %th COMMAND
- @sidekiq_processes.each do |process| %tbody
- next unless process.match(/(sidekiq \d+\.\d+\.\d+.+$)/) - @sidekiq_processes.each do |process|
- data = process.strip.split(' ') - next unless process.match(/(sidekiq \d+\.\d+\.\d+.+$)/)
%tr - data = process.strip.split(' ')
%td= gitlab_config.user %tr
- 5.times do %td= gitlab_config.user
%td= data.shift - 5.times do
%td= data.join(' ') %td= data.shift
%td= data.join(' ')
.clearfix .clearfix
%p %p
......
...@@ -5,22 +5,23 @@ ...@@ -5,22 +5,23 @@
.panel-head-actions .panel-head-actions
= link_to 'New Deploy Key', new_admin_deploy_key_path, class: "btn btn-new btn-sm" = link_to 'New Deploy Key', new_admin_deploy_key_path, class: "btn btn-new btn-sm"
- if @deploy_keys.any? - if @deploy_keys.any?
%table.table .table-holder
%thead.panel-heading %table.table
%tr %thead.panel-heading
%th Title
%th Fingerprint
%th Added at
%th
%tbody
- @deploy_keys.each do |deploy_key|
%tr %tr
%td %th Title
%strong= deploy_key.title %th Fingerprint
%td %th Added at
%code.key-fingerprint= deploy_key.fingerprint %th
%td %tbody
%span.cgray - @deploy_keys.each do |deploy_key|
added #{time_ago_with_tooltip(deploy_key.created_at)} %tr
%td %td
= link_to 'Remove', admin_deploy_key_path(deploy_key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-sm btn-remove delete-key pull-right" %strong= deploy_key.title
%td
%code.key-fingerprint= deploy_key.fingerprint
%td
%span.cgray
added #{time_ago_with_tooltip(deploy_key.created_at)}
%td
= link_to 'Remove', admin_deploy_key_path(deploy_key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-sm btn-remove delete-key pull-right"
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
= render 'admin/users/head' = render 'admin/users/head'
- if @identities.present? - if @identities.present?
%table.table .table-holder
%thead %table.table
%tr %thead
%th Provider %tr
%th Identifier %th Provider
%th %th Identifier
= render @identities %th
= render @identities
- else - else
%h4 This user has no identities %h4 This user has no identities
...@@ -2,22 +2,23 @@ ...@@ -2,22 +2,23 @@
%h3.page-title Service templates %h3.page-title Service templates
%p.light Service template allows you to set default values for project services %p.light Service template allows you to set default values for project services
%table.table .table-holder
%thead %table.table
%tr %thead
%th %tr
%th Service %th
%th Description %th Service
%th Last edit %th Description
- @services.sort_by(&:title).each do |service| %th Last edit
%tr - @services.sort_by(&:title).each do |service|
%td %tr
= icon("copy", class: 'clgray') %td
%td = icon("copy", class: 'clgray')
= link_to edit_admin_application_settings_service_path(service.id) do %td
%strong= service.title = link_to edit_admin_application_settings_service_path(service.id) do
%td %strong= service.title
= service.description %td
%td.light = service.description
= time_ago_in_words service.updated_at %td.light
ago = time_ago_in_words service.updated_at
ago
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
%strong %strong
= link_to user_path(@user) do = link_to user_path(@user) do
= @user.username = @user.username
= render 'users/profile', user: @user = render 'admin/users/profile', user: @user
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
......
%table.table .table-holder
%thead %table.table
%tr %thead
%th User ID %tr
%th Description %th User ID
%th When %th Description
- @events.each do |event| %th When
%tr - @events.each do |event|
%td %tr
= event.user_id %td
%td = event.user_id
= event.description %td
%td.light = event.description
= time_ago_in_words event.updated_at %td.light
ago = time_ago_in_words event.updated_at
ago
= paginate @events = paginate @events
\ No newline at end of file
%table.table .table-holder
%thead %table.table
%tr %thead
%th ID %tr
%th Name %th ID
%th Last build %th Name
%th Access %th Last build
%th Builds %th Access
%th %th Builds
%th
- @projects.each do |project| - @projects.each do |project|
= render "ci/admin/projects/project", project: project = render "ci/admin/projects/project", project: project
= paginate @projects = paginate @projects
...@@ -35,18 +35,19 @@ ...@@ -35,18 +35,19 @@
%br %br
%table.table .table-holder
%thead %table.table
%tr %thead
%th Type %tr
%th Runner token %th Type
%th Description %th Runner token
%th Projects %th Description
%th Builds %th Projects
%th Tags %th Builds
%th Last contact %th Tags
%th %th Last contact
%th
- @runners.each do |runner| - @runners.each do |runner|
= render "ci/admin/runners/runner", runner: runner = render "ci/admin/runners/runner", runner: runner
= paginate @runners = paginate @runners
%h3.page-title Events %h3.page-title Events
%table.table .table-holder
%thead %table.table
%tr %thead
%th User ID %tr
%th Description %th User ID
%th When %th Description
- @events.each do |event| %th When
%tr - @events.each do |event|
%td %tr
= event.user_id %td
%td = event.user_id
= event.description %td
%td.light = event.description
= time_ago_in_words event.updated_at %td.light
ago = time_ago_in_words event.updated_at
ago
= paginate @events = paginate @events
\ No newline at end of file
...@@ -4,29 +4,30 @@ ...@@ -4,29 +4,30 @@
syntax is correct syntax is correct
%i.fa.fa-ok.correct-syntax %i.fa.fa-ok.correct-syntax
%table.table.table-bordered .table-holder
%thead %table.table.table-bordered
%tr %thead
%th Parameter %tr
%th Value %th Parameter
%tbody %th Value
- @stages.each do |stage| %tbody
- @builds.select { |build| build[:stage] == stage }.each do |build| - @stages.each do |stage|
%tr - @builds.select { |build| build[:stage] == stage }.each do |build|
%td #{stage.capitalize} Job - #{build[:name]} %tr
%td %td #{stage.capitalize} Job - #{build[:name]}
%pre %td
= simple_format build[:script] %pre
= simple_format build[:script]
%br %br
%b Tag list: %b Tag list:
= build[:tags] = build[:tags]
%br %br
%b Refs only: %b Refs only:
= build[:only] && build[:only].join(", ") = build[:only] && build[:only].join(", ")
%br %br
%b Refs except: %b Refs except:
= build[:except] && build[:except].join(", ") = build[:except] && build[:except].join(", ")
-else -else
%p %p
......
.wiki
%h1
GitLab CI is now integrated in GitLab UI
%h2 For existing projects
%p
Check the following pages to find the CI status you're looking for:
%ul
%li Projects page - shows CI status for each project.
%li Project commits page - show CI status for each commit.
%h2 For new projects
%p
If you want to enable CI for a new project it is easy as adding
= link_to ".gitlab-ci.yml", "http://doc.gitlab.com/ce/ci/yaml/README.html"
file to your repository
...@@ -13,26 +13,28 @@ ...@@ -13,26 +13,28 @@
%span All issues for this milestone are closed. You may close the milestone now. %span All issues for this milestone are closed. You may close the milestone now.
.description .description
%table.table
%thead .table-holder
%tr %table.table
%th Project %thead
%th Open issues %tr
%th State %th Project
%th Due date %th Open issues
- @dashboard_milestone.milestones.each do |milestone| %th State
%tr %th Due date
%td - @dashboard_milestone.milestones.each do |milestone|
= link_to "#{milestone.project.name_with_namespace}", namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone) %tr
%td %td
= milestone.issues.opened.count = link_to "#{milestone.project.name_with_namespace}", namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone)
%td %td
- if milestone.closed? = milestone.issues.opened.count
Closed %td
- else - if milestone.closed?
Open Closed
%td - else
= milestone.expires_at Open
%td
= milestone.expires_at
.context .context
%p.lead %p.lead
......
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