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-fe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Yin
pleroma-fe
Commits
424d4ab5
Commit
424d4ab5
authored
Sep 05, 2019
by
rinpatch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Utilize `user.requested` to display follow request status on user card
Closes #635
parent
c89703a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
src/components/user_card/user_card.js
src/components/user_card/user_card.js
+1
-3
src/components/user_card/user_card.vue
src/components/user_card/user_card.vue
+2
-2
src/services/follow_manipulate/follow_manipulate.js
src/services/follow_manipulate/follow_manipulate.js
+4
-7
No files found.
src/components/user_card/user_card.js
View file @
424d4ab5
...
...
@@ -11,7 +11,6 @@ export default {
data
()
{
return
{
followRequestInProgress
:
false
,
followRequestSent
:
false
,
hideUserStatsLocal
:
typeof
this
.
$store
.
state
.
config
.
hideUserStats
===
'
undefined
'
?
this
.
$store
.
state
.
instance
.
hideUserStats
:
this
.
$store
.
state
.
config
.
hideUserStats
,
...
...
@@ -112,9 +111,8 @@ export default {
followUser
()
{
const
store
=
this
.
$store
this
.
followRequestInProgress
=
true
requestFollow
(
this
.
user
,
store
).
then
((
{
sent
}
)
=>
{
requestFollow
(
this
.
user
,
store
).
then
(()
=>
{
this
.
followRequestInProgress
=
false
this
.
followRequestSent
=
sent
})
},
unfollowUser
()
{
...
...
src/components/user_card/user_card.vue
View file @
424d4ab5
...
...
@@ -135,13 +135,13 @@
<button
class=
"btn btn-default btn-block"
:disabled=
"followRequestInProgress"
:title=
"
followRequestSent
? $t('user_card.follow_again') : ''"
:title=
"
user.requested
? $t('user_card.follow_again') : ''"
@
click=
"followUser"
>
<template
v-if=
"followRequestInProgress"
>
{{
$t
(
'
user_card.follow_progress
'
)
}}
</
template
>
<
template
v-else-if=
"
followRequestSent
"
>
<
template
v-else-if=
"
user.requested
"
>
{{
$t
(
'
user_card.follow_sent
'
)
}}
</
template
>
<
template
v-else
>
...
...
src/services/follow_manipulate/follow_manipulate.js
View file @
424d4ab5
...
...
@@ -9,10 +9,7 @@ const fetchUser = (attempt, user, store) => new Promise((resolve, reject) => {
if
(
!
following
&&
!
(
locked
&&
sent
)
&&
attempt
<=
3
)
{
// If we BE reports that we still not following that user - retry,
// increment attempts by one
return
fetchUser
(
++
attempt
,
user
,
store
)
}
else
{
// If we run out of attempts, just return whatever status is.
return
sent
fetchUser
(
++
attempt
,
user
,
store
)
}
})
...
...
@@ -23,7 +20,7 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
if
(
updated
.
following
||
(
user
.
locked
&&
user
.
requested
))
{
// If we get result immediately or the account is locked, just stop.
resolve
(
{
sent
:
updated
.
requested
}
)
resolve
()
return
}
...
...
@@ -35,8 +32,8 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
// Recursive Promise, it will call itself up to 3 times.
return
fetchUser
(
1
,
user
,
store
)
.
then
((
sent
)
=>
{
resolve
(
{
sent
}
)
.
then
(()
=>
{
resolve
()
})
})
})
...
...
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