[28294] Make news description actually optional

https://community.openproject.com/wp/28294
pull/6547/head
Oliver Günther 6 years ago
parent 0224682176
commit 3f681b3683
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 6
      app/models/news.rb
  2. 1
      app/views/news/_form.html.erb

@ -34,7 +34,7 @@ class News < ActiveRecord::Base
order('created_on')
}, as: :commented, dependent: :delete_all
validates_presence_of :title, :description
validates_presence_of :title
validates_length_of :title, maximum: 60
validates_length_of :summary, maximum: 255
@ -62,6 +62,10 @@ class News < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_news, project)
end
def description=(val)
super val.presence || ''
end
# returns latest news for projects visible by user
def self.latest(user: User.current, count: 5)
latest_for(user, count: count)

@ -39,7 +39,6 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
<div class="form--field">
<%= f.text_area :description,
required: true,
class: 'wiki-edit wiki-toolbar',
container_class: '-wide',
with_text_formatting: true %>

Loading…
Cancel
Save