add follow requests UI

This commit is contained in:
William Pitcock 2018-06-07 00:58:44 +00:00
parent b8d0a6a0ba
commit f3a27764aa
7 changed files with 61 additions and 3 deletions

View File

@ -0,0 +1,18 @@
import UserCard from '../user_card/user_card.vue'
const FollowRequests = {
data () {
return {
requests: []
}
},
components: {
UserCard
},
created () {
this.$store.state.api.backendInteractor.fetchFollowRequests()
.then((requests) => { this.requests = requests })
}
}
export default FollowRequests

View File

@ -0,0 +1,12 @@
<template>
<div class="settings panel panel-default">
<div class="panel-heading">
{{$t('nav.friend_requests')}}
</div>
<div class="panel-body">
<user-card v-for="request in requests" :key="request.id" :user="request" :showFollows="false" :showApproval="true"></user-card>
</div>
</div>
</template>
<script src="./follow_requests.js"></script>

View File

@ -12,6 +12,11 @@
{{ $t("nav.mentions") }}
</router-link>
</li>
<li v-if='currentUser && currentUser.locked'>
<router-link to='/friend-requests'>
{{ $t("nav.friend_requests") }}
</router-link>
</li>
<li>
<router-link to='/main/public'>
{{ $t("nav.public_tl") }}

View File

@ -3,7 +3,8 @@ import UserCardContent from '../user_card_content/user_card_content.vue'
const UserCard = {
props: [
'user',
'showFollows'
'showFollows',
'showApproval'
],
data () {
return {
@ -16,6 +17,12 @@ const UserCard = {
methods: {
toggleUserExpanded () {
this.userExpanded = !this.userExpanded
},
approveUser () {
this.$store.state.api.backendInteractor.approveUser(this.user.id)
},
denyUser () {
this.$store.state.api.backendInteractor.denyUser(this.user.id)
}
}
}

View File

@ -15,6 +15,10 @@
</div>
<a :href="user.statusnet_profile_url" target="blank"><div class="user-screen-name">@{{ user.screen_name }}</div></a>
</div>
<div class="approval" v-if="showApproval">
<button class="btn btn-default" @click="approveUser">{{ $t('user_card.approve') }}</button>
<button class="btn btn-default" @click="denyUser">{{ $t('user_card.deny') }}</button>
</div>
</div>
</template>
@ -75,4 +79,11 @@
margin-bottom: 0;
}
}
.approval {
button {
width: 100%;
margin-bottom: 0.5em;
}
}
</style>

View File

@ -218,7 +218,8 @@ const en = {
timeline: 'Timeline',
mentions: 'Mentions',
public_tl: 'Public Timeline',
twkn: 'The Whole Known Network'
twkn: 'The Whole Known Network',
friend_requests: 'Follow Requests'
},
user_card: {
follows_you: 'Follows you!',
@ -232,7 +233,9 @@ const en = {
followers: 'Followers',
followees: 'Following',
per_day: 'per day',
remote_follow: 'Remote follow'
remote_follow: 'Remote follow',
approve: 'Approve',
deny: 'Deny'
},
timeline: {
show_new: 'Show new',

View File

@ -12,6 +12,7 @@ import UserProfile from './components/user_profile/user_profile.vue'
import Settings from './components/settings/settings.vue'
import Registration from './components/registration/registration.vue'
import UserSettings from './components/user_settings/user_settings.vue'
import FollowRequests from './components/follow_requests/follow_requests.vue'
import statusesModule from './modules/statuses.js'
import usersModule from './modules/users.js'
@ -117,6 +118,7 @@ window.fetch('/static/config.json')
{ name: 'mentions', path: '/:username/mentions', component: Mentions },
{ name: 'settings', path: '/settings', component: Settings },
{ name: 'registration', path: '/registration', component: Registration },
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests },
{ name: 'user-settings', path: '/user-settings', component: UserSettings }
]