From a8b7e9631ba12f60467fceccb76e3d1f402bb35a Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Thu, 26 Aug 2021 08:52:53 -0500 Subject: [PATCH] DEV: Move admin namespace (#87) --- app/routes/discourse.rb | 2 +- .../javascripts/admin/adapters/channel.js.es6 | 2 +- .../admin/adapters/provider.js.es6 | 2 +- assets/javascripts/admin/adapters/rule.js.es6 | 2 +- ....es6 => chat-integration-route-map.js.es6} | 2 +- ...-plugins-chat-integration-provider.js.es6} | 18 ++++--- ... => admin-plugins-chat-integration.js.es6} | 0 ...gins-chat-integration-edit-channel.js.es6} | 0 ...plugins-chat-integration-edit-rule.js.es6} | 0 ...dmin-plugins-chat-integration-test.js.es6} | 2 +- ...min-plugins-chat-integration-index.js.es6} | 2 +- ...-plugins-chat-integration-provider.js.es6} | 2 +- ... => admin-plugins-chat-integration.js.es6} | 0 ...lugins-chat-integration-channel-error.hbs} | 0 ...plugins-chat-integration-edit-channel.hbs} | 0 ...in-plugins-chat-integration-edit-rule.hbs} | 0 ...> admin-plugins-chat-integration-test.hbs} | 0 ... => plugins-chat-integration-provider.hbs} | 0 ...-chat.hbs => plugins-chat-integration.hbs} | 2 +- plugin.rb | 2 +- spec/requests/chat_controller_spec.rb | 48 +++++++++---------- .../acceptance/chat-integration-test.js.es6 | 34 ++++++------- 22 files changed, 63 insertions(+), 57 deletions(-) rename assets/javascripts/admin/{chat-route-map.js.es6 => chat-integration-route-map.js.es6} (75%) rename assets/javascripts/admin/controllers/{admin-plugins-chat-provider.js.es6 => admin-plugins-chat-integration-provider.js.es6} (79%) rename assets/javascripts/admin/controllers/{admin-plugins-chat.js.es6 => admin-plugins-chat-integration.js.es6} (100%) rename assets/javascripts/admin/controllers/modals/{admin-plugins-chat-edit-channel.js.es6 => admin-plugins-chat-integration-edit-channel.js.es6} (100%) rename assets/javascripts/admin/controllers/modals/{admin-plugins-chat-edit-rule.js.es6 => admin-plugins-chat-integration-edit-rule.js.es6} (100%) rename assets/javascripts/admin/controllers/modals/{admin-plugins-chat-test.js.es6 => admin-plugins-chat-integration-test.js.es6} (95%) rename assets/javascripts/admin/routes/{admin-plugins-chat-index.js.es6 => admin-plugins-chat-integration-index.js.es6} (82%) rename assets/javascripts/admin/routes/{admin-plugins-chat-provider.js.es6 => admin-plugins-chat-integration-provider.js.es6} (94%) rename assets/javascripts/admin/routes/{admin-plugins-chat.js.es6 => admin-plugins-chat-integration.js.es6} (100%) rename assets/javascripts/admin/templates/modal/{admin-plugins-chat-channel-error.hbs => admin-plugins-chat-integration-channel-error.hbs} (100%) rename assets/javascripts/admin/templates/modal/{admin-plugins-chat-edit-channel.hbs => admin-plugins-chat-integration-edit-channel.hbs} (100%) rename assets/javascripts/admin/templates/modal/{admin-plugins-chat-edit-rule.hbs => admin-plugins-chat-integration-edit-rule.hbs} (100%) rename assets/javascripts/admin/templates/modal/{admin-plugins-chat-test.hbs => admin-plugins-chat-integration-test.hbs} (100%) rename assets/javascripts/discourse/templates/admin/{plugins-chat-provider.hbs => plugins-chat-integration-provider.hbs} (100%) rename assets/javascripts/discourse/templates/admin/{plugins-chat.hbs => plugins-chat-integration.hbs} (92%) diff --git a/app/routes/discourse.rb b/app/routes/discourse.rb index 0e3214f..f9fb23d 100644 --- a/app/routes/discourse.rb +++ b/app/routes/discourse.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true Discourse::Application.routes.append do - mount ::DiscourseChatIntegration::AdminEngine, at: '/admin/plugins/chat', constraints: AdminConstraint.new + mount ::DiscourseChatIntegration::AdminEngine, at: '/admin/plugins/chat-integration', constraints: AdminConstraint.new mount ::DiscourseChatIntegration::PublicEngine, at: '/chat-transcript/', as: 'chat-transcript' mount ::DiscourseChatIntegration::Provider::HookEngine, at: '/chat-integration/' diff --git a/assets/javascripts/admin/adapters/channel.js.es6 b/assets/javascripts/admin/adapters/channel.js.es6 index e100dde..2fe5f04 100644 --- a/assets/javascripts/admin/adapters/channel.js.es6 +++ b/assets/javascripts/admin/adapters/channel.js.es6 @@ -1,3 +1,3 @@ import buildPluginAdapter from "admin/adapters/build-plugin"; -export default buildPluginAdapter("chat"); +export default buildPluginAdapter("chat-integration"); diff --git a/assets/javascripts/admin/adapters/provider.js.es6 b/assets/javascripts/admin/adapters/provider.js.es6 index e100dde..2fe5f04 100644 --- a/assets/javascripts/admin/adapters/provider.js.es6 +++ b/assets/javascripts/admin/adapters/provider.js.es6 @@ -1,3 +1,3 @@ import buildPluginAdapter from "admin/adapters/build-plugin"; -export default buildPluginAdapter("chat"); +export default buildPluginAdapter("chat-integration"); diff --git a/assets/javascripts/admin/adapters/rule.js.es6 b/assets/javascripts/admin/adapters/rule.js.es6 index e100dde..2fe5f04 100644 --- a/assets/javascripts/admin/adapters/rule.js.es6 +++ b/assets/javascripts/admin/adapters/rule.js.es6 @@ -1,3 +1,3 @@ import buildPluginAdapter from "admin/adapters/build-plugin"; -export default buildPluginAdapter("chat"); +export default buildPluginAdapter("chat-integration"); diff --git a/assets/javascripts/admin/chat-route-map.js.es6 b/assets/javascripts/admin/chat-integration-route-map.js.es6 similarity index 75% rename from assets/javascripts/admin/chat-route-map.js.es6 rename to assets/javascripts/admin/chat-integration-route-map.js.es6 index 201c5b6..786a660 100644 --- a/assets/javascripts/admin/chat-route-map.js.es6 +++ b/assets/javascripts/admin/chat-integration-route-map.js.es6 @@ -2,7 +2,7 @@ export default { resource: "admin.adminPlugins", path: "/plugins", map() { - this.route("chat", function () { + this.route("chat-integration", function () { this.route("provider", { path: "/:provider" }); }); }, diff --git a/assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6 b/assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6 similarity index 79% rename from assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6 rename to assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6 index a2176db..0e5176b 100644 --- a/assets/javascripts/admin/controllers/admin-plugins-chat-provider.js.es6 +++ b/assets/javascripts/admin/controllers/admin-plugins-chat-integration-provider.js.es6 @@ -29,7 +29,7 @@ export default Ember.Controller.extend({ provider: this.get("model.provider"), }; - showModal("admin-plugins-chat-edit-channel", { + showModal("admin-plugins-chat-integration-edit-channel", { model, admin: true, }); @@ -43,7 +43,7 @@ export default Ember.Controller.extend({ provider: this.get("model.provider"), }; - showModal("admin-plugins-chat-edit-channel", { + showModal("admin-plugins-chat-integration-edit-channel", { model, admin: true, }); @@ -51,7 +51,7 @@ export default Ember.Controller.extend({ testChannel(channel) { this.set("modalShowing", true); - showModal("admin-plugins-chat-test", { + showModal("admin-plugins-chat-integration-test", { model: { channel }, admin: true, }); @@ -70,7 +70,10 @@ export default Ember.Controller.extend({ groups: this.get("model.groups"), }; - showModal("admin-plugins-chat-edit-rule", { model, admin: true }); + showModal("admin-plugins-chat-integration-edit-rule", { + model, + admin: true, + }); }, editRuleWithChannel(rule, channel) { @@ -83,13 +86,16 @@ export default Ember.Controller.extend({ groups: this.get("model.groups"), }; - showModal("admin-plugins-chat-edit-rule", { model, admin: true }); + showModal("admin-plugins-chat-integration-edit-rule", { + model, + admin: true, + }); }, showError(channel) { this.set("modalShowing", true); - showModal("admin-plugins-chat-channel-error", { + showModal("admin-plugins-chat-integration-channel-error", { model: channel, admin: true, }); diff --git a/assets/javascripts/admin/controllers/admin-plugins-chat.js.es6 b/assets/javascripts/admin/controllers/admin-plugins-chat-integration.js.es6 similarity index 100% rename from assets/javascripts/admin/controllers/admin-plugins-chat.js.es6 rename to assets/javascripts/admin/controllers/admin-plugins-chat-integration.js.es6 diff --git a/assets/javascripts/admin/controllers/modals/admin-plugins-chat-edit-channel.js.es6 b/assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-edit-channel.js.es6 similarity index 100% rename from assets/javascripts/admin/controllers/modals/admin-plugins-chat-edit-channel.js.es6 rename to assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-edit-channel.js.es6 diff --git a/assets/javascripts/admin/controllers/modals/admin-plugins-chat-edit-rule.js.es6 b/assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-edit-rule.js.es6 similarity index 100% rename from assets/javascripts/admin/controllers/modals/admin-plugins-chat-edit-rule.js.es6 rename to assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-edit-rule.js.es6 diff --git a/assets/javascripts/admin/controllers/modals/admin-plugins-chat-test.js.es6 b/assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-test.js.es6 similarity index 95% rename from assets/javascripts/admin/controllers/modals/admin-plugins-chat-test.js.es6 rename to assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-test.js.es6 index 3f93954..eaee5e2 100644 --- a/assets/javascripts/admin/controllers/modals/admin-plugins-chat-test.js.es6 +++ b/assets/javascripts/admin/controllers/modals/admin-plugins-chat-integration-test.js.es6 @@ -28,7 +28,7 @@ export default Ember.Controller.extend(ModalFunctionality, { } this.set("loading", true); - ajax("/admin/plugins/chat/test", { + ajax("/admin/plugins/chat-integration/test", { data: { channel_id: this.get("model.channel.id"), topic_id: this.get("model.topic_id"), diff --git a/assets/javascripts/admin/routes/admin-plugins-chat-index.js.es6 b/assets/javascripts/admin/routes/admin-plugins-chat-integration-index.js.es6 similarity index 82% rename from assets/javascripts/admin/routes/admin-plugins-chat-index.js.es6 rename to assets/javascripts/admin/routes/admin-plugins-chat-integration-index.js.es6 index a07721a..f530ff8 100644 --- a/assets/javascripts/admin/routes/admin-plugins-chat-index.js.es6 +++ b/assets/javascripts/admin/routes/admin-plugins-chat-integration-index.js.es6 @@ -4,7 +4,7 @@ export default DiscourseRoute.extend({ afterModel(model) { if (model.totalRows > 0) { this.transitionTo( - "adminPlugins.chat.provider", + "adminPlugins.chat-integration.provider", model.get("firstObject").name ); } diff --git a/assets/javascripts/admin/routes/admin-plugins-chat-provider.js.es6 b/assets/javascripts/admin/routes/admin-plugins-chat-integration-provider.js.es6 similarity index 94% rename from assets/javascripts/admin/routes/admin-plugins-chat-provider.js.es6 rename to assets/javascripts/admin/routes/admin-plugins-chat-integration-provider.js.es6 index 9f347a8..cbc1d85 100644 --- a/assets/javascripts/admin/routes/admin-plugins-chat-provider.js.es6 +++ b/assets/javascripts/admin/routes/admin-plugins-chat-integration-provider.js.es6 @@ -5,7 +5,7 @@ export default DiscourseRoute.extend({ model(params) { return Ember.RSVP.hash({ channels: this.store.findAll("channel", { provider: params.provider }), - provider: this.modelFor("admin-plugins-chat").findBy( + provider: this.modelFor("admin-plugins-chat-integration").findBy( "id", params.provider ), diff --git a/assets/javascripts/admin/routes/admin-plugins-chat.js.es6 b/assets/javascripts/admin/routes/admin-plugins-chat-integration.js.es6 similarity index 100% rename from assets/javascripts/admin/routes/admin-plugins-chat.js.es6 rename to assets/javascripts/admin/routes/admin-plugins-chat-integration.js.es6 diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-channel-error.hbs similarity index 100% rename from assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs rename to assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-channel-error.hbs diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-edit-channel.hbs similarity index 100% rename from assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs rename to assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-edit-channel.hbs diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-edit-rule.hbs similarity index 100% rename from assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs rename to assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-edit-rule.hbs diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-test.hbs similarity index 100% rename from assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs rename to assets/javascripts/admin/templates/modal/admin-plugins-chat-integration-test.hbs diff --git a/assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs b/assets/javascripts/discourse/templates/admin/plugins-chat-integration-provider.hbs similarity index 100% rename from assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs rename to assets/javascripts/discourse/templates/admin/plugins-chat-integration-provider.hbs diff --git a/assets/javascripts/discourse/templates/admin/plugins-chat.hbs b/assets/javascripts/discourse/templates/admin/plugins-chat-integration.hbs similarity index 92% rename from assets/javascripts/discourse/templates/admin/plugins-chat.hbs rename to assets/javascripts/discourse/templates/admin/plugins-chat-integration.hbs index bc578dc..7c12bb7 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-chat.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-chat-integration.hbs @@ -4,7 +4,7 @@