Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
401
Issues
401
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
efd4d049
Commit
efd4d049
authored
Feb 24, 2018
by
lain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user upgrading code.
parent
1331a39d
Pipeline
#817
failed with stage
in 2 minutes and 19 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
+8
-5
No files found.
lib/pleroma/web/activity_pub/transmogrifier.ex
View file @
efd4d049
...
...
@@ -209,15 +209,18 @@ def upgrade_user_from_ap_id(ap_id) do
# This could potentially take a long time, do it in the background
Task
.
start
(
fn
->
q
=
from
a
in
Activity
,
where:
^
old_follower_address
in
a
.
recipients
,
update:
[
set:
[
recipients:
fragment
(
"array_replace(?,?,?)"
,
a
.
recipients
,
^
old_follower_address
,
^
user
.
follower_address
)]]
Repo
.
update_all
(
q
,
[])
q
=
from
u
in
User
,
where:
^
old_follower_address
in
u
.
following
,
update:
[
set:
[
following:
fragment
(
"array_replace(?,?,?)"
,
u
.
following
,
^
old_follower_address
,
^
user
.
follower_address
)]]
Repo
.
update_all
(
q
,
[])
# Only do this for recent activties, don't go through the whole db.
since
=
(
Repo
.
aggregate
(
Activity
,
:max
,
:id
)
||
0
)
-
100_000
q
=
from
a
in
Activity
,
where:
^
old_follower_address
in
a
.
recipients
,
where:
a
.
id
>
^
since
,
update:
[
set:
[
recipients:
fragment
(
"array_replace(?,?,?)"
,
a
.
recipients
,
^
old_follower_address
,
^
user
.
follower_address
)]]
Repo
.
update_all
(
q
,
[])
end
)
{
:ok
,
user
}
...
...
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