Sha256: 89665eb0084b3f6364fde756abbf170f16726546499d6dc2b79be48a0595e3bd

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

module ContentState
  class JustPublished < Published
    include Singleton

    # We need to save the state as 'Published', but we need after_save
    # to be handled by JustPublished. So, JustPublished tells Rails that
    # it's *actually* Published and all shall be well.
    def memento
      'ContentState::Published'
    end

    def just_published?
      true
    end

    def just_changed_published_status?
      true
    end

    def published?(content)
      true
    end

#    def enter_hook(content)
#      super
#    end

#    def set_published_at(content, new_time)
#      super
#    end

    def send_notifications(content)
      content.interested_users.each do |user|
        content.send_notification_to_user(user)
      end
    end

    def send_pings(content)
      content.really_send_pings
    end

    def withdraw(content)
      content[:published_at] = nil
      content.state = Factory.new(:draft)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-4.1.1 app/models/content_state/just_published.rb
typo-4.1 app/models/content_state/just_published.rb