Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
pleroma-fe
Commits
a3cc8cc5
Commit
a3cc8cc5
authored
5 years ago
by
HJ
Browse files
Options
Downloads
Patches
Plain Diff
sorting
parent
0a778160
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1028
`master` refresh with `develop`
,
!824
EmojiInput refactoring
Pipeline
#12948
failed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/emoji-input/suggestor.js
+15
-1
15 additions, 1 deletion
src/components/emoji-input/suggestor.js
with
15 additions
and
1 deletion
src/components/emoji-input/suggestor.js
+
15
−
1
View file @
a3cc8cc5
...
...
@@ -29,7 +29,21 @@ function suggestUsers (users) {
user
.
screen_name
.
toLowerCase
().
startsWith
(
noPrefix
)
||
user
.
name
.
toLowerCase
().
startsWith
(
noPrefix
)
/* eslint-disable camelcase */
).
map
(({
screen_name
,
name
,
profile_image_url_original
})
=>
({
).
slice
(
0
,
20
).
sort
((
a
,
b
)
=>
{
let
aScore
=
0
let
bScore
=
0
aScore
+=
a
.
screen_name
.
toLowerCase
().
startsWith
(
noPrefix
)
*
2
aScore
+=
a
.
name
.
toLowerCase
().
startsWith
(
noPrefix
)
bScore
+=
b
.
screen_name
.
toLowerCase
().
startsWith
(
noPrefix
)
*
2
bScore
+=
b
.
name
.
toLowerCase
().
startsWith
(
noPrefix
)
const
diff
=
bScore
*
10
-
aScore
*
10
const
nameAlphabetically
=
a
.
name
>
b
.
name
?
1
:
-
1
const
screenNameAlphabetically
=
a
.
screen_name
>
b
.
screen_name
?
1
:
-
1
return
diff
+
nameAlphabetically
+
screenNameAlphabetically
}).
map
(({
screen_name
,
name
,
profile_image_url_original
})
=>
({
displayText
:
screen_name
,
detailText
:
name
,
imageUrl
:
profile_image_url_original
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment