add an option to confirm that you want a post to be public
This commit is contained in:
parent
a9bdf9c281
commit
d98c9c9657
6 changed files with 63 additions and 6 deletions
|
|
@ -14,6 +14,7 @@ import suggestor from '../emoji_input/suggestor.js'
|
|||
import { mapGetters, mapState } from 'vuex'
|
||||
import Checkbox from '../checkbox/checkbox.vue'
|
||||
import Select from '../select/select.vue'
|
||||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
|
|
@ -35,6 +36,10 @@ library.add(
|
|||
faCircleNotch
|
||||
)
|
||||
|
||||
var finEvent
|
||||
var finNewStatus
|
||||
var finOpts
|
||||
|
||||
const buildMentionsString = ({ user, attentions = [] }, currentUser) => {
|
||||
let allAttentions = [...attentions]
|
||||
|
||||
|
|
@ -122,7 +127,8 @@ const PostStatusForm = {
|
|||
Select,
|
||||
Attachment,
|
||||
StatusContent,
|
||||
Gallery
|
||||
Gallery,
|
||||
ConfirmModal
|
||||
},
|
||||
mounted () {
|
||||
this.updateIdempotencyKey()
|
||||
|
|
@ -236,7 +242,8 @@ const PostStatusForm = {
|
|||
idempotencyKey: '',
|
||||
activeEmojiInput: undefined,
|
||||
activeTextInput: undefined,
|
||||
subjectVisible: showSubject
|
||||
subjectVisible: showSubject,
|
||||
showingPostConfirmDialog: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -770,6 +777,32 @@ const PostStatusForm = {
|
|||
}
|
||||
}
|
||||
return this.$store.state.users.currentUser.default_scope
|
||||
},
|
||||
hideDenyConfirmDialog () {
|
||||
this.showingPostConfirmDialog = false
|
||||
|
||||
finEvent = null
|
||||
finNewStatus = null
|
||||
finOpts = null
|
||||
},
|
||||
doPostYes () {
|
||||
this.showingPostConfirmDialog = false
|
||||
this.postStatus(finEvent, finNewStatus, finOpts)
|
||||
},
|
||||
handlePost (event, newStatus, opts = {}) {
|
||||
if (this.mergedConfig.modalOnPubPost) {
|
||||
if (newStatus.visibility === "public" || newStatus.visibility === "unlisted" || newStatus.visibility === "local") {
|
||||
finEvent = event
|
||||
finNewStatus = newStatus
|
||||
finOpts = opts
|
||||
|
||||
this.showingPostConfirmDialog = true
|
||||
} else {
|
||||
this.postStatus(event, newStatus, opts = {})
|
||||
}
|
||||
} else {
|
||||
this.postStatus(event, newStatus, opts = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,9 +171,9 @@
|
|||
:disabled="posting && !optimisticPosting"
|
||||
class="form-post-body"
|
||||
:class="{ 'scrollable-form': !!maxHeight, '-has-subject': subjectVisible }"
|
||||
@keydown.exact.enter="submitOnEnter && postStatus($event, newStatus)"
|
||||
@keydown.meta.enter="postStatus($event, newStatus)"
|
||||
@keydown.ctrl.enter="!submitOnEnter && postStatus($event, newStatus)"
|
||||
@keydown.exact.enter="submitOnEnter && handlePost($event, newStatus)"
|
||||
@keydown.meta.enter="handlePost($event, newStatus)"
|
||||
@keydown.ctrl.enter="!submitOnEnter && handlePost($event, newStatus)"
|
||||
@input="resize"
|
||||
@compositionupdate="resize"
|
||||
@paste="paste"
|
||||
|
|
@ -317,7 +317,7 @@
|
|||
v-else
|
||||
:disabled="uploadingFiles || disableSubmit"
|
||||
class="btn button-default"
|
||||
@click.stop.prevent="postStatus($event, newStatus)"
|
||||
@click.stop.prevent="handlePost($event, newStatus)"
|
||||
>
|
||||
{{ $t('post_status.post') }}
|
||||
</button>
|
||||
|
|
@ -371,6 +371,18 @@
|
|||
</Checkbox>
|
||||
</div>
|
||||
</form>
|
||||
<teleport to="#modal">
|
||||
<confirm-modal
|
||||
v-if="showingPostConfirmDialog"
|
||||
:title="$t('post_status.post_confirm_title')"
|
||||
:confirm-text="$t('post_status.post_confirm_accept_button')"
|
||||
:cancel-text="$t('post_status.post_confirm_cancel_button')"
|
||||
@accepted="doPostYes"
|
||||
@cancelled="hideDenyConfirmDialog"
|
||||
>
|
||||
{{ $t('post_status.post_confirm') }}
|
||||
</confirm-modal>
|
||||
</teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -320,6 +320,11 @@
|
|||
{{ $t('settings.confirm_dialogs_deny_follow') }}
|
||||
</BooleanSetting>
|
||||
</li>
|
||||
<li>
|
||||
<BooleanSetting path="modalOnPubPost">
|
||||
{{ $t('settings.confirm_dialogs_public_post') }}
|
||||
</BooleanSetting>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -395,6 +395,10 @@
|
|||
"media_not_sensitive_warning": "You have a Content Warning, but the attachments are not marked as sensitive!",
|
||||
"new_status": "New post",
|
||||
"post": "Post",
|
||||
"post_confirm": "Are you sure you want to post this publicly?",
|
||||
"post_confirm_accept_button": "Yes, post",
|
||||
"post_confirm_cancel_button": "No, cancel",
|
||||
"post_confirm_title": "Confirm post visibility",
|
||||
"posting": "Posting",
|
||||
"preview": "Preview",
|
||||
"preview_empty": "Empty",
|
||||
|
|
@ -511,6 +515,7 @@
|
|||
"confirm_dialogs_delete": "Deleting a post",
|
||||
"confirm_dialogs_deny_follow": "Rejecting a follow request",
|
||||
"confirm_dialogs_mute": "Muting someone",
|
||||
"confirm_dialogs_public_post": "Posting unlisted or publicly",
|
||||
"confirm_dialogs_repeat": "Boosting a post",
|
||||
"confirm_dialogs_unfollow": "Unfollowing someone",
|
||||
"confirm_new_password": "Confirm new password",
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ export const defaultState = {
|
|||
modalOnLogout: undefined, // instance default
|
||||
modalOnApproveFollow: undefined, // instance default
|
||||
modalOnDenyFollow: undefined, // instance default
|
||||
modalOnPubPost: undefined, // instance default
|
||||
playVideosInModal: false,
|
||||
useOneClickNsfw: false,
|
||||
useContainFit: true,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const defaultState = {
|
|||
modalOnLogout: true,
|
||||
modalOnApproveFollow: false,
|
||||
modalOnDenyFollow: false,
|
||||
modalOnPubPost: false,
|
||||
loginMethod: 'password',
|
||||
logo: '/static/logo.svg',
|
||||
logoMargin: '.2em',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue