2018-01-23 05:16:27 +00:00
|
|
|
|
<:Head>
|
2018-01-23 17:21:21 +00:00
|
|
|
|
<title>{{'Pinafore – ' + profileName}}</title>
|
2018-01-23 05:16:27 +00:00
|
|
|
|
</:Head>
|
|
|
|
|
|
|
|
|
|
<Layout page='tags'
|
2018-01-24 17:47:31 +00:00
|
|
|
|
virtual="true"
|
2018-01-27 16:13:28 +00:00
|
|
|
|
virtualRealm='account/{{params.accountId}}'
|
2018-01-23 17:21:21 +00:00
|
|
|
|
dynamicPage="{{profileName}}"
|
2018-01-23 05:16:27 +00:00
|
|
|
|
dynamicHref="/accounts/{{params.accountId}}"
|
2018-01-23 17:21:21 +00:00
|
|
|
|
dynamicLabel="{{shortProfileName}}"
|
2018-01-23 05:16:27 +00:00
|
|
|
|
dynamicIcon="#fa-user" >
|
|
|
|
|
{{#if $isUserLoggedIn}}
|
2018-01-23 17:21:21 +00:00
|
|
|
|
<DynamicPageBanner title="{{profileName}}" />
|
2018-01-23 05:16:27 +00:00
|
|
|
|
<LazyTimeline timeline='account/{{params.accountId}}' />
|
|
|
|
|
{{else}}
|
|
|
|
|
<HiddenFromSSR>
|
|
|
|
|
<FreeTextLayout>
|
|
|
|
|
<h1>Profile</h1>
|
|
|
|
|
|
|
|
|
|
<p>A user timeline will appear here when logged in.</p>
|
|
|
|
|
</FreeTextLayout>
|
|
|
|
|
</HiddenFromSSR>
|
|
|
|
|
{{/if}}
|
|
|
|
|
</Layout>
|
|
|
|
|
<script>
|
|
|
|
|
import Layout from '../_components/Layout.html'
|
2018-01-28 00:35:44 +00:00
|
|
|
|
import LazyTimeline from '../_components/timeline/LazyTimeline.html'
|
2018-01-23 05:16:27 +00:00
|
|
|
|
import FreeTextLayout from '../_components/FreeTextLayout.html'
|
|
|
|
|
import { store } from '../_utils/store.js'
|
|
|
|
|
import HiddenFromSSR from '../_components/HiddenFromSSR'
|
|
|
|
|
import DynamicPageBanner from '../_components/DynamicPageBanner.html'
|
|
|
|
|
import { getAccount } from '../_utils/mastodon/user'
|
2018-01-23 17:21:21 +00:00
|
|
|
|
import { database } from '../_utils/database/database'
|
2018-01-23 05:16:27 +00:00
|
|
|
|
|
|
|
|
|
export default {
|
2018-01-23 17:21:21 +00:00
|
|
|
|
oncreate() {
|
2018-01-23 05:16:27 +00:00
|
|
|
|
let currentInstance = this.store.get('currentInstance')
|
|
|
|
|
let accessToken = this.store.get('accessToken')
|
|
|
|
|
let accountId = this.get('params').accountId
|
2018-01-23 17:21:21 +00:00
|
|
|
|
database.getAccount(currentInstance, accountId).then(account => {
|
|
|
|
|
this.set({cachedAccount: account})
|
|
|
|
|
})
|
|
|
|
|
getAccount(currentInstance, accessToken, accountId).then(account => {
|
2018-01-28 02:41:41 +00:00
|
|
|
|
this.set({remoteAccount: account})
|
2018-01-23 17:21:21 +00:00
|
|
|
|
})
|
2018-01-23 05:16:27 +00:00
|
|
|
|
},
|
|
|
|
|
store: () => store,
|
|
|
|
|
computed: {
|
2018-01-28 02:41:41 +00:00
|
|
|
|
remoteProfileName: (remoteAccount) => {
|
|
|
|
|
return remoteAccount && ('@' + remoteAccount.acct)
|
2018-01-23 05:16:27 +00:00
|
|
|
|
},
|
2018-01-28 02:41:41 +00:00
|
|
|
|
remoteShortProfileName: (remoteAccount) => {
|
|
|
|
|
return remoteAccount && ('@' + remoteAccount.username)
|
2018-01-23 05:16:27 +00:00
|
|
|
|
},
|
2018-01-23 17:21:21 +00:00
|
|
|
|
cachedProfileName: (cachedAccount) => {
|
|
|
|
|
return cachedAccount && ('@' + cachedAccount.acct)
|
2018-01-23 05:16:27 +00:00
|
|
|
|
},
|
2018-01-23 17:21:21 +00:00
|
|
|
|
cachedShortProfileName: (cachedAccount) => {
|
|
|
|
|
return cachedAccount && ('@' + cachedAccount.username)
|
|
|
|
|
},
|
|
|
|
|
profileName: (remoteProfileName, cachedProfileName) => {
|
|
|
|
|
return remoteProfileName || cachedProfileName || ''
|
|
|
|
|
},
|
|
|
|
|
shortProfileName: (remoteShortProfileName, cachedShortProfileName) => {
|
|
|
|
|
return remoteShortProfileName || cachedShortProfileName || ''
|
2018-01-23 05:16:27 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
Layout,
|
|
|
|
|
LazyTimeline,
|
|
|
|
|
FreeTextLayout,
|
|
|
|
|
HiddenFromSSR,
|
|
|
|
|
DynamicPageBanner
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|