Merge pull request #1070 from Retrospring/more-services-cleanup
More services cleanup
This commit is contained in:
commit
0ab4f38fd9
|
@ -8,7 +8,7 @@ class WellKnown::NodeInfoController < ApplicationController
|
||||||
links: [
|
links: [
|
||||||
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
||||||
href: node_info_url
|
href: node_info_url
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ class WellKnown::NodeInfoController < ApplicationController
|
||||||
protocols: %i[],
|
protocols: %i[],
|
||||||
services: {
|
services: {
|
||||||
inbound: inbound_services,
|
inbound: inbound_services,
|
||||||
outbound: outbound_services
|
outbound: outbound_services,
|
||||||
},
|
},
|
||||||
usage: usage_stats,
|
usage: usage_stats,
|
||||||
# We don't implement this so we can always return true for now
|
# We don't implement this so we can always return true for now
|
||||||
openRegistrations: true,
|
openRegistrations: true,
|
||||||
metadata: {}
|
metadata: {},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,23 +36,19 @@ class WellKnown::NodeInfoController < ApplicationController
|
||||||
{
|
{
|
||||||
name: "Retrospring",
|
name: "Retrospring",
|
||||||
version: Retrospring::Version.to_s,
|
version: Retrospring::Version.to_s,
|
||||||
repository: "https://github.com/Retrospring/retrospring"
|
repository: "https://github.com/Retrospring/retrospring",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def usage_stats
|
def usage_stats
|
||||||
{
|
{
|
||||||
users: {
|
users: {
|
||||||
total: User.count
|
total: User.count,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def inbound_services = []
|
def inbound_services = []
|
||||||
|
|
||||||
def outbound_services
|
def outbound_services = []
|
||||||
{
|
|
||||||
"twitter" => APP_CONFIG.dig("sharing", "twitter", "enabled")
|
|
||||||
}.select { |_service, available| available }.keys
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Notification::ServiceTokenExpired < Notification
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Notification::TwitterTokenExpired < Notification::ServiceTokenExpired
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# stub model for notifying about expired service connections
|
|
||||||
class User::ExpiredServiceConnection < User
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class User::ExpiredTwitterServiceConnection < User::ExpiredServiceConnection
|
|
||||||
end
|
|
|
@ -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))
|
|
|
@ -27,10 +27,11 @@ en:
|
||||||
header: "Share your answers"
|
header: "Share your answers"
|
||||||
body_html: |
|
body_html: |
|
||||||
<p>Want your followers on another platform to see your %{app_name} answers?
|
<p>Want your followers on another platform to see your %{app_name} answers?
|
||||||
You can configure automatic sharing to your favourite platforms easily.</p>
|
You can easily share them to your favourite platforms.</p>
|
||||||
|
|
||||||
<p class="text-muted">Not sure if it's a favourite, but at the moment only
|
<p class="text-muted">We support <strong>Tumblr</strong>, <strong>Twitter</strong>,
|
||||||
<b>Twitter</b> is supported.</p>
|
and many other services including <strong>Mastodon</strong> and
|
||||||
|
<strong>Misskey</strong>.</p>
|
||||||
customize:
|
customize:
|
||||||
header: "Customise your experience"
|
header: "Customise your experience"
|
||||||
body_html: |
|
body_html: |
|
||||||
|
@ -359,10 +360,6 @@ en:
|
||||||
heading: "Push notifications are failing to send to one of your devices."
|
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."
|
text_html: "Please check the %{settings_push} if you still want to be notified."
|
||||||
settings_push: "push notification settings"
|
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:
|
settings:
|
||||||
account:
|
account:
|
||||||
email_confirm: "Currently awaiting confirmation for %{resource}"
|
email_confirm: "Currently awaiting confirmation for %{resource}"
|
||||||
|
|
|
@ -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
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
|
@ -13,9 +13,9 @@ describe WellKnown::NodeInfoController do
|
||||||
"links" => [
|
"links" => [
|
||||||
{
|
{
|
||||||
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
"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
|
||||||
end
|
end
|
||||||
|
@ -44,47 +44,11 @@ describe WellKnown::NodeInfoController do
|
||||||
expect(parsed["software"]).to eq({
|
expect(parsed["software"]).to eq({
|
||||||
"name" => "Retrospring",
|
"name" => "Retrospring",
|
||||||
"version" => "2023.0102.1",
|
"version" => "2023.0102.1",
|
||||||
"repository" => "https://github.com/Retrospring/retrospring"
|
"repository" => "https://github.com/Retrospring/retrospring",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
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
|
context "site has users" do
|
||||||
let(:num_users) { rand(10..50) }
|
let(:num_users) { rand(10..50) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue