Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
baa254fc
Commit
baa254fc
authored
Jan 29, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-01-29
parents
0f6da0ee
a5a91d7e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
229 additions
and
218 deletions
+229
-218
app/assets/javascripts/compare.js
app/assets/javascripts/compare.js
+21
-26
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/compare_autocomplete.js
+9
-7
app/assets/javascripts/create_merge_request_dropdown.js
app/assets/javascripts/create_merge_request_dropdown.js
+67
-80
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+15
-18
app/assets/javascripts/due_date_select.js
app/assets/javascripts/due_date_select.js
+21
-27
app/assets/javascripts/filterable_list.js
app/assets/javascripts/filterable_list.js
+13
-18
app/assets/javascripts/groups/groups_filterable_list.js
app/assets/javascripts/groups/groups_filterable_list.js
+4
-13
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js
...s/vue_merge_request_widget/components/mr_widget_header.js
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+6
-6
changelogs/unreleased/42255-disable-mr-checkout-button-when-source-branch-deleted.yml
...disable-mr-checkout-button-when-source-branch-deleted.yml
+5
-0
lib/gitlab/seeder.rb
lib/gitlab/seeder.rb
+10
-0
lib/support/nginx/gitlab
lib/support/nginx/gitlab
+4
-0
lib/support/nginx/gitlab-ssl
lib/support/nginx/gitlab-ssl
+4
-0
spec/javascripts/pipelines/pipelines_table_row_spec.js
spec/javascripts/pipelines/pipelines_table_row_spec.js
+2
-2
spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js
...scripts/vue_mr_widget/components/mr_widget_header_spec.js
+27
-11
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+20
-10
No files found.
app/assets/javascripts/compare.js
View file @
baa254fc
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, no-var, object-shorthand, consistent-return, no-unused-vars, comma-dangle, vars-on-top, prefer-template, max-len */
import
{
localTimeAgo
}
from
'
./lib/utils/datetime_utility
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
export
default
class
Compare
{
constructor
(
opts
)
{
...
...
@@ -41,17 +42,14 @@ export default class Compare {
}
getTargetProject
()
{
return
$
.
ajax
({
url
:
this
.
opts
.
targetProjectUrl
,
data
:
{
target_project_id
:
$
(
"
input[name='merge_request[target_project_id]']
"
).
val
()
},
beforeSend
:
function
()
{
return
$
(
'
.mr_target_commit
'
).
empty
();
$
(
'
.mr_target_commit
'
).
empty
();
return
axios
.
get
(
this
.
opts
.
targetProjectUrl
,
{
params
:
{
target_project_id
:
$
(
"
input[name='merge_request[target_project_id]']
"
).
val
(),
},
success
:
function
(
html
)
{
return
$
(
'
.js-target-branch-dropdown .dropdown-content
'
).
html
(
html
);
}
}).
then
(({
data
})
=>
{
$
(
'
.js-target-branch-dropdown .dropdown-content
'
).
html
(
data
);
});
}
...
...
@@ -68,22 +66,19 @@ export default class Compare {
});
}
static
sendAjax
(
url
,
loading
,
target
,
data
)
{
var
$target
;
$target
=
$
(
target
);
return
$
.
ajax
({
url
:
url
,
data
:
data
,
beforeSend
:
function
()
{
loading
.
show
();
return
$target
.
empty
();
},
success
:
function
(
html
)
{
loading
.
hide
();
$target
.
html
(
html
);
var
className
=
'
.
'
+
$target
[
0
].
className
.
replace
(
'
'
,
'
.
'
);
localTimeAgo
(
$
(
'
.js-timeago
'
,
className
));
}
static
sendAjax
(
url
,
loading
,
target
,
params
)
{
const
$target
=
$
(
target
);
loading
.
show
();
$target
.
empty
();
return
axios
.
get
(
url
,
{
params
,
}).
then
(({
data
})
=>
{
loading
.
hide
();
$target
.
html
(
data
);
const
className
=
'
.
'
+
$target
[
0
].
className
.
replace
(
'
'
,
'
.
'
);
localTimeAgo
(
$
(
'
.js-timeago
'
,
className
));
});
}
}
app/assets/javascripts/compare_autocomplete.js
View file @
baa254fc
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, prefer-arrow-callback, no-else-return, newline-per-chained-call, wrap-iife, max-len */
import
{
__
}
from
'
./locale
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
flash
from
'
./flash
'
;
export
default
function
initCompareAutocomplete
()
{
$
(
'
.js-compare-dropdown
'
).
each
(
function
()
{
...
...
@@ -10,15 +13,14 @@ export default function initCompareAutocomplete() {
const
$filterInput
=
$
(
'
input[type="search"]
'
,
$dropdownContainer
);
$dropdown
.
glDropdown
({
data
:
function
(
term
,
callback
)
{
return
$
.
ajax
({
url
:
$dropdown
.
data
(
'
refs-url
'
),
data
:
{
axios
.
get
(
$dropdown
.
data
(
'
refsUrl
'
),
{
params
:
{
ref
:
$dropdown
.
data
(
'
ref
'
),
search
:
term
,
}
}).
done
(
function
(
refs
)
{
return
callback
(
refs
);
});
}
,
}).
then
(({
data
})
=>
{
callback
(
data
);
})
.
catch
(()
=>
flash
(
__
(
'
Error fetching refs
'
)))
;
},
selectable
:
true
,
filterable
:
true
,
...
...
app/assets/javascripts/create_merge_request_dropdown.js
View file @
baa254fc
/* eslint-disable no-new */
import
_
from
'
underscore
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
Flash
from
'
./flash
'
;
import
DropLab
from
'
./droplab/drop_lab
'
;
import
ISetter
from
'
./droplab/plugins/input_setter
'
;
...
...
@@ -74,60 +75,52 @@ export default class CreateMergeRequestDropdown {
}
checkAbilityToCreateBranch
()
{
return
$
.
ajax
({
type
:
'
GET
'
,
dataType
:
'
json
'
,
url
:
this
.
canCreatePath
,
beforeSend
:
()
=>
this
.
setUnavailableButtonState
(),
})
.
done
((
data
)
=>
{
this
.
setUnavailableButtonState
(
false
);
if
(
data
.
can_create_branch
)
{
this
.
available
();
this
.
enable
()
;
if
(
!
this
.
droplabInitialized
)
{
this
.
droplabInitialized
=
true
;
this
.
initDroplab
();
this
.
bindEvents
();
this
.
setUnavailableButtonState
();
axios
.
get
(
this
.
canCreatePath
)
.
then
(({
data
})
=>
{
this
.
setUnavailableButtonState
(
false
);
if
(
data
.
can_create_branch
)
{
this
.
available
(
);
this
.
enable
();
if
(
!
this
.
droplabInitialized
)
{
this
.
droplabInitialized
=
true
;
this
.
initDroplab
();
this
.
bindEvents
();
}
}
else
if
(
data
.
has_related_branch
)
{
this
.
hide
();
}
}
else
if
(
data
.
has_related_branch
)
{
this
.
hide
();
}
}).
fail
(()
=>
{
this
.
unavailable
();
this
.
disable
();
new
Flash
(
'
Failed to check if a new branch can be created.
'
);
});
})
.
catch
(()
=>
{
this
.
unavailable
();
this
.
disable
();
Flash
(
'
Failed to check if a new branch can be created.
'
);
});
}
createBranch
()
{
return
$
.
ajax
({
method
:
'
POST
'
,
dataType
:
'
json
'
,
url
:
this
.
createBranchPath
,
beforeSend
:
()
=>
(
this
.
isCreatingBranch
=
true
),
})
.
done
((
data
)
=>
{
this
.
branchCreated
=
true
;
window
.
location
.
href
=
data
.
url
;
})
.
fail
(()
=>
new
Flash
(
'
Failed to create a branch for this issue. Please try again.
'
));
this
.
isCreatingBranch
=
true
;
return
axios
.
post
(
this
.
createBranchPath
)
.
then
(({
data
})
=>
{
this
.
branchCreated
=
true
;
window
.
location
.
href
=
data
.
url
;
})
.
catch
(()
=>
Flash
(
'
Failed to create a branch for this issue. Please try again.
'
));
}
createMergeRequest
()
{
return
$
.
ajax
({
method
:
'
POST
'
,
dataType
:
'
json
'
,
url
:
this
.
createMrPath
,
beforeSend
:
()
=>
(
this
.
isCreatingMergeRequest
=
true
),
})
.
done
((
data
)
=>
{
this
.
mergeRequestCreated
=
true
;
window
.
location
.
href
=
data
.
url
;
})
.
fail
(()
=>
new
Flash
(
'
Failed to create Merge Request. Please try again.
'
));
this
.
isCreatingMergeRequest
=
true
;
return
axios
.
post
(
this
.
createMrPath
)
.
then
(({
data
})
=>
{
this
.
mergeRequestCreated
=
true
;
window
.
location
.
href
=
data
.
url
;
})
.
catch
(()
=>
Flash
(
'
Failed to create Merge Request. Please try again.
'
));
}
disable
()
{
...
...
@@ -200,39 +193,33 @@ export default class CreateMergeRequestDropdown {
getRef
(
ref
,
target
=
'
all
'
)
{
if
(
!
ref
)
return
false
;
return
$
.
ajax
({
method
:
'
GET
'
,
dataType
:
'
json
'
,
url
:
this
.
refsPath
+
ref
,
beforeSend
:
()
=>
{
this
.
isGettingRef
=
true
;
},
})
.
always
(()
=>
{
this
.
isGettingRef
=
false
;
})
.
done
((
data
)
=>
{
const
branches
=
data
[
Object
.
keys
(
data
)[
0
]];
const
tags
=
data
[
Object
.
keys
(
data
)[
1
]];
let
result
;
return
axios
.
get
(
this
.
refsPath
+
ref
)
.
then
(({
data
})
=>
{
const
branches
=
data
[
Object
.
keys
(
data
)[
0
]];
const
tags
=
data
[
Object
.
keys
(
data
)[
1
]];
let
result
;
if
(
target
===
'
branch
'
)
{
result
=
CreateMergeRequestDropdown
.
findByValue
(
branches
,
ref
);
}
else
{
result
=
CreateMergeRequestDropdown
.
findByValue
(
branches
,
ref
,
true
)
||
CreateMergeRequestDropdown
.
findByValue
(
tags
,
ref
,
true
);
this
.
suggestedRef
=
result
;
}
if
(
target
===
'
branch
'
)
{
result
=
CreateMergeRequestDropdown
.
findByValue
(
branches
,
ref
);
}
else
{
result
=
CreateMergeRequestDropdown
.
findByValue
(
branches
,
ref
,
true
)
||
CreateMergeRequestDropdown
.
findByValue
(
tags
,
ref
,
true
);
this
.
suggestedRef
=
result
;
}
this
.
isGettingRef
=
false
;
return
this
.
updateInputState
(
target
,
ref
,
result
);
})
.
fail
(()
=>
{
this
.
unavailable
();
this
.
disable
();
new
Flash
(
'
Failed to get ref.
'
);
return
this
.
updateInputState
(
target
,
ref
,
result
);
})
.
catch
(()
=>
{
this
.
unavailable
();
this
.
disable
();
new
Flash
(
'
Failed to get ref.
'
);
return
false
;
});
this
.
isGettingRef
=
false
;
return
false
;
});
}
getTargetData
(
target
)
{
...
...
@@ -332,12 +319,12 @@ export default class CreateMergeRequestDropdown {
xhr
=
this
.
createBranch
();
}
xhr
.
fail
(()
=>
{
xhr
.
catch
(()
=>
{
this
.
isCreatingMergeRequest
=
false
;
this
.
isCreatingBranch
=
false
;
});
xhr
.
always
(()
=>
this
.
enable
());
this
.
enable
();
});
this
.
disable
();
}
...
...
app/assets/javascripts/dropzone_input.js
View file @
baa254fc
...
...
@@ -2,6 +2,7 @@ import Dropzone from 'dropzone';
import
_
from
'
underscore
'
;
import
'
./preview_markdown
'
;
import
csrf
from
'
./lib/utils/csrf
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
Dropzone
.
autoDiscover
=
false
;
...
...
@@ -235,25 +236,21 @@ export default function dropzoneInput(form) {
uploadFile
=
(
item
,
filename
)
=>
{
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
item
,
filename
);
return
$
.
ajax
({
url
:
uploadsPath
,
type
:
'
POST
'
,
data
:
formData
,
dataType
:
'
json
'
,
processData
:
false
,
contentType
:
false
,
headers
:
csrf
.
headers
,
beforeSend
:
()
=>
{
showSpinner
();
return
closeAlertMessage
();
},
success
:
(
e
,
text
,
response
)
=>
{
const
md
=
response
.
responseJSON
.
link
.
markdown
;
showSpinner
();
closeAlertMessage
();
axios
.
post
(
uploadsPath
,
formData
)
.
then
(({
data
})
=>
{
const
md
=
data
.
link
.
markdown
;
insertToTextArea
(
filename
,
md
);
},
error
:
response
=>
showError
(
response
.
responseJSON
.
message
),
complete
:
()
=>
closeSpinner
(),
});
closeSpinner
();
})
.
catch
((
e
)
=>
{
showError
(
e
.
response
.
data
.
message
);
closeSpinner
();
});
};
updateAttachingMessage
=
(
files
,
messageContainer
)
=>
{
...
...
app/assets/javascripts/due_date_select.js
View file @
baa254fc
/* global dateFormat */
import
Pikaday
from
'
pikaday
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
class
DueDateSelect
{
...
...
@@ -125,37 +126,30 @@ class DueDateSelect {
}
submitSelectedDate
(
isDropdown
)
{
return
$
.
ajax
({
type
:
'
PUT
'
,
url
:
this
.
issueUpdateURL
,
data
:
this
.
datePayload
,
dataType
:
'
json
'
,
beforeSend
:
()
=>
{
const
selectedDateValue
=
this
.
datePayload
[
this
.
abilityName
].
due_date
;
const
displayedDateStyle
=
this
.
displayedDate
!==
'
No due date
'
?
'
bold
'
:
'
no-value
'
;
const
selectedDateValue
=
this
.
datePayload
[
this
.
abilityName
].
due_date
;
const
displayedDateStyle
=
this
.
displayedDate
!==
'
No due date
'
?
'
bold
'
:
'
no-value
'
;
this
.
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
this
.
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
if
(
isDropdown
)
{
this
.
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
this
.
$selectbox
.
hide
();
}
if
(
isDropdown
)
{
this
.
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
this
.
$selectbox
.
hide
();
}
this
.
$value
.
css
(
'
display
'
,
''
);
this
.
$valueContent
.
html
(
`<span class='
${
displayedDateStyle
}
'>
${
this
.
displayedDate
}
</span>`
);
this
.
$sidebarValue
.
html
(
this
.
displayedDate
);
this
.
$value
.
css
(
'
display
'
,
''
);
this
.
$valueContent
.
html
(
`<span class='
${
displayedDateStyle
}
'>
${
this
.
displayedDate
}
</span>`
);
this
.
$sidebarValue
.
html
(
this
.
displayedDate
);
return
selectedDateValue
.
length
?
$
(
'
.js-remove-due-date-holder
'
).
removeClass
(
'
hidden
'
)
:
$
(
'
.js-remove-due-date-holder
'
).
addClass
(
'
hidden
'
);
},
}).
done
(()
=>
{
if
(
isDropdown
)
{
this
.
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
this
.
$dropdown
.
dropdown
(
'
toggle
'
);
}
return
this
.
$loading
.
fadeOut
();
});
$
(
'
.js-remove-due-date-holder
'
).
toggleClass
(
'
hidden
'
,
selectedDateValue
.
length
);
return
axios
.
put
(
this
.
issueUpdateURL
,
this
.
datePayload
)
.
then
(()
=>
{
if
(
isDropdown
)
{
this
.
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
this
.
$dropdown
.
dropdown
(
'
toggle
'
);
}
return
this
.
$loading
.
fadeOut
();
});
}
}
...
...
app/assets/javascripts/filterable_list.js
View file @
baa254fc
import
_
from
'
underscore
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
/**
* Makes search request for content when user types a value in the search input.
...
...
@@ -54,32 +55,26 @@ export default class FilterableList {
this
.
listFilterElement
.
removeEventListener
(
'
input
'
,
this
.
debounceFilter
);
}
filterResults
(
queryData
)
{
filterResults
(
params
)
{
if
(
this
.
isBusy
)
{
return
false
;
}
$
(
this
.
listHolderElement
).
fadeTo
(
250
,
0.5
);
return
$
.
ajax
({
url
:
this
.
getFilterEndpoint
(),
data
:
queryData
,
type
:
'
GET
'
,
dataType
:
'
json
'
,
context
:
this
,
complete
:
this
.
onFilterComplete
,
beforeSend
:
()
=>
{
this
.
isBusy
=
true
;
},
success
:
(
response
,
textStatus
,
xhr
)
=>
{
this
.
onFilterSuccess
(
response
,
xhr
,
queryData
);
},
});
this
.
isBusy
=
true
;
return
axios
.
get
(
this
.
getFilterEndpoint
(),
{
params
,
}).
then
((
res
)
=>
{
this
.
onFilterSuccess
(
res
,
params
);
this
.
onFilterComplete
();
}).
catch
(()
=>
this
.
onFilterComplete
());
}
onFilterSuccess
(
response
,
xhr
,
queryData
)
{
if
(
response
.
html
)
{
this
.
listHolderElement
.
innerHTML
=
response
.
html
;
onFilterSuccess
(
response
,
queryData
)
{
if
(
response
.
data
.
html
)
{
this
.
listHolderElement
.
innerHTML
=
response
.
data
.
html
;
}
// Change url so if user reload a page - search results are saved
...
...
app/assets/javascripts/groups/groups_filterable_list.js
View file @
baa254fc
import
FilterableList
from
'
~/filterable_list
'
;
import
eventHub
from
'
./event_hub
'
;
import
{
getParameterByName
}
from
'
../lib/utils/common_utils
'
;
import
{
normalizeHeaders
,
getParameterByName
}
from
'
../lib/utils/common_utils
'
;
export
default
class
GroupFilterableList
extends
FilterableList
{
constructor
({
form
,
filter
,
holder
,
filterEndpoint
,
pagePath
,
dropdownSel
,
filterInputField
})
{
...
...
@@ -94,23 +94,14 @@ export default class GroupFilterableList extends FilterableList {
this
.
form
.
querySelector
(
`[name="
${
this
.
filterInputField
}
"]`
).
value
=
''
;
}
onFilterSuccess
(
data
,
xhr
,
queryData
)
{
onFilterSuccess
(
res
,
queryData
)
{
const
currentPath
=
this
.
getPagePath
(
queryData
);
const
paginationData
=
{
'
X-Per-Page
'
:
xhr
.
getResponseHeader
(
'
X-Per-Page
'
),
'
X-Page
'
:
xhr
.
getResponseHeader
(
'
X-Page
'
),
'
X-Total
'
:
xhr
.
getResponseHeader
(
'
X-Total
'
),
'
X-Total-Pages
'
:
xhr
.
getResponseHeader
(
'
X-Total-Pages
'
),
'
X-Next-Page
'
:
xhr
.
getResponseHeader
(
'
X-Next-Page
'
),
'
X-Prev-Page
'
:
xhr
.
getResponseHeader
(
'
X-Prev-Page
'
),
};
window
.
history
.
replaceState
({
page
:
currentPath
,
},
document
.
title
,
currentPath
);
eventHub
.
$emit
(
'
updateGroups
'
,
data
,
Object
.
prototype
.
hasOwnProperty
.
call
(
queryData
,
this
.
filterInputField
));
eventHub
.
$emit
(
'
updatePagination
'
,
paginationData
);
eventHub
.
$emit
(
'
updateGroups
'
,
res
.
data
,
Object
.
prototype
.
hasOwnProperty
.
call
(
queryData
,
this
.
filterInputField
));
eventHub
.
$emit
(
'
updatePagination
'
,
normalizeHeaders
(
res
.
headers
)
);
}
}
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js
View file @
baa254fc
...
...
@@ -76,6 +76,7 @@ export default {
<a
href="#modal_merge_info"
data-toggle="modal"
:disabled="mr.sourceBranchRemoved"
class="btn btn-sm inline">
Check out branch
</a>
...
...
app/models/merge_request.rb
View file @
baa254fc
...
...
@@ -1016,13 +1016,13 @@ class MergeRequest < ActiveRecord::Base
merged_at
=
metrics
&
.
merged_at
notes_association
=
notes_with_associations
# It is not guaranteed that Note#created_at will be strictly later than
# MergeRequestMetric#merged_at. Nanoseconds on MySQL may break this
# comparison, as will a HA environment if clocks are not *precisely*
# synchronized. Add a minute's leeway to compensate for both possibilities
cutoff
=
merged_at
-
1
.
minute
if
merged_at
# It is not guaranteed that Note#created_at will be strictly later than
# MergeRequestMetric#merged_at. Nanoseconds on MySQL may break this
# comparison, as will a HA environment if clocks are not *precisely*
# synchronized. Add a minute's leeway to compensate for both possibilities
cutoff
=
merged_at
-
1
.
minute
notes_association
=
notes_association
.
where
(
'created_at >= ?'
,
cutoff
)
end
...
...
changelogs/unreleased/42255-disable-mr-checkout-button-when-source-branch-deleted.yml
0 → 100644
View file @
baa254fc
---
title
:
Disable MR check out button when source branch is deleted
merge_request
:
16631
author
:
Jacopo Beschi @jacopo-beschi
type
:
fixed
lib/gitlab/seeder.rb
View file @
baa254fc
...
...
@@ -5,9 +5,15 @@ module DeliverNever
end
end
module
MuteNotifications
def
new_note
(
note
)
end
end
module
Gitlab
class
Seeder
def
self
.
quiet
mute_notifications
mute_mailer
SeedFu
.
quiet
=
true
...
...
@@ -18,6 +24,10 @@ module Gitlab
puts
"
\n
OK"
.
color
(
:green
)
end
def
self
.
mute_notifications
NotificationService
.
prepend
(
MuteNotifications
)
end
def
self
.
mute_mailer
ActionMailer
::
MessageDelivery
.
prepend
(
DeliverNever
)
end
...
...
lib/support/nginx/gitlab
View file @
baa254fc
...
...
@@ -17,6 +17,8 @@
## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab-workhorse {
# Gitlab socket file,
# for Omnibus this would be: unix:/var/opt/gitlab/gitlab-workhorse/socket
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
}
...
...
@@ -110,6 +112,8 @@ server {
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
# Location to the Gitlab's public directory,
# for Omnibus this would be: /opt/gitlab/embedded/service/gitlab-rails/public.
root /home/git/gitlab/public;
internal;
}
...
...
lib/support/nginx/gitlab-ssl
View file @
baa254fc
...
...
@@ -21,6 +21,8 @@
## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab-workhorse {
# Gitlab socket file,
# for Omnibus this would be: unix:/var/opt/gitlab/gitlab-workhorse/socket
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
}
...
...
@@ -160,6 +162,8 @@ server {
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
# Location to the Gitlab's public directory,
# for Omnibus this would be: /opt/gitlab/embedded/service/gitlab-rails/public
root /home/git/gitlab/public;
internal;
}
...
...
spec/javascripts/pipelines/pipelines_table_row_spec.js
View file @
baa254fc
...
...
@@ -26,8 +26,8 @@ describe('Pipelines Table Row', () => {
const
pipelines
=
getJSONFixture
(
jsonFixtureName
).
pipelines
;
pipeline
=
pipelines
.
find
(
p
=>
p
.
user
!==
null
&&
p
.
commit
!==
null
);
pipelineWithoutAuthor
=
pipelines
.
find
(
p
=>
p
.
user
==
null
&&
p
.
commit
!==
null
);
pipelineWithoutCommit
=
pipelines
.
find
(
p
=>
p
.
user
==
null
&&
p
.
commit
==
null
);
pipelineWithoutAuthor
=
pipelines
.
find
(
p
=>
p
.
user
==
=
null
&&
p
.
commit
!==
null
);
pipelineWithoutCommit
=
pipelines
.
find
(
p
=>
p
.
user
==
=
null
&&
p
.
commit
=
==
null
);
});
afterEach
(()
=>
{
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_header_spec.js
View file @
baa254fc
...
...
@@ -48,20 +48,23 @@ describe('MRWidgetHeader', () => {
describe
(
'
template
'
,
()
=>
{
let
vm
;
let
el
;
let
mr
;
const
sourceBranchPath
=
'
/foo/bar/mr-widget-refactor
'
;
const
mr
=
{
divergedCommitsCount
:
12
,
sourceBranch
:
'
mr-widget-refactor
'
,
sourceBranchLink
:
`<a href="
${
sourceBranchPath
}
">mr-widget-refactor</a>`
,
targetBranchPath
:
'
foo/bar/commits-path
'
,
targetBranchTreePath
:
'
foo/bar/tree/path
'
,
targetBranch
:
'
master
'
,
isOpen
:
true
,
emailPatchesPath
:
'
/mr/email-patches
'
,
plainDiffPath
:
'
/mr/plainDiffPath
'
,
};
beforeEach
(()
=>
{
mr
=
{
divergedCommitsCount
:
12
,
sourceBranch
:
'
mr-widget-refactor
'
,
sourceBranchLink
:
`<a href="
${
sourceBranchPath
}
">mr-widget-refactor</a>`
,
sourceBranchRemoved
:
false
,
targetBranchPath
:
'
foo/bar/commits-path
'
,
targetBranchTreePath
:
'
foo/bar/tree/path
'
,
targetBranch
:
'
master
'
,
isOpen
:
true
,
emailPatchesPath
:
'
/mr/email-patches
'
,
plainDiffPath
:
'
/mr/plainDiffPath
'
,
};
vm
=
createComponent
(
mr
);
el
=
vm
.
$el
;
});
...
...
@@ -82,6 +85,8 @@ describe('MRWidgetHeader', () => {
expect
(
el
.
textContent
).
toContain
(
'
Check out branch
'
);
expect
(
el
.
querySelectorAll
(
'
.dropdown li a
'
)[
0
].
getAttribute
(
'
href
'
)).
toEqual
(
mr
.
emailPatchesPath
);
expect
(
el
.
querySelectorAll
(
'
.dropdown li a
'
)[
1
].
getAttribute
(
'
href
'
)).
toEqual
(
mr
.
plainDiffPath
);
expect
(
el
.
querySelector
(
'
a[href="#modal_merge_info"]
'
).
getAttribute
(
'
disabled
'
)).
toBeNull
();
});
it
(
'
should not have right action links if the MR state is not open
'
,
(
done
)
=>
{
...
...
@@ -101,5 +106,16 @@ describe('MRWidgetHeader', () => {
done
();
});
});
it
(
'
should disable check out branch button if source branch has been removed
'
,
(
done
)
=>
{
vm
.
mr
.
sourceBranchRemoved
=
true
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
el
.
querySelector
(
'
a[href="#modal_merge_info"]
'
).
getAttribute
(
'
disabled
'
)).
toBe
(
'
disabled
'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
spec/models/merge_request_spec.rb
View file @
baa254fc
...
...
@@ -1273,16 +1273,6 @@ describe MergeRequest do
end
describe
'#can_be_reverted?'
do
context
'when there is no merged_at for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
nil
)
end
it
'returns false'
do
expect
(
subject
.
can_be_reverted?
(
nil
)).
to
be_falsey
end
end
context
'when there is no merge_commit for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
Time
.
now
.
utc
)
...
...
@@ -1306,6 +1296,16 @@ describe MergeRequest do
end
end
context
'when there is no merged_at for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
nil
)
end
it
'returns true'
do
expect
(
subject
.
can_be_reverted?
(
nil
)).
to
be_truthy
end
end
context
'when there is a revert commit'
do
let
(
:current_user
)
{
subject
.
author
}
let
(
:branch
)
{
subject
.
target_branch
}
...
...
@@ -1336,6 +1336,16 @@ describe MergeRequest do
end
end
context
'when there is no merged_at for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
nil
)
end
it
'returns false'
do
expect
(
subject
.
can_be_reverted?
(
current_user
)).
to
be_falsey
end
end
context
'when the revert commit is mentioned in a note just before the MR was merged'
do
before
do
subject
.
notes
.
last
.
update!
(
created_at:
subject
.
metrics
.
merged_at
-
30
.
seconds
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment