Merge branch 'hotfix/v0.1.0.1' into develop
This commit is contained in:
commit
cdb4be14ce
5 changed files with 37 additions and 4 deletions
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
# 0.1.0.1
|
||||||
|
|
||||||
|
* Regression fix: 500 for deleted reshares introduced by the locator
|
||||||
|
* Federate locations
|
||||||
|
|
||||||
# 0.1.0.0
|
# 0.1.0.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
class Location < ActiveRecord::Base
|
class Location < ActiveRecord::Base
|
||||||
|
before_validation :split_coords, on: :create
|
||||||
before_validation :split_coords, :on => :create
|
validates_presence_of :lat, :lng
|
||||||
|
|
||||||
attr_accessor :coordinates
|
attr_accessor :coordinates
|
||||||
|
|
||||||
|
include Diaspora::Federated::Base
|
||||||
|
xml_attr :address
|
||||||
|
xml_attr :lat
|
||||||
|
xml_attr :lng
|
||||||
|
|
||||||
belongs_to :status_message
|
belongs_to :status_message
|
||||||
|
|
||||||
def split_coords
|
def split_coords
|
||||||
coordinates.present? ? (self.lat, self.lng = coordinates.split(',')) : false
|
self.lat, self.lng = coordinates.split(',') if coordinates.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class Reshare < Post
|
||||||
end
|
end
|
||||||
|
|
||||||
def address
|
def address
|
||||||
absolute_root.location.try(:address)
|
absolute_root.try(:location).try(:address)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class StatusMessage < Post
|
||||||
xml_name :status_message
|
xml_name :status_message
|
||||||
xml_attr :raw_message
|
xml_attr :raw_message
|
||||||
xml_attr :photos, :as => [Photo]
|
xml_attr :photos, :as => [Photo]
|
||||||
|
xml_attr :location, :as => Location
|
||||||
|
|
||||||
has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid
|
has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,29 @@ STR
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with a location' do
|
||||||
|
before do
|
||||||
|
@message.location = Location.new(coordinates: "1, 2").tap(&:save)
|
||||||
|
@xml = @message.to_xml.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'serializes the location' do
|
||||||
|
@xml.should include "location"
|
||||||
|
@xml.should include "lat"
|
||||||
|
@xml.should include "lng"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe ".from_xml" do
|
||||||
|
before do
|
||||||
|
@marshalled = StatusMessage.from_xml(@xml)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'marshals the location' do
|
||||||
|
@marshalled.location.should be_present
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#after_dispatch' do
|
describe '#after_dispatch' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue