app/models/commontator/comment.rb in commontator-4.2.2 vs app/models/commontator/comment.rb in commontator-4.3.0
- old
+ new
@@ -10,11 +10,11 @@
validates_presence_of :editor, :on => :update
validates_presence_of :thread
validates_presence_of :body
validates_uniqueness_of :body, :scope => [:creator_type, :creator_id, :thread_id],
- :message => 'has already been posted'
+ :message => I18n.t('commontator.comment.errors.double_posted')
protected
cattr_accessor :acts_as_votable_initialized
@@ -56,22 +56,10 @@
self.deleted_at = nil
self.editor = user
self.save
end
- def created_timestamp
- config = thread.config
- "#{config.comment_create_verb_past.capitalize} on " + \
- created_at.strftime(config.timestamp_format)
- end
-
- def updated_timestamp
- config = thread.config
- is_modified? ? ("Last #{config.comment_edit_verb_past} on " + \
- updated_at.strftime(config.timestamp_format)) : ''
- end
-
##################
# Access Control #
##################
def can_be_read_by?(user)
@@ -85,11 +73,13 @@
end
def can_be_edited_by?(user)
(!thread.is_closed? && !is_deleted? &&\
(is_latest? || thread.config.can_edit_old_comments) &&\
- user == creator && thread.config.can_edit_own_comments && thread.can_be_read_by?(user)) ||\
- (thread.config.admin_can_edit_comments && thread.can_be_edited_by?(user))
+ user == creator && thread.config.can_edit_own_comments &&\
+ thread.can_be_read_by?(user)) ||\
+ (thread.config.moderators_can_edit_comments &&\
+ thread.can_be_edited_by?(user))
end
def can_be_deleted_by?(user)
(!thread.is_closed? && (!is_deleted? || editor == user) &&\
(is_latest? || thread.config.can_delete_old_comments) &&\