webfinger is now not washington specific

This commit is contained in:
maxwell 2010-07-16 14:15:19 -07:00
parent 99f7e938fd
commit 3d87c111df
3 changed files with 14 additions and 1 deletions

View file

@ -80,6 +80,13 @@ class User < Person
def mine?(post)
self == post.person
end
def terse_url
terse= self.url.gsub(/https?:\/\//, '')
terse.gsub!(/www\./, '')
terse = terse.chop! if terse[-1, 1] == '/'
terse
end
def do_bad_things
self.password_confirmation = self.password

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
xmlns:hm='http://host-meta.net/xrd/1.0'>
<hm:Host>washington.joindiaspora.com</hm:Host>
<hm:Host><%= @user.terse_url %></hm:Host>
<Link rel='lrdd'
template='<%=@user.url%>webfinger?q={uri}'>
<Title>Resource Descriptor</Title>

View file

@ -41,4 +41,10 @@ describe User do
@user.send_friend_request_to( @friend.url ).should be nil
end
it 'should be able to give me the terse url for webfinger' do
user = Factory.create(:user)
user.terse_url.should == 'example.com'
end
end