enhance(frontend): モデレーターはノートに添付された画像上から直接NSFW設定できるように
This commit is contained in:
		@@ -23,6 +23,7 @@
 | 
			
		||||
		<div v-if="image.isSensitive" :class="$style.indicator" style="color: var(--warn);">NSFW</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<button v-tooltip="i18n.ts.hide" :class="$style.hide" class="_button" @click="hide = true"><i class="ti ti-eye-off"></i></button>
 | 
			
		||||
	<button :class="$style.menu" class="_button" @click.stop="showMenu"><i class="ti ti-dots"></i></button>
 | 
			
		||||
</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -34,6 +35,8 @@ import bytes from '@/filters/bytes';
 | 
			
		||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
 | 
			
		||||
import { defaultStore } from '@/store';
 | 
			
		||||
import { i18n } from '@/i18n';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { iAmModerator } from '@/account';
 | 
			
		||||
 | 
			
		||||
const props = defineProps<{
 | 
			
		||||
	image: misskey.entities.DriveFile;
 | 
			
		||||
@@ -57,6 +60,17 @@ watch(() => props.image, () => {
 | 
			
		||||
	deep: true,
 | 
			
		||||
	immediate: true,
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function showMenu(ev: MouseEvent) {
 | 
			
		||||
	os.popupMenu([...(iAmModerator ? [{
 | 
			
		||||
		text: i18n.ts.markAsSensitive,
 | 
			
		||||
		icon: 'ti ti-eye-off',
 | 
			
		||||
		action: () => {
 | 
			
		||||
			os.apiWithDialog('drive/files/update', { fileId: props.image.id, isSensitive: true });
 | 
			
		||||
		},
 | 
			
		||||
	}] : [])], ev.currentTarget ?? ev.target);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" module>
 | 
			
		||||
@@ -106,6 +120,21 @@ watch(() => props.image, () => {
 | 
			
		||||
	right: 12px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.menu {
 | 
			
		||||
	display: block;
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	border-radius: 6px;
 | 
			
		||||
	background-color: rgba(0, 0, 0, 0.3);
 | 
			
		||||
	-webkit-backdrop-filter: var(--blur, blur(15px));
 | 
			
		||||
	backdrop-filter: var(--blur, blur(15px));
 | 
			
		||||
	color: #fff;
 | 
			
		||||
	font-size: 0.8em;
 | 
			
		||||
	padding: 6px 8px;
 | 
			
		||||
	text-align: center;
 | 
			
		||||
	bottom: 12px;
 | 
			
		||||
	right: 12px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.imageContainer {
 | 
			
		||||
	display: block;
 | 
			
		||||
	cursor: zoom-in;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user