From 862fa38f8b4b4a2e96f1919807f20c33b5399d9e Mon Sep 17 00:00:00 2001 From: Dennis Schubert Date: Fri, 18 Oct 2019 23:14:14 +0200 Subject: [PATCH] Remove the JSXC/Prosody integration. As per discussion on https://discourse.diasporafoundation.org/t/removing-diaspora-s-current-chat-integration/2718, nobody raised serious concerns or objections. Given future plans, we do not think having an unfinished implementation of something that likely will not get finished in the current form is worth it. So let's get rid of it. --- .eslintrc | 1 - .gitignore | 5 -- Changelog.md | 6 ++ Gemfile | 4 -- Gemfile.lock | 16 ----- app/assets/config/manifest.js | 1 - app/assets/javascripts/app/pages/contacts.js | 18 ------ app/assets/javascripts/app/views/help_view.js | 59 +++++------------- app/assets/javascripts/jsxc.js | 50 --------------- app/assets/stylesheets/_application.scss | 2 - app/assets/stylesheets/chat.scss | 14 ----- app/assets/stylesheets/contacts.scss | 3 - app/assets/stylesheets/help.scss | 12 ---- app/assets/templates/faq_chat_tpl.jst.hbs | 6 -- app/assets/templates/help_tpl.jst.hbs | 6 -- app/controllers/application_controller.rb | 1 - app/controllers/aspects_controller.rb | 10 +-- app/helpers/jsxc_helper.rb | 15 ----- app/presenters/node_info_presenter.rb | 5 -- app/serializers/export/aspect_serializer.rb | 2 +- app/views/contacts/_header.html.haml | 7 --- app/views/streams/main_stream.html.haml | 5 -- config/certs/README | 7 --- config/defaults.yml | 15 ----- config/diaspora.yml.example | 62 ------------------- config/eye.rb | 9 --- config/initializers/prosody.rb | 24 ------- config/initializers/secure_headers.rb | 8 --- config/locales/diaspora/en.yml | 5 -- config/locales/javascript/javascript.en.yml | 2 - config/routes.rb | 1 - db/migrate/20191018014242_remove_chat.rb | 10 +++ lib/archive_importer.rb | 2 +- lib/schemas/archive-format.json | 3 +- script/server | 16 ----- .../jasmine_fixtures/contacts_spec.rb | 1 - spec/helpers/jsxc_helper_spec.rb | 21 ------- spec/integration/exporter_spec.rb | 6 +- spec/integration/migration_service_spec.rb | 4 +- spec/javascripts/app/pages/contacts_spec.js | 23 ------- spec/javascripts/app/views/help_view_spec.js | 27 -------- .../javascripts/jasmine_helpers/SpecHelper.js | 1 - spec/lib/archive_importer_spec.rb | 1 - spec/presenters/node_info_presenter_spec.rb | 12 ---- .../export/aspect_serializer_spec.rb | 3 +- 45 files changed, 39 insertions(+), 472 deletions(-) delete mode 100644 app/assets/javascripts/jsxc.js delete mode 100644 app/assets/stylesheets/chat.scss delete mode 100644 app/assets/templates/faq_chat_tpl.jst.hbs delete mode 100644 app/helpers/jsxc_helper.rb delete mode 100644 config/certs/README delete mode 100644 config/initializers/prosody.rb create mode 100644 db/migrate/20191018014242_remove_chat.rb delete mode 100644 spec/helpers/jsxc_helper_spec.rb diff --git a/.eslintrc b/.eslintrc index fd80c6478..5a45c4f49 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,7 +16,6 @@ "Handlebars": false, "HandlebarsTemplates": false, "ImagePaths": false, - "jsxc": false, "L": false, "OSM": false, "PerfectScrollbar": false, diff --git a/.gitignore b/.gitignore index 65d3c2649..c18b96c64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ -# XMPP certificates, keys and user data -config/certs/*.crt -config/certs/*.key -config/prosody.cfg.lua - # Trademark sillyness app/views/home/_show.* app/views/terms/terms.* diff --git a/Changelog.md b/Changelog.md index f3c543662..73b2e9a24 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ # 0.8.0.0 +## The chat integration has been removed + +After [a discussion with our community on Discourse](https://discourse.diasporafoundation.org/t/2718), we decided to remove the pieces of XMPP chat integration that were put in place a while ago. When we first added the chat support, we merged the implementation in an unfinished state in the hopes that the open issues will be addressed eventually, and the implementation would end up more polished. This ended up not being the case. After careful consideration and discussion, we did not manage to come up with clear reasons why we need a chat implementation, so we decided that the best way forward would be to remove it. + +Although the chat was never enabled per default and was marked as experimental, some production pods did set up the integration and offered an XMPP service to their users. After this release, diaspora\* will no longer contain a chat applet, so users will no longer be able to use the webchat inside diaspora\*. The existing module that is used to enable users to authenticate to Prosody using their diaspora\* credentials will continue to work, but contact list synchronization might not work without further changes to the Prosody module, which is developed independently from this project. + ## Refactor * Add bootstrapping for using ECMAScript 6 with automatic transpiling for compatibility [#7581](https://github.com/diaspora/diaspora/pull/7581) * Remove backporting of mention syntax [#7788](https://github.com/diaspora/diaspora/pull/7788) diff --git a/Gemfile b/Gemfile index 5be4afe9e..fc1062884 100644 --- a/Gemfile +++ b/Gemfile @@ -175,10 +175,6 @@ gem "openid_connect", "1.1.8" gem "active_model_serializers", "0.9.7" -# XMPP chat dependencies -gem "diaspora-prosody-config", "0.0.7" -gem "rails-assets-diaspora_jsxc", "0.1.5.develop.7", source: "https://rails-assets.org" - # Tags gem "acts-as-taggable-on", "6.0.0" diff --git a/Gemfile.lock b/Gemfile.lock index 76bb7b357..56cd3defe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,7 +184,6 @@ GEM devise_lastseenable (0.0.6) devise rails (>= 3.0.4) - diaspora-prosody-config (0.0.7) diaspora_federation (0.2.6) faraday (>= 0.9.0, < 0.16.0) faraday_middleware (>= 0.10.0, < 0.14.0) @@ -538,31 +537,18 @@ GEM rails-assets-corejs-typeahead (1.2.1) rails-assets-jquery (>= 1.11) rails-assets-cropperjs (1.4.3) - rails-assets-diaspora_jsxc (0.1.5.develop.7) - rails-assets-emojione (~> 2.0.1) - rails-assets-favico.js (>= 0.3.10, < 0.4) - rails-assets-jquery-colorbox (~> 1.6.3) - rails-assets-jquery-fullscreen-plugin (~> 0.5.0) - rails-assets-jquery.slimscroll (~> 1.3.6) - rails-assets-jquery.ui (~> 1.11.4) - rails-assets-emojione (2.0.1) - rails-assets-favico.js (0.3.10) rails-assets-fine-uploader (5.13.0) rails-assets-highlightjs (9.12.0) rails-assets-jasmine (3.4.0) rails-assets-jasmine-ajax (4.0.0) rails-assets-jasmine (~> 3) rails-assets-jquery (3.4.1) - rails-assets-jquery-colorbox (1.6.4) - rails-assets-jquery (>= 1.3.2) - rails-assets-jquery-fullscreen-plugin (0.5.0) rails-assets-jquery-placeholder (2.3.1) rails-assets-jquery (>= 1.6) rails-assets-jquery-textchange (0.2.3) rails-assets-jquery rails-assets-jquery.are-you-sure (1.9.0) rails-assets-jquery (>= 1.4.2) - rails-assets-jquery.slimscroll (1.3.8) rails-assets-jquery.ui (1.11.4) rails-assets-jquery (>= 1.6) rails-assets-markdown-it--markdown-it-for-inline (0.1.1) @@ -812,7 +798,6 @@ DEPENDENCIES devise (= 4.6.1) devise-two-factor (= 3.0.3) devise_lastseenable (= 0.0.6) - diaspora-prosody-config (= 0.0.7) diaspora_federation-json_schema (= 0.2.6) diaspora_federation-rails (= 0.2.6) diaspora_federation-test (= 0.2.6) @@ -878,7 +863,6 @@ DEPENDENCIES rails-assets-bootstrap-markdown (= 2.10.0)! rails-assets-corejs-typeahead (= 1.2.1)! rails-assets-cropperjs (= 1.4.3)! - rails-assets-diaspora_jsxc (= 0.1.5.develop.7)! rails-assets-fine-uploader (= 5.13.0)! rails-assets-highlightjs (= 9.12.0)! rails-assets-jasmine-ajax (= 4.0.0)! diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index fc75a31f6..04515b804 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -2,7 +2,6 @@ //= link jquery3.js //= link jquery_ujs.js //= link main.js -//= link jsxc.js //= link bookmarklet.js //= link mobile/bookmarklet.js //= link mobile/mobile.js diff --git a/app/assets/javascripts/app/pages/contacts.js b/app/assets/javascripts/app/pages/contacts.js index 0035951c0..8c8d34654 100644 --- a/app/assets/javascripts/app/pages/contacts.js +++ b/app/assets/javascripts/app/pages/contacts.js @@ -5,14 +5,12 @@ app.pages.Contacts = Backbone.View.extend({ el: "#contacts_container", events: { - "click #chat_privilege_toggle" : "toggleChatPrivilege", "click #change_aspect_name" : "showAspectNameForm", "click .conversation_button": "showMessageModal", "click .invitations-button": "showInvitationsModal" }, initialize: function(opts) { - this.chatToggle = $("#chat_privilege_toggle i"); this.stream = opts.stream; this.stream.render(); $("#people-stream.contacts .header i").tooltip({"placement": "bottom"}); @@ -27,22 +25,6 @@ app.pages.Contacts = Backbone.View.extend({ this.setupAspectSorting(); }, - toggleChatPrivilege: function() { - if (this.chatToggle.hasClass("enabled")) { - this.chatToggle.tooltip("destroy") - .removeClass("enabled") - .removeAttr("data-original-title") - .attr("title", Diaspora.I18n.t("contacts.aspect_chat_is_not_enabled")) - .tooltip({"placement": "bottom"}); - } else { - this.chatToggle.tooltip("destroy") - .addClass("enabled") - .removeAttr("data-original-title") - .attr("title", Diaspora.I18n.t("contacts.aspect_chat_is_enabled")) - .tooltip({"placement": "bottom"}); - } - }, - showAspectNameForm: function() { $(".header > h3").hide(); var aspectName = $.trim($(".header h3 #aspect_name").text()); diff --git a/app/assets/javascripts/app/views/help_view.js b/app/assets/javascripts/app/views/help_view.js index 24052f09f..619395b6e 100644 --- a/app/assets/javascripts/app/views/help_view.js +++ b/app/assets/javascripts/app/views/help_view.js @@ -9,8 +9,7 @@ app.views.Help = app.views.StaticContentView.extend({ "click .faq-link-sharing": "sharing", "click .faq-link-posts-and-posting": "postsAndPosting", "click .faq-link-tags": "tags", - "click .faq-link-keyboard-shortcuts": "keyboardShortcuts", - "click .faq-link-chat": "chat" + "click .faq-link-keyboard-shortcuts": "keyboardShortcuts" }, initialize : function() { @@ -39,31 +38,22 @@ app.views.Help = app.views.StaticContentView.extend({ } }; - this.CHAT_SUBS = { - add_contact_roster_a: { - toggle_privilege: this.getChatIcons(), - contacts_page: this.linkHtml(Routes.contacts(), Diaspora.I18n.t("chat.contacts_page")) - } - }; - this.data = { - title_header: Diaspora.I18n.t( 'title_header' ), - title_getting_help: Diaspora.I18n.t( 'getting_help.title' ), - title_account_and_data_management: Diaspora.I18n.t( 'account_and_data_management.title' ), - title_aspects: Diaspora.I18n.t( 'aspects.title' ), - title_mentions: Diaspora.I18n.t( 'mentions.title' ), - title_pods: Diaspora.I18n.t( 'pods.title' ), - title_posts_and_posting: Diaspora.I18n.t( 'posts_and_posting.title' ), - title_private_posts: Diaspora.I18n.t( 'private_posts.title' ), - title_public_posts: Diaspora.I18n.t( 'public_posts.title' ), - title_resharing_posts: Diaspora.I18n.t( 'resharing_posts.title' ), + title_header: Diaspora.I18n.t("title_header"), + title_getting_help: Diaspora.I18n.t("getting_help.title"), + title_account_and_data_management: Diaspora.I18n.t("account_and_data_management.title"), + title_aspects: Diaspora.I18n.t("aspects.title"), + title_mentions: Diaspora.I18n.t("mentions.title"), + title_pods: Diaspora.I18n.t("pods.title"), + title_posts_and_posting: Diaspora.I18n.t("posts_and_posting.title"), + title_private_posts: Diaspora.I18n.t("private_posts.title"), + title_public_posts: Diaspora.I18n.t("public_posts.title"), + title_resharing_posts: Diaspora.I18n.t("resharing_posts.title"), title_profile: Diaspora.I18n.t("profile.title"), - title_sharing: Diaspora.I18n.t( 'sharing.title' ), - title_tags: Diaspora.I18n.t( 'tags.title' ), - title_keyboard_shortcuts: Diaspora.I18n.t( 'keyboard_shortcuts.title' ), - title_miscellaneous: Diaspora.I18n.t( 'miscellaneous.title' ), - title_chat: Diaspora.I18n.t( 'chat.title' ), - chat_enabled: this.chatEnabled() + title_sharing: Diaspora.I18n.t("sharing.title"), + title_tags: Diaspora.I18n.t("tags.title"), + title_keyboard_shortcuts: Diaspora.I18n.t("keyboard_shortcuts.title"), + title_miscellaneous: Diaspora.I18n.t("miscellaneous.title") }; return this; @@ -199,27 +189,8 @@ app.views.Help = app.views.StaticContentView.extend({ e.preventDefault(); }, - chat: function(e){ - this.renderStaticSection("chat", "faq_chat", this.CHAT_SUBS); - this.menuClicked(e); - - e.preventDefault(); - }, - linkHtml: function(url, text) { return "" + text + ""; - }, - - chatEnabled: function(){ - return gon.appConfig.chat.enabled; - }, - - getChatIcons: function(){ - return "
" + - " " + - " " + - " " + - "
"; } }); // @license-end diff --git a/app/assets/javascripts/jsxc.js b/app/assets/javascripts/jsxc.js deleted file mode 100644 index 66ed5d622..000000000 --- a/app/assets/javascripts/jsxc.js +++ /dev/null @@ -1,50 +0,0 @@ -//= require emojione -//= require favico.js/favico - -//= require jquery.ui/ui/resizable -//= require jquery.ui/ui/draggable -//= require jquery.slimscroll/jquery.slimscroll -//= require jquery-colorbox -//= require jquery-fullscreen-plugin - -//= require diaspora_jsxc - -// initialize jsxc xmpp client -$(document).ready(function() { - if (app.currentUser.authenticated()) { - $.post("/user/auth_token", null, function(data) { - if (jsxc && data['token']) { - var jid = app.currentUser.get('diaspora_id'); - jsxc.init({ - root: '/assets/diaspora_jsxc', - rosterAppend: 'body', - otr: { - debug: true, - SEND_WHITESPACE_TAG: true, - WHITESPACE_START_AKE: true - }, - onlineHelp: "/help/chat", - priority: { - online: 1, - chat: 1 - }, - displayRosterMinimized: function() { - return false; - }, - xmpp: { - url: $('script#jsxc').data('endpoint'), - username: jid.replace(/@.*?$/g, ''), - domain: jid.replace(/^.*?@/g, ''), - jid: jid, - password: data.token, - resource: 'diaspora-jsxc', - overwrite: true, - onlogin: true - } - }); - } else { - console.error('No token found! Authenticated!?'); - } - }, 'json'); - } -}); diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index 2eb0c4810..ae8ca9c06 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -84,8 +84,6 @@ @import 'stream'; @import 'stream_element'; @import 'comments'; -@import 'diaspora_jsxc'; -@import 'chat'; @import 'markdown-content'; @import 'oembed'; @import 'media-embed'; diff --git a/app/assets/stylesheets/chat.scss b/app/assets/stylesheets/chat.scss deleted file mode 100644 index 8adb9dd52..000000000 --- a/app/assets/stylesheets/chat.scss +++ /dev/null @@ -1,14 +0,0 @@ -body > .container-fluid.chat-roster-shown { - padding-right: 224px; - #back-to-top { right: 244px; } -} -body > .container-fluid.chat-roster-hidden { - #back-to-top { right: 54px; } -} - -// This element is instanciated by JSXC. Does not have to follow naming conventions -// scss-lint:disable IdSelector, SelectorFormat -#jsxc_roster { - top: $navbar-height; -} -// scss-lint:enable IdSelector, SelectorFormat diff --git a/app/assets/stylesheets/contacts.scss b/app/assets/stylesheets/contacts.scss index 8a35dbe48..2773f92d3 100644 --- a/app/assets/stylesheets/contacts.scss +++ b/app/assets/stylesheets/contacts.scss @@ -37,9 +37,6 @@ text-decoration: none; margin-right: 25px; } - #chat_privilege_toggle > .enabled { - color: $text-color-active; - } .contacts-header-icon { font-size: 24.5px; line-height: 40px; diff --git a/app/assets/stylesheets/help.scss b/app/assets/stylesheets/help.scss index c19e09439..f6075d679 100644 --- a/app/assets/stylesheets/help.scss +++ b/app/assets/stylesheets/help.scss @@ -91,18 +91,6 @@ ul#help_nav { border-radius: 0px 0px 4px 4px; background-color: white; padding: 10px 20px; - - div.help-chat-icons{ - text-align: center; - font-size: 50px; - line-height: 70px; - - [class^="entypo-"], [class*="entypo-"] { - color: $text-color-pale; - - &.entypo-chat { color: $text-color-active; } - } - } } } } diff --git a/app/assets/templates/faq_chat_tpl.jst.hbs b/app/assets/templates/faq_chat_tpl.jst.hbs deleted file mode 100644 index fb3633345..000000000 --- a/app/assets/templates/faq_chat_tpl.jst.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
- -

