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';
...
@@ -2,11 +2,9 @@ import Vue from 'vue';
import
notesApp
from
'
./components/notes_app.vue
'
;
import
notesApp
from
'
./components/notes_app.vue
'
;
import
initDiscussionFilters
from
'
./discussion_filters
'
;
import
initDiscussionFilters
from
'
./discussion_filters
'
;
import
initSortDiscussions
from
'
./sort_discussions
'
;
import
initSortDiscussions
from
'
./sort_discussions
'
;
import
createStore
from
'
./stores
'
;
import
{
store
}
from
'
./stores
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
store
=
createStore
();
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
Vue
({
new
Vue
({
el
:
'
#js-vue-notes
'
,
el
:
'
#js-vue-notes
'
,
...
...
app/assets/javascripts/notes/stores/index.js
View file @
b42cae52
...
@@ -4,4 +4,8 @@ import notesModule from './modules';
...
@@ -4,4 +4,8 @@ import notesModule from './modules';
Vue
.
use
(
Vuex
);
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 () => ({
...
@@ -25,6 +25,7 @@ export default () => ({
},
},
userData
:
{},
userData
:
{},
noteableData
:
{
noteableData
:
{
confidential
:
false
,
// TODO: Move data like this to Issue Store, should not be apart of notes.
current_user
:
{},
current_user
:
{},
preview_note_path
:
'
path/to/preview
'
,
preview_note_path
:
'
path/to/preview
'
,
},
},
...
...
app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
View file @
b42cae52
<
script
>
<
script
>
import
{
mapState
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
Flash
from
'
~/flash
'
;
import
Flash
from
'
~/flash
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
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
'
;
import
recaptchaModalImplementor
from
'
~/vue_shared/mixins/recaptcha_modal_implementor
'
;
export
default
{
export
default
{
components
:
{
components
:
{
e
ditForm
,
E
ditForm
,
Icon
,
Icon
,
},
},
directives
:
{
directives
:
{
...
@@ -17,10 +18,6 @@ export default {
...
@@ -17,10 +18,6 @@ export default {
},
},
mixins
:
[
recaptchaModalImplementor
],
mixins
:
[
recaptchaModalImplementor
],
props
:
{
props
:
{
isConfidential
:
{
required
:
true
,
type
:
Boolean
,
},
isEditable
:
{
isEditable
:
{
required
:
true
,
required
:
true
,
type
:
Boolean
,
type
:
Boolean
,
...
@@ -36,11 +33,12 @@ export default {
...
@@ -36,11 +33,12 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
({
confidential
:
({
noteableData
})
=>
noteableData
.
confidential
}),
confidentialityIcon
()
{
confidentialityIcon
()
{
return
this
.
isC
onfidential
?
'
eye-slash
'
:
'
eye
'
;
return
this
.
c
onfidential
?
'
eye-slash
'
:
'
eye
'
;
},
},
tooltipLabel
()
{
tooltipLabel
()
{
return
this
.
isC
onfidential
?
__
(
'
Confidential
'
)
:
__
(
'
Not confidential
'
);
return
this
.
c
onfidential
?
__
(
'
Confidential
'
)
:
__
(
'
Not confidential
'
);
},
},
},
},
created
()
{
created
()
{
...
@@ -95,17 +93,16 @@ export default {
...
@@ -95,17 +93,16 @@ export default {
data-track-label=
"right_sidebar"
data-track-label=
"right_sidebar"
data-track-property=
"confidentiality"
data-track-property=
"confidentiality"
@
click.prevent=
"toggleForm"
@
click.prevent=
"toggleForm"
>
{{
__
(
'
Edit
'
)
}}
</a
>
>
{{
__
(
'
Edit
'
)
}}
</a>
</div>
</div>
<div
class=
"value sidebar-item-value hide-collapsed"
>
<div
class=
"value sidebar-item-value hide-collapsed"
>
<edit
F
orm
<edit
-f
orm
v-if=
"edit"
v-if=
"edit"
:is-confidential=
"
isC
onfidential"
:is-confidential=
"
c
onfidential"
:update-confidential-attribute=
"updateConfidentialAttribute"
: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"
/>
<icon
:size=
"16"
name=
"eye"
aria-hidden=
"true"
class=
"sidebar-item-icon inline"
/>
{{
__
(
'
Not confidential
'
)
}}
{{
__
(
'
Not confidential
'
)
}}
</div>
</div>
...
...
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
b42cae52
...
@@ -10,6 +10,7 @@ import sidebarParticipants from './components/participants/sidebar_participants.
...
@@ -10,6 +10,7 @@ import sidebarParticipants from './components/participants/sidebar_participants.
import
sidebarSubscriptions
from
'
./components/subscriptions/sidebar_subscriptions.vue
'
;
import
sidebarSubscriptions
from
'
./components/subscriptions/sidebar_subscriptions.vue
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
store
}
from
'
~/notes/stores
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
...
@@ -59,8 +60,8 @@ function mountConfidentialComponent(mediator) {
...
@@ -59,8 +60,8 @@ function mountConfidentialComponent(mediator) {
const
ConfidentialComp
=
Vue
.
extend
(
ConfidentialIssueSidebar
);
const
ConfidentialComp
=
Vue
.
extend
(
ConfidentialIssueSidebar
);
new
ConfidentialComp
({
new
ConfidentialComp
({
store
,
propsData
:
{
propsData
:
{
isConfidential
:
initialData
.
is_confidential
,
isEditable
:
initialData
.
is_editable
,
isEditable
:
initialData
.
is_editable
,
service
:
mediator
.
service
,
service
:
mediator
.
service
,
},
},
...
...
spec/frontend/sidebar/__snapshots__/confidential_issue_sidebar_spec.js.snap
View file @
b42cae52
// Jest Snapshot v1, https://goo.gl/fbAQLP
// 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
<div
class="block issuable-sidebar-item confidentiality"
class="block issuable-sidebar-item confidentiality"
>
>
...
@@ -52,7 +52,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
...
@@ -52,7 +52,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
</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
<div
class="block issuable-sidebar-item confidentiality"
class="block issuable-sidebar-item confidentiality"
>
>
...
@@ -84,9 +84,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
...
@@ -84,9 +84,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
data-track-property="confidentiality"
data-track-property="confidentiality"
href="#"
href="#"
>
>
Edit
Edit
</a>
</a>
</div>
</div>
...
@@ -114,7 +112,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
...
@@ -114,7 +112,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = false and
</div>
</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
<div
class="block issuable-sidebar-item confidentiality"
class="block issuable-sidebar-item confidentiality"
>
>
...
@@ -166,7 +164,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
...
@@ -166,7 +164,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
</div>
</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
<div
class="block issuable-sidebar-item confidentiality"
class="block issuable-sidebar-item confidentiality"
>
>
...
@@ -198,9 +196,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
...
@@ -198,9 +196,7 @@ exports[`Confidential Issue Sidebar Block renders for isConfidential = true and
data-track-property="confidentiality"
data-track-property="confidentiality"
href="#"
href="#"
>
>
Edit
Edit
</a>
</a>
</div>
</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';
...
@@ -5,6 +5,7 @@ import EditForm from '~/sidebar/components/confidential/edit_form.vue';
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
RecaptchaModal
from
'
~/vue_shared/components/recaptcha_modal.vue
'
;
import
RecaptchaModal
from
'
~/vue_shared/components/recaptcha_modal.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/sidebar/services/sidebar_service
'
);
jest
.
mock
(
'
~/sidebar/services/sidebar_service
'
);
...
@@ -31,8 +32,10 @@ describe('Confidential Issue Sidebar Block', () => {
...
@@ -31,8 +32,10 @@ describe('Confidential Issue Sidebar Block', () => {
};
};
const
createComponent
=
propsData
=>
{
const
createComponent
=
propsData
=>
{
const
store
=
createStore
();
const
service
=
new
SidebarService
();
const
service
=
new
SidebarService
();
wrapper
=
shallowMount
(
ConfidentialIssueSidebar
,
{
wrapper
=
shallowMount
(
ConfidentialIssueSidebar
,
{
store
,
propsData
:
{
propsData
:
{
service
,
service
,
...
propsData
,
...
propsData
,
...
@@ -49,29 +52,31 @@ describe('Confidential Issue Sidebar Block', () => {
...
@@ -49,29 +52,31 @@ describe('Confidential Issue Sidebar Block', () => {
});
});
it
.
each
`
it
.
each
`
isC
onfidential | isEditable
c
onfidential | isEditable
${
false
}
|
${
false
}
${
false
}
|
${
false
}
${
false
}
|
${
true
}
${
false
}
|
${
true
}
${
true
}
|
${
false
}
${
true
}
|
${
false
}
${
true
}
|
${
true
}
${
true
}
|
${
true
}
`
(
`
(
'
renders for
isConfidential = $isC
onfidential and isEditable = $isEditable
'
,
'
renders for
confidential = $c
onfidential and isEditable = $isEditable
'
,
({
isC
onfidential
,
isEditable
})
=>
{
({
c
onfidential
,
isEditable
})
=>
{
createComponent
({
createComponent
({
isConfidential
,
isEditable
,
isEditable
,
});
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
confidential
;
expect
(
wrapper
.
element
).
toMatchSnapshot
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
},
},
);
);
describe
(
'
if editable
'
,
()
=>
{
describe
(
'
if editable
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
createComponent
({
isConfidential
:
true
,
isEditable
:
true
,
isEditable
:
true
,
});
});
wrapper
.
vm
.
$store
.
state
.
noteableData
.
confidential
=
true
;
});
});
it
(
'
displays the edit form when editable
'
,
()
=>
{
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