From 4a23c367406d19a0e1f7e3dd301635ee6c7186b4 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Tue, 16 Apr 2019 02:05:16 +0900
Subject: [PATCH] Backport #4674 (#4708)
---
locales/en-US.yml | 5 +-
locales/ja-JP.yml | 6 +-
src/client/app/admin/views/drive.vue | 20 ++-
.../views/components/post-form-attaches.vue | 140 ++++++++++++++++++
.../app/common/views/widgets/post-form.vue | 42 +-----
.../app/desktop/views/components/drive.vue | 1 -
.../desktop/views/components/post-form.vue | 16 +-
.../app/mobile/views/components/post-form.vue | 43 +-----
8 files changed, 170 insertions(+), 103 deletions(-)
create mode 100644 src/client/app/common/views/components/post-form-attaches.vue
diff --git a/locales/en-US.yml b/locales/en-US.yml
index 2b11de112..5927000e0 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -877,7 +877,6 @@ desktop/views/components/post-form.vue:
posting: "Posting"
attach-media-from-local: "Attach media from your device"
attach-media-from-drive: "Attach media from your Drive"
- attach-cancel: "Cancel attachment"
insert-a-kao: "v('ω')v"
create-poll: "Create a poll"
text-remain: "{} characters remaining"
@@ -970,6 +969,10 @@ common/views/components/password-settings.vue:
not-match: "The new passwords do not match"
changed: "Password changed"
failed: "Failed to change password"
+common/views/components/post-form-attaches.vue:
+ attach-cancel: "Remove Attachment"
+ mark-as-sensitive: "Mark as 'sensitive'"
+ unmark-as-sensitive: "Unmark as 'sensitive'"
desktop/views/components/sub-note-content.vue:
private: "This post is private"
deleted: "This post has been deleted"
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index d4457b659..067d8fca6 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -967,7 +967,6 @@ desktop/views/components/post-form.vue:
posting: "投稿中"
attach-media-from-local: "PCからメディアを添付"
attach-media-from-drive: "ドライブからメディアを添付"
- attach-cancel: "添付取り消し"
insert-a-kao: "v('ω')v"
create-poll: "アンケートを作成"
text-remain: "残り{}文字"
@@ -1073,6 +1072,11 @@ common/views/components/password-settings.vue:
changed: "パスワードを変更しました"
failed: "パスワード変更に失敗しました"
+common/views/components/post-form-attaches.vue:
+ attach-cancel: "添付取り消し"
+ mark-as-sensitive: "閲覧注意に設定"
+ unmark-as-sensitive: "閲覧注意を解除"
+
desktop/views/components/sub-note-content.vue:
private: "この投稿は非公開です"
deleted: "この投稿は削除されました"
diff --git a/src/client/app/admin/views/drive.vue b/src/client/app/admin/views/drive.vue
index 7812aadaa..fa2df9f37 100644
--- a/src/client/app/admin/views/drive.vue
+++ b/src/client/app/admin/views/drive.vue
@@ -38,7 +38,7 @@
@@ -75,10 +75,15 @@ import Vue from 'vue';
import i18n from '../../i18n';
import { faCloud, faTerminal, faSearch } from '@fortawesome/free-solid-svg-icons';
import { faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
+import XFileThumbnail from '../../common/views/components/drive-file-thumbnail.vue';
export default Vue.extend({
i18n: i18n('admin/views/drive.vue'),
+ components: {
+ XFileThumbnail
+ },
+
data() {
return {
file: null,
@@ -151,13 +156,6 @@ export default Vue.extend({
});
},
- thumbnail(file: any): any {
- return {
- 'background-color': file.properties.avgColor && file.properties.avgColor.length == 3 ? `rgb(${file.properties.avgColor.join(',')})` : 'transparent',
- 'background-image': `url(${file.thumbnailUrl})`
- };
- },
-
async del(file: any) {
const process = async () => {
await this.$root.api('drive/files/delete', { fileId: file.id });
@@ -179,9 +177,9 @@ export default Vue.extend({
this.$root.api('drive/files/update', {
fileId: file.id,
isSensitive: !file.isSensitive
+ }).then(() => {
+ file.isSensitive = !file.isSensitive;
});
-
- file.isSensitive = !file.isSensitive;
},
async show() {
@@ -244,7 +242,7 @@ export default Vue.extend({
> div:nth-child(1)
> .thumbnail
- display block
+ display flex
width 64px
height 64px
background-size cover
diff --git a/src/client/app/common/views/components/post-form-attaches.vue b/src/client/app/common/views/components/post-form-attaches.vue
new file mode 100644
index 000000000..2b18fa392
--- /dev/null
+++ b/src/client/app/common/views/components/post-form-attaches.vue
@@ -0,0 +1,140 @@
+
+
+
+
+
+

+
+
+
+
+
+
{{ 4 - files.length }}/4
+
+
+
+
+
+
diff --git a/src/client/app/common/views/widgets/post-form.vue b/src/client/app/common/views/widgets/post-form.vue
index c2341c8e3..b30168b87 100644
--- a/src/client/app/common/views/widgets/post-form.vue
+++ b/src/client/app/common/views/widgets/post-form.vue
@@ -21,14 +21,7 @@
-
-
-
-
-

-
-
-
+
@@ -65,7 +57,6 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import insertTextAtCursor from 'insert-text-at-cursor';
-import * as XDraggable from 'vuedraggable';
import getFace from '../../../common/scripts/get-face';
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
import { parse } from '../../../../../mfm/parse';
@@ -74,13 +65,14 @@ import { erase, unique } from '../../../../../prelude/array';
import { length } from 'stringz';
import { toASCII } from 'punycode';
import extractMentions from '../../../../../misc/extract-mentions';
+import XPostFormAttaches from '../../../common/views/components/post-form-attaches.vue';
export default Vue.extend({
i18n: i18n('desktop/views/components/post-form.vue'),
components: {
- XDraggable,
- MkVisibilityChooser
+ MkVisibilityChooser,
+ XPostFormAttaches
},
props: {
diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue
index 0a59af69e..6b26cdf89 100644
--- a/src/client/app/mobile/views/components/post-form.vue
+++ b/src/client/app/mobile/views/components/post-form.vue
@@ -21,13 +21,7 @@
-
+