From ec2b1ec3f0035466585d9cc2a7842e519e14e31a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 20 Jul 2018 02:40:37 +0900 Subject: [PATCH] #1334 --- locales/ja.yml | 10 ++++ .../common/views/components/media-list.vue | 24 ++++++-- .../desktop/views/components/drive.file.vue | 12 ++++ .../desktop/views/components/media-image.vue | 30 +++++++++- .../mobile/views/components/media-image.vue | 30 +++++++++- src/docs/api/entities/drive-file.yaml | 7 +++ src/models/drive-file.ts | 1 + src/remote/activitypub/models/image.ts | 4 +- src/remote/activitypub/renderer/image.ts | 5 +- src/remote/activitypub/renderer/person.ts | 12 +++- src/server/activitypub.ts | 8 +-- .../api/endpoints/drive/files/create.ts | 10 +++- .../api/endpoints/drive/files/update.ts | 59 ++++++++++++++----- src/services/drive/add-file.ts | 6 +- src/services/drive/upload-from-url.ts | 4 +- 15 files changed, 178 insertions(+), 44 deletions(-) diff --git a/locales/ja.yml b/locales/ja.yml index 357537934..d26d13996 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -330,6 +330,8 @@ desktop/views/components/drive.file.vue: banner: "バナー" contextmenu: rename: "名前を変更" + mark-as-sensitive: "閲覧注意に設定" + unmark-as-sensitive: "閲覧注意を解除" copy-url: "URLをコピー" download: "ダウンロード" else-files: "その他..." @@ -377,6 +379,10 @@ desktop/views/components/drive.vue: upload: "ファイルをアップロード" url-upload: "URLからアップロード" +desktop/views/components/media-image.vue: + sensitive: "閲覧注意" + click-to-show: "クリックして表示" + desktop/views/components/follow-button.vue: following: "フォロー中" follow: "フォロー" @@ -853,6 +859,10 @@ mobile/views/components/drive.file-detail.vue: hash: "ハッシュ (md5)" exif: "EXIF" +mobile/views/components/media-image.vue: + sensitive: "閲覧注意" + click-to-show: "クリックして表示" + mobile/views/components/follow-button.vue: following: "フォロー中" follow: "フォロー" diff --git a/src/client/app/common/views/components/media-list.vue b/src/client/app/common/views/components/media-list.vue index 2f8a1943a..cdfc2c8d3 100644 --- a/src/client/app/common/views/components/media-list.vue +++ b/src/client/app/common/views/components/media-list.vue @@ -46,33 +46,45 @@ export default Vue.extend({ display grid grid-gap 4px + > * + overflow hidden + border-radius 4px + &[data-count="1"] grid-template-rows 1fr + &[data-count="2"] grid-template-columns 1fr 1fr grid-template-rows 1fr + &[data-count="3"] grid-template-columns 1fr 0.5fr grid-template-rows 1fr 1fr - :nth-child(1) + + > *:nth-child(1) grid-row 1 / 3 - :nth-child(3) + + > *:nth-child(3) grid-column 2 / 3 grid-row 2 / 3 + &[data-count="4"] grid-template-columns 1fr 1fr grid-template-rows 1fr 1fr - :nth-child(1) + > *:nth-child(1) grid-column 1 / 2 grid-row 1 / 2 - :nth-child(2) + + > *:nth-child(2) grid-column 2 / 3 grid-row 1 / 2 - :nth-child(3) + + > *:nth-child(3) grid-column 1 / 2 grid-row 2 / 3 - :nth-child(4) + + > *:nth-child(4) grid-column 2 / 3 grid-row 2 / 3 diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue index 86addb131..11700d496 100644 --- a/src/client/app/desktop/views/components/drive.file.vue +++ b/src/client/app/desktop/views/components/drive.file.vue @@ -68,6 +68,11 @@ export default Vue.extend({ icon: '%fa:i-cursor%', action: this.rename }, { + type: 'item', + text: this.file.isSensitive ? '%i18n:@contextmenu.unmark-as-sensitive%' : '%i18n:@contextmenu.mark-as-sensitive%', + icon: this.file.isSensitive ? '%fa:R eye%' : '%fa:R eye-slash%', + action: this.toggleSensitive + }, null, { type: 'item', text: '%i18n:@contextmenu.copy-url%', icon: '%fa:link%', @@ -149,6 +154,13 @@ export default Vue.extend({ }); }, + toggleSensitive() { + (this as any).api('drive/files/update', { + fileId: this.file.id, + isSensitive: !this.file.isSensitive + }); + }, + copyUrl() { copyToClipboard(this.file.url); (this as any).apis.dialog({ diff --git a/src/client/app/desktop/views/components/media-image.vue b/src/client/app/desktop/views/components/media-image.vue index b98a4707e..42a31c4c2 100644 --- a/src/client/app/desktop/views/components/media-image.vue +++ b/src/client/app/desktop/views/components/media-image.vue @@ -1,5 +1,11 @@