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
16b4671d
Commit
16b4671d
authored
Jul 29, 2020
by
Scott Stern
Committed by
Kushal Pandya
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ff for confidential apollo implementation
parent
dc6b984c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
178 deletions
+40
-178
app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
...ar/components/confidential/confidential_issue_sidebar.vue
+0
-25
app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
...pts/sidebar/components/confidential/edit_form_buttons.vue
+8
-14
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+0
-1
spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
...bar/__snapshots__/confidential_issue_sidebar_spec.js.snap
+0
-8
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
+32
-55
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
+0
-75
No files found.
app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
View file @
16b4671d
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
Flash
from
'
~/flash
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
import
EditForm
from
'
./edit_form.vue
'
;
import
recaptchaModalImplementor
from
'
~/vue_shared/mixins/recaptcha_modal_implementor
'
;
export
default
{
components
:
{
...
...
@@ -16,7 +14,6 @@ export default {
directives
:
{
tooltip
,
},
mixins
:
[
recaptchaModalImplementor
],
props
:
{
fullPath
:
{
required
:
true
,
...
...
@@ -46,11 +43,9 @@ export default {
},
},
created
()
{
eventHub
.
$on
(
'
updateConfidentialAttribute
'
,
this
.
updateConfidentialAttribute
);
eventHub
.
$on
(
'
closeConfidentialityForm
'
,
this
.
toggleForm
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
updateConfidentialAttribute
'
,
this
.
updateConfidentialAttribute
);
eventHub
.
$off
(
'
closeConfidentialityForm
'
,
this
.
toggleForm
);
},
methods
:
{
...
...
@@ -58,24 +53,6 @@ export default {
toggleForm
()
{
this
.
edit
=
!
this
.
edit
;
},
closeForm
()
{
this
.
edit
=
false
;
},
updateConfidentialAttribute
()
{
// TODO: rm when FF is defaulted to on.
const
confidential
=
!
this
.
confidential
;
this
.
service
.
update
(
'
issue
'
,
{
confidential
})
.
then
(({
data
})
=>
this
.
checkForSpam
(
data
))
.
then
(()
=>
window
.
location
.
reload
())
.
catch
(
error
=>
{
if
(
error
.
name
===
'
SpamError
'
)
{
this
.
openRecaptcha
();
}
else
{
Flash
(
__
(
'
Something went wrong trying to change the confidentiality of this issue
'
));
}
});
},
},
};
</
script
>
...
...
@@ -124,7 +101,5 @@ export default {
{{
__
(
'
This issue is confidential
'
)
}}
</div>
</div>
<recaptcha-modal
v-if=
"showRecaptcha"
:html=
"recaptchaHTML"
@
close=
"closeRecaptcha"
/>
</div>
</
template
>
app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
View file @
16b4671d
...
...
@@ -3,7 +3,6 @@ import $ from 'jquery';
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
Flash
from
'
~/flash
'
;
import
eventHub
from
'
../../event_hub
'
;
...
...
@@ -11,7 +10,6 @@ export default {
components
:
{
GlLoadingIcon
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
fullPath
:
{
required
:
true
,
...
...
@@ -43,18 +41,14 @@ export default {
this
.
isLoading
=
true
;
const
confidential
=
!
this
.
confidential
;
if
(
this
.
glFeatures
.
confidentialApolloSidebar
)
{
this
.
updateConfidentialityOnIssue
({
confidential
,
fullPath
:
this
.
fullPath
})
.
catch
(()
=>
{
Flash
(
__
(
'
Something went wrong trying to change the confidentiality of this issue
'
));
})
.
finally
(()
=>
{
this
.
closeForm
();
this
.
isLoading
=
false
;
});
}
else
{
eventHub
.
$emit
(
'
updateConfidentialAttribute
'
);
}
this
.
updateConfidentialityOnIssue
({
confidential
,
fullPath
:
this
.
fullPath
})
.
catch
(()
=>
{
Flash
(
__
(
'
Something went wrong trying to change the confidentiality of this issue
'
));
})
.
finally
(()
=>
{
this
.
closeForm
();
this
.
isLoading
=
false
;
});
},
},
};
...
...
app/controllers/projects/issues_controller.rb
View file @
16b4671d
...
...
@@ -52,7 +52,6 @@ class Projects::IssuesController < Projects::ApplicationController
before_action
only: :show
do
push_frontend_feature_flag
(
:real_time_issue_sidebar
,
@project
)
push_frontend_feature_flag
(
:confidential_apollo_sidebar
,
@project
)
end
before_action
only: :index
do
...
...
spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
View file @
16b4671d
...
...
@@ -49,8 +49,6 @@ exports[`Confidential Issue Sidebar Block renders for confidential = false and i
</div>
</div>
<!---->
</div>
`;
...
...
@@ -111,8 +109,6 @@ exports[`Confidential Issue Sidebar Block renders for confidential = false and i
</div>
</div>
<!---->
</div>
`;
...
...
@@ -164,8 +160,6 @@ exports[`Confidential Issue Sidebar Block renders for confidential = true and is
</div>
</div>
<!---->
</div>
`;
...
...
@@ -225,7 +219,5 @@ exports[`Confidential Issue Sidebar Block renders for confidential = true and is
</div>
</div>
<!---->
</div>
`;
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
View file @
16b4671d
...
...
@@ -14,12 +14,7 @@ describe('Edit Form Buttons', () => {
let
store
;
const
findConfidentialToggle
=
()
=>
wrapper
.
find
(
'
[data-testid="confidential-toggle"]
'
);
const
createComponent
=
({
props
=
{},
data
=
{},
confidentialApolloSidebar
=
false
,
resolved
=
true
,
})
=>
{
const
createComponent
=
({
props
=
{},
data
=
{},
resolved
=
true
})
=>
{
store
=
createStore
();
if
(
resolved
)
{
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockResolvedValue
();
...
...
@@ -38,11 +33,6 @@ describe('Edit Form Buttons', () => {
...
data
,
};
},
provide
:
{
glFeatures
:
{
confidentialApolloSidebar
,
},
},
store
,
});
};
...
...
@@ -98,62 +88,49 @@ describe('Edit Form Buttons', () => {
it
(
'
renders on or off text based on confidentiality
'
,
()
=>
{
expect
(
findConfidentialToggle
().
text
()).
toBe
(
'
Turn Off
'
);
});
describe
(
'
when clicking on the confidential toggle
'
,
()
=>
{
it
(
'
emits updateConfidentialAttribute
'
,
()
=>
{
findConfidentialToggle
().
trigger
(
'
click
'
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
updateConfidentialAttribute
'
);
});
});
});
describe
(
'
when confidentialApolloSidebar is turned on
'
,
()
=>
{
const
isConfidential
=
true
;
describe
(
'
when succeeds
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
data
:
{
isLoading
:
false
},
confidentialApolloSidebar
:
true
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
isConfidential
;
findConfidentialToggle
().
trigger
(
'
click
'
);
});
describe
(
'
when succeeds
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
data
:
{
isLoading
:
false
}
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
true
;
findConfidentialToggle
().
trigger
(
'
click
'
);
});
it
(
'
dispatches the correct action
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
updateConfidentialityOnIssue
'
,
{
confidential
:
!
isConfidential
,
fullPath
:
''
,
});
it
(
'
dispatches the correct action
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
updateConfidentialityOnIssue
'
,
{
confidential
:
false
,
fullPath
:
''
,
});
});
it
(
'
resets loading
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
wrapper
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
false
);
});
it
(
'
resets loading
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
wrapper
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
false
);
});
});
it
(
'
emits close form
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
closeConfidentialityForm
'
);
});
it
(
'
emits close form
'
,
()
=>
{
return
waitForPromises
().
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
closeConfidentialityForm
'
);
});
});
});
describe
(
'
when fails
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
data
:
{
isLoading
:
false
},
confidentialApolloSidebar
:
true
,
resolved
:
false
,
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
isConfidential
;
findConfidentialToggle
().
trigger
(
'
click
'
);
describe
(
'
when fails
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
data
:
{
isLoading
:
false
},
resolved
:
false
,
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
true
;
findConfidentialToggle
().
trigger
(
'
click
'
);
});
it
(
'
calls flash with the correct message
'
,
()
=>
{
expect
(
flash
).
toHaveBeenCalledWith
(
'
Something went wrong trying to change the confidentiality of this issue
'
,
);
});
it
(
'
calls flash with the correct message
'
,
()
=>
{
expect
(
flash
).
toHaveBeenCalledWith
(
'
Something went wrong trying to change the confidentiality of this issue
'
,
);
});
});
});
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
View file @
16b4671d
...
...
@@ -3,11 +3,8 @@ import { mockTracking, triggerEvent } from 'helpers/tracking_helper';
import
ConfidentialIssueSidebar
from
'
~/sidebar/components/confidential/confidential_issue_sidebar.vue
'
;
import
EditForm
from
'
~/sidebar/components/confidential/edit_form.vue
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
createFlash
from
'
~/flash
'
;
import
RecaptchaModal
from
'
~/vue_shared/components/recaptcha_modal.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
import
{
useMockLocationHelper
}
from
'
helpers/mock_window_location_helper
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/sidebar/services/sidebar_service
'
);
...
...
@@ -20,22 +17,6 @@ describe('Confidential Issue Sidebar Block', () => {
.
fn
()
.
mockResolvedValue
({
data
:
{
issueSetConfidential
:
{
issue
:
{
confidential
:
true
}
}
}
});
const
findRecaptchaModal
=
()
=>
wrapper
.
find
(
RecaptchaModal
);
const
triggerUpdateConfidentialAttribute
=
()
=>
{
wrapper
.
setData
({
edit
:
true
});
return
(
// wait for edit form to become visible
wrapper
.
vm
.
$nextTick
()
.
then
(()
=>
{
eventHub
.
$emit
(
'
updateConfidentialAttribute
'
);
})
// wait for reCAPTCHA modal to render
.
then
(()
=>
wrapper
.
vm
.
$nextTick
())
);
};
const
createComponent
=
({
propsData
,
data
=
{}
})
=>
{
const
store
=
createStore
();
const
service
=
new
SidebarService
();
...
...
@@ -133,61 +114,5 @@ describe('Confidential Issue Sidebar Block', () => {
property
:
'
confidentiality
'
,
});
});
describe
(
'
for successful update
'
,
()
=>
{
beforeEach
(()
=>
{
SidebarService
.
prototype
.
update
.
mockResolvedValue
({
data
:
'
irrelevant
'
});
});
it
(
'
reloads the page
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
window
.
location
.
reload
).
toHaveBeenCalled
();
}));
it
(
'
does not show an error message
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
createFlash
).
not
.
toHaveBeenCalled
();
}));
});
describe
(
'
for update error
'
,
()
=>
{
beforeEach
(()
=>
{
SidebarService
.
prototype
.
update
.
mockRejectedValue
(
new
Error
(
'
updating failed!
'
));
});
it
(
'
does not reload the page
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
window
.
location
.
reload
).
not
.
toHaveBeenCalled
();
}));
it
(
'
shows an error message
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalled
();
}));
});
describe
(
'
for spam error
'
,
()
=>
{
beforeEach
(()
=>
{
SidebarService
.
prototype
.
update
.
mockRejectedValue
({
name
:
'
SpamError
'
});
});
it
(
'
does not reload the page
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
window
.
location
.
reload
).
not
.
toHaveBeenCalled
();
}));
it
(
'
does not show an error message
'
,
()
=>
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
createFlash
).
not
.
toHaveBeenCalled
();
}));
it
(
'
shows a reCAPTCHA modal
'
,
()
=>
{
expect
(
findRecaptchaModal
().
exists
()).
toBe
(
false
);
return
triggerUpdateConfidentialAttribute
().
then
(()
=>
{
expect
(
findRecaptchaModal
().
exists
()).
toBe
(
true
);
});
});
});
});
});
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