mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-07-05 13:42:09 +00:00
Correct eslint fails
This commit is contained in:
parent
148dd8df6b
commit
645c21f2f7
@ -3,8 +3,8 @@ export default {
|
|||||||
path: '/plugins',
|
path: '/plugins',
|
||||||
map() {
|
map() {
|
||||||
this.route('chat', function(){
|
this.route('chat', function(){
|
||||||
this.route('provider', {path: '/:provider'});
|
this.route('provider', {path: '/:provider'});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
modalShowing: false,
|
modalShowing: false,
|
||||||
|
|
||||||
anyErrors: function(){
|
anyErrors: function(){
|
||||||
var anyErrors = false;
|
var anyErrors = false;
|
||||||
@ -14,16 +14,16 @@ export default Ember.Controller.extend({
|
|||||||
}.property('model.channels'),
|
}.property('model.channels'),
|
||||||
|
|
||||||
actions:{
|
actions:{
|
||||||
createChannel(){
|
createChannel(){
|
||||||
this.set('modalShowing', true);
|
this.set('modalShowing', true);
|
||||||
var model = {channel: this.store.createRecord('channel',{provider: this.get('model.provider').id, data:{}},), provider:this.get('model.provider')};
|
var model = {channel: this.store.createRecord('channel',{provider: this.get('model.provider').id, data:{}},), provider:this.get('model.provider')};
|
||||||
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
||||||
},
|
},
|
||||||
editChannel(channel){
|
editChannel(channel){
|
||||||
this.set('modalShowing', true);
|
this.set('modalShowing', true);
|
||||||
var model = {channel: channel, provider: this.get('model.provider')};
|
var model = {channel: channel, provider: this.get('model.provider')};
|
||||||
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
showModal('admin-plugins-chat-edit-channel', { model: model, admin: true });
|
||||||
},
|
},
|
||||||
testChannel(channel){
|
testChannel(channel){
|
||||||
this.set('modalShowing', true);
|
this.set('modalShowing', true);
|
||||||
var model = {channel:channel};
|
var model = {channel:channel};
|
||||||
|
@ -89,9 +89,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
save: function(){
|
save: function(){
|
||||||
if(this.get('saveDisabled')){return;};
|
if(this.get('saveDisabled')){return;};
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.get('model.channel').save().then(function() {
|
this.get('model.channel').save().then(function() {
|
||||||
self.send('closeModal');
|
self.send('closeModal');
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
self.flash(extractError(error), 'error');
|
self.flash(extractError(error), 'error');
|
||||||
|
@ -30,9 +30,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
save: function(){
|
save: function(){
|
||||||
if(this.get('saveDisabled')){return;};
|
if(this.get('saveDisabled')){return;};
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.get('model.rule').save().then(function() {
|
this.get('model.rule').save().then(function() {
|
||||||
self.send('closeModal');
|
self.send('closeModal');
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
self.flash(extractError(error), 'error');
|
self.flash(extractError(error), 'error');
|
||||||
|
@ -2,7 +2,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|||||||
import { ajax } from 'discourse/lib/ajax';
|
import { ajax } from 'discourse/lib/ajax';
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
setupKeydown: function() {
|
setupKeydown: function() {
|
||||||
Ember.run.schedule('afterRender', () => {
|
Ember.run.schedule('afterRender', () => {
|
||||||
$('#chat_integration_test_modal').keydown(e => {
|
$('#chat_integration_test_modal').keydown(e => {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
@ -13,41 +13,41 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
}.on('init'),
|
}.on('init'),
|
||||||
|
|
||||||
sendDisabled: function(){
|
sendDisabled: function(){
|
||||||
if(this.get('model').topic_id){
|
if(this.get('model').topic_id){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}.property('model.topic_id'),
|
}.property('model.topic_id'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
send: function(){
|
send: function(){
|
||||||
if(this.get('sendDisabled')){return;};
|
if(this.get('sendDisabled')){return;};
|
||||||
self = this;
|
self = this;
|
||||||
this.set('loading', true);
|
this.set('loading', true);
|
||||||
ajax("/admin/plugins/chat/test", {
|
ajax("/admin/plugins/chat/test", {
|
||||||
data: { channel_id: this.get('model.channel.id'),
|
data: { channel_id: this.get('model.channel.id'),
|
||||||
topic_id: this.get('model.topic_id')
|
topic_id: this.get('model.topic_id')
|
||||||
},
|
},
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.set('loading', false);
|
self.set('loading', false);
|
||||||
self.flash(I18n.t('chat_integration.test_modal.success'), 'success');
|
self.flash(I18n.t('chat_integration.test_modal.success'), 'success');
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
self.set('loading', false);
|
self.set('loading', false);
|
||||||
|
|
||||||
var response = e.jqXHR.responseJSON;
|
var response = e.jqXHR.responseJSON;
|
||||||
var error_key = 'chat_integration.test_modal.error';
|
var error_key = 'chat_integration.test_modal.error';
|
||||||
|
|
||||||
if(response['error_key']){
|
if(response['error_key']){
|
||||||
error_key = response['error_key'];
|
error_key = response['error_key'];
|
||||||
}
|
}
|
||||||
self.flash(I18n.t(error_key), 'error');
|
self.flash(I18n.t(error_key), 'error');
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user