2019-09-09 07:31:08 +00:00
|
|
|
<template>
|
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head" v-if="title">
|
|
|
|
<p class="modal-card-title">{{ title }}</p>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<section
|
|
|
|
class="modal-card-body is-flex"
|
|
|
|
:class="{ 'is-titleless': !title }">
|
|
|
|
<div class="media">
|
|
|
|
<div
|
|
|
|
class="media-left">
|
|
|
|
<b-icon
|
|
|
|
icon="alert"
|
|
|
|
type="is-warning"
|
|
|
|
size="is-large"/>
|
|
|
|
</div>
|
|
|
|
<div class="media-content">
|
2019-11-15 17:36:47 +00:00
|
|
|
<div class="box" v-if="comment">
|
|
|
|
<article class="media">
|
|
|
|
<div class="media-left">
|
|
|
|
<figure class="image is-48x48" v-if="comment.actor.avatar">
|
|
|
|
<img :src="comment.actor.avatar.url" alt="Image">
|
|
|
|
</figure>
|
|
|
|
<b-icon class="media-left" v-else size="is-large" icon="account-circle" />
|
|
|
|
</div>
|
|
|
|
<div class="media-content">
|
|
|
|
<div class="content">
|
|
|
|
<strong>{{ comment.actor.name }}</strong> <small>@{{ comment.actor.preferredUsername }}</small>
|
|
|
|
<br>
|
|
|
|
<p v-html="comment.text"></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
</div>
|
2019-09-20 16:22:03 +00:00
|
|
|
<p>{{ $t('The report will be sent to the moderators of your instance. You can explain why you report this content below.') }}</p>
|
2019-09-09 07:31:08 +00:00
|
|
|
|
|
|
|
<div class="control">
|
|
|
|
<b-input
|
|
|
|
v-model="content"
|
|
|
|
type="textarea"
|
|
|
|
@keyup.enter="confirm"
|
2019-09-20 16:22:03 +00:00
|
|
|
:placeholder="$t('Additional comments')"
|
2019-09-09 07:31:08 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="control" v-if="outsideDomain">
|
2019-12-03 10:29:51 +00:00
|
|
|
<p>{{ $t('The content came from another server. Transfer an anonymous copy of the report?') }}</p>
|
2019-09-20 16:22:03 +00:00
|
|
|
<b-switch v-model="forward">{{ $t('Transfer to {outsideDomain}', { outsideDomain }) }}</b-switch>
|
2019-09-09 07:31:08 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<footer class="modal-card-foot">
|
|
|
|
<button
|
|
|
|
class="button"
|
|
|
|
ref="cancelButton"
|
2019-09-11 07:59:01 +00:00
|
|
|
@click="close">
|
2019-09-20 16:22:03 +00:00
|
|
|
{{ translatedCancelText }}
|
2019-09-09 07:31:08 +00:00
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="button is-primary"
|
|
|
|
ref="confirmButton"
|
|
|
|
@click="confirm">
|
2019-09-20 16:22:03 +00:00
|
|
|
{{ translatedConfirmText }}
|
2019-09-09 07:31:08 +00:00
|
|
|
</button>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
2019-11-15 17:36:47 +00:00
|
|
|
import { IComment } from '@/types/comment.model';
|
2019-09-09 07:31:08 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
mounted() {
|
|
|
|
this.$data.isActive = true;
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class ReportModal extends Vue {
|
|
|
|
@Prop({ type: Function, default: () => {} }) onConfirm;
|
|
|
|
@Prop({ type: String }) title;
|
2019-11-15 17:36:47 +00:00
|
|
|
@Prop({ type: Object }) comment!: IComment;
|
2019-09-09 07:31:08 +00:00
|
|
|
@Prop({ type: String, default: '' }) outsideDomain;
|
2019-09-20 16:22:03 +00:00
|
|
|
@Prop({ type: String }) cancelText;
|
|
|
|
@Prop({ type: String }) confirmText;
|
2019-09-09 07:31:08 +00:00
|
|
|
|
|
|
|
isActive: boolean = false;
|
|
|
|
content: string = '';
|
|
|
|
forward: boolean = false;
|
|
|
|
|
2019-09-20 16:22:03 +00:00
|
|
|
get translatedCancelText() {
|
|
|
|
return this.cancelText || this.$t('Cancel');
|
|
|
|
}
|
|
|
|
|
|
|
|
get translatedConfirmText() {
|
|
|
|
return this.confirmText || this.$t('Send the report');
|
|
|
|
}
|
|
|
|
|
2019-09-09 07:31:08 +00:00
|
|
|
confirm() {
|
|
|
|
this.onConfirm(this.content, this.forward);
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close the Dialog.
|
|
|
|
*/
|
|
|
|
close() {
|
|
|
|
this.isActive = false;
|
2019-09-11 07:59:01 +00:00
|
|
|
this.$emit('close');
|
2019-09-09 07:31:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2019-11-15 17:36:47 +00:00
|
|
|
<style lang="scss" scoped>
|
2019-09-09 07:31:08 +00:00
|
|
|
.modal-card .modal-card-foot {
|
|
|
|
justify-content: flex-end;
|
|
|
|
}
|
2019-11-15 17:36:47 +00:00
|
|
|
|
|
|
|
.modal-card-body {
|
|
|
|
.media-content {
|
|
|
|
.box {
|
|
|
|
.media {
|
|
|
|
padding-top: 0;
|
|
|
|
border-top: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
& > p {
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|