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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
a32f291a
Commit
a32f291a
authored
Jul 08, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Separate mounted blocks to methods.
parent
7edc1bc3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
38 deletions
+46
-38
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+1
-1
app/assets/javascripts/notes/components/issue_notes.vue
app/assets/javascripts/notes/components/issue_notes.vue
+45
-37
No files found.
app/assets/javascripts/awards_handler.js
View file @
a32f291a
...
@@ -253,7 +253,7 @@ class AwardsHandler {
...
@@ -253,7 +253,7 @@ class AwardsHandler {
});
});
$
(
'
.emoji-menu
'
).
removeClass
(
'
is-visible
'
);
$
(
'
.emoji-menu
'
).
removeClass
(
'
is-visible
'
);
$
(
'
.js-add-award.is-active
'
).
removeClass
(
'
is-active
'
);
return
$
(
'
.js-add-award.is-active
'
).
removeClass
(
'
is-active
'
);
}
}
addAwardToEmojiBar
(
votesBlock
,
emoji
,
checkForMutuality
)
{
addAwardToEmojiBar
(
votesBlock
,
emoji
,
checkForMutuality
)
{
...
...
app/assets/javascripts/notes/components/issue_notes.vue
View file @
a32f291a
...
@@ -44,22 +44,8 @@ export default {
...
@@ -44,22 +44,8 @@ export default {
componentData
(
note
)
{
componentData
(
note
)
{
return
note
.
individual_note
?
note
.
notes
[
0
]
:
note
;
return
note
.
individual_note
?
note
.
notes
[
0
]
:
note
;
},
},
checkLocationHash
()
{
fetchNotes
()
{
const
hash
=
gl
.
utils
.
getLocationHash
();
const
{
discussionsPath
}
=
this
.
$el
.
parentNode
.
dataset
;
const
$el
=
$
(
`#
${
hash
}
`
);
if
(
hash
&&
$el
)
{
const
isInViewport
=
gl
.
utils
.
isInViewport
(
$el
[
0
]);
this
.
$store
.
commit
(
'
setTargetNoteHash
'
,
hash
);
if
(
!
isInViewport
)
{
gl
.
utils
.
scrollToElement
(
$el
);
}
}
},
},
mounted
()
{
const
{
discussionsPath
,
notesPath
,
lastFetchedAt
}
=
this
.
$el
.
parentNode
.
dataset
;
this
.
$store
.
dispatch
(
'
fetchNotes
'
,
discussionsPath
)
this
.
$store
.
dispatch
(
'
fetchNotes
'
,
discussionsPath
)
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -73,7 +59,9 @@ export default {
...
@@ -73,7 +59,9 @@ export default {
.
catch
(()
=>
{
.
catch
(()
=>
{
new
Flash
(
'
Something went wrong while fetching issue comments. Please try again.
'
);
// eslint-disable-line
new
Flash
(
'
Something went wrong while fetching issue comments. Please try again.
'
);
// eslint-disable-line
});
});
},
initPolling
()
{
const
{
notesPath
,
lastFetchedAt
}
=
this
.
$el
.
parentNode
.
dataset
;
const
options
=
{
const
options
=
{
endpoint
:
`
${
notesPath
}
?full_data=1`
,
endpoint
:
`
${
notesPath
}
?full_data=1`
,
lastFetchedAt
,
lastFetchedAt
,
...
@@ -88,8 +76,9 @@ export default {
...
@@ -88,8 +76,9 @@ export default {
.
catch
(()
=>
{
.
catch
(()
=>
{
new
Flash
(
'
Something went wrong while fetching latest comments.
'
);
// eslint-disable-line
new
Flash
(
'
Something went wrong while fetching latest comments.
'
);
// eslint-disable-line
});
});
},
6000
);
},
15000
);
},
bindEventHubListeners
()
{
eventHub
.
$on
(
'
toggleAward
'
,
(
data
)
=>
{
eventHub
.
$on
(
'
toggleAward
'
,
(
data
)
=>
{
const
{
awardName
,
noteId
}
=
data
;
const
{
awardName
,
noteId
}
=
data
;
const
endpoint
=
this
.
notesById
[
noteId
].
toggle_award_path
;
const
endpoint
=
this
.
notesById
[
noteId
].
toggle_award_path
;
...
@@ -97,6 +86,25 @@ export default {
...
@@ -97,6 +86,25 @@ export default {
this
.
$store
.
dispatch
(
'
toggleAward
'
,
{
endpoint
,
awardName
,
noteId
});
this
.
$store
.
dispatch
(
'
toggleAward
'
,
{
endpoint
,
awardName
,
noteId
});
});
});
},
},
checkLocationHash
()
{
const
hash
=
gl
.
utils
.
getLocationHash
();
const
$el
=
$
(
`#
${
hash
}
`
);
if
(
hash
&&
$el
)
{
const
isInViewport
=
gl
.
utils
.
isInViewport
(
$el
[
0
]);
this
.
$store
.
commit
(
'
setTargetNoteHash
'
,
hash
);
if
(
!
isInViewport
)
{
gl
.
utils
.
scrollToElement
(
$el
);
}
}
},
},
mounted
()
{
this
.
fetchNotes
();
this
.
initPolling
();
this
.
bindEventHubListeners
();
},
};
};
</
script
>
</
script
>
...
...
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