From bcd499c3725d620bc9d4612e04add76cf7a4e395 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Thu, 2 Aug 2018 17:57:00 +0900 Subject: who to follow panel uses /api/v1/suggestions --- .../who_to_follow_panel/who_to_follow_panel.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/components') 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 51b9f469..be9a9f31 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 @@ -7,12 +7,12 @@ function showWhoToFollow (panel, reply, aHost, aUser) { var user user = users[cn] var img - if (user.icon) { + if (user.avatar) { img = user.icon } else { img = '/images/avi.png' } - var name = user.to_id + var name = user.acct if (index === 0) { panel.img1 = img panel.name1 = name @@ -52,17 +52,13 @@ function showWhoToFollow (panel, reply, aHost, aUser) { } function getWhoToFollow (panel) { - var user = panel.$store.state.users.currentUser.screen_name - if (user) { + var credentials = panel.$store.state.users.currentUser.credentials + if (credentials) { panel.name1 = 'Loading...' panel.name2 = 'Loading...' panel.name3 = 'Loading...' - var host = window.location.hostname - var whoToFollowProvider = panel.$store.state.config.whoToFollowProvider - var url - url = whoToFollowProvider.replace(/{{host}}/g, encodeURIComponent(host)) - url = url.replace(/{{user}}/g, encodeURIComponent(user)) - window.fetch(url, {mode: 'cors'}).then(function (response) { + var url = '/api/v1/suggestions' + window.fetch(url, {headers: authHeaders(credentials)}).then(function (response) { if (response.ok) { return response.json() } else { -- cgit v1.2.3-70-g09d2 From 5900bccff3f09be6bfbfa4a891c91ee043e3a9f0 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Thu, 2 Aug 2018 18:34:12 +0900 Subject: debug --- .../who_to_follow_panel/who_to_follow_panel.js | 19 +++++++------------ src/services/api/api.service.js | 10 +++++++++- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src/components') 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 be9a9f31..5e85b95d 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,4 +1,6 @@ -function showWhoToFollow (panel, reply, aHost, aUser) { +import apiService from '../../services/api/api.service.js' + +function showWhoToFollow (panel, reply) { var users = reply.ids var cn var index = 0 @@ -58,17 +60,10 @@ function getWhoToFollow (panel) { panel.name2 = 'Loading...' panel.name3 = 'Loading...' var url = '/api/v1/suggestions' - window.fetch(url, {headers: authHeaders(credentials)}).then(function (response) { - if (response.ok) { - return response.json() - } else { - panel.name1 = '' - panel.name2 = '' - panel.name3 = '' - } - }).then(function (reply) { - showWhoToFollow(panel, reply, host, user) - }) + apiService.suggestions ({credentials: credentials}) + .then ((reply) => { + showWhoToFollow(panel, reply) + }) } } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index adf598b7..d07e43c6 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -36,6 +36,7 @@ const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests' const APPROVE_USER_URL = '/api/pleroma/friendships/approve' const DENY_USER_URL = '/api/pleroma/friendships/deny' +const SUGGESTIONS_URL = '/api/v1/suggestions' import { each, map } from 'lodash' import 'whatwg-fetch' @@ -448,6 +449,12 @@ const fetchMutes = ({credentials}) => { }).then((data) => data.json()) } +const suggestions = ({credentials}) => { + return fetch(SUGGESTIONS_URL, { + headers: authHeaders(credentials) + }).then((data) => data.json()) +} + const apiService = { verifyCredentials, fetchTimeline, @@ -481,7 +488,8 @@ const apiService = { changePassword, fetchFollowRequests, approveUser, - denyUser + denyUser, + suggestions } export default apiService -- cgit v1.2.3-70-g09d2 From 19e310fc670d329896829d25d25d59a16b425ed1 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Thu, 2 Aug 2018 18:38:43 +0900 Subject: lint --- src/components/who_to_follow_panel/who_to_follow_panel.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/components') 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 5e85b95d..5b7f6b94 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 @@ -59,9 +59,8 @@ function getWhoToFollow (panel) { panel.name1 = 'Loading...' panel.name2 = 'Loading...' panel.name3 = 'Loading...' - var url = '/api/v1/suggestions' - apiService.suggestions ({credentials: credentials}) - .then ((reply) => { + apiService.suggestions({credentials: credentials}) + .then((reply) => { showWhoToFollow(panel, reply) }) } -- cgit v1.2.3-70-g09d2 From 5e47c59615a1ebe7c42a43eea2e93b814742e9e9 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Thu, 2 Aug 2018 19:16:48 +0900 Subject: debug --- src/components/who_to_follow_panel/who_to_follow_panel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components') 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 5b7f6b94..d7626dd4 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,7 +1,7 @@ import apiService from '../../services/api/api.service.js' function showWhoToFollow (panel, reply) { - var users = reply.ids + var users = reply var cn var index = 0 var random = Math.floor(Math.random() * 10) @@ -10,7 +10,7 @@ function showWhoToFollow (panel, reply) { user = users[cn] var img if (user.avatar) { - img = user.icon + img = user.avatar } else { img = '/images/avi.png' } -- cgit v1.2.3-70-g09d2 From e2dae877728296373389954858fa86d61aa25f91 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sat, 11 Aug 2018 14:50:40 +0900 Subject: update --- src/components/who_to_follow_panel/who_to_follow_panel.vue | 4 ++-- src/i18n/messages.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/components') 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 5af6d0d5..d111d4be 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 @@ -3,7 +3,7 @@
- Who to follow + $t('who_to_follow.who_to_follow')
@@ -11,7 +11,7 @@ {{ name1 }}
{{ name2 }}
{{ name3 }}
- More + $t('who_to_follow.more')

diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 38cf5ef0..abaea258 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -380,6 +380,10 @@ const en = { }, user_profile: { timeline_title: 'User Timeline' + }, + who_to_follow: { + who_to_follow: 'Who to follow', + more: 'More' } } @@ -900,6 +904,10 @@ const ja = { }, user_profile: { timeline_title: 'ユーザータイムライン' + }, + who_to_follow: { + who_to_follow: 'おすすめユーザー', + more: 'くわしく' } } -- cgit v1.2.3-70-g09d2 From d1b3d7e90fd76592b17691ebf391052f5e1f26a2 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sat, 11 Aug 2018 14:54:30 +0900 Subject: debug --- src/components/who_to_follow_panel/who_to_follow_panel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components') 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 d111d4be..8b3abe70 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 @@ -3,7 +3,7 @@
- $t('who_to_follow.who_to_follow') + {{$t('who_to_follow.who_to_follow')}}
@@ -11,7 +11,7 @@ {{ name1 }}
{{ name2 }}
{{ name3 }}
- $t('who_to_follow.more') + {{$t('who_to_follow.more')}}

