# File app/models/note.rb, line 34 def self.create_status_change_note(noteable, author, status) create({ noteable: noteable, project: noteable.project, author: author, note: "_Status changed to #{status}_" }, without_protection: true) end
Returns true if this is a downvote note, otherwise false is returned
# File app/models/note.rb, line 106 def downvote? note.start_with?('-1') || note.start_with?(':-1:') end
# File app/models/note.rb, line 82 def for_commit? noteable_type == "Commit" end
# File app/models/note.rb, line 86 def for_diff_line? line_code.present? end
override to return commits, which are not active record
# File app/models/note.rb, line 52 def noteable if for_commit? project.commit(noteable_id) else super end # Temp fix to prevent app crash # if note commit id doesnt exist rescue nil end
Returns true if this is an upvote note, otherwise false is returned
# File app/models/note.rb, line 100 def upvote? note.start_with?('+1') || note.start_with?(':+1:') end