Compare commits
2 Commits
367f566ccb
...
0367450c4b
| Author | SHA1 | Date | |
|---|---|---|---|
|
0367450c4b
|
|||
|
e6f5623c7f
|
@@ -209,6 +209,6 @@ class Setting < RailsSettings::Base
|
||||
|
||||
def self.default_services
|
||||
# TODO Make configurable from respective service settings page
|
||||
%w[ discourse gitea mediawiki xmpp ]
|
||||
%w[ discourse gitea mastodon mediawiki xmpp ]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -131,7 +131,7 @@ class User < ApplicationRecord
|
||||
|
||||
def mastodon_address
|
||||
return nil unless Setting.mastodon_enabled?
|
||||
"#{self.cn}@#{Setting.mastodon_address_domain}"
|
||||
"#{self.cn.gsub("-", "_")}@#{Setting.mastodon_address_domain}"
|
||||
end
|
||||
|
||||
def valid_attribute?(attribute_name)
|
||||
|
||||
@@ -41,6 +41,14 @@ RSpec.describe User, type: :model do
|
||||
expect(user.mastodon_address).to eq("jimmy@kosmos.social")
|
||||
end
|
||||
end
|
||||
|
||||
describe "username contains hyphen/dash" do
|
||||
let(:jammy) { build :user, cn: "jammy-jellyfish", ou: "kosmos.org" }
|
||||
|
||||
it "returns the user address" do
|
||||
expect(jammy.mastodon_address).to eq("jammy_jellyfish@kosmos.org")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -147,7 +155,7 @@ RSpec.describe User, type: :model do
|
||||
after { clear_enqueued_jobs }
|
||||
|
||||
it "enables default services" do
|
||||
expect(user).to receive(:enable_service).with(%w[ discourse gitea mediawiki xmpp ])
|
||||
expect(user).to receive(:enable_service).with(%w[ discourse gitea mastodon mediawiki xmpp ])
|
||||
user.send :devise_after_confirmation
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user