From 065d35c288ae53185f42953f7432e0bf4b1d99b9 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 12 Feb 2023 19:04:01 +0100 Subject: [PATCH 1/3] well_known/node_info: remove twitter as outbound service --- .../well_known/node_info_controller.rb | 18 ++++---- .../well_known/node_info_controller_spec.rb | 42 ++----------------- 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/app/controllers/well_known/node_info_controller.rb b/app/controllers/well_known/node_info_controller.rb index 6633b137..c4031c69 100644 --- a/app/controllers/well_known/node_info_controller.rb +++ b/app/controllers/well_known/node_info_controller.rb @@ -8,7 +8,7 @@ class WellKnown::NodeInfoController < ApplicationController links: [ rel: "http://nodeinfo.diaspora.software/ns/schema/2.1", href: node_info_url - ] + ], } end @@ -21,12 +21,12 @@ class WellKnown::NodeInfoController < ApplicationController protocols: %i[], services: { inbound: inbound_services, - outbound: outbound_services + outbound: outbound_services, }, usage: usage_stats, # We don't implement this so we can always return true for now openRegistrations: true, - metadata: {} + metadata: {}, } end @@ -36,23 +36,19 @@ class WellKnown::NodeInfoController < ApplicationController { name: "Retrospring", version: Retrospring::Version.to_s, - repository: "https://github.com/Retrospring/retrospring" + repository: "https://github.com/Retrospring/retrospring", } end def usage_stats { users: { - total: User.count - } + total: User.count, + }, } end def inbound_services = [] - def outbound_services - { - "twitter" => APP_CONFIG.dig("sharing", "twitter", "enabled") - }.select { |_service, available| available }.keys - end + def outbound_services = [] end diff --git a/spec/controllers/well_known/node_info_controller_spec.rb b/spec/controllers/well_known/node_info_controller_spec.rb index ad6a8dce..54d871aa 100644 --- a/spec/controllers/well_known/node_info_controller_spec.rb +++ b/spec/controllers/well_known/node_info_controller_spec.rb @@ -13,9 +13,9 @@ describe WellKnown::NodeInfoController do "links" => [ { "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1", - "href" => "http://test.host/nodeinfo/2.1" + "href" => "http://test.host/nodeinfo/2.1", } - ] + ], }) end end @@ -44,47 +44,11 @@ describe WellKnown::NodeInfoController do expect(parsed["software"]).to eq({ "name" => "Retrospring", "version" => "2023.0102.1", - "repository" => "https://github.com/Retrospring/retrospring" + "repository" => "https://github.com/Retrospring/retrospring", }) end end - context "Twitter integration enabled" do - before do - stub_const("APP_CONFIG", { - "sharing" => { - "twitter" => { - "enabled" => true - } - } - }) - end - - it "includes Twitter in outbound services" do - subject - parsed = JSON.parse(response.body) - expect(parsed.dig("services", "outbound")).to include("twitter") - end - end - - context "Twitter integration disabled" do - before do - stub_const("APP_CONFIG", { - "sharing" => { - "twitter" => { - "enabled" => false - } - } - }) - end - - it "includes Twitter in outbound services" do - subject - parsed = JSON.parse(response.body) - expect(parsed.dig("services", "outbound")).to_not include("twitter") - end - end - context "site has users" do let(:num_users) { rand(10..50) } From e1aee89be00d035c3630e2b1d55ed2ed34760126 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 12 Feb 2023 19:18:17 +0100 Subject: [PATCH 2/3] remove expired service connection notifications --- app/models/notification/service_token_expired.rb | 4 ---- app/models/notification/twitter_token_expired.rb | 4 ---- app/models/user/expired_service_connection.rb | 5 ----- app/models/user/expired_twitter_service_connection.rb | 4 ---- .../type/_expiredtwitterserviceconnection.html.haml | 8 -------- config/locales/views.en.yml | 4 ---- ...044_remove_expired_service_connection_notifications.rb | 7 +++++++ db/schema.rb | 2 +- 8 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 app/models/notification/service_token_expired.rb delete mode 100644 app/models/notification/twitter_token_expired.rb delete mode 100644 app/models/user/expired_service_connection.rb delete mode 100644 app/models/user/expired_twitter_service_connection.rb delete mode 100644 app/views/notifications/type/_expiredtwitterserviceconnection.html.haml create mode 100644 db/migrate/20230212181044_remove_expired_service_connection_notifications.rb diff --git a/app/models/notification/service_token_expired.rb b/app/models/notification/service_token_expired.rb deleted file mode 100644 index bc61a820..00000000 --- a/app/models/notification/service_token_expired.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -class Notification::ServiceTokenExpired < Notification -end diff --git a/app/models/notification/twitter_token_expired.rb b/app/models/notification/twitter_token_expired.rb deleted file mode 100644 index 9ddb8447..00000000 --- a/app/models/notification/twitter_token_expired.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -class Notification::TwitterTokenExpired < Notification::ServiceTokenExpired -end diff --git a/app/models/user/expired_service_connection.rb b/app/models/user/expired_service_connection.rb deleted file mode 100644 index 110dd896..00000000 --- a/app/models/user/expired_service_connection.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -# stub model for notifying about expired service connections -class User::ExpiredServiceConnection < User -end diff --git a/app/models/user/expired_twitter_service_connection.rb b/app/models/user/expired_twitter_service_connection.rb deleted file mode 100644 index bb39250e..00000000 --- a/app/models/user/expired_twitter_service_connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -class User::ExpiredTwitterServiceConnection < User::ExpiredServiceConnection -end diff --git a/app/views/notifications/type/_expiredtwitterserviceconnection.html.haml b/app/views/notifications/type/_expiredtwitterserviceconnection.html.haml deleted file mode 100644 index fd941e2f..00000000 --- a/app/views/notifications/type/_expiredtwitterserviceconnection.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -.d-flex.notification - .flex-shrink-0.notification__icon - %i.fa.fa-2x.fa-fw.fa-twitter - .flex-grow-1 - %h6.notification__user - = t(".heading") - .notification__text - = t(".text_html", settings_sharing: link_to(t(".settings_services"), services_path)) diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index ea82b1dc..6dfef2d3 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -359,10 +359,6 @@ en: heading: "Push notifications are failing to send to one of your devices." text_html: "Please check the %{settings_push} if you still want to be notified." settings_push: "push notification settings" - expiredtwitterserviceconnection: - heading: "Twitter connection expired" - text_html: "If you would like to continue automatically sharing your answers to Twitter, head to %{settings_sharing} and re-connect your account." - settings_services: "Sharing Settings" settings: account: email_confirm: "Currently awaiting confirmation for %{resource}" diff --git a/db/migrate/20230212181044_remove_expired_service_connection_notifications.rb b/db/migrate/20230212181044_remove_expired_service_connection_notifications.rb new file mode 100644 index 00000000..3f306f39 --- /dev/null +++ b/db/migrate/20230212181044_remove_expired_service_connection_notifications.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class RemoveExpiredServiceConnectionNotifications < ActiveRecord::Migration[6.1] + def up = Notification.where(type: "Notification::ServiceTokenExpired").delete_all + + def down = raise ActiveRecord::IrreversibleMigration +end diff --git a/db/schema.rb b/db/schema.rb index 79160ab2..0d70a9eb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_02_05_162800) do +ActiveRecord::Schema.define(version: 2023_02_12_181044) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" From 5799a6f4d48d02c8d8c854ed78316daf069ebbf5 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 12 Feb 2023 19:23:28 +0100 Subject: [PATCH 3/3] locales/views: reword "share your answers" bit on the landingpage --- config/locales/views.en.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 6dfef2d3..c944b72c 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -27,10 +27,11 @@ en: header: "Share your answers" body_html: |

Want your followers on another platform to see your %{app_name} answers? - You can configure automatic sharing to your favourite platforms easily.

+ You can easily share them to your favourite platforms.

-

Not sure if it's a favourite, but at the moment only - Twitter is supported.

+

We support Tumblr, Twitter, + and many other services including Mastodon and + Misskey.

customize: header: "Customise your experience" body_html: |