Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
jeff
pleroma
Commits
06947c91
Commit
06947c91
authored
5 years ago
by
rinpatch
Committed by
kaniini
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove bookmarks assoc
parent
238dd72f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pleroma/user.ex
+0
-2
0 additions, 2 deletions
lib/pleroma/user.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+1
-23
1 addition, 23 deletions
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
with
1 addition
and
25 deletions
lib/pleroma/user.ex
+
0
−
2
View file @
06947c91
...
...
@@ -10,7 +10,6 @@ defmodule Pleroma.User do
alias
Comeonin
.
Pbkdf2
alias
Pleroma
.
Activity
alias
Pleroma
.
Bookmark
alias
Pleroma
.
Notification
alias
Pleroma
.
Object
alias
Pleroma
.
Registration
...
...
@@ -54,7 +53,6 @@ defmodule Pleroma.User do
field
(
:search_type
,
:integer
,
virtual:
true
)
field
(
:tags
,
{
:array
,
:string
},
default:
[])
field
(
:last_refreshed_at
,
:naive_datetime_usec
)
has_many
(
:bookmarks
,
Bookmark
)
has_many
(
:notifications
,
Notification
)
has_many
(
:registrations
,
Registration
)
embeds_one
(
:info
,
Pleroma
.
User
.
Info
)
...
...
This diff is collapsed.
Click to expand it.
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+
1
−
23
View file @
06947c91
...
...
@@ -295,8 +295,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|>
ActivityPub
.
contain_timeline
(
user
)
|>
Enum
.
reverse
()
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
add_link_headers
(
:home_timeline
,
activities
)
|>
put_view
(
StatusView
)
...
...
@@ -315,8 +313,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|>
ActivityPub
.
fetch_public_activities
()
|>
Enum
.
reverse
()
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
add_link_headers
(
:public_timeline
,
activities
,
false
,
%{
"local"
=>
local_only
})
|>
put_view
(
StatusView
)
...
...
@@ -324,8 +320,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
end
def
user_statuses
(%{
assigns:
%{
user:
reading_user
}}
=
conn
,
params
)
do
with
%
User
{}
=
user
<-
User
.
get_cached_by_id
(
params
[
"id"
]),
reading_user
<-
Repo
.
preload
(
reading_user
,
:bookmarks
)
do
with
%
User
{}
=
user
<-
User
.
get_cached_by_id
(
params
[
"id"
])
do
activities
=
ActivityPub
.
fetch_user_activities
(
user
,
reading_user
,
params
)
conn
...
...
@@ -352,8 +347,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|>
ActivityPub
.
fetch_activities_query
(
params
)
|>
Pagination
.
fetch_paginated
(
params
)
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
add_link_headers
(
:dm_timeline
,
activities
)
|>
put_view
(
StatusView
)
...
...
@@ -363,8 +356,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def
get_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
id
})
do
with
%
Activity
{}
=
activity
<-
Activity
.
get_by_id_with_object
(
id
),
true
<-
Visibility
.
visible_for_user?
(
activity
,
user
)
do
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
})
...
...
@@ -514,8 +505,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def
reblog_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
ap_id_or_id
})
do
with
{
:ok
,
announce
,
_activity
}
<-
CommonAPI
.
repeat
(
ap_id_or_id
,
user
),
%
Activity
{}
=
announce
<-
Activity
.
normalize
(
announce
.
data
)
do
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
announce
,
for:
user
,
as:
:activity
})
...
...
@@ -525,8 +514,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def
unreblog_status
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
ap_id_or_id
})
do
with
{
:ok
,
_unannounce
,
%{
data:
%{
"id"
=>
id
}}}
<-
CommonAPI
.
unrepeat
(
ap_id_or_id
,
user
),
%
Activity
{}
=
activity
<-
Activity
.
get_create_by_object_ap_id_with_object
(
id
)
do
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -577,8 +564,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%
User
{}
=
user
<-
User
.
get_cached_by_nickname
(
user
.
nickname
),
true
<-
Visibility
.
visible_for_user?
(
activity
,
user
),
{
:ok
,
_bookmark
}
<-
Bookmark
.
create
(
user
.
id
,
activity
.
id
)
do
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -590,8 +575,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
%
User
{}
=
user
<-
User
.
get_cached_by_nickname
(
user
.
nickname
),
true
<-
Visibility
.
visible_for_user?
(
activity
,
user
),
{
:ok
,
_bookmark
}
<-
Bookmark
.
destroy
(
user
.
id
,
activity
.
id
)
do
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
try_render
(
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
...
...
@@ -1112,8 +1095,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
ActivityPub
.
fetch_activities
([],
params
)
|>
Enum
.
reverse
()
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
add_link_headers
(
:favourites
,
activities
)
|>
put_view
(
StatusView
)
...
...
@@ -1159,7 +1140,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
def
bookmarks
(%{
assigns:
%{
user:
user
}}
=
conn
,
params
)
do
user
=
User
.
get_cached_by_id
(
user
.
id
)
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
bookmarks
=
Bookmark
.
for_user_query
(
user
.
id
)
...
...
@@ -1276,8 +1256,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|>
ActivityPub
.
fetch_activities_bounded
(
following
,
params
)
|>
Enum
.
reverse
()
user
=
Repo
.
preload
(
user
,
bookmarks:
:activity
)
conn
|>
put_view
(
StatusView
)
|>
render
(
"index.json"
,
%{
activities:
activities
,
for:
user
,
as:
:activity
})
...
...
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