who-to-follow-panel using internal user link

This commit is contained in:
hakabahitoyo 2018-03-28 17:45:35 +09:00
parent caad818009
commit 5a97cfb959
2 changed files with 18 additions and 22 deletions

View file

@ -19,44 +19,40 @@ function showWhoToFollow (panel, users, aHost, aUser) {
} else {
img = '/images/avi.png'
}
var link = 'https://' + host + '/users/' + username
var name = username + '@' + host
if ((!user.following) &&
(!user.blacklisted) &&
(!(host === aHost && username === aUser))) {
if (index === 0) {
panel.img1 = img
panel.link1 = link
panel.name1 = name
this.$store.state.api.backendInteractor.externalProfile(name)
panel.$store.state.api.backendInteractor.externalProfile(name)
.then((externalUser) => {
if (!externalUser.error) {
this.$store.commit('addNewUsers', [externalUser])
panel.link1 = 'https://' + host + '/users/' + externalUser.id
}
})
panel.$store.commit('addNewUsers', [externalUser])
panel.link1 = '/users/' + externalUser.id
}
})
} else if (index === 1) {
panel.img2 = img
panel.link2 = link
panel.name2 = name
this.$store.state.api.backendInteractor.externalProfile(name)
panel.$store.state.api.backendInteractor.externalProfile(name)
.then((externalUser) => {
if (!externalUser.error) {
this.$store.commit('addNewUsers', [externalUser])
panel.link2 = 'https://' + host + '/users/' + externalUser.id
}
})
panel.$store.commit('addNewUsers', [externalUser])
panel.link2 = '/users/' + externalUser.id
}
})
} else if (index === 2) {
panel.img3 = img
panel.link3 = link
panel.name3 = name
this.$store.state.api.backendInteractor.externalProfile(name)
panel.$store.state.api.backendInteractor.externalProfile(name)
.then((externalUser) => {
if (!externalUser.error) {
this.$store.commit('addNewUsers', [externalUser])
panel.link3 = 'https://' + host + '/users/' + externalUser.id
}
})
panel.$store.commit('addNewUsers', [externalUser])
panel.link3 = '/users/' + externalUser.id
}
})
}
index = index + 1
if (index > 2) {

View file

@ -8,9 +8,9 @@
</div>
<div class="panel-body who-to-follow">
<p>
<img v-bind:src="img1"/> <a v-bind:href="link1" target="_blank">{{ name1 }}</a><br>
<img v-bind:src="img2"/> <a v-bind:href="link2" target="_blank">{{ name2 }}</a><br>
<img v-bind:src="img3"/> <a v-bind:href="link3" target="_blank">{{ name3 }}</a><br>
<img v-bind:src="img1"/> <a v-bind:href="link1">{{ name1 }}</a><br>
<img v-bind:src="img2"/> <a v-bind:href="link2">{{ name2 }}</a><br>
<img v-bind:src="img3"/> <a v-bind:href="link3">{{ name3 }}</a><br>
<img v-bind:src="$store.state.config.logo"> <a v-bind:href="moreUrl" target="_blank">More</a>
</p>
</div>