-- cgit v1.2.3-70-g09d2 From 95e6bccec5a3bb89ca6b1511f12eb0caf5a241a4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 20 Aug 2018 18:06:29 +0000 Subject: Revert "Unify button styles and use min-width" This reverts commit 8f7919388391742671ef0398e017383d7f0b2bc5. --- src/App.scss | 2 -- src/components/login_form/login_form.vue | 5 +++++ src/components/post_status_form/post_status_form.vue | 4 ++++ src/components/settings/settings.vue | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/App.scss b/src/App.scss index ae6561a9..3b8b3224 100644 --- a/src/App.scss +++ b/src/App.scss @@ -63,8 +63,6 @@ button{ box-shadow: 0px 0px 2px black; font-size: 14px; font-family: sans-serif; - min-width: 10em; - min-height: 2em; &:hover { box-shadow: 0px 0px 4px rgba(255, 255, 255, 0.3); diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue index d2bdffcb..b7fed48a 100644 --- a/src/components/login_form/login_form.vue +++ b/src/components/login_form/login_form.vue @@ -34,6 +34,11 @@ @import '../../_variables.scss'; .login-form { + .btn { + min-height: 28px; + width: 10em; + } + .error { text-align: center; } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 1e1c6f1d..2b84758b 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -107,6 +107,10 @@ padding: 0.5em; height: 32px; + button { + width: 10em; + } + p { margin: 0.35em; padding: 0.35em; diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 170f5773..415317f0 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -117,6 +117,8 @@ .btn { margin-top: 1em; + min-height: 28px; + width: 10em; } } .setting-list { -- cgit v1.2.3-70-g09d2 From 2596f228140c693aaecd192b0d10254250fc4bcd Mon Sep 17 00:00:00 2001 From: scarlett Date: Tue, 21 Aug 2018 19:16:03 +0100 Subject: Centre-align profile bios. --- src/components/user_card_content/user_card_content.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 71222d15..59358040 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -105,8 +105,8 @@ {{user.followers_count}} -

-

{{ user.description }}

+

+

{{ user.description }}

@@ -130,7 +130,11 @@ .profile-panel-body { word-wrap: break-word; background: linear-gradient(to bottom, rgba(0, 0, 0, 0), $fallback--bg 80%); - background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--bg, $fallback--bg) 80%) + background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--bg, $fallback--bg) 80%); + + .profile-bio { + text-align: center; + } } .user-info { -- cgit v1.2.3-70-g09d2 From 54166c3ad3bd3c9377d7788b84733c19d16732ad Mon Sep 17 00:00:00 2001 From: tsukada-ecsec Date: Wed, 22 Aug 2018 11:47:36 +0900 Subject: update settings --- src/App.js | 2 +- src/App.vue | 2 +- src/components/who_to_follow_panel/who_to_follow_panel.js | 4 ++-- src/main.js | 8 ++++++++ 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/components') diff --git a/src/App.js b/src/App.js index a052e058..39c97a80 100644 --- a/src/App.js +++ b/src/App.js @@ -29,7 +29,7 @@ export default { style () { return { 'background-image': `url(${this.background})` } }, sitename () { return this.$store.state.config.name }, chat () { return this.$store.state.chat.channel.state === 'joined' }, - showWhoToFollowPanel () { return this.$store.state.config.showWhoToFollowPanel }, + suggestionsEnabled () { return this.$store.state.config.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel } }, methods: { diff --git a/src/App.vue b/src/App.vue index 923d411b..71e90289 100644 --- a/src/App.vue +++ b/src/App.vue @@ -24,7 +24,7 @@ - + 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 d7626dd4..70b35980 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 @@ -85,9 +85,9 @@ const WhoToFollowPanel = { moreUrl: function () { var host = window.location.hostname var user = this.user - var whoToFollowLink = this.$store.state.config.whoToFollowLink + var suggestionsWeb = this.$store.state.config.suggestionsWeb var url - url = whoToFollowLink.replace(/{{host}}/g, encodeURIComponent(host)) + url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host)) url = url.replace(/{{user}}/g, encodeURIComponent(user)) return url }, diff --git a/src/main.js b/src/main.js index 06f8a6ec..4124214d 100644 --- a/src/main.js +++ b/src/main.js @@ -192,3 +192,11 @@ window.fetch('/instance/panel.html') store.dispatch('setOption', { name: 'instanceSpecificPanelContent', value: html }) }) +window.fetch('/nodeinfo/2.0.json') + .then((res) => res.json()) + .then((data) => { + const suggestions = data.metadata.suggestions + store.dispatch('setOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) + store.dispatch('setOption', { name: 'suggestionsWeb', value: suggestions.web }) + }) + -- cgit v1.2.3-70-g09d2 From 0647c1bb720144b3d9e3d7943129d0d67d176ab0 Mon Sep 17 00:00:00 2001 From: tsukada-ecsec Date: Wed, 22 Aug 2018 15:15:15 +0900 Subject: debug --- src/components/who_to_follow_panel/who_to_follow_panel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/components') 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 70b35980..6766e561 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 @@ -91,20 +91,20 @@ const WhoToFollowPanel = { url = url.replace(/{{user}}/g, encodeURIComponent(user)) return url }, - showWhoToFollowPanel () { - return this.$store.state.config.showWhoToFollowPanel + suggestionsEnabled () { + return this.$store.state.config.suggestionsEnabled } }, watch: { user: function (user, oldUser) { - if (this.showWhoToFollowPanel) { + if (this.suggestionsEnabled) { getWhoToFollow(this) } } }, mounted: function () { - if (this.showWhoToFollowPanel) { + if (this.suggestionsEnabled) { getWhoToFollow(this) } } -- cgit v1.2.3-70-g09d2 From 296ab5430147f01107131046dcd428085bef9020 Mon Sep 17 00:00:00 2001 From: scarlett Date: Fri, 24 Aug 2018 20:04:26 +0100 Subject: Add settings for changing the visibility of replies in the timeline. --- src/components/settings/settings.js | 4 ++++ src/components/settings/settings.vue | 10 +++++++++ src/components/status/status.js | 42 ++++++++++++++++++++++++++++++++++++ src/components/status/status.vue | 2 +- src/i18n/messages.js | 3 +++ src/main.js | 1 + src/modules/config.js | 1 + 7 files changed, 62 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index c85ef59f..d5ca33cc 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -8,6 +8,7 @@ const settings = { hideAttachmentsLocal: this.$store.state.config.hideAttachments, hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv, hideNsfwLocal: this.$store.state.config.hideNsfw, + replyVisibilityLocal: this.$store.state.config.replyVisibility, loopVideoLocal: this.$store.state.config.loopVideo, loopVideoSilentOnlyLocal: this.$store.state.config.loopVideoSilentOnly, muteWordsString: this.$store.state.config.muteWords.join('\n'), @@ -44,6 +45,9 @@ const settings = { hideNsfwLocal (value) { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) }, + replyVisibilityLocal (value) { + this.$store.dispatch('setOption', { name: 'replyVisibility', value }) + }, loopVideoLocal (value) { this.$store.dispatch('setOption', { name: 'loopVideo', value }) }, diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 415317f0..9612876e 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -38,6 +38,16 @@ +
  • + +
  • diff --git a/src/components/status/status.js b/src/components/status/status.js index 9670f69d..a6cb6b6f 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -105,6 +105,48 @@ const Status = { const lengthScore = this.status.statusnet_html.split(/ 20 }, + isReply () { + if (this.status.in_reply_to_status_id) { + return true + } + // For private replies where we can't see the OP, in_reply_to_status_id will be null. + // So instead, check that the post starts with a @mention. + if (this.status.visibility === 'private') { + var textBody = this.status.text + if (this.status.summary !== null) { + textBody = textBody.substring(this.status.summary.length, textBody.length) + } + return textBody.startsWith('@') + } + return false + }, + hideReply () { + if (this.$store.state.config.replyVisibility === 'all') { + return false + } + if (this.inlineExpanded || this.expanded || !this.isReply) { + return false + } + if (this.status.user.id === this.$store.state.users.currentUser.id) { + return false + } + if (this.status.activity_type === 'repeat') { + return false + } + var checkFollowing = this.$store.state.config.replyVisibility === 'following' + for (var i = 0; i < this.status.attentions.length; ++i) { + if (this.status.user.id === this.status.attentions[i].id) { + continue + } + if (checkFollowing && this.status.attentions[i].following) { + return false + } + if (this.status.attentions[i].id === this.$store.state.users.currentUser.id) { + return false + } + } + return this.status.attentions.length > 0 + }, hideSubjectStatus () { if (this.tallStatus && !this.$store.state.config.collapseMessageWithSubject) { return false diff --git a/src/components/status/status.vue b/src/components/status/status.vue index e7d5ed7a..2bc44ee7 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -1,5 +1,5 @@