Merge branch 'stable' into develop
This commit is contained in:
commit
3e35ef0b63
4 changed files with 13 additions and 2 deletions
|
|
@ -30,6 +30,7 @@ Ruby 2.0 is no longer officially supported.
|
|||
* Remove two unused methods [#5970](https://github.com/diaspora/diaspora/pull/5970)
|
||||
* Refactored the Logger to add basic logrotating and more useful timestamps [#5975](https://github.com/diaspora/diaspora/pull/5975)
|
||||
* Gracefully handle mailer failures if a like is already deleted again [#5983](https://github.com/diaspora/diaspora/pull/5983)
|
||||
* Ensure posts have an author [#5986](https://github.com/diaspora/diaspora/pull/5986)
|
||||
|
||||
## Bug fixes
|
||||
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class Post < ActiveRecord::Base
|
|||
|
||||
validates_uniqueness_of :id
|
||||
|
||||
validates :author, presence: true
|
||||
|
||||
after_create do
|
||||
self.touch(:interacted_at)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class StatusMessage < Post
|
|||
validates_length_of :text, :maximum => 65535, :message => proc {|p, v| I18n.t('status_messages.too_long', :count => 65535, :current_length => v[:value].length)}
|
||||
|
||||
# don't allow creation of empty status messages
|
||||
validate :presence_of_content, on: :create, if: proc { |sm| sm.author.local? }
|
||||
validate :presence_of_content, on: :create, if: proc {|sm| sm.author && sm.author.local? }
|
||||
|
||||
xml_name :status_message
|
||||
xml_attr :raw_message
|
||||
|
|
|
|||
|
|
@ -443,4 +443,12 @@ STR
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "validation" do
|
||||
it "should not be valid if the author is missing" do
|
||||
sm = FactoryGirl.build(:status_message, text: @message_text)
|
||||
sm.author = nil
|
||||
expect(sm).not_to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue