From 92a8ca00111b3cd0a5129964c47566a04ab54285 Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 7 Jun 2018 05:03:50 -0400 Subject: [PATCH 1/6] crt's compose box changes --- .../post_status_form/post_status_form.js | 17 ++++++++++++++ .../post_status_form/post_status_form.vue | 23 +++++++++++++++++-- src/services/api/api.service.js | 4 +++- .../status_poster/status_poster.service.js | 4 ++-- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index e6742580..cdacfa14 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -46,6 +46,12 @@ const PostStatusForm = { error: null, posting: false, highlighted: 0, + vis: { + public: { 'icon-globe': true, big: true, selected: true }, + unlisted: { 'icon-lock-open-alt': true, big: true, selected: false }, + private: { 'icon-lock': true, big: true, selected: false }, + direct: { 'icon-mail-alt': true, big: true, selected: false } + }, newStatus: { status: statusText, files: [] @@ -170,6 +176,7 @@ const PostStatusForm = { this.caret = selectionStart }, postStatus (newStatus) { + console.log(newStatus); if (this.posting) { return } if (this.submitDisabled) { return } @@ -185,6 +192,8 @@ const PostStatusForm = { this.posting = true statusPoster.postStatus({ status: newStatus.status, + spoilerText: newStatus.spoilerText || undefined, + visibility: newStatus.visibility, media: newStatus.files, store: this.$store, inReplyToStatusId: this.replyTo @@ -198,6 +207,9 @@ const PostStatusForm = { let el = this.$el.querySelector('textarea') el.style.height = '16px' this.error = null + + Object.keys(this.vis).forEach(x => this.vis[x].selected = false) + this.vis.public.selected = true } else { this.error = data.error } @@ -249,6 +261,11 @@ const PostStatusForm = { }, clearError () { this.error = null + }, + changeVis (visibility) { + console.log(visibility) + Object.keys(this.vis).forEach(x => this.vis[x].selected = x == visibility) + this.newStatus.visibility = visibility } } } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 28dd227e..e76850ae 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -2,6 +2,11 @@
+ +
+ + + + +
@@ -143,7 +154,15 @@ line-height:24px; } - form textarea { + form textarea.form-cw { + line-height:16px; + resize: none; + overflow: hidden; + transition: min-height 200ms 100ms; + min-height: 1px; + } + + form textarea.form-control { line-height:16px; resize: none; overflow: hidden; @@ -152,7 +171,7 @@ box-sizing: content-box; } - form textarea:focus { + form textarea.form-control:focus { min-height: 48px; } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 65761aee..0d91851b 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -331,12 +331,14 @@ const retweet = ({ id, credentials }) => { }) } -const postStatus = ({credentials, status, mediaIds, inReplyToStatusId}) => { +const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) => { const idsText = mediaIds.join(',') const form = new FormData() form.append('status', status) form.append('source', 'Pleroma FE') + if (spoilerText) form.append('spoiler_text', spoilerText) + if (visibility) form.append('visibility', visibility) form.append('media_ids', idsText) if (inReplyToStatusId) { form.append('in_reply_to_status_id', inReplyToStatusId) diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 001ff8a5..3381e9e2 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -1,10 +1,10 @@ import { map } from 'lodash' import apiService from '../api/api.service.js' -const postStatus = ({ store, status, media = [], inReplyToStatusId = undefined }) => { +const postStatus = ({ store, status, spoilerText, visibility, media = [], inReplyToStatusId = undefined }) => { const mediaIds = map(media, 'id') - return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, mediaIds, inReplyToStatusId}) + return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) .then((data) => data.json()) .then((data) => { if (!data.error) { From f49229974a04c440dcb2d9d9b7c89033a1ee5482 Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 7 Jun 2018 05:08:39 -0400 Subject: [PATCH 2/6] correct linter problems --- src/components/post_status_form/post_status_form.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index cdacfa14..2f40d690 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -176,7 +176,6 @@ const PostStatusForm = { this.caret = selectionStart }, postStatus (newStatus) { - console.log(newStatus); if (this.posting) { return } if (this.submitDisabled) { return } @@ -207,8 +206,8 @@ const PostStatusForm = { let el = this.$el.querySelector('textarea') el.style.height = '16px' this.error = null - - Object.keys(this.vis).forEach(x => this.vis[x].selected = false) + + Object.keys(this.vis).forEach(function (x) { this.vis[x].selected = false }) this.vis.public.selected = true } else { this.error = data.error @@ -264,7 +263,7 @@ const PostStatusForm = { }, changeVis (visibility) { console.log(visibility) - Object.keys(this.vis).forEach(x => this.vis[x].selected = x == visibility) + Object.keys(this.vis).forEach(function (x) { this.vis[x].selected = x === visibility}) this.newStatus.visibility = visibility } } From a759378b4d82bcb3ff20590b1369cb86d3e0dc50 Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 7 Jun 2018 05:18:54 -0400 Subject: [PATCH 3/6] more lint fixes --- src/components/post_status_form/post_status_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 2f40d690..0f8ebecd 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -263,7 +263,7 @@ const PostStatusForm = { }, changeVis (visibility) { console.log(visibility) - Object.keys(this.vis).forEach(function (x) { this.vis[x].selected = x === visibility}) + Object.keys(this.vis).forEach(function (x) { this.vis[x].selected = x === visibility }) this.newStatus.visibility = visibility } } From d62e7029948fce572a3c4ff0a50ad40130687238 Mon Sep 17 00:00:00 2001 From: Astra Date: Thu, 7 Jun 2018 17:31:43 -0400 Subject: [PATCH 4/6] should resolve a 3/4 things --- src/components/post_status_form/post_status_form.js | 12 ++++++------ src/components/post_status_form/post_status_form.vue | 2 +- src/i18n/messages.js | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 0f8ebecd..cc08c8a2 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -47,10 +47,10 @@ const PostStatusForm = { posting: false, highlighted: 0, vis: { - public: { 'icon-globe': true, big: true, selected: true }, - unlisted: { 'icon-lock-open-alt': true, big: true, selected: false }, - private: { 'icon-lock': true, big: true, selected: false }, - direct: { 'icon-mail-alt': true, big: true, selected: false } + public: { icon: 'icon-globe', big: true, selected: true }, + unlisted: { icon: 'icon-lock-open-alt', big: true, selected: false }, + private: { icon: 'icon-lock', big: true, selected: false }, + direct: { icon: 'icon-mail-alt', big: true, selected: false } }, newStatus: { status: statusText, @@ -191,7 +191,7 @@ const PostStatusForm = { this.posting = true statusPoster.postStatus({ status: newStatus.status, - spoilerText: newStatus.spoilerText || undefined, + spoilerText: newStatus.spoilerText || null, visibility: newStatus.visibility, media: newStatus.files, store: this.$store, @@ -207,7 +207,7 @@ const PostStatusForm = { el.style.height = '16px' this.error = null - Object.keys(this.vis).forEach(function (x) { this.vis[x].selected = false }) + for (key in Object.keys(this.vis)) { this.vis[key].selected = false } this.vis.public.selected = true } else { this.error = data.error diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index e76850ae..dbd11a19 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -4,7 +4,7 @@
-
- - - - +
+ + + +
@@ -90,6 +91,17 @@ } } +.post-status-form .visibility-tray { + font-size: 1.2em; + padding: 3px; + cursor: pointer; + + .selected { + color: $fallback--lightFg; + color: var(--lightFg, $fallback--lightFg); + } +} + .post-status-form, .login { .form-bottom { display: flex; diff --git a/src/main.js b/src/main.js index 3c4a072b..0c964dcc 100644 --- a/src/main.js +++ b/src/main.js @@ -88,7 +88,7 @@ window.fetch('/api/statusnet/config.json') window.fetch('/static/config.json') .then((res) => res.json()) .then((data) => { - const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel} = data + const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled} = data store.dispatch('setOption', { name: 'theme', value: theme }) store.dispatch('setOption', { name: 'background', value: background }) store.dispatch('setOption', { name: 'logo', value: logo }) @@ -96,6 +96,7 @@ window.fetch('/static/config.json') store.dispatch('setOption', { name: 'whoToFollowProvider', value: whoToFollowProvider }) store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink }) store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel }) + store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) if (data['chatDisabled']) { store.dispatch('disableChat') } diff --git a/static/config.json b/static/config.json index 9cdb22d5..4dacfebe 100644 --- a/static/config.json +++ b/static/config.json @@ -10,5 +10,6 @@ "whoToFollowProviderDummy2": "https://followlink.osa-p.net/api/get_recommend.json?acct=@{{user}}@{{host}}", "whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}", "whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html", - "showInstanceSpecificPanel": false + "showInstanceSpecificPanel": false, + "scopeOptionsEnabled": false }