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
Hakaba Hitoyo
pleroma
Commits
b396dba4
Commit
b396dba4
authored
Nov 18, 2018
by
lain
Browse files
Fix follower count setting.
parent
5c8f07f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
b396dba4
...
...
@@ -454,11 +454,13 @@ def update_follower_count(%User{} = user) do
follower_count
=
Repo
.
one
(
follower_count_query
)
new_info
=
Map
.
put
(
user
.
info
,
"follower_count"
,
follower_count
)
info_cng
=
user
.
info
|>
User
.
Info
.
set_follower_count
(
follower_count
)
cs
=
info_changeset
(
user
,
%{
info:
new_info
})
cng
=
change
(
user
)
|>
put_embed
(
:info
,
info_cng
)
update_and_set_cache
(
c
s
)
update_and_set_cache
(
c
ng
)
end
def
get_users_from_set_query
(
ap_ids
,
false
)
do
...
...
lib/pleroma/user/info.ex
View file @
b396dba4
...
...
@@ -32,4 +32,12 @@ def add_to_note_count(info, number) do
|>
cast
(
params
,
[
:note_count
])
|>
validate_required
([
:note_count
])
end
def
set_follower_count
(
info
,
number
)
do
params
=
%{
follower_count:
Enum
.
max
([
0
,
number
])}
info
|>
cast
(
params
,
[
:follower_count
])
|>
validate_required
([
:follower_count
])
end
end
Write
Preview
Supports
Markdown
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