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

View File

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