From 0370363aaff7c254e21dfe78da35af7f27f328b0 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 26 Jan 2025 17:04:40 -0500 Subject: [PATCH] show pending inbound follow requests on a user's profile --- packages/frontend/src/pages/user/home.vue | 68 ++++++++++++++++++++++- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue index 5565555ca4..837413305e 100644 --- a/packages/frontend/src/pages/user/home.vue +++ b/packages/frontend/src/pages/user/home.vue @@ -39,9 +39,12 @@ SPDX-License-Identifier: AGPL-3.0-only
  • {{ i18n.ts.blocked }}
  • {{ i18n.ts.blockingYou }}
  • -
    - - +
    + + +
    {{ i18n.ts.receiveFollowRequest }}
    + {{ i18n.ts.accept }} + {{ i18n.ts.reject }}
    @@ -384,6 +387,29 @@ async function updateMemo() { isEditingMemo.value = false; } +// Set true to disable the follow / follow request controls +const disableFollowControls = ref(false); + +async function acceptFollowRequest() { + try { + disableFollowControls.value = true; + await os.apiWithDialog('following/requests/accept', { userId: user.value.id }); + user.value = await os.apiWithDialog('users/show', { userId: user.value.id }); + } finally { + disableFollowControls.value = false; + } +} + +async function rejectFollowRequest() { + try { + disableFollowControls.value = true; + await os.apiWithDialog('following/requests/reject', { userId: user.value.id }); + user.value = await os.apiWithDialog('users/show', { userId: user.value.id }); + } finally { + disableFollowControls.value = false; + } +} + watch([props.user], () => { memoDraft.value = props.user.memo; }); @@ -860,4 +886,40 @@ onUnmounted(() => { margin-left: 8px; } } + +.actions { + display: grid; + grid-template-rows: min-content min-content min-content; + grid-template-columns: min-content auto 1fr; + grid-template-areas: + "menu follow follow" + "banner banner banner" + "accept accept reject"; +} + +.actionsMenu { + grid-area: menu; + width: unset; +} + +.actionsFollow { + grid-area: follow; + margin-left: 8px; +} + +.actionsBanner { + grid-area: banner; + justify-self: center; + margin-top: 8px; + margin-bottom: 4px; +} + +.actionsAccept { + grid-area: accept; +} + +.actionsReject { + grid-area: reject; + margin-left: 8px; +}