aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-09-12 07:02:11 +0000
committerShpuld Shpludson <shp@cock.li>2019-09-12 07:02:11 +0000
commit4a469d7fe3a951e63742b63f18f45e96500ec9e3 (patch)
treefc34cea1cbf08930bcf0bf684f418cb7acea1ed9 /src
parent2bb053dd71ddfff5451ff43356cbad5cb4c5c5a6 (diff)
parent424d4ab57e13a8a271a16e063ce70af98759f8f9 (diff)
Merge branch 'fix/follow-request-detection' into 'develop'
Utilize `user.requested` to display follow request status on user card Closes #635 See merge request pleroma/pleroma-fe!942
Diffstat (limited to 'src')
-rw-r--r--src/components/user_card/user_card.js4
-rw-r--r--src/components/user_card/user_card.vue4
-rw-r--r--src/services/follow_manipulate/follow_manipulate.js11
3 files changed, 7 insertions, 12 deletions
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 82d3b835..e3bd7697 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -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 () {
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index fc18e240..0b83cf16 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -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>
diff --git a/src/services/follow_manipulate/follow_manipulate.js b/src/services/follow_manipulate/follow_manipulate.js
index 529fdb9b..d82ce593 100644
--- a/src/services/follow_manipulate/follow_manipulate.js
+++ b/src/services/follow_manipulate/follow_manipulate.js
@@ -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()
})
})
})