[Debug] Avoid duplicates in the who to follow panel
This commit is contained in:
parent
35d75be1d6
commit
702f013225
2 changed files with 14 additions and 12 deletions
|
@ -1,10 +1,12 @@
|
||||||
import apiService from '../../services/api/api.service.js'
|
import apiService from '../../services/api/api.service.js'
|
||||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
function showWhoToFollow (panel, reply) {
|
function showWhoToFollow (panel, reply) {
|
||||||
|
_.shuffle(reply)
|
||||||
|
|
||||||
panel.usersToFollow.forEach((toFollow, index) => {
|
panel.usersToFollow.forEach((toFollow, index) => {
|
||||||
let randIndex = Math.floor(Math.random() * reply.length)
|
let user = reply[index]
|
||||||
let user = reply[randIndex]
|
|
||||||
let img = user.avatar || '/images/avi.png'
|
let img = user.avatar || '/images/avi.png'
|
||||||
let name = user.acct
|
let name = user.acct
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body who-to-follow">
|
<div class="panel-body who-to-follow">
|
||||||
<p>
|
<span v-for="user in usersToFollow">
|
||||||
<span v-for="user in usersToFollow">
|
<img v-bind:src="user.img" />
|
||||||
<img v-bind:src="user.img" />
|
<router-link v-bind:to="userProfileLink(user.id, user.name)">
|
||||||
<router-link v-bind:to="userProfileLink(user.id, user.name)">
|
{{user.name}}
|
||||||
{{user.name}}
|
</router-link><br />
|
||||||
</router-link><br />
|
</span>
|
||||||
</span>
|
<img v-bind:src="$store.state.instance.logo"> <a v-bind:href="moreUrl" target="_blank">{{$t('who_to_follow.more')}}</a>
|
||||||
<img v-bind:src="$store.state.instance.logo"> <a v-bind:href="moreUrl" target="_blank">{{$t('who_to_follow.more')}}</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +29,9 @@
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
}
|
}
|
||||||
.who-to-follow p {
|
.who-to-follow {
|
||||||
|
padding: 0.5em 1em 0.5em 1em;
|
||||||
|
margin: 0px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
Loading…
Reference in a new issue