mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:13:22 +08:00
Add a warning if a user tries to PM themselves
This commit is contained in:
parent
5f67cd7b45
commit
19fa24d888
|
@ -8,6 +8,7 @@ export default Ember.Component.extend({
|
|||
queuedForTyping: null,
|
||||
_lastSimilaritySearch: null,
|
||||
_similarTopicsMessage: null,
|
||||
_yourselfConfirm: null,
|
||||
similarTopics: null,
|
||||
|
||||
hidden: Ember.computed.not('composer.viewOpen'),
|
||||
|
@ -83,6 +84,22 @@ export default Ember.Component.extend({
|
|||
// Some messages only get shown after being typed.
|
||||
_typedReply() {
|
||||
if (this.isDestroying || this.isDestroyed) { return; }
|
||||
|
||||
const composer = this.get('composer');
|
||||
if (composer.get('privateMessage')) {
|
||||
const usernames = composer.get('targetUsernames').split(',');
|
||||
if (usernames.length === 1 && usernames[0] === this.currentUser.get('username')) {
|
||||
|
||||
const message = this._yourselfConfirm || composer.store.createRecord('composer-message', {
|
||||
id: 'yourself_confirm',
|
||||
templateName: 'custom-body',
|
||||
title: I18n.t('composer.yourself_confirm.title'),
|
||||
body: I18n.t('composer.yourself_confirm.body')
|
||||
});
|
||||
this.send('popup', message);
|
||||
}
|
||||
}
|
||||
|
||||
this.get('queuedForTyping').forEach(msg => this.send("popup", msg));
|
||||
},
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
<a href {{action "closeMessage"}} class='close'>{{fa-icon "close"}}</a>
|
||||
{{#if message.title}}<h3>{{message.title}}</h3>{{/if}}
|
||||
<p>{{{message.body}}}</p>
|
||||
|
|
|
@ -1090,6 +1090,9 @@ en:
|
|||
modal_ok: "OK"
|
||||
modal_cancel: "Cancel"
|
||||
cant_send_pm: "Sorry, you can't send a message to %{username}."
|
||||
yourself_confirm:
|
||||
title: "Did you forget to add recipients?"
|
||||
body: "Right now this message is only being sent to yourself!"
|
||||
|
||||
admin_options_title: "Optional staff settings for this topic"
|
||||
auto_close:
|
||||
|
|
Loading…
Reference in New Issue
Block a user