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
4f1d2bf5
Commit
4f1d2bf5
authored
May 06, 2019
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make hasQuickActions stateless
parent
4ce36f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
app/assets/javascripts/notes/stores/utils.js
app/assets/javascripts/notes/stores/utils.js
+4
-3
No files found.
app/assets/javascripts/notes/stores/utils.js
View file @
4f1d2bf5
...
...
@@ -2,7 +2,8 @@ import AjaxCache from '~/lib/utils/ajax_cache';
import
{
trimFirstCharOfLineContent
}
from
'
~/diffs/store/utils
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
const
REGEX_QUICK_ACTIONS
=
/^
\/\w
+.*$/gm
;
// factory function because global flag makes RegExp stateful
const
createQuickActionsRegex
=
()
=>
/^
\/\w
+.*$/gm
;
export
const
findNoteObjectById
=
(
notes
,
id
)
=>
notes
.
filter
(
n
=>
n
.
id
===
id
)[
0
];
...
...
@@ -27,9 +28,9 @@ export const getQuickActionText = note => {
return
text
;
};
export
const
hasQuickActions
=
note
=>
REGEX_QUICK_ACTIONS
.
test
(
note
);
export
const
hasQuickActions
=
note
=>
createQuickActionsRegex
()
.
test
(
note
);
export
const
stripQuickActions
=
note
=>
note
.
replace
(
REGEX_QUICK_ACTIONS
,
''
).
trim
();
export
const
stripQuickActions
=
note
=>
note
.
replace
(
createQuickActionsRegex
()
,
''
).
trim
();
export
const
prepareDiffLines
=
diffLines
=>
diffLines
.
map
(
line
=>
({
...
trimFirstCharOfLineContent
(
line
)
}));
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