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
fb2b0960
Commit
fb2b0960
authored
Apr 29, 2020
by
sstern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary reactive properties in view mount.
parent
62a35156
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
43 deletions
+38
-43
app/assets/javascripts/mr_notes/init_notes.js
app/assets/javascripts/mr_notes/init_notes.js
+14
-17
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+24
-26
No files found.
app/assets/javascripts/mr_notes/init_notes.js
View file @
fb2b0960
...
...
@@ -15,19 +15,6 @@ export default () => {
notesApp
,
},
store
,
data
()
{
const
notesDataset
=
document
.
getElementById
(
'
js-vue-mr-discussions
'
).
dataset
;
const
noteableData
=
JSON
.
parse
(
notesDataset
.
noteableData
);
noteableData
.
noteableType
=
notesDataset
.
noteableType
;
noteableData
.
targetType
=
notesDataset
.
targetType
;
return
{
noteableData
,
currentUserData
:
JSON
.
parse
(
notesDataset
.
currentUserData
),
notesData
:
JSON
.
parse
(
notesDataset
.
notesData
),
helpPagePath
:
notesDataset
.
helpPagePath
,
};
},
computed
:
{
...
mapGetters
([
'
discussionTabCounter
'
]),
...
mapState
({
...
...
@@ -67,6 +54,19 @@ export default () => {
updateDiscussionTabCounter
()
{
this
.
notesCountBadge
.
text
(
this
.
discussionTabCounter
);
},
dataset
()
{
const
data
=
this
.
$el
.
dataset
;
const
noteableData
=
JSON
.
parse
(
data
.
noteableData
);
noteableData
.
noteableType
=
data
.
noteableType
;
noteableData
.
targetType
=
data
.
targetType
;
return
{
noteableData
,
notesData
:
JSON
.
parse
(
data
.
notesData
),
userData
:
JSON
.
parse
(
data
.
currentUserData
),
helpPagePath
:
data
.
helpPagePath
,
};
},
},
render
(
createElement
)
{
// NOTE: Even though `discussionKeyboardNavigator` is added to the `notes-app`,
...
...
@@ -76,11 +76,8 @@ export default () => {
return
createElement
(
discussionKeyboardNavigator
,
[
createElement
(
'
notes-app
'
,
{
props
:
{
noteableData
:
this
.
noteableData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
...
this
.
dataset
(),
shouldShow
:
this
.
isShowTabActive
,
helpPagePath
:
this
.
helpPagePath
,
},
}),
]);
...
...
app/assets/javascripts/notes/index.js
View file @
fb2b0960
...
...
@@ -14,38 +14,36 @@ document.addEventListener('DOMContentLoaded', () => {
notesApp
,
},
store
,
data
()
{
const
notesDataset
=
document
.
getElementById
(
'
js-vue-notes
'
).
dataset
;
const
parsedUserData
=
JSON
.
parse
(
notesDataset
.
currentUserData
);
const
noteableData
=
JSON
.
parse
(
notesDataset
.
noteableData
);
let
currentUserData
=
{};
methods
:
{
setData
()
{
const
notesDataset
=
this
.
$el
.
dataset
;
const
parsedUserData
=
JSON
.
parse
(
notesDataset
.
currentUserData
);
const
noteableData
=
JSON
.
parse
(
notesDataset
.
noteableData
);
let
currentUserData
=
{};
noteableData
.
noteableType
=
notesDataset
.
noteableType
;
noteableData
.
targetType
=
notesDataset
.
targetType
;
noteableData
.
noteableType
=
notesDataset
.
noteableType
;
noteableData
.
targetType
=
notesDataset
.
targetType
;
if
(
parsedUserData
)
{
currentUserData
=
{
id
:
parsedUserData
.
id
,
name
:
parsedUserData
.
name
,
username
:
parsedUserData
.
username
,
avatar_url
:
parsedUserData
.
avatar_path
||
parsedUserData
.
avatar_url
,
path
:
parsedUserData
.
path
,
};
}
if
(
parsedUserData
)
{
currentUserData
=
{
id
:
parsedUserData
.
id
,
name
:
parsedUserData
.
name
,
username
:
parsedUserData
.
username
,
avatar_url
:
parsedUserData
.
avatar_path
||
parsedUserData
.
avatar_url
,
path
:
parsedUserData
.
path
,
};
}
return
{
noteableData
,
currentUserData
,
notesData
:
JSON
.
parse
(
notesDataset
.
notesData
),
};
return
{
noteableData
,
userData
:
currentUserData
,
notesData
:
JSON
.
parse
(
notesDataset
.
notesData
),
};
},
},
render
(
createElement
)
{
return
createElement
(
'
notes-app
'
,
{
props
:
{
noteableData
:
this
.
noteableData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
},
props
:
{
...
this
.
setData
()
},
});
},
});
...
...
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