{{ add_contact_roster_q }}

-
-
{{{ add_contact_roster_a }}}
-
\ No newline at end of file diff --git a/app/assets/templates/help_tpl.jst.hbs b/app/assets/templates/help_tpl.jst.hbs index 16dc93075..ee88469e7 100644 --- a/app/assets/templates/help_tpl.jst.hbs +++ b/app/assets/templates/help_tpl.jst.hbs @@ -64,12 +64,6 @@ {{ title_miscellaneous }} {{ title_miscellaneous }} - {{#if chat_enabled }} -
  • - {{ title_chat }} - {{ title_chat }} -
  • - {{/if}} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 86d763887..c1a16ff94 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -162,7 +162,6 @@ class ApplicationController < ActionController::Base def gon_set_appconfig gon.push(appConfig: { - chat: {enabled: AppConfig.chat.enabled?}, settings: {podname: AppConfig.settings.pod_name}, map: {mapbox: { enabled: AppConfig.map.mapbox.enabled?, diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index b970f7596..40405f175 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -76,14 +76,6 @@ class AspectsController < ApplicationController head :no_content end - def toggle_chat_privilege - @aspect = current_user.aspects.where(:id => params[:aspect_id]).first - - @aspect.chat_enabled = !@aspect.chat_enabled - @aspect.save - head :no_content - end - private def connect_person_to_aspect(aspecting_person_id) @@ -97,6 +89,6 @@ class AspectsController < ApplicationController end def aspect_params - params.require(:aspect).permit(:name, :chat_enabled, :order_id) + params.require(:aspect).permit(:name, :order_id) end end diff --git a/app/helpers/jsxc_helper.rb b/app/helpers/jsxc_helper.rb deleted file mode 100644 index d94597d55..000000000 --- a/app/helpers/jsxc_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module JsxcHelper - def get_bosh_endpoint - proto = AppConfig.chat.server.bosh.proto - port = AppConfig.chat.server.bosh.port - bind = AppConfig.chat.server.bosh.bind - host = AppConfig.pod_uri.host - - unless AppConfig.chat.server.bosh.proxy? - return "#{proto}://#{host}:#{port}#{bind}" - end - AppConfig.url_to bind - end -end diff --git a/app/presenters/node_info_presenter.rb b/app/presenters/node_info_presenter.rb index e0c2c579b..f2f1566eb 100644 --- a/app/presenters/node_info_presenter.rb +++ b/app/presenters/node_info_presenter.rb @@ -23,7 +23,6 @@ class NodeInfoPresenter doc.services.outbound = available_services doc.open_registrations = open_registrations? doc.metadata["nodeName"] = name - doc.metadata["xmppChat"] = chat_enabled? doc.metadata["camo"] = camo_config doc.metadata["adminAccount"] = admin_account end @@ -70,10 +69,6 @@ class NodeInfoPresenter AppConfig.settings.enable_registrations? end - def chat_enabled? - AppConfig.chat.enabled? - end - def camo_config { markdown: AppConfig.privacy.camo.proxy_markdown_images?, diff --git a/app/serializers/export/aspect_serializer.rb b/app/serializers/export/aspect_serializer.rb index 938939ad9..478bef3fa 100644 --- a/app/serializers/export/aspect_serializer.rb +++ b/app/serializers/export/aspect_serializer.rb @@ -2,6 +2,6 @@ module Export class AspectSerializer < ActiveModel::Serializer - attributes :name, :chat_enabled + attributes :name end end diff --git a/app/views/contacts/_header.html.haml b/app/views/contacts/_header.html.haml index 4348e0dea..7acc2e93a 100644 --- a/app/views/contacts/_header.html.haml +++ b/app/views/contacts/_header.html.haml @@ -4,13 +4,6 @@ - if @aspect.contacts.size > 0 && @aspect.contacts.size < 20 = start_a_conversation_link(@aspect, @aspect.contacts.size) - -if AppConfig.chat.enabled? - = link_to aspect_toggle_chat_privilege_path(@aspect), id: "chat_privilege_toggle", class: "contacts_button", method: :put, remote: true do - -if @aspect.chat_enabled? - %i.entypo-chat.enabled.contacts-header-icon{title: t("javascripts.contacts.aspect_chat_is_enabled")} - -else - %i.entypo-chat.contacts-header-icon{title: t("javascripts.contacts.aspect_chat_is_not_enabled")} - = link_to @aspect, method: "delete", data: { confirm: t("aspects.edit.confirm_remove_aspect") }, class: "delete contacts_button", id: "delete_aspect" do %i.entypo-trash.contacts-header-icon{title: t("delete")} .pull-right.contact-list-search diff --git a/app/views/streams/main_stream.html.haml b/app/views/streams/main_stream.html.haml index abc6f1f36..f69edd2d3 100644 --- a/app/views/streams/main_stream.html.haml +++ b/app/views/streams/main_stream.html.haml @@ -2,11 +2,6 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -- content_for :head do - - if AppConfig.chat.enabled? - = javascript_include_tag :jsxc, id: 'jsxc', - data: { endpoint: get_bosh_endpoint } - - if current_user&.getting_started? #welcome-to-diaspora .container-fluid diff --git a/config/certs/README b/config/certs/README deleted file mode 100644 index 2e8573574..000000000 --- a/config/certs/README +++ /dev/null @@ -1,7 +0,0 @@ -If you want to encrypt your chat streams with prosody. -Add to `config/certs` your server certificate and key. - -The domain name should be included in the file name e.g.: - -* example.com.crt -* example.com.key diff --git a/config/defaults.yml b/config/defaults.yml index be7dc1dc1..619c43a0c 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -49,21 +49,6 @@ defaults: unicorn_timeout: 90 embed_sidekiq_worker: false sidekiq_workers: 1 - chat: - enabled: false - server: - enabled: true - certs: "config/certs" - bosh: - proxy: false - proto: 'http' - address: '0.0.0.0' - port: 5280 - bind: '/http-bind' - log: - info: 'log/prosody.log' - error: 'log/prosody.err' - debug: false map: mapbox: enabled: false diff --git a/config/diaspora.yml.example b/config/diaspora.yml.example index 746f0685d..c95be222d 100644 --- a/config/diaspora.yml.example +++ b/config/diaspora.yml.example @@ -208,68 +208,6 @@ configuration: ## Section ## increase environment.sidekiq.concurrency instead! #sidekiq_workers: 1 - ## Diaspora has an internal XMPP web-client. If you want to enable the chat - ## functionality or want to use a custom XMPP server, then you should edit - ## the following configuration. - chat: ## Section - - ## Enable the chat service and all its components. - ## - ## Please make sure that you followed the Installation-Instructions first: - ## https://wiki.diasporafoundation.org/Integration/Chat#Installation.2FUpdate - #enabled: true - - ## Custom XMPP server configuration goes here. - server: ## Section - - ## Use the configuration bridge to prosody (default=true). - ## In case you want to run your own server or want to configure - ## prosody on your own, you should disable it. - #enabled: false - - ## Set the directory in which to look for virtual hosts TLS certificates. - #certs: 'config/certs' - - ## XEP-0124 BOSH requests - ## The easiest way of avoiding certificate and mixed-content issues - ## is to use a proxy, e.g.: - ## - ## Apache: https://wiki.diasporafoundation.org/Integration/Chat#Apache2 - ## Nginx: https://wiki.diasporafoundation.org/Integration/Chat#Nginx - ## - ## If you configured your proxy correctly, - ## you should set the proxy option to 'true' - bosh: ## Section - - ## If you'd like to use a proxy, you should set the proxy - ## option to true, otherwise jsxc always tries to - ## connect directly to the port specified below. - #proxy: true - - ## Configure the protocol used to access the BOSH endpoint - #proto: http - - ## Configure the address that prosody should listen on. - #address: '0.0.0.0' - - ## Configure the BOSH port. - #port: 5280 - - ## Configure the bind endpoint. - #bind: '/http-bind' - - ## Specify log behaviour here. - log: ## Section - - ## Log file location. - #info: 'log/prosody.log' - - ## Error log file location. - #error: 'log/prosody.err' - - ## The debug level logs all XML sent and received by the server. - #debug: false - ## Displays the location of a post in a map. Per default we are using the map ## tiles of the Heidelberg University (http://giscience.uni-hd.de). ## You also have the possibility to use the map tiles of https://www.mapbox.com diff --git a/config/eye.rb b/config/eye.rb index a7d54e308..20dfe9c86 100644 --- a/config/eye.rb +++ b/config/eye.rb @@ -50,13 +50,4 @@ Eye.application("diaspora") do end end end - - with_condition(AppConfig.chat.enabled? && AppConfig.chat.server.enabled?) do - process :xmpp do - start_command "bin/bundle exec rails runner Prosody.start" - daemonize true - pid_file "tmp/pids/xmpp.pid" - stop_signals [:TERM, 10.seconds, :KILL] - end - end end diff --git a/config/initializers/prosody.rb b/config/initializers/prosody.rb deleted file mode 100644 index df179e5c0..000000000 --- a/config/initializers/prosody.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -if AppConfig.chat.enabled? && AppConfig.chat.server.enabled? - db = Rails.application.config - .database_configuration[Rails.env] - - Prosody.update_configuration( - bosh_port: AppConfig.chat.server.bosh.port, bosh_path: AppConfig.chat.server.bosh.bind, - bosh_interface: AppConfig.chat.server.bosh.address, - - log_debug: (AppConfig.chat.server.log.debug? ? "debug" : "info"), - log_info: "#{Dir.pwd}/#{AppConfig.chat.server.log.info}", - log_error: "#{Dir.pwd}/#{AppConfig.chat.server.log.error}", - - certs: "#{Dir.pwd}/#{AppConfig.chat.server.certs}", - hostname: AppConfig.environment.url, - - virtualhost_driver: db["adapter"], - virtualhost_database: db["database"], - virtualhost_username: db["username"], - virtualhost_password: db["password"], - virtualhost_host: db["host"] - ) -end diff --git a/config/initializers/secure_headers.rb b/config/initializers/secure_headers.rb index c02d9cd94..967df9c84 100644 --- a/config/initializers/secure_headers.rb +++ b/config/initializers/secure_headers.rb @@ -29,14 +29,6 @@ SecureHeaders::Configuration.default do |config| csp[:style_src] << asset_host end - if AppConfig.chat.enabled? - csp[:media_src] << "data:" - - unless AppConfig.chat.server.bosh.proxy? - csp[:connect_src] << "#{AppConfig.pod_uri.host}:#{AppConfig.chat.server.bosh.port}" - end - end - csp[:script_src] << "code.jquery.com" if AppConfig.privacy.jquery_cdn? csp[:form_action] << "www.paypal.com" if AppConfig.settings.paypal_donations.enable? diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index fa3aa016f..5800302ff 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -400,11 +400,6 @@ en: rename_aspect_a: "Click “My aspects” in the side-bar from a stream view and click the pencil icon by the aspect you want to rename, or go to your Contacts page and select the relevant aspect. Then click the edit icon next to the aspect name at the top of this page, change the name and press “Update”." delete_aspect_q: "How do I delete an aspect?" delete_aspect_a: "Click “My aspects” in the side-bar from a stream view and click the pencil icon by the aspect you want to delete, or go to your Contacts page and select the relevant aspect. Then click the trash icon in the top right of the page." - chat: - title: "Chat" - contacts_page: "contacts page" - add_contact_roster_q: "How do I chat with someone in diaspora*?" - add_contact_roster_a: "First, you need to enable chat for one of the aspects that person is in. To do so, go to the %{contacts_page}, select the aspect you want and click on the chat icon to enable chat for the aspect. %{toggle_privilege} You could, if you prefer, create a special aspect called “Chat” and add the people you want to chat with to that aspect. Once you’ve done this, open the chat interface and select the person you want to chat with." mentions: title: "Mentions" what_is_a_mention_q: "What is a “mention”?" diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index 372d26705..ed0e12931 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -121,8 +121,6 @@ en: contacts: add_contact: "Add contact" - aspect_chat_is_enabled: "Contacts in this aspect are able to chat with you." - aspect_chat_is_not_enabled: "Contacts in this aspect are not able to chat with you." remove_contact: "Remove contact" error_add: "Couldn’t add <%= name %> to the aspect :(" error_remove: "Couldn’t remove <%= name %> from the aspect :(" diff --git a/config/routes.rb b/config/routes.rb index 8517e7ee8..e5969a097 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -59,7 +59,6 @@ Rails.application.routes.draw do get "aspects" => "streams#aspects", :as => "aspects_stream" resources :aspects, except: %i(index new edit) do - put :toggle_chat_privilege collection do put "order" => :update_order end diff --git a/db/migrate/20191018014242_remove_chat.rb b/db/migrate/20191018014242_remove_chat.rb new file mode 100644 index 000000000..f6f1b3d9d --- /dev/null +++ b/db/migrate/20191018014242_remove_chat.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class RemoveChat < ActiveRecord::Migration[5.1] + def up + remove_column :aspects, :chat_enabled + drop_table :chat_contacts + drop_table :chat_fragments + drop_table :chat_offline_messages + end +end diff --git a/lib/archive_importer.rb b/lib/archive_importer.rb index c989c1b06..8eb3a2342 100644 --- a/lib/archive_importer.rb +++ b/lib/archive_importer.rb @@ -66,7 +66,7 @@ class ArchiveImporter def import_aspects contact_groups.each do |group| begin - user.aspects.create!(group.slice("name", "chat_enabled")) + user.aspects.create!(group.slice("name")) rescue ActiveRecord::RecordInvalid => e logger.warn "#{self}: #{e}" end diff --git a/lib/schemas/archive-format.json b/lib/schemas/archive-format.json index 77ef84fb2..0bb79017e 100644 --- a/lib/schemas/archive-format.json +++ b/lib/schemas/archive-format.json @@ -30,8 +30,7 @@ "items": { "type": "object", "properties": { - "name": { "type": "string" }, - "chat_enabled": { "type": "boolean" } + "name": { "type": "string" } }, "required": [ "name" diff --git a/script/server b/script/server index 9cc8ee51a..86151d973 100755 --- a/script/server +++ b/script/server @@ -110,9 +110,6 @@ vars=$(bin/bundle exec ruby ./script/get_config.rb \ single_process_mode=environment.single_process_mode? \ embed_sidekiq_worker=server.embed_sidekiq_worker \ workers=server.sidekiq_workers \ - chat=chat.enabled \ - chat_server=chat.server.enabled \ - chat_bosh_proxy=chat.server.bosh.proxy \ redis_url=environment.redis \ | grep -vE "is not writable|as your home directory temporarily" ) @@ -189,19 +186,6 @@ https://github.com/diaspora/diaspora/issues/4202 for details " fi -if [ "$chat" = "true" -a "$chat_server" = "true" -a "$chat_bosh_proxy" = "false" ] -then - warning " -***************************************************************** -You enabled the chat feature but haven't configured BOSH! That -could lead to mixed-content problems with the http clients. Please -think about editing your proxy configuration as described in: - -diaspora.yml.example -***************************************************************** -" -fi - # Use libjemalloc if it's available for better memory usage command -v ldconfig > /dev/null 2>&1 if [ $? -eq 0 ]; then diff --git a/spec/controllers/jasmine_fixtures/contacts_spec.rb b/spec/controllers/jasmine_fixtures/contacts_spec.rb index fdd1beeeb..f2fccfcb6 100644 --- a/spec/controllers/jasmine_fixtures/contacts_spec.rb +++ b/spec/controllers/jasmine_fixtures/contacts_spec.rb @@ -7,7 +7,6 @@ describe ContactsController, :type => :controller do describe '#index' do before do - AppConfig.chat.enabled = true @aspect = bob.aspects.create(:name => "another aspect") bob.share_with alice.person, @aspect bob.share_with eve.person, @aspect diff --git a/spec/helpers/jsxc_helper_spec.rb b/spec/helpers/jsxc_helper_spec.rb deleted file mode 100644 index 0d80218c2..000000000 --- a/spec/helpers/jsxc_helper_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -describe JsxcHelper, :type => :helper do - before do - AppConfig.chat.server.bosh.port = 1234 - AppConfig.chat.server.bosh.bind = "/bind" - end - - describe "#get_bosh_endpoint" do - it "using http scheme and default values" do - AppConfig.chat.server.bosh.proxy = false - expect(helper.get_bosh_endpoint).to include %Q(http://localhost:1234/bind) - end - - it "using https scheme and no port" do - AppConfig.chat.server.bosh.proxy = true - allow(AppConfig).to receive(:pod_uri).and_return(Addressable::URI.parse("https://localhost/")) - expect(helper.get_bosh_endpoint).to include %Q(https://localhost/bind) - end - end -end diff --git a/spec/integration/exporter_spec.rb b/spec/integration/exporter_spec.rb index ac9bdbfd9..7794c07de 100644 --- a/spec/integration/exporter_spec.rb +++ b/spec/integration/exporter_spec.rb @@ -46,12 +46,10 @@ describe Diaspora::Exporter do user: { "contact_groups": [ { - "name": "generic", - "chat_enabled": false + "name": "generic" }, { - "name": "Work", - "chat_enabled": false + "name": "Work" } ] } diff --git a/spec/integration/migration_service_spec.rb b/spec/integration/migration_service_spec.rb index af5d6f237..f4daf1645 100644 --- a/spec/integration/migration_service_spec.rb +++ b/spec/integration/migration_service_spec.rb @@ -148,8 +148,7 @@ describe MigrationService do } ], "contact_groups": [ - {"name":"Friends","chat_enabled":true}, - {"name":"Friends","chat_enabled":false} + {"name":"Friends"} ], "post_subscriptions": [ "#{unknown_subscription_guid}", @@ -303,7 +302,6 @@ describe MigrationService do aspect = user.aspects.find_by(name: "Friends") expect(aspect).not_to be_nil - expect(aspect.chat_enabled).to be_truthy poll_participation = PollParticipation.find_by(author: user.person, guid: poll_participation_entity.guid) expect(poll_participation).not_to be_nil diff --git a/spec/javascripts/app/pages/contacts_spec.js b/spec/javascripts/app/pages/contacts_spec.js index c9d972ec6..4df7d4e4a 100644 --- a/spec/javascripts/app/pages/contacts_spec.js +++ b/spec/javascripts/app/pages/contacts_spec.js @@ -11,29 +11,6 @@ describe("app.pages.Contacts", function(){ }); }); - context('toggle chat privilege', function() { - beforeEach(function() { - this.chatToggle = $("#chat_privilege_toggle"); - this.chatIcon = $("#chat_privilege_toggle i"); - }); - - it('updates the title for the tooltip', function() { - expect(this.chatIcon.attr("data-original-title")).toBe( - Diaspora.I18n.t("contacts.aspect_chat_is_not_enabled") - ); - this.chatToggle.trigger("click"); - expect(this.chatIcon.attr("data-original-title")).toBe( - Diaspora.I18n.t("contacts.aspect_chat_is_enabled") - ); - }); - - it("toggles the chat icon", function() { - expect(this.chatIcon.hasClass("enabled")).toBeFalsy(); - this.chatToggle.trigger("click"); - expect(this.chatIcon.hasClass("enabled")).toBeTruthy(); - }); - }); - context('show aspect name form', function() { beforeEach(function() { this.button = $('#change_aspect_name'); diff --git a/spec/javascripts/app/views/help_view_spec.js b/spec/javascripts/app/views/help_view_spec.js index e73830267..c4671886a 100644 --- a/spec/javascripts/app/views/help_view_spec.js +++ b/spec/javascripts/app/views/help_view_spec.js @@ -1,6 +1,5 @@ describe("app.views.Help", function(){ beforeEach(function(){ - gon.appConfig = {chat: {enabled: false}}; this.locale = JSON.parse(spec.readFixture("locale_en_help_json")); Diaspora.I18n.reset(); Diaspora.I18n.load(this.locale, "en"); @@ -134,30 +133,4 @@ describe("app.views.Help", function(){ }); }); }); - - describe("chat section", function(){ - describe("chat enabled", function(){ - beforeEach(function(){ - gon.appConfig = {chat: {enabled: true}}; - this.view = new app.views.Help(); - this.view.render(); - }); - - it('should display the chat', function(){ - expect(this.view.$el.find('a[data-section=chat]').length).toBe(1); - }); - }); - - describe("chat disabled", function(){ - beforeEach(function(){ - gon.appConfig = {chat: {enabled: false}}; - this.view = new app.views.Help(); - this.view.render(); - }); - - it('should not display the chat', function () { - expect(this.view.$el.find('a[data-section=chat]').length).toBe(0); - }); - }); - }); }); diff --git a/spec/javascripts/jasmine_helpers/SpecHelper.js b/spec/javascripts/jasmine_helpers/SpecHelper.js index 4b0bd9175..a9f2b7083 100644 --- a/spec/javascripts/jasmine_helpers/SpecHelper.js +++ b/spec/javascripts/jasmine_helpers/SpecHelper.js @@ -76,7 +76,6 @@ beforeEach(function() { // add gon defaults window.gon = { appConfig: { - chat: {enabled: false}, settings: {podname: "MyPod"}, map: { mapbox: { diff --git a/spec/lib/archive_importer_spec.rb b/spec/lib/archive_importer_spec.rb index 504032d84..aa360c417 100644 --- a/spec/lib/archive_importer_spec.rb +++ b/spec/lib/archive_importer_spec.rb @@ -63,7 +63,6 @@ describe ArchiveImporter do } }, "contact_groups" => [{ - "chat_enabled" => true, "name" => "Friends" }], "followed_tags" => [target.tag_followings.first.tag.name], diff --git a/spec/presenters/node_info_presenter_spec.rb b/spec/presenters/node_info_presenter_spec.rb index 8929213b0..ab4cb09c2 100644 --- a/spec/presenters/node_info_presenter_spec.rb +++ b/spec/presenters/node_info_presenter_spec.rb @@ -39,7 +39,6 @@ describe NodeInfoPresenter do }, "metadata" => { "nodeName" => AppConfig.settings.pod_name, - "xmppChat" => AppConfig.chat.enabled?, "camo" => { "markdown" => AppConfig.privacy.camo.proxy_markdown_images?, "opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?, @@ -118,16 +117,6 @@ describe NodeInfoPresenter do end end - context "when chat is enabled" do - before do - AppConfig.chat.enabled = true - end - - it "should mark the xmppChat metadata as true" do - expect(hash).to include "metadata" => include("xmppChat" => true) - end - end - context "when camo is enabled" do before do AppConfig.privacy.camo.proxy_markdown_images = true @@ -173,7 +162,6 @@ describe NodeInfoPresenter do }, "metadata" => { "nodeName" => AppConfig.settings.pod_name, - "xmppChat" => AppConfig.chat.enabled?, "camo" => { "markdown" => AppConfig.privacy.camo.proxy_markdown_images?, "opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?, diff --git a/spec/serializers/export/aspect_serializer_spec.rb b/spec/serializers/export/aspect_serializer_spec.rb index eba297f19..41ea5e874 100644 --- a/spec/serializers/export/aspect_serializer_spec.rb +++ b/spec/serializers/export/aspect_serializer_spec.rb @@ -6,8 +6,7 @@ describe Export::AspectSerializer do it "has aspect attributes" do expect(serializer.attributes).to eq( - name: aspect.name, - chat_enabled: aspect.chat_enabled + name: aspect.name ) end end