Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
7b87cac6
Commit
7b87cac6
authored
Jan 23, 2022
by
Alex Gleason
Browse files
Merge branch 'preserve-mentions-order' into 'develop'
Preserve order of mentioned users See merge request
!3617
parents
9983799c
75c4fefb
Pipeline
#38829
passed with stages
in 51 minutes and 52 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
7b87cac6
...
...
@@ -2279,6 +2279,7 @@ def ensure_keys_present(%User{} = user) do
def
get_ap_ids_by_nicknames
(
nicknames
)
do
from
(
u
in
User
,
where:
u
.
nickname
in
^
nicknames
,
order_by:
fragment
(
"array_position(?, ?)"
,
^
nicknames
,
u
.
nickname
),
select:
u
.
ap_id
)
|>
Repo
.
all
()
...
...
test/pleroma/user_test.exs
View file @
7b87cac6
...
...
@@ -2084,6 +2084,17 @@ test "it returns a list of AP ids for a given set of nicknames" do
assert
user
.
ap_id
in
ap_ids
assert
user_two
.
ap_id
in
ap_ids
end
test
"it returns a list of AP ids in the same order"
do
user
=
insert
(
:user
)
user_two
=
insert
(
:user
)
user_three
=
insert
(
:user
)
ap_ids
=
User
.
get_ap_ids_by_nicknames
([
user
.
nickname
,
user_three
.
nickname
,
user_two
.
nickname
])
assert
[
user
.
ap_id
,
user_three
.
ap_id
,
user_two
.
ap_id
]
==
ap_ids
end
end
describe
"sync followers count"
do
...
...
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