2023-01-16 09:14:51 +00:00
|
|
|
/**
|
2019-10-25 11:26:16 +00:00
|
|
|
* @file provides global account related methods
|
2019-10-25 11:35:38 +00:00
|
|
|
* @mixin
|
|
|
|
*
|
2024-09-08 14:27:01 +00:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-10-07 09:10:16 +00:00
|
|
|
*/
|
|
|
|
|
2022-10-27 13:07:12 +00:00
|
|
|
import serverData from './serverData.js'
|
2019-10-07 09:10:16 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
mixins: [
|
2022-10-27 13:07:12 +00:00
|
|
|
serverData,
|
2019-10-07 09:10:16 +00:00
|
|
|
],
|
2019-10-25 11:26:16 +00:00
|
|
|
computed: {
|
2023-01-16 09:14:51 +00:00
|
|
|
/** @return {string} the complete account name */
|
2019-10-25 11:26:16 +00:00
|
|
|
profileAccount() {
|
|
|
|
return (this.uid.indexOf('@') === -1) ? this.uid + '@' + this.hostname : this.uid
|
2019-10-07 09:10:16 +00:00
|
|
|
},
|
2023-01-16 09:14:51 +00:00
|
|
|
|
2023-01-19 16:18:11 +00:00
|
|
|
/** @return {import('../types/Mastodon.js').Account} detailed information about an account (account must be loaded in the store first) */
|
2019-10-25 11:26:16 +00:00
|
|
|
accountInfo() {
|
|
|
|
return this.$store.getters.getAccount(this.profileAccount)
|
2019-10-07 09:10:16 +00:00
|
|
|
},
|
2023-01-16 09:14:51 +00:00
|
|
|
|
2022-10-27 13:07:12 +00:00
|
|
|
/**
|
2023-01-16 09:14:51 +00:00
|
|
|
* Somewhat duplicate with accountInfo(), but needed (for some reason) to avoid glitches
|
2022-10-27 13:07:12 +00:00
|
|
|
* where components would first show "user not found" before display an account's account info
|
2023-01-19 16:18:11 +00:00
|
|
|
*
|
|
|
|
* @return {boolean}
|
2022-10-27 13:07:12 +00:00
|
|
|
*/
|
2019-10-25 11:26:16 +00:00
|
|
|
accountLoaded() {
|
2023-01-19 16:18:11 +00:00
|
|
|
return this.$store.getters.accountLoaded(this.profileAccount) !== undefined
|
|
|
|
},
|
|
|
|
|
|
|
|
/** @return {boolean} */
|
|
|
|
isLocal() {
|
|
|
|
return !this.accountInfo.acct.includes('@')
|
|
|
|
},
|
|
|
|
/** @return {import('../types/Mastodon.js').Relationship} */
|
|
|
|
relationship() {
|
|
|
|
return this.$store.getters.getRelationshipWith(this.accountInfo.id)
|
2022-10-27 13:07:12 +00:00
|
|
|
},
|
|
|
|
},
|
2019-10-07 09:10:16 +00:00
|
|
|
}
|