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
9cb894b9
Commit
9cb894b9
authored
Feb 03, 2020
by
Himanshu Kapoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag :stage_all_by_default
Remove FF as it is no longer needed.
parent
d56cf9ca
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
39 additions
and
199 deletions
+39
-199
app/assets/javascripts/ide/components/commit_sidebar/form.vue
...assets/javascripts/ide/components/commit_sidebar/form.vue
+3
-9
app/assets/javascripts/ide/components/file_row_extra.vue
app/assets/javascripts/ide/components/file_row_extra.vue
+4
-11
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+2
-7
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+1
-3
app/controllers/ide_controller.rb
app/controllers/ide_controller.rb
+0
-4
locale/gitlab.pot
locale/gitlab.pot
+0
-6
spec/frontend/ide/stores/actions/file_spec.js
spec/frontend/ide/stores/actions/file_spec.js
+8
-60
spec/frontend/ide/stores/integration_spec.js
spec/frontend/ide/stores/integration_spec.js
+5
-10
spec/javascripts/ide/components/commit_sidebar/form_spec.js
spec/javascripts/ide/components/commit_sidebar/form_spec.js
+1
-1
spec/javascripts/ide/components/file_row_extra_spec.js
spec/javascripts/ide/components/file_row_extra_spec.js
+1
-1
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+14
-87
No files found.
app/assets/javascripts/ide/components/commit_sidebar/form.vue
View file @
9cb894b9
...
...
@@ -6,7 +6,6 @@ import CommitMessageField from './message_field.vue';
import
Actions
from
'
./actions.vue
'
;
import
SuccessMessage
from
'
./success_message.vue
'
;
import
{
activityBarViews
,
MAX_WINDOW_HEIGHT_COMPACT
}
from
'
../../constants
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
export
default
{
components
:
{
...
...
@@ -15,7 +14,6 @@ export default {
CommitMessageField
,
SuccessMessage
,
},
mixins
:
[
glFeatureFlagsMixin
()],
data
()
{
return
{
isCompact
:
true
,
...
...
@@ -29,13 +27,9 @@ export default {
...
mapGetters
(
'
commit
'
,
[
'
discardDraftButtonDisabled
'
,
'
preBuiltCommitMessage
'
]),
overviewText
()
{
return
sprintf
(
this
.
glFeatures
.
stageAllByDefault
?
__
(
'
<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes
'
,
)
:
__
(
'
<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes
'
,
),
__
(
'
<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes
'
,
),
{
stagedFilesLength
:
this
.
stagedFiles
.
length
,
changedFilesLength
:
this
.
changedFiles
.
length
,
...
...
app/assets/javascripts/ide/components/file_row_extra.vue
View file @
9cb894b9
...
...
@@ -6,7 +6,6 @@ import Icon from '~/vue_shared/components/icon.vue';
import
ChangedFileIcon
from
'
~/vue_shared/components/changed_file_icon.vue
'
;
import
NewDropdown
from
'
./new_dropdown/index.vue
'
;
import
MrFileIcon
from
'
./mr_file_icon.vue
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
export
default
{
name
:
'
FileRowExtra
'
,
...
...
@@ -19,7 +18,6 @@ export default {
ChangedFileIcon
,
MrFileIcon
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
file
:
{
type
:
Object
,
...
...
@@ -57,15 +55,10 @@ export default {
return
n__
(
'
%d staged change
'
,
'
%d staged changes
'
,
this
.
folderStagedCount
);
}
return
sprintf
(
this
.
glFeatures
.
stageAllByDefault
?
__
(
'
%{staged} staged and %{unstaged} unstaged changes
'
)
:
__
(
'
%{unstaged} unstaged and %{staged} staged changes
'
),
{
unstaged
:
this
.
folderUnstagedCount
,
staged
:
this
.
folderStagedCount
,
},
);
return
sprintf
(
__
(
'
%{staged} staged and %{unstaged} unstaged changes
'
),
{
unstaged
:
this
.
folderUnstagedCount
,
staged
:
this
.
folderStagedCount
,
});
},
showTreeChangesCount
()
{
return
this
.
isTree
&&
this
.
changesCount
>
0
&&
!
this
.
file
.
opened
;
...
...
app/assets/javascripts/ide/stores/actions.js
View file @
9cb894b9
...
...
@@ -79,10 +79,7 @@ export const createTempEntry = (
if
(
type
===
'
blob
'
)
{
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
.
path
);
if
(
gon
.
features
?.
stageAllByDefault
)
commit
(
types
.
STAGE_CHANGE
,
{
path
:
file
.
path
,
diffInfo
:
getters
.
getDiffInfo
(
file
.
path
)
});
else
commit
(
types
.
ADD_FILE_TO_CHANGED
,
file
.
path
);
commit
(
types
.
STAGE_CHANGE
,
{
path
:
file
.
path
,
diffInfo
:
getters
.
getDiffInfo
(
file
.
path
)
});
dispatch
(
'
setFileActive
'
,
file
.
path
);
dispatch
(
'
triggerFilesChange
'
);
...
...
@@ -250,9 +247,7 @@ export const renameEntry = ({ dispatch, commit, state, getters }, { path, name,
if
(
isReset
)
{
commit
(
types
.
REMOVE_FILE_FROM_STAGED_AND_CHANGED
,
newEntry
);
}
else
if
(
!
isInChanges
)
{
if
(
gon
.
features
?.
stageAllByDefault
)
commit
(
types
.
STAGE_CHANGE
,
{
path
:
newPath
,
diffInfo
:
getters
.
getDiffInfo
(
newPath
)
});
else
commit
(
types
.
ADD_FILE_TO_CHANGED
,
newPath
);
commit
(
types
.
STAGE_CHANGE
,
{
path
:
newPath
,
diffInfo
:
getters
.
getDiffInfo
(
newPath
)
});
}
if
(
!
newEntry
.
tempFile
)
{
...
...
app/assets/javascripts/ide/stores/actions/file.js
View file @
9cb894b9
...
...
@@ -158,9 +158,7 @@ export const changeFileContent = ({ commit, state, getters }, { path, content })
const
indexOfChangedFile
=
state
.
changedFiles
.
findIndex
(
f
=>
f
.
path
===
path
);
if
(
file
.
changed
&&
indexOfChangedFile
===
-
1
)
{
if
(
gon
.
features
?.
stageAllByDefault
)
commit
(
types
.
STAGE_CHANGE
,
{
path
,
diffInfo
:
getters
.
getDiffInfo
(
path
)
});
else
commit
(
types
.
ADD_FILE_TO_CHANGED
,
path
);
commit
(
types
.
STAGE_CHANGE
,
{
path
,
diffInfo
:
getters
.
getDiffInfo
(
path
)
});
}
else
if
(
!
file
.
changed
&&
!
file
.
tempFile
&&
indexOfChangedFile
!==
-
1
)
{
commit
(
types
.
REMOVE_FILE_FROM_CHANGED
,
path
);
}
...
...
app/controllers/ide_controller.rb
View file @
9cb894b9
...
...
@@ -3,10 +3,6 @@
class
IdeController
<
ApplicationController
layout
'fullscreen'
before_action
do
push_frontend_feature_flag
(
:stage_all_by_default
,
default_enabled:
true
)
end
def
index
Gitlab
::
UsageDataCounters
::
WebIdeCounter
.
increment_views_count
end
...
...
locale/gitlab.pot
View file @
9cb894b9
...
...
@@ -466,9 +466,6 @@ msgstr ""
msgid "%{total} open issues"
msgstr ""
msgid "%{unstaged} unstaged and %{staged} staged changes"
msgstr ""
msgid "%{usage_ping_link_start}Learn more%{usage_ping_link_end} about what information is shared with GitLab Inc."
msgstr ""
...
...
@@ -727,9 +724,6 @@ msgstr ""
msgid "<no scopes selected>"
msgstr ""
msgid "<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes"
msgstr ""
msgid "<strong>%{group_name}</strong> group members"
msgstr ""
...
...
spec/frontend/ide/stores/actions/file_spec.js
View file @
9cb894b9
...
...
@@ -534,27 +534,21 @@ describe('IDE store file actions', () => {
.
catch
(
done
.
fail
);
});
it
(
'
adds a newline to the end of the file if it doesnt already exist
'
,
done
=>
{
callAction
(
'
content
'
)
.
then
(()
=>
{
expect
(
tmpFile
.
content
).
toBe
(
'
content
\n
'
);
done
();
it
(
'
adds file into stagedFiles array
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
catch
(
done
.
fail
);
});
it
(
'
adds file into changedFiles array
'
,
done
=>
{
callAction
()
.
then
(()
=>
{
expect
(
store
.
state
.
chan
gedFiles
.
length
).
toBe
(
1
);
expect
(
store
.
state
.
sta
gedFiles
.
length
).
toBe
(
1
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
adds file not more than once into
chan
gedFiles array
'
,
done
=>
{
it
(
'
adds file not more than once into
sta
gedFiles array
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
...
...
@@ -567,7 +561,7 @@ describe('IDE store file actions', () => {
}),
)
.
then
(()
=>
{
expect
(
store
.
state
.
chan
gedFiles
.
length
).
toBe
(
1
);
expect
(
store
.
state
.
sta
gedFiles
.
length
).
toBe
(
1
);
done
();
})
...
...
@@ -594,52 +588,6 @@ describe('IDE store file actions', () => {
.
catch
(
done
.
fail
);
});
describe
(
'
when `gon.feature.stageAllByDefault` is true
'
,
()
=>
{
const
originalGonFeatures
=
Object
.
assign
({},
gon
.
features
);
beforeAll
(()
=>
{
gon
.
features
=
{
stageAllByDefault
:
true
};
});
afterAll
(()
=>
{
gon
.
features
=
originalGonFeatures
;
});
it
(
'
adds file into stagedFiles array
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
{
expect
(
store
.
state
.
stagedFiles
.
length
).
toBe
(
1
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
adds file not more than once into stagedFiles array
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
content
:
'
content 123
'
,
}),
)
.
then
(()
=>
{
expect
(
store
.
state
.
stagedFiles
.
length
).
toBe
(
1
);
done
();
})
.
catch
(
done
.
fail
);
});
});
it
(
'
bursts unused seal
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
...
...
spec/frontend/ide/stores/integration_spec.js
View file @
9cb894b9
...
...
@@ -61,19 +61,14 @@ describe('IDE store integration', () => {
store
.
dispatch
(
'
createTempEntry
'
,
{
name
:
TEST_PATH
,
type
:
'
blob
'
});
});
it
(
'
has changed and staged
'
,
()
=>
{
expect
(
store
.
state
.
changedFiles
).
toEqual
([
expect
.
objectContaining
({
path
:
TEST_PATH
,
tempFile
:
true
,
deleted
:
false
,
}),
]);
it
(
'
is added to staged as modified
'
,
()
=>
{
expect
(
store
.
state
.
stagedFiles
).
toEqual
([
expect
.
objectContaining
({
path
:
TEST_PATH
,
deleted
:
true
,
deleted
:
false
,
staged
:
true
,
changed
:
true
,
tempFile
:
false
,
}),
]);
});
...
...
spec/javascripts/ide/components/commit_sidebar/form_spec.js
View file @
9cb894b9
...
...
@@ -52,7 +52,7 @@ describe('IDE commit form', () => {
vm
.
$store
.
state
.
stagedFiles
.
push
(
'
test
'
);
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
p
'
).
textContent
).
toContain
(
'
1
unstaged and 1
staged changes
'
);
expect
(
vm
.
$el
.
querySelector
(
'
p
'
).
textContent
).
toContain
(
'
1
staged and 1 un
staged changes
'
);
done
();
});
});
...
...
spec/javascripts/ide/components/file_row_extra_spec.js
View file @
9cb894b9
...
...
@@ -63,7 +63,7 @@ describe('IDE extra file row component', () => {
stagedFilesCount
=
1
;
unstagedFilesCount
=
1
;
expect
(
vm
.
folderChangesTooltip
).
toBe
(
'
1
unstaged and 1
staged changes
'
);
expect
(
vm
.
folderChangesTooltip
).
toBe
(
'
1
staged and 1 un
staged changes
'
);
});
});
...
...
spec/javascripts/ide/stores/actions_spec.js
View file @
9cb894b9
...
...
@@ -225,35 +225,6 @@ describe('Multi-file store actions', () => {
.
catch
(
done
.
fail
);
});
describe
(
'
when `gon.feature.stageAllByDefault` is true
'
,
()
=>
{
const
originalGonFeatures
=
Object
.
assign
({},
gon
.
features
);
beforeAll
(()
=>
{
gon
.
features
=
{
stageAllByDefault
:
true
};
});
afterAll
(()
=>
{
gon
.
features
=
originalGonFeatures
;
});
it
(
'
adds tmp file to staged files
'
,
done
=>
{
const
name
=
'
test
'
;
store
.
dispatch
(
'
createTempEntry
'
,
{
name
,
branchId
:
'
mybranch
'
,
type
:
'
blob
'
,
})
.
then
(()
=>
{
expect
(
store
.
state
.
stagedFiles
).
toEqual
([
jasmine
.
objectContaining
({
name
})]);
done
();
})
.
catch
(
done
.
fail
);
});
});
it
(
'
adds tmp file to open files
'
,
done
=>
{
const
name
=
'
test
'
;
...
...
@@ -274,7 +245,7 @@ describe('Multi-file store actions', () => {
.
catch
(
done
.
fail
);
});
it
(
'
adds tmp file to
chan
ged files
'
,
done
=>
{
it
(
'
adds tmp file to
sta
ged files
'
,
done
=>
{
const
name
=
'
test
'
;
store
...
...
@@ -284,9 +255,7 @@ describe('Multi-file store actions', () => {
type
:
'
blob
'
,
})
.
then
(()
=>
{
expect
(
store
.
state
.
changedFiles
).
toEqual
([
jasmine
.
objectContaining
({
name
,
tempFile
:
true
}),
]);
expect
(
store
.
state
.
stagedFiles
).
toEqual
([
jasmine
.
objectContaining
({
name
})]);
done
();
})
...
...
@@ -294,15 +263,9 @@ describe('Multi-file store actions', () => {
});
it
(
'
sets tmp file as active
'
,
()
=>
{
const
dispatch
=
jasmine
.
createSpy
();
const
commit
=
jasmine
.
createSpy
();
createTempEntry
(
{
state
:
store
.
state
,
getters
:
store
.
getters
,
dispatch
,
commit
},
{
name
:
'
test
'
,
branchId
:
'
mybranch
'
,
type
:
'
blob
'
},
);
createTempEntry
(
store
,
{
name
:
'
test
'
,
branchId
:
'
mybranch
'
,
type
:
'
blob
'
});
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
setFileActive
'
,
'
test
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
setFileActive
'
,
'
test
'
);
});
it
(
'
creates flash message if file already exists
'
,
done
=>
{
...
...
@@ -804,55 +767,19 @@ describe('Multi-file store actions', () => {
});
});
describe
(
'
when `gon.feature.stageAllByDefault` is true
'
,
()
=>
{
const
originalGonFeatures
=
Object
.
assign
({},
gon
.
features
);
beforeAll
(()
=>
{
gon
.
features
=
{
stageAllByDefault
:
true
};
});
afterAll
(()
=>
{
gon
.
features
=
originalGonFeatures
;
});
it
(
'
by default renames an entry and stages it
'
,
()
=>
{
const
dispatch
=
jasmine
.
createSpy
();
const
commit
=
jasmine
.
createSpy
();
renameEntry
(
{
dispatch
,
commit
,
state
:
store
.
state
,
getters
:
store
.
getters
},
{
path
:
'
orig
'
,
name
:
'
renamed
'
},
);
expect
(
commit
.
calls
.
allArgs
()).
toEqual
([
[
types
.
RENAME_ENTRY
,
{
path
:
'
orig
'
,
name
:
'
renamed
'
,
parentPath
:
undefined
}],
[
types
.
STAGE_CHANGE
,
jasmine
.
objectContaining
({
path
:
'
renamed
'
})],
]);
});
});
it
(
'
by default renames an entry and stages it
'
,
()
=>
{
const
dispatch
=
jasmine
.
createSpy
();
const
commit
=
jasmine
.
createSpy
();
it
(
'
by default renames an entry and adds to changed
'
,
done
=>
{
testAction
(
renameEntry
,
renameEntry
(
{
dispatch
,
commit
,
state
:
store
.
state
,
getters
:
store
.
getters
},
{
path
:
'
orig
'
,
name
:
'
renamed
'
},
store
.
state
,
[
{
type
:
types
.
RENAME_ENTRY
,
payload
:
{
path
:
'
orig
'
,
name
:
'
renamed
'
,
parentPath
:
undefined
,
},
},
{
type
:
types
.
ADD_FILE_TO_CHANGED
,
payload
:
'
renamed
'
,
},
],
jasmine
.
any
(
Object
),
done
,
);
expect
(
commit
.
calls
.
allArgs
()).
toEqual
([
[
types
.
RENAME_ENTRY
,
{
path
:
'
orig
'
,
name
:
'
renamed
'
,
parentPath
:
undefined
}],
[
types
.
STAGE_CHANGE
,
jasmine
.
objectContaining
({
path
:
'
renamed
'
})],
]);
});
it
(
'
if not changed, completely unstages and discards entry if renamed to original
'
,
done
=>
{
...
...
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