mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
Add a warning if a user tries to PM themselves
This commit is contained in:
parent
5f67cd7b45
commit
19fa24d888
3 changed files with 21 additions and 0 deletions
|
@ -8,6 +8,7 @@ export default Ember.Component.extend({
|
||||||
queuedForTyping: null,
|
queuedForTyping: null,
|
||||||
_lastSimilaritySearch: null,
|
_lastSimilaritySearch: null,
|
||||||
_similarTopicsMessage: null,
|
_similarTopicsMessage: null,
|
||||||
|
_yourselfConfirm: null,
|
||||||
similarTopics: null,
|
similarTopics: null,
|
||||||
|
|
||||||
hidden: Ember.computed.not('composer.viewOpen'),
|
hidden: Ember.computed.not('composer.viewOpen'),
|
||||||
|
@ -83,6 +84,22 @@ export default Ember.Component.extend({
|
||||||
// Some messages only get shown after being typed.
|
// Some messages only get shown after being typed.
|
||||||
_typedReply() {
|
_typedReply() {
|
||||||
if (this.isDestroying || this.isDestroyed) { return; }
|
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));
|
this.get('queuedForTyping').forEach(msg => this.send("popup", msg));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
<a href {{action "closeMessage"}} class='close'>{{fa-icon "close"}}</a>
|
<a href {{action "closeMessage"}} class='close'>{{fa-icon "close"}}</a>
|
||||||
|
{{#if message.title}}<h3>{{message.title}}</h3>{{/if}}
|
||||||
<p>{{{message.body}}}</p>
|
<p>{{{message.body}}}</p>
|
||||||
|
|
|
@ -1090,6 +1090,9 @@ en:
|
||||||
modal_ok: "OK"
|
modal_ok: "OK"
|
||||||
modal_cancel: "Cancel"
|
modal_cancel: "Cancel"
|
||||||
cant_send_pm: "Sorry, you can't send a message to %{username}."
|
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"
|
admin_options_title: "Optional staff settings for this topic"
|
||||||
auto_close:
|
auto_close:
|
||||||
|
|
Loading…
Reference in a new issue