From f3a27764aaf31a434c3f858668aa97e6c7328011 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 7 Jun 2018 00:58:44 +0000 Subject: [PATCH] add follow requests UI --- .../follow_requests/follow_requests.js | 18 ++++++++++++++++++ .../follow_requests/follow_requests.vue | 12 ++++++++++++ src/components/nav_panel/nav_panel.vue | 5 +++++ src/components/user_card/user_card.js | 9 ++++++++- src/components/user_card/user_card.vue | 11 +++++++++++ src/i18n/messages.js | 7 +++++-- src/main.js | 2 ++ 7 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/components/follow_requests/follow_requests.js create mode 100644 src/components/follow_requests/follow_requests.vue diff --git a/src/components/follow_requests/follow_requests.js b/src/components/follow_requests/follow_requests.js new file mode 100644 index 00000000..9fe4a57e --- /dev/null +++ b/src/components/follow_requests/follow_requests.js @@ -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 diff --git a/src/components/follow_requests/follow_requests.vue b/src/components/follow_requests/follow_requests.vue new file mode 100644 index 00000000..87dc4194 --- /dev/null +++ b/src/components/follow_requests/follow_requests.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 2e1a6c7a..0b188f9a 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -12,6 +12,11 @@ {{ $t("nav.mentions") }} +
  • + + {{ $t("nav.friend_requests") }} + +
  • {{ $t("nav.public_tl") }} diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index a7a871c3..f47df0eb 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -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) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 51d6965f..6478a65f 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -15,6 +15,10 @@
    @{{ user.screen_name }}
    +
    + + +
    @@ -75,4 +79,11 @@ margin-bottom: 0; } } + +.approval { + button { + width: 100%; + margin-bottom: 0.5em; + } +} diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 3e842af8..6f56e8b7 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -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', diff --git a/src/main.js b/src/main.js index 3c4a072b..6b1262be 100644 --- a/src/main.js +++ b/src/main.js @@ -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 } ]