Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb40
1 files changed, 20 insertions, 20 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index c23aab03bcc..0175430be4d 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -32,8 +32,8 @@ class Note < ActiveRecord::Base
delegate :name, :email, to: :author, prefix: true
validates :note, :project, presence: true
- validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true
- validates :attachment, file_size: { maximum: 10.megabytes.to_i }
+ validates :line_code, format: {with: /\A[a-z0-9]+_\d+_\d+\Z/}, allow_blank: true
+ validates :attachment, file_size: {maximum: 10.megabytes.to_i}
validates :noteable_id, presence: true, if: ->(n) { n.noteable_type.present? && n.noteable_type != 'Commit' }
validates :commit_id, presence: true, if: ->(n) { n.noteable_type == 'Commit' }
@@ -45,24 +45,24 @@ class Note < ActiveRecord::Base
scope :inline, -> { where("line_code IS NOT NULL") }
scope :not_inline, -> { where(line_code: [nil, '']) }
- scope :common, ->{ where(noteable_type: ["", nil]) }
- scope :fresh, ->{ order("created_at ASC, id ASC") }
- scope :inc_author_project, ->{ includes(:project, :author) }
- scope :inc_author, ->{ includes(:author) }
+ scope :common, -> { where(noteable_type: ["", nil]) }
+ scope :fresh, -> { order("created_at ASC, id ASC") }
+ scope :inc_author_project, -> { includes(:project, :author) }
+ scope :inc_author, -> { includes(:author) }
- def self.create_status_change_note(noteable, author, status)
+ def self.create_status_change_note(noteable, project, author, status)
create({
- noteable: noteable,
- project: noteable.project,
- author: author,
- note: "_Status changed to #{status}_"
- }, without_protection: true)
+ noteable: noteable,
+ project: project,
+ author: author,
+ note: "_Status changed to #{status}_"
+ }, without_protection: true)
end
def commit_author
@commit_author ||=
- project.users.find_by_email(noteable.author_email) ||
- project.users.find_by_name(noteable.author_name)
+ project.users.find_by_email(noteable.author_email) ||
+ project.users.find_by_name(noteable.author_name)
rescue
nil
end
@@ -97,8 +97,8 @@ class Note < ActiveRecord::Base
# otherwise false is returned
def downvote?
votable? && (note.start_with?('-1') ||
- note.start_with?(':-1:')
- )
+ note.start_with?(':-1:')
+ )
end
def for_commit?
@@ -136,8 +136,8 @@ class Note < ActiveRecord::Base
else
super
end
- # Temp fix to prevent app crash
- # if note commit id doesn't exist
+ # Temp fix to prevent app crash
+ # if note commit id doesn't exist
rescue
nil
end
@@ -146,8 +146,8 @@ class Note < ActiveRecord::Base
# otherwise false is returned
def upvote?
votable? && (note.start_with?('+1') ||
- note.start_with?(':+1:')
- )
+ note.start_with?(':+1:')
+ )
end
def votable?