only show hourglass for locked accounts

This commit is contained in:
Nolan Lawson 2018-03-23 08:39:09 -07:00
parent c67ba5c0a9
commit 882a288326
3 changed files with 16 additions and 13 deletions

View file

@ -8,16 +8,17 @@ export async function setAccountFollowed (accountId, follow, toastOnSuccess) {
let instanceName = store.get('currentInstance') let instanceName = store.get('currentInstance')
let accessToken = store.get('accessToken') let accessToken = store.get('accessToken')
try { try {
let account
if (follow) { if (follow) {
await followAccount(instanceName, accessToken, accountId) account = await followAccount(instanceName, accessToken, accountId)
} else { } else {
await unfollowAccount(instanceName, accessToken, accountId) account = await unfollowAccount(instanceName, accessToken, accountId)
} }
await updateProfileAndRelationship(accountId) await updateProfileAndRelationship(accountId)
let relationship = await database.getRelationship(instanceName, accountId) let relationship = await database.getRelationship(instanceName, accountId)
if (toastOnSuccess) { if (toastOnSuccess) {
if (follow) { if (follow) {
if (relationship.requested) { if (account.locked && relationship.requested) {
toast.say('Requested to follow account') toast.say('Requested to follow account')
} else { } else {
toast.say('Followed account') toast.say('Followed account')

View file

@ -1,18 +1,18 @@
<div class="account-profile {{headerIsMissing ? 'header-is-missing' : ''}}" <div class="account-profile {{headerIsMissing ? 'header-is-missing' : ''}}"
style="background-image: url({{$autoplayGifs ? profile.header : profile.header_static}});"> style="background-image: url({{$autoplayGifs ? account.header : account.header_static}});">
<div class="account-profile-grid-wrapper"> <div class="account-profile-grid-wrapper">
<div class="account-profile-backdrop"></div> <div class="account-profile-backdrop"></div>
<div class="account-profile-grid"> <div class="account-profile-grid">
<div class="account-profile-avatar"> <div class="account-profile-avatar">
<Avatar account="{{profile}}" size="big" /> <Avatar :account size="big" />
</div> </div>
<div class="account-profile-name"> <div class="account-profile-name">
<ExternalLink href="{{profile.url}}" showIcon="true" normalIconColor="true"> <ExternalLink href="{{account.url}}" showIcon="true" normalIconColor="true">
{{profile.display_name || profile.acct}} {{account.display_name || account.acct}}
</ExternalLink> </ExternalLink>
</div> </div>
<div class="account-profile-username"> <div class="account-profile-username">
{{'@' + profile.acct}} {{'@' + account.acct}}
</div> </div>
<div class="account-profile-followed-by"> <div class="account-profile-followed-by">
{{#if relationship && relationship.followed_by}} {{#if relationship && relationship.followed_by}}
@ -195,7 +195,7 @@
export default { export default {
methods: { methods: {
async onFollowButtonClick() { async onFollowButtonClick() {
let accountId = this.get('profile').id let accountId = this.get('account').id
let instanceName = this.store.get('currentInstance') let instanceName = this.store.get('currentInstance')
let following = this.get('following') let following = this.get('following')
let followRequested = this.get('followRequested') let followRequested = this.get('followRequested')
@ -210,8 +210,8 @@
followButtonAnimation: FOLLOW_BUTTON_ANIMATION followButtonAnimation: FOLLOW_BUTTON_ANIMATION
}), }),
computed: { computed: {
headerIsMissing: (profile) => profile.header.endsWith('missing.png'), headerIsMissing: (account) => account.header.endsWith('missing.png'),
note: (profile) => profile.note, note: (account) => account.note,
massagedNote: (note) => { massagedNote: (note) => {
// GNU Social / Pleroma don't add <p> tags // GNU Social / Pleroma don't add <p> tags
if (!note.startsWith('<p>')) { if (!note.startsWith('<p>')) {
@ -220,7 +220,9 @@
return note return note
}, },
following: (relationship) => relationship && relationship.following, following: (relationship) => relationship && relationship.following,
followRequested: (relationship) => relationship && relationship.requested, followRequested: (relationship, account) => {
return relationship && relationship.requested && account && account.locked
},
followLabel: (following, followRequested) => { followLabel: (following, followRequested) => {
if (following) { if (following) {
return 'Unfollow' return 'Unfollow'

View file

@ -1,7 +1,7 @@
{{#if $isUserLoggedIn}} {{#if $isUserLoggedIn}}
<DynamicPageBanner title="" /> <DynamicPageBanner title="" />
{{#if $currentAccountProfile && $currentVerifyCredentials}} {{#if $currentAccountProfile && $currentVerifyCredentials}}
<AccountProfile profile="{{$currentAccountProfile}}" <AccountProfile account="{{$currentAccountProfile}}"
relationship="{{$currentAccountRelationship}}" relationship="{{$currentAccountRelationship}}"
verifyCredentials="{{$currentVerifyCredentials}}" verifyCredentials="{{$currentVerifyCredentials}}"
/> />