2026-01-29 20:33:59 +02:00
|
|
|
import { mapState } from 'pinia'
|
2026-06-03 02:19:25 +03:00
|
|
|
import { defineAsyncComponent } from 'vue'
|
2026-01-08 17:26:52 +02:00
|
|
|
|
2026-06-04 21:56:25 +03:00
|
|
|
import Popover from 'src/components/popover/popover.vue'
|
|
|
|
|
import ProgressButton from 'src/components/progress_button/progress_button.vue'
|
2026-06-04 21:59:09 +03:00
|
|
|
import UserListMenu from 'src/components/user_list_menu/user_list_menu.vue'
|
2020-10-20 22:13:19 +03:00
|
|
|
|
2026-02-05 00:28:45 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-03-24 21:42:22 +02:00
|
|
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
import { useReportsStore } from 'src/stores/reports'
|
|
|
|
|
|
2026-01-08 17:26:52 +02:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import { faEllipsisV } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
2026-01-06 16:22:52 +02:00
|
|
|
library.add(faEllipsisV)
|
2019-10-08 10:21:48 +03:00
|
|
|
|
|
|
|
|
const AccountActions = {
|
2026-01-06 16:22:52 +02:00
|
|
|
props: ['user', 'relationship'],
|
|
|
|
|
data() {
|
2022-02-09 16:26:30 -05:00
|
|
|
return {
|
2022-09-27 18:47:50 -04:00
|
|
|
showingConfirmBlock: false,
|
2026-01-06 16:22:52 +02:00
|
|
|
showingConfirmRemoveFollower: false,
|
2022-02-09 16:26:30 -05:00
|
|
|
}
|
2019-10-08 10:21:48 +03:00
|
|
|
},
|
|
|
|
|
components: {
|
2020-02-28 16:39:47 +00:00
|
|
|
ProgressButton,
|
2022-08-15 23:19:33 +03:00
|
|
|
Popover,
|
2022-02-09 16:26:30 -05:00
|
|
|
UserListMenu,
|
2026-06-03 02:19:25 +03:00
|
|
|
ConfirmModal: defineAsyncComponent(
|
|
|
|
|
() => import('src/components/confirm_modal/confirm_modal.vue'),
|
|
|
|
|
),
|
2026-06-04 19:52:38 +03:00
|
|
|
UserTimedFilterModal: defineAsyncComponent(
|
2026-06-04 21:59:09 +03:00
|
|
|
() =>
|
|
|
|
|
import(
|
|
|
|
|
'src/components/user_timed_filter_modal/user_timed_filter_modal.vue'
|
|
|
|
|
),
|
2026-06-04 19:52:38 +03:00
|
|
|
),
|
2019-10-08 10:21:48 +03:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
showConfirmRemoveUserFromFollowers() {
|
2022-09-27 18:47:50 -04:00
|
|
|
this.showingConfirmRemoveFollower = true
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideConfirmRemoveUserFromFollowers() {
|
2022-09-27 18:47:50 -04:00
|
|
|
this.showingConfirmRemoveFollower = false
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideConfirmBlock() {
|
2025-08-29 13:54:03 +03:00
|
|
|
this.showingConfirmBlock = false
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
showRepeats() {
|
2019-10-08 10:21:48 +03:00
|
|
|
this.$store.dispatch('showReblogs', this.user.id)
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
hideRepeats() {
|
2019-10-08 10:21:48 +03:00
|
|
|
this.$store.dispatch('hideReblogs', this.user.id)
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
blockUser() {
|
2025-06-12 20:04:39 +03:00
|
|
|
if (this.$refs.timedBlockDialog) {
|
|
|
|
|
this.$refs.timedBlockDialog.optionallyPrompt()
|
2022-02-09 16:26:30 -05:00
|
|
|
} else {
|
2025-06-12 20:04:39 +03:00
|
|
|
if (!this.shouldConfirmBlock) {
|
|
|
|
|
this.doBlockUser()
|
|
|
|
|
} else {
|
|
|
|
|
this.showingConfirmBlock = true
|
|
|
|
|
}
|
2022-02-09 16:26:30 -05:00
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
doBlockUser() {
|
2025-08-29 13:54:03 +03:00
|
|
|
this.$store.dispatch('blockUser', { id: this.user.id })
|
2022-02-09 16:26:30 -05:00
|
|
|
this.hideConfirmBlock()
|
2019-10-08 10:21:48 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
unblockUser() {
|
2019-10-08 10:21:48 +03:00
|
|
|
this.$store.dispatch('unblockUser', this.user.id)
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
removeUserFromFollowers() {
|
2022-09-27 18:47:50 -04:00
|
|
|
if (!this.shouldConfirmRemoveUserFromFollowers) {
|
|
|
|
|
this.doRemoveUserFromFollowers()
|
|
|
|
|
} else {
|
|
|
|
|
this.showConfirmRemoveUserFromFollowers()
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
doRemoveUserFromFollowers() {
|
2022-09-15 22:02:58 -06:00
|
|
|
this.$store.dispatch('removeUserFromFollowers', this.user.id)
|
2022-09-27 18:47:50 -04:00
|
|
|
this.hideConfirmRemoveUserFromFollowers()
|
2022-09-15 22:02:58 -06:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
reportUser() {
|
2023-04-06 17:59:12 -06:00
|
|
|
useReportsStore().openUserReportingModal({ userId: this.user.id })
|
2020-05-07 16:10:53 +03:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
openChat() {
|
2020-05-07 16:10:53 +03:00
|
|
|
this.$router.push({
|
|
|
|
|
name: 'chat',
|
2026-01-06 16:22:52 +02:00
|
|
|
params: {
|
|
|
|
|
username: this.$store.state.users.currentUser.screen_name,
|
|
|
|
|
recipient_id: this.user.id,
|
|
|
|
|
},
|
2020-05-07 16:10:53 +03:00
|
|
|
})
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2020-05-07 16:10:53 +03:00
|
|
|
},
|
|
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
shouldConfirmBlock() {
|
2026-03-24 21:42:22 +02:00
|
|
|
return useMergedConfigStore().mergedConfig.modalOnBlock
|
2022-02-09 16:26:30 -05:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
shouldConfirmRemoveUserFromFollowers() {
|
2026-03-24 21:42:22 +02:00
|
|
|
return useMergedConfigStore().mergedConfig.modalOnRemoveUserFromFollowers
|
2022-09-27 18:47:50 -04:00
|
|
|
},
|
2026-02-05 00:28:45 +02:00
|
|
|
...mapState(useInstanceCapabilitiesStore, [
|
|
|
|
|
'blockExpiration',
|
|
|
|
|
'pleromaChatMessagesAvailable',
|
|
|
|
|
]),
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2019-10-08 10:21:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default AccountActions
|