From ae7b96abbf0c027f0f746ca8f83d06b7ecf2d925 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 19 Dec 2018 01:11:57 +0300 Subject: Fix resize not working properly for textareas --- src/components/post_status_form/post_status_form.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/components') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 0ce2aff0..fa994c87 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -246,7 +246,7 @@ const PostStatusForm = { } this.$emit('posted') let el = this.$el.querySelector('textarea') - el.style.height = '16px' + el.style.height = undefined this.error = null } else { this.error = data.error @@ -294,13 +294,15 @@ const PostStatusForm = { e.dataTransfer.dropEffect = 'copy' }, resize (e) { - if (!e.target) { return } - const vertPadding = Number(window.getComputedStyle(e.target)['padding-top'].substr(0, 1)) + - Number(window.getComputedStyle(e.target)['padding-bottom'].substr(0, 1)) - e.target.style.height = 'auto' - e.target.style.height = `${e.target.scrollHeight - vertPadding}px` - if (e.target.value === '') { - e.target.style.height = '16px' + const target = e.target || e + if (!(target instanceof window.Element)) { return } + const vertPadding = Number(window.getComputedStyle(target)['padding-top'].substr(0, 1)) + + Number(window.getComputedStyle(target)['padding-bottom'].substr(0, 1)) + // Auto is needed to make textbox shrink when removing lines + target.style.height = 'auto' + target.style.height = `${target.scrollHeight - vertPadding}px` + if (target.value === '') { + target.style.height = undefined } }, clearError () { -- cgit v1.2.3-70-g09d2 From afa2baec0cc57fd0beb3aac26048717569d5b116 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 19 Dec 2018 01:23:52 +0300 Subject: I suppose SOME browsers don't do this by default... --- src/components/post_status_form/post_status_form.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index fa994c87..46dcc8a6 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -32,6 +32,8 @@ const PostStatusForm = { }, mounted () { this.resize(this.$refs.textarea) + const textLength = this.$refs.textarea.value.length + this.$refs.textarea.setSelectionRange(textLength, textLength) if (this.replyTo) { this.$refs.textarea.focus() -- cgit v1.2.3-70-g09d2 From 5970bf4e856b6ced0bbbf53268411f95ce3e1341 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 20 Dec 2018 07:27:29 +0300 Subject: fixed incorrect height when empty text --- src/components/post_status_form/post_status_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 46dcc8a6..94c75b6a 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -304,7 +304,7 @@ const PostStatusForm = { target.style.height = 'auto' target.style.height = `${target.scrollHeight - vertPadding}px` if (target.value === '') { - target.style.height = undefined + target.style.height = null } }, clearError () { -- cgit v1.2.3-70-g09d2 From 6fa993c12241d5d5d740fd83fb1a8c29bb691659 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Tue, 25 Dec 2018 00:34:33 +0000 Subject: remove unneeded numbered variables who_to_follow --- .../who_to_follow_panel/who_to_follow_panel.js | 98 +++++++--------------- .../who_to_follow_panel/who_to_follow_panel.vue | 9 +- 2 files changed, 38 insertions(+), 69 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 c2df6899..3ead0b72 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 @@ -2,62 +2,31 @@ import apiService from '../../services/api/api.service.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' function showWhoToFollow (panel, reply) { - var users = reply - var cn - var index - var step = 7 - cn = Math.floor(Math.random() * step) - for (index = 0; index < 3; index++) { - var user - user = users[cn] - var img - if (user.avatar) { - img = user.avatar - } else { - img = '/images/avi.png' - } - var name = user.acct - if (index === 0) { - panel.img1 = img - panel.name1 = name - panel.$store.state.api.backendInteractor.externalProfile(name) - .then((externalUser) => { - if (!externalUser.error) { - panel.$store.commit('addNewUsers', [externalUser]) - panel.id1 = externalUser.id - } - }) - } else if (index === 1) { - panel.img2 = img - panel.name2 = name - panel.$store.state.api.backendInteractor.externalProfile(name) - .then((externalUser) => { - if (!externalUser.error) { - panel.$store.commit('addNewUsers', [externalUser]) - panel.id2 = externalUser.id - } - }) - } else if (index === 2) { - panel.img3 = img - panel.name3 = name - panel.$store.state.api.backendInteractor.externalProfile(name) - .then((externalUser) => { - if (!externalUser.error) { - panel.$store.commit('addNewUsers', [externalUser]) - panel.id3 = externalUser.id - } - }) - } - cn = (cn + step) % users.length - } + panel.usersToFollow.forEach((toFollow, index) => { + let randIndex = Math.floor(Math.random() * reply.length) + let user = reply[randIndex] + 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.name1 = 'Loading...' - panel.name2 = 'Loading...' - panel.name3 = 'Loading...' + panel.usersToFollow.forEach((_, index) => { + panel.usersToFollow[index].name = 'Loading...' + }) apiService.suggestions({credentials: credentials}) .then((reply) => { showWhoToFollow(panel, reply) @@ -67,27 +36,24 @@ function getWhoToFollow (panel) { const WhoToFollowPanel = { data: () => ({ - img1: '/images/avi.png', - name1: '', - id1: 0, - img2: '/images/avi.png', - name2: '', - id2: 0, - img3: '/images/avi.png', - name3: '', - id3: 0 + 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 () { - var host = window.location.hostname - var user = this.user - var suggestionsWeb = this.$store.state.instance.suggestionsWeb - var url - url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host)) - url = url.replace(/{{user}}/g, encodeURIComponent(user)) + let host = window.location.hostname + let user = this.user + let suggestionsWeb = this.$store.state.instance.suggestionsWeb + let url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host)) + .replace(/{{user}}/g, encodeURIComponent(user)) return url }, suggestionsEnabled () { 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 a62e8360..ad6a028e 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 @@ -8,9 +8,12 @@

- {{ name1 }}
- {{ name2 }}
- {{ name3 }}
+ + + + {{user.name}} +
+
{{$t('who_to_follow.more')}}

-- cgit v1.2.3-70-g09d2 From 18d7684f3243da4068dcc21b66854484fb61b062 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 25 Dec 2018 04:24:49 +0300 Subject: fix for non-shrinking main post form --- src/components/post_status_form/post_status_form.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/components') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 94c75b6a..2435074b 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -248,6 +248,7 @@ const PostStatusForm = { } this.$emit('posted') let el = this.$el.querySelector('textarea') + el.style.height = 'auto' el.style.height = undefined this.error = null } else { -- cgit v1.2.3-70-g09d2 From ed2393c970557d1184ddb19519102be5a1f51a9d Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Tue, 25 Dec 2018 01:32:20 +0000 Subject: fix inconsistencies within who_to_follow_panel --- src/components/who_to_follow_panel/who_to_follow_panel.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 3ead0b72..b2183e6d 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 @@ -24,8 +24,8 @@ function showWhoToFollow (panel, reply) { function getWhoToFollow (panel) { var credentials = panel.$store.state.users.currentUser.credentials if (credentials) { - panel.usersToFollow.forEach((_, index) => { - panel.usersToFollow[index].name = 'Loading...' + panel.usersToFollow.forEach(toFollow => { + toFollow.name = 'Loading...' }) apiService.suggestions({credentials: credentials}) .then((reply) => { @@ -49,11 +49,11 @@ const WhoToFollowPanel = { return this.$store.state.users.currentUser.screen_name }, moreUrl: function () { - let host = window.location.hostname - let user = this.user - let suggestionsWeb = this.$store.state.instance.suggestionsWeb - let url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host)) - .replace(/{{user}}/g, encodeURIComponent(user)) + 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 () { -- cgit v1.2.3-70-g09d2 From fa8ecb1c39d2900de69fef0a609ef31ce0ef9161 Mon Sep 17 00:00:00 2001 From: HJ Date: Wed, 26 Dec 2018 09:19:25 +0000 Subject: User Card Content fixes and updates --- .../user_card_content/user_card_content.vue | 145 +++++++++++++-------- src/modules/statuses.js | 2 + src/modules/users.js | 18 +++ 3 files changed, 109 insertions(+), 56 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 c5222519..c76c41a9 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -2,22 +2,25 @@