From 3a172529293e9669767d39d175e8748ace49bdd0 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sun, 9 Sep 2018 14:34:51 +0900 Subject: use prime number step for Who to follow panel --- src/components/who_to_follow_panel/who_to_follow_panel.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/components/who_to_follow_panel') 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 6766e561..ce60308f 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 @@ -3,9 +3,10 @@ import apiService from '../../services/api/api.service.js' function showWhoToFollow (panel, reply) { var users = reply var cn - var index = 0 - var random = Math.floor(Math.random() * 10) - for (cn = random; cn < users.length; cn = cn + 10) { + var index + var step = 7 + cn = Math.floor(Math.random() * step) + for (index = 0; index < 3; index++) { var user user = users[cn] var img @@ -46,11 +47,8 @@ function showWhoToFollow (panel, reply) { } }) } - index = index + 1 - if (index > 2) { - break - } } + cn = (cn + step) % users.length } function getWhoToFollow (panel) { -- cgit v1.2.3-70-g09d2 From 207c188c16bc04bd004233666c79db4e9b3fbfc9 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sun, 9 Sep 2018 15:22:55 +0000 Subject: Debug --- src/components/who_to_follow_panel/who_to_follow_panel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/who_to_follow_panel') 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 ce60308f..bc62f455 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 @@ -47,8 +47,8 @@ function showWhoToFollow (panel, reply) { } }) } + cn = (cn + step) % users.length } - cn = (cn + step) % users.length } function getWhoToFollow (panel) { -- cgit v1.2.3-70-g09d2 From 394153380da68816bccb2c5408fb7137d468f622 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 9 Sep 2018 22:31:34 +0300 Subject: more missing stuff --- src/components/features_panel/features_panel.js | 2 +- src/components/instance_specific_panel/instance_specific_panel.js | 2 +- src/components/post_status_form/post_status_form.js | 4 ++-- src/components/who_to_follow_panel/who_to_follow_panel.js | 4 ++-- src/components/who_to_follow_panel/who_to_follow_panel.vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/components/who_to_follow_panel') diff --git a/src/components/features_panel/features_panel.js b/src/components/features_panel/features_panel.js index 945165bb..e0b7a118 100644 --- a/src/components/features_panel/features_panel.js +++ b/src/components/features_panel/features_panel.js @@ -1,7 +1,7 @@ const FeaturesPanel = { computed: { chat: function () { - return this.$store.state.config.chatAvailable && (!this.$store.state.chatDisabled) + return this.$store.state.instance.chatAvailable && (!this.$store.state.chatDisabled) }, gopher: function () { return this.$store.state.instance.gopherAvailable }, whoToFollow: function () { return this.$store.state.instance.suggestionsEnabled }, diff --git a/src/components/instance_specific_panel/instance_specific_panel.js b/src/components/instance_specific_panel/instance_specific_panel.js index abd408c8..09e3d055 100644 --- a/src/components/instance_specific_panel/instance_specific_panel.js +++ b/src/components/instance_specific_panel/instance_specific_panel.js @@ -1,7 +1,7 @@ const InstanceSpecificPanel = { computed: { instanceSpecificPanelContent () { - return this.$store.state.config.instanceSpecificPanelContent + return this.$store.state.instance.instanceSpecificPanelContent } } } diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index dc92f009..a84e764c 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -102,7 +102,7 @@ const PostStatusForm = { name: '', utf: utf || '', // eslint-disable-next-line camelcase - img: utf ? '' : this.$store.state.config.server + image_url, + img: utf ? '' : this.$store.state.instance.server + image_url, highlighted: index === this.highlighted })) } else { @@ -129,7 +129,7 @@ const PostStatusForm = { return this.newStatus.status.length }, statusLengthLimit () { - return this.$store.state.config.textlimit + return this.$store.state.instance.textlimit }, hasStatusLengthLimit () { return this.statusLengthLimit > 0 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 bc62f455..49b8f5b6 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 @@ -83,14 +83,14 @@ const WhoToFollowPanel = { moreUrl: function () { var host = window.location.hostname var user = this.user - var suggestionsWeb = this.$store.state.config.suggestionsWeb + var suggestionsWeb = this.$store.state.instance.suggestionsWeb var url url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host)) url = url.replace(/{{user}}/g, encodeURIComponent(user)) return url }, suggestionsEnabled () { - return this.$store.state.config.suggestionsEnabled + return this.$store.state.instance.suggestionsEnabled } }, watch: { 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 8b3abe70..d031318d 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 @@ -11,7 +11,7 @@ {{ name1 }}
{{ name2 }}
{{ name3 }}
- {{$t('who_to_follow.more')}} + {{$t('who_to_follow.more')}}

-- cgit v1.2.3-70-g09d2