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
0b1506a4
Commit
0b1506a4
authored
6 years ago
by
HJ
Browse files
Options
Downloads
Patches
Plain Diff
wip support for follower/following, a bit broken and with regression
parent
09736691
No related branches found
No related tags found
2 merge requests
!1028
`master` refresh with `develop`
,
!667
MastoAPI support for followers/friends(following)
Pipeline
#8814
passed
6 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/api/api.service.js
+7
-7
7 additions, 7 deletions
src/services/api/api.service.js
with
7 additions
and
7 deletions
src/services/api/api.service.js
+
7
−
7
View file @
0b1506a4
...
...
@@ -16,8 +16,6 @@ const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload'
const
CONVERSATION_URL
=
'
/api/statusnet/conversation
'
const
MENTIONS_URL
=
'
/api/statuses/mentions.json
'
const
DM_TIMELINE_URL
=
'
/api/statuses/dm_timeline.json
'
const
FOLLOWERS_URL
=
'
/api/statuses/followers.json
'
const
FRIENDS_URL
=
'
/api/statuses/friends.json
'
const
BLOCKS_URL
=
'
/api/statuses/blocks.json
'
const
FOLLOWING_URL
=
'
/api/friendships/create.json
'
const
UNFOLLOWING_URL
=
'
/api/friendships/destroy.json
'
...
...
@@ -43,6 +41,8 @@ const DENY_USER_URL = '/api/pleroma/friendships/deny'
const
SUGGESTIONS_URL
=
'
/api/v1/suggestions
'
const
MASTODON_USER_FAVORITES_TIMELINE_URL
=
'
/api/v1/favourites
'
const
MASTODON_FOLLOWING_URL
=
id
=>
`/api/v1/accounts/
${
id
}
/following`
const
MASTODON_FOLLOWERS_URL
=
id
=>
`/api/v1/accounts/
${
id
}
/followers`
import
{
each
,
map
}
from
'
lodash
'
import
{
parseStatus
,
parseUser
,
parseNotification
}
from
'
../entity_normalizer/entity_normalizer.service.js
'
...
...
@@ -258,9 +258,9 @@ const fetchUser = ({id, credentials}) => {
}
const
fetchFriends
=
({
id
,
page
,
credentials
})
=>
{
let
url
=
`
${
FRIENDS_URL
}
?user_id=
${
id
}
`
let
url
=
MASTODON_FOLLOWING_URL
(
id
)
if
(
page
)
{
url
=
url
+
`
&
page=
${
page
}
`
url
=
url
+
`
?
page=
${
page
}
`
}
return
fetch
(
url
,
{
headers
:
authHeaders
(
credentials
)
})
.
then
((
data
)
=>
data
.
json
())
...
...
@@ -268,16 +268,16 @@ const fetchFriends = ({id, page, credentials}) => {
}
const
exportFriends
=
({
id
,
credentials
})
=>
{
let
url
=
`
${
FRIENDS_URL
}
?user_id=
${
id
}
&
all=true`
let
url
=
MASTODON_FOLLOWING_URL
(
id
)
+
`?
all=true`
return
fetch
(
url
,
{
headers
:
authHeaders
(
credentials
)
})
.
then
((
data
)
=>
data
.
json
())
.
then
((
data
)
=>
data
.
map
(
parseUser
))
}
const
fetchFollowers
=
({
id
,
page
,
credentials
})
=>
{
let
url
=
`
${
FOLLOWERS_URL
}
?user_id=
${
id
}
`
let
url
=
MASTODON_
FOLLOWERS_URL
(
id
)
if
(
page
)
{
url
=
url
+
`
&
page=
${
page
}
`
url
=
url
+
`
?
page=
${
page
}
`
}
return
fetch
(
url
,
{
headers
:
authHeaders
(
credentials
)
})
.
then
((
data
)
=>
data
.
json
())
...
...
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