Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ before. * Use Poltergeist instead of Selenium [#6768](https://github.com/diaspora/diaspora/pull/6768) * Redesigned the landing page and added dedicated notes for podmins [#6268](https://github.com/diaspora/diaspora/pull/6268) * Moved the entire federation implementation into its own gem. 🎉 [#6873](https://github.com/diaspora/diaspora/pull/6873) * Remove `StatusMessage#raw_message` [#6921](https://github.com/diaspora/diaspora/pull/6921) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) Loading app/models/post.rb +0 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ class Post < ActiveRecord::Base end def root; end def raw_message; ""; end def mentioned_people; []; end def photos; []; end Loading app/models/reshare.rb +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ class Reshare < Post :message, :nsfw, to: :absolute_root, allow_nil: true def raw_message absolute_root.try(:raw_message) || super def text absolute_root.try(:text) || "" end def mentioned_people Loading app/models/status_message.rb +14 −37 Original line number Diff line number Diff line Loading @@ -8,23 +8,18 @@ class StatusMessage < Post include PeopleHelper acts_as_taggable_on :tags extract_tags_from :raw_message extract_tags_from :text 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 && sm.author.local? } validate :presence_of_content, on: :create has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid has_one :location has_one :poll, autosave: true # a StatusMessage is federated before its photos are so presence_of_content() fails erroneously if no text is present # therefore, we put the validation in a before_destory callback instead of a validation before_destroy :absence_of_content attr_accessor :oembed_url attr_accessor :open_graph_url Loading @@ -42,29 +37,23 @@ class StatusMessage < Post end def self.user_tag_stream(user, tag_ids) owned_or_visible_by_user(user). tag_stream(tag_ids) owned_or_visible_by_user(user).tag_stream(tag_ids) end def self.public_tag_stream(tag_ids) all_public. tag_stream(tag_ids) end def raw_message read_attribute(:text) || "" all_public.tag_stream(tag_ids) end def raw_message=(text) write_attribute(:text, text) def self.tag_stream(tag_ids) joins(:taggings).where("taggings.tag_id IN (?)", tag_ids) end def nsfw self.raw_message.match(/#nsfw/i) || super text.try(:match, /#nsfw/i) || super end def message @message ||= Diaspora::MessageRenderer.new raw_message, mentioned_people: mentioned_people @message ||= Diaspora::MessageRenderer.new(text, mentioned_people: mentioned_people) end def mentioned_people Loading @@ -72,7 +61,7 @@ class StatusMessage < Post create_mentions if self.mentions.empty? self.mentions.includes(:person => :profile).map{ |mention| mention.person } else Diaspora::Mentionable.people_from_string(self.raw_message) Diaspora::Mentionable.people_from_string(text) end end Loading @@ -84,7 +73,7 @@ class StatusMessage < Post ## ---- ---- def create_mentions ppl = Diaspora::Mentionable.people_from_string(self.raw_message) ppl = Diaspora::Mentionable.people_from_string(text) ppl.each do |person| self.mentions.find_or_create_by(person_id: person.id) end Loading @@ -103,7 +92,7 @@ class StatusMessage < Post end def text_and_photos_blank? self.raw_message.blank? && self.photos.blank? text.blank? && photos.blank? end def queue_gather_oembed_data Loading Loading @@ -132,22 +121,10 @@ class StatusMessage < Post } end protected def presence_of_content if text_and_photos_blank? errors[:base] << "Cannot create a StatusMessage without content" end end def absence_of_content unless text_and_photos_blank? errors[:base] << "Cannot destory a StatusMessage with text and/or photos present" end end private def self.tag_stream(tag_ids) joins(:taggings).where('taggings.tag_id IN (?)', tag_ids) def presence_of_content errors[:base] << "Cannot create a StatusMessage without content" if text_and_photos_blank? end end app/presenters/post_presenter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class PostPresenter < BasePresenter if @post.message @post.message.plain_text_for_json else @post.raw_message @post.text end end Loading Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ before. * Use Poltergeist instead of Selenium [#6768](https://github.com/diaspora/diaspora/pull/6768) * Redesigned the landing page and added dedicated notes for podmins [#6268](https://github.com/diaspora/diaspora/pull/6268) * Moved the entire federation implementation into its own gem. 🎉 [#6873](https://github.com/diaspora/diaspora/pull/6873) * Remove `StatusMessage#raw_message` [#6921](https://github.com/diaspora/diaspora/pull/6921) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) Loading
app/models/post.rb +0 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ class Post < ActiveRecord::Base end def root; end def raw_message; ""; end def mentioned_people; []; end def photos; []; end Loading
app/models/reshare.rb +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ class Reshare < Post :message, :nsfw, to: :absolute_root, allow_nil: true def raw_message absolute_root.try(:raw_message) || super def text absolute_root.try(:text) || "" end def mentioned_people Loading
app/models/status_message.rb +14 −37 Original line number Diff line number Diff line Loading @@ -8,23 +8,18 @@ class StatusMessage < Post include PeopleHelper acts_as_taggable_on :tags extract_tags_from :raw_message extract_tags_from :text 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 && sm.author.local? } validate :presence_of_content, on: :create has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid has_one :location has_one :poll, autosave: true # a StatusMessage is federated before its photos are so presence_of_content() fails erroneously if no text is present # therefore, we put the validation in a before_destory callback instead of a validation before_destroy :absence_of_content attr_accessor :oembed_url attr_accessor :open_graph_url Loading @@ -42,29 +37,23 @@ class StatusMessage < Post end def self.user_tag_stream(user, tag_ids) owned_or_visible_by_user(user). tag_stream(tag_ids) owned_or_visible_by_user(user).tag_stream(tag_ids) end def self.public_tag_stream(tag_ids) all_public. tag_stream(tag_ids) end def raw_message read_attribute(:text) || "" all_public.tag_stream(tag_ids) end def raw_message=(text) write_attribute(:text, text) def self.tag_stream(tag_ids) joins(:taggings).where("taggings.tag_id IN (?)", tag_ids) end def nsfw self.raw_message.match(/#nsfw/i) || super text.try(:match, /#nsfw/i) || super end def message @message ||= Diaspora::MessageRenderer.new raw_message, mentioned_people: mentioned_people @message ||= Diaspora::MessageRenderer.new(text, mentioned_people: mentioned_people) end def mentioned_people Loading @@ -72,7 +61,7 @@ class StatusMessage < Post create_mentions if self.mentions.empty? self.mentions.includes(:person => :profile).map{ |mention| mention.person } else Diaspora::Mentionable.people_from_string(self.raw_message) Diaspora::Mentionable.people_from_string(text) end end Loading @@ -84,7 +73,7 @@ class StatusMessage < Post ## ---- ---- def create_mentions ppl = Diaspora::Mentionable.people_from_string(self.raw_message) ppl = Diaspora::Mentionable.people_from_string(text) ppl.each do |person| self.mentions.find_or_create_by(person_id: person.id) end Loading @@ -103,7 +92,7 @@ class StatusMessage < Post end def text_and_photos_blank? self.raw_message.blank? && self.photos.blank? text.blank? && photos.blank? end def queue_gather_oembed_data Loading Loading @@ -132,22 +121,10 @@ class StatusMessage < Post } end protected def presence_of_content if text_and_photos_blank? errors[:base] << "Cannot create a StatusMessage without content" end end def absence_of_content unless text_and_photos_blank? errors[:base] << "Cannot destory a StatusMessage with text and/or photos present" end end private def self.tag_stream(tag_ids) joins(:taggings).where('taggings.tag_id IN (?)', tag_ids) def presence_of_content errors[:base] << "Cannot create a StatusMessage without content" if text_and_photos_blank? end end
app/presenters/post_presenter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class PostPresenter < BasePresenter if @post.message @post.message.plain_text_for_json else @post.raw_message @post.text end end Loading