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
f0e12d84
Commit
f0e12d84
authored
Aug 28, 2018
by
Winnie Hellmann
Committed by
Phil Hughes
Aug 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display default status emoji if only message is entered
parent
ee578b07
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
app/assets/javascripts/pages/profiles/show/index.js
app/assets/javascripts/pages/profiles/show/index.js
+28
-4
changelogs/unreleased/winh-default-status-emoji.yml
changelogs/unreleased/winh-default-status-emoji.yml
+5
-0
spec/features/profiles/user_edit_profile_spec.rb
spec/features/profiles/user_edit_profile_spec.rb
+10
-0
No files found.
app/assets/javascripts/pages/profiles/show/index.js
View file @
f0e12d84
...
...
@@ -3,15 +3,22 @@ import createFlash from '~/flash';
import
GfmAutoComplete
from
'
~/gfm_auto_complete
'
;
import
EmojiMenu
from
'
./emoji_menu
'
;
const
defaultStatusEmoji
=
'
speech_balloon
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
toggleEmojiMenuButtonSelector
=
'
.js-toggle-emoji-menu
'
;
const
toggleEmojiMenuButton
=
document
.
querySelector
(
toggleEmojiMenuButtonSelector
);
const
statusEmojiField
=
document
.
getElementById
(
'
js-status-emoji-field
'
);
const
statusMessageField
=
document
.
getElementById
(
'
js-status-message-field
'
);
const
findNoEmojiPlaceholder
=
()
=>
document
.
getElementById
(
'
js-no-emoji-placeholder
'
);
const
toggleNoEmojiPlaceholder
=
(
isVisible
)
=>
{
const
placeholderElement
=
document
.
getElementById
(
'
js-no-emoji-placeholder
'
);
placeholderElement
.
classList
.
toggle
(
'
hidden
'
,
!
isVisible
);
};
const
findStatusEmoji
=
()
=>
toggleEmojiMenuButton
.
querySelector
(
'
gl-emoji
'
);
const
removeStatusEmoji
=
()
=>
{
const
statusEmoji
=
toggleEmojiMenuButton
.
querySelector
(
'
gl-emoji
'
);
const
statusEmoji
=
findStatusEmoji
(
);
if
(
statusEmoji
)
{
statusEmoji
.
remove
();
}
...
...
@@ -19,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => {
const
selectEmojiCallback
=
(
emoji
,
emojiTag
)
=>
{
statusEmojiField
.
value
=
emoji
;
findNoEmojiPlaceholder
().
classList
.
add
(
'
hidden
'
);
toggleNoEmojiPlaceholder
(
false
);
removeStatusEmoji
();
toggleEmojiMenuButton
.
innerHTML
+=
emojiTag
;
};
...
...
@@ -29,7 +36,7 @@ document.addEventListener('DOMContentLoaded', () => {
statusEmojiField
.
value
=
''
;
statusMessageField
.
value
=
''
;
removeStatusEmoji
();
findNoEmojiPlaceholder
().
classList
.
remove
(
'
hidden
'
);
toggleNoEmojiPlaceholder
(
true
);
});
const
emojiAutocomplete
=
new
GfmAutoComplete
();
...
...
@@ -44,6 +51,23 @@ document.addEventListener('DOMContentLoaded', () => {
selectEmojiCallback
,
);
emojiMenu
.
bindEvents
();
const
defaultEmojiTag
=
Emoji
.
glEmojiTag
(
defaultStatusEmoji
);
statusMessageField
.
addEventListener
(
'
input
'
,
()
=>
{
const
hasStatusMessage
=
statusMessageField
.
value
.
trim
()
!==
''
;
const
statusEmoji
=
findStatusEmoji
();
if
(
hasStatusMessage
&&
statusEmoji
)
{
return
;
}
if
(
hasStatusMessage
)
{
toggleNoEmojiPlaceholder
(
false
);
toggleEmojiMenuButton
.
innerHTML
+=
defaultEmojiTag
;
}
else
if
(
statusEmoji
.
dataset
.
name
===
defaultStatusEmoji
)
{
toggleNoEmojiPlaceholder
(
true
);
removeStatusEmoji
();
}
});
})
.
catch
(()
=>
createFlash
(
'
Failed to load emoji list!
'
));
});
changelogs/unreleased/winh-default-status-emoji.yml
0 → 100644
View file @
f0e12d84
---
title
:
Display default status emoji if only message is entered
merge_request
:
21330
author
:
type
:
changed
spec/features/profiles/user_edit_profile_spec.rb
View file @
f0e12d84
...
...
@@ -130,5 +130,15 @@ describe 'User edit profile' do
visit
user_path
(
user
)
expect
(
page
).
not_to
have_selector
'.cover-status'
end
it
'displays a default emoji if only message is entered'
do
message
=
'a status without emoji'
visit
(
profile_path
)
fill_in
'js-status-message-field'
,
with:
message
within
(
'.js-toggle-emoji-menu'
)
do
expect
(
page
).
to
have_emoji
(
'speech_balloon'
)
end
end
end
end
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