Page MenuHomePhorge

No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js
index eaeb527ab6..fddc7c7d50 100644
--- a/src/components/who_to_follow_panel/who_to_follow_panel.js
+++ b/src/components/who_to_follow_panel/who_to_follow_panel.js
@@ -1,83 +1,85 @@
import apiService from '../../services/api/api.service.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
+import _ from 'lodash'
function showWhoToFollow (panel, reply) {
+ _.shuffle(reply)
+
panel.usersToFollow.forEach((toFollow, index) => {
- let randIndex = Math.floor(Math.random() * reply.length)
- let user = reply[randIndex]
+ let user = reply[index]
let img = user.avatar || '/images/avi.png'
let name = user.acct
toFollow.img = img
toFollow.name = name
panel.$store.state.api.backendInteractor.externalProfile(name)
.then((externalUser) => {
if (!externalUser.error) {
panel.$store.commit('addNewUsers', [externalUser])
toFollow.id = externalUser.id
}
})
})
}
function getWhoToFollow (panel) {
var credentials = panel.$store.state.users.currentUser.credentials
if (credentials) {
panel.usersToFollow.forEach(toFollow => {
toFollow.name = 'Loading...'
})
apiService.suggestions({credentials: credentials})
.then((reply) => {
showWhoToFollow(panel, reply)
})
}
}
const WhoToFollowPanel = {
data: () => ({
usersToFollow: new Array(3).fill().map(x => (
{
img: '/images/avi.png',
name: '',
id: 0
}
))
}),
computed: {
user: function () {
return this.$store.state.users.currentUser.screen_name
},
moreUrl: function () {
const host = window.location.hostname
const user = this.user
const suggestionsWeb = this.$store.state.instance.suggestionsWeb
const url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host))
.replace(/{{user}}/g, encodeURIComponent(user))
return url
},
suggestionsEnabled () {
return this.$store.state.instance.suggestionsEnabled
}
},
methods: {
userProfileLink (id, name) {
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
}
},
watch: {
user: function (user, oldUser) {
if (this.suggestionsEnabled) {
getWhoToFollow(this)
}
}
},
mounted:
function () {
if (this.suggestionsEnabled) {
getWhoToFollow(this)
}
}
}
export default WhoToFollowPanel
diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.vue b/src/components/who_to_follow_panel/who_to_follow_panel.vue
index ad6a028eab..272c41d370 100644
--- a/src/components/who_to_follow_panel/who_to_follow_panel.vue
+++ b/src/components/who_to_follow_panel/who_to_follow_panel.vue
@@ -1,40 +1,40 @@
<template>
<div class="who-to-follow-panel">
<div class="panel panel-default base01-background">
<div class="panel-heading timeline-heading base02-background base04">
<div class="title">
{{$t('who_to_follow.who_to_follow')}}
</div>
</div>
<div class="panel-body who-to-follow">
- <p>
- <span v-for="user in usersToFollow">
- <img v-bind:src="user.img" />
- <router-link v-bind:to="userProfileLink(user.id, user.name)">
- {{user.name}}
- </router-link><br />
- </span>
- <img v-bind:src="$store.state.instance.logo"> <a v-bind:href="moreUrl" target="_blank">{{$t('who_to_follow.more')}}</a>
- </p>
+ <span v-for="user in usersToFollow">
+ <img v-bind:src="user.img" />
+ <router-link v-bind:to="userProfileLink(user.id, user.name)">
+ {{user.name}}
+ </router-link><br />
+ </span>
+ <img v-bind:src="$store.state.instance.logo"> <a v-bind:href="moreUrl" target="_blank">{{$t('who_to_follow.more')}}</a>
</div>
</div>
</div>
</template>
<script src="./who_to_follow_panel.js" ></script>
<style lang="scss">
.who-to-follow * {
vertical-align: middle;
}
.who-to-follow img {
width: 32px;
height: 32px;
}
- .who-to-follow p {
+ .who-to-follow {
+ padding: 0.5em 1em 0.5em 1em;
+ margin: 0px;
line-height: 40px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 19, 1:16 PM (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1767264
Default Alt Text
(4 KB)

Event Timeline