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
b42cae52
Commit
b42cae52
authored
May 08, 2020
by
Scott Stern
Committed by
Andrew Fontaine
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect confidential component to notes store
parent
a0f2c5ba
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
36 deletions
+38
-36
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+1
-3
app/assets/javascripts/notes/stores/index.js
app/assets/javascripts/notes/stores/index.js
+5
-1
app/assets/javascripts/notes/stores/modules/index.js
app/assets/javascripts/notes/stores/modules/index.js
+1
-0
app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
...ar/components/confidential/confidential_issue_sidebar.vue
+10
-13
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+2
-1
spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
...bar/__snapshots__/confidential_issue_sidebar_spec.js.snap
+4
-8
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
+15
-10
No files found.
app/assets/javascripts/notes/index.js
View file @
b42cae52
...
...
@@ -2,11 +2,9 @@ import Vue from 'vue';
import
notesApp
from
'
./components/notes_app.vue
'
;
import
initDiscussionFilters
from
'
./discussion_filters
'
;
import
initSortDiscussions
from
'
./sort_discussions
'
;
import
createStore
from
'
./stores
'
;
import
{
store
}
from
'
./stores
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
store
=
createStore
();
// eslint-disable-next-line no-new
new
Vue
({
el
:
'
#js-vue-notes
'
,
...
...
app/assets/javascripts/notes/stores/index.js
View file @
b42cae52
...
...
@@ -4,4 +4,8 @@ import notesModule from './modules';
Vue
.
use
(
Vuex
);
export
default
()
=>
new
Vuex
.
Store
(
notesModule
());
// NOTE: Giving the option to either use a singleton or new instance of notes.
const
notesStore
=
()
=>
new
Vuex
.
Store
(
notesModule
());
export
default
notesStore
;
export
const
store
=
notesStore
();
app/assets/javascripts/notes/stores/modules/index.js
View file @
b42cae52
...
...
@@ -25,6 +25,7 @@ export default () => ({
},
userData
:
{},
noteableData
:
{
confidential
:
false
,
// TODO: Move data like this to Issue Store, should not be apart of notes.
current_user
:
{},
preview_note_path
:
'
path/to/preview
'
,
},
...
...
app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
View file @
b42cae52
<
script
>
import
{
mapState
}
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
e
ditForm
from
'
./edit_form.vue
'
;
import
E
ditForm
from
'
./edit_form.vue
'
;
import
recaptchaModalImplementor
from
'
~/vue_shared/mixins/recaptcha_modal_implementor
'
;
export
default
{
components
:
{
e
ditForm
,
E
ditForm
,
Icon
,
},
directives
:
{
...
...
@@ -17,10 +18,6 @@ export default {
},
mixins
:
[
recaptchaModalImplementor
],
props
:
{
isConfidential
:
{
required
:
true
,
type
:
Boolean
,
},
isEditable
:
{
required
:
true
,
type
:
Boolean
,
...
...
@@ -36,11 +33,12 @@ export default {
};
},
computed
:
{
...
mapState
({
confidential
:
({
noteableData
})
=>
noteableData
.
confidential
}),
confidentialityIcon
()
{
return
this
.
isC
onfidential
?
'
eye-slash
'
:
'
eye
'
;
return
this
.
c
onfidential
?
'
eye-slash
'
:
'
eye
'
;
},
tooltipLabel
()
{
return
this
.
isC
onfidential
?
__
(
'
Confidential
'
)
:
__
(
'
Not confidential
'
);
return
this
.
c
onfidential
?
__
(
'
Confidential
'
)
:
__
(
'
Not confidential
'
);
},
},
created
()
{
...
...
@@ -95,17 +93,16 @@ export default {
data-track-label=
"right_sidebar"
data-track-property=
"confidentiality"
@
click.prevent=
"toggleForm"
>
{{
__
(
'
Edit
'
)
}}
</a
>
{{
__
(
'
Edit
'
)
}}
</a>
</div>
<div
class=
"value sidebar-item-value hide-collapsed"
>
<edit
F
orm
<edit
-f
orm
v-if=
"edit"
:is-confidential=
"
isC
onfidential"
:is-confidential=
"
c
onfidential"
:update-confidential-attribute=
"updateConfidentialAttribute"
/>
<div
v-if=
"!
isC
onfidential"
class=
"no-value sidebar-item-value"
>
<div
v-if=
"!
c
onfidential"
class=
"no-value sidebar-item-value"
>
<icon
:size=
"16"
name=
"eye"
aria-hidden=
"true"
class=
"sidebar-item-icon inline"
/>
{{
__
(
'
Not confidential
'
)
}}
</div>
...
...
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
b42cae52
...
...
@@ -10,6 +10,7 @@ import sidebarParticipants from './components/participants/sidebar_participants.
import
sidebarSubscriptions
from
'
./components/subscriptions/sidebar_subscriptions.vue
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
store
}
from
'
~/notes/stores
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
VueApollo
);
...
...
@@ -59,8 +60,8 @@ function mountConfidentialComponent(mediator) {
const
ConfidentialComp
=
Vue
.
extend
(
ConfidentialIssueSidebar
);
new
ConfidentialComp
({
store
,
propsData
:
{
isConfidential
:
initialData
.
is_confidential
,
isEditable
:
initialData
.
is_editable
,
service
:
mediator
.
service
,
},
...
...
spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
View file @
b42cae52
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Confidential Issue Sidebar Block renders for
isC
onfidential = false and isEditable = false 1`] = `
exports[`Confidential Issue Sidebar Block renders for
c
onfidential = false and isEditable = false 1`] = `
<div
class="block issuable-sidebar-item confidentiality"
>
...
...
@@ -52,7 +52,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
`;
exports[`Confidential Issue Sidebar Block renders for
isC
onfidential = false and isEditable = true 1`] = `
exports[`Confidential Issue Sidebar Block renders for
c
onfidential = false and isEditable = true 1`] = `
<div
class="block issuable-sidebar-item confidentiality"
>
...
...
@@ -84,9 +84,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
data-track-property="confidentiality"
href="#"
>
Edit
</a>
</div>
...
...
@@ -114,7 +112,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
`;
exports[`Confidential Issue Sidebar Block renders for
isC
onfidential = true and isEditable = false 1`] = `
exports[`Confidential Issue Sidebar Block renders for
c
onfidential = true and isEditable = false 1`] = `
<div
class="block issuable-sidebar-item confidentiality"
>
...
...
@@ -166,7 +164,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
</div>
`;
exports[`Confidential Issue Sidebar Block renders for
isC
onfidential = true and isEditable = true 1`] = `
exports[`Confidential Issue Sidebar Block renders for
c
onfidential = true and isEditable = true 1`] = `
<div
class="block issuable-sidebar-item confidentiality"
>
...
...
@@ -198,9 +196,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
data-track-property="confidentiality"
href="#"
>
Edit
</a>
</div>
...
...
spec/frontend/sidebar/confidential_issue_sidebar_spec.js
View file @
b42cae52
...
...
@@ -5,6 +5,7 @@ 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
'
;
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/sidebar/services/sidebar_service
'
);
...
...
@@ -31,8 +32,10 @@ describe('Confidential Issue Sidebar Block', () => {
};
const
createComponent
=
propsData
=>
{
const
store
=
createStore
();
const
service
=
new
SidebarService
();
wrapper
=
shallowMount
(
ConfidentialIssueSidebar
,
{
store
,
propsData
:
{
service
,
...
propsData
,
...
...
@@ -49,29 +52,31 @@ describe('Confidential Issue Sidebar Block', () => {
});
it
.
each
`
isC
onfidential | isEditable
${
false
}
|
${
false
}
${
false
}
|
${
true
}
${
true
}
|
${
false
}
${
true
}
|
${
true
}
c
onfidential | isEditable
${
false
}
|
${
false
}
${
false
}
|
${
true
}
${
true
}
|
${
false
}
${
true
}
|
${
true
}
`
(
'
renders for
isConfidential = $isC
onfidential and isEditable = $isEditable
'
,
({
isC
onfidential
,
isEditable
})
=>
{
'
renders for
confidential = $c
onfidential and isEditable = $isEditable
'
,
({
c
onfidential
,
isEditable
})
=>
{
createComponent
({
isConfidential
,
isEditable
,
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
confidential
;
expect
(
wrapper
.
element
).
toMatchSnapshot
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
},
);
describe
(
'
if editable
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
isConfidential
:
true
,
isEditable
:
true
,
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
true
;
});
it
(
'
displays the edit form when editable
'
,
()
=>
{
...
...
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