From 96d49bf04ce77c975fe500f4d961e4a1ffed4c26 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 30 Dec 2012 14:43:00 +0200 Subject: Use sdoc to generate application code documentation --- doc/code/classes/Note.html | 536 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 536 insertions(+) create mode 100644 doc/code/classes/Note.html (limited to 'doc/code/classes/Note.html') diff --git a/doc/code/classes/Note.html b/doc/code/classes/Note.html new file mode 100644 index 00000000000..4ec1c4dcf79 --- /dev/null +++ b/doc/code/classes/Note.html @@ -0,0 +1,536 @@ + + + + + Note + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
F
+
+ +
+ +
N
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + notify
+ [RW] + notify_author
+ + + + + +
Class Public methods
+ +
+
+ + create_status_change_note(noteable, author, status) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 53
+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
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + commit_author() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 109
+def commit_author
+  @commit_author ||=
+    project.users.find_by_email(noteable.author_email) ||
+    project.users.find_by_name(noteable.author_name)
+rescue
+  nil
+end
+
+
+ +
+ +
+
+ + downvote?() + + +
+ + +
+

Returns true if this is a downvote note, otherwise false is returned

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 125
+def downvote?
+  note.start_with?('-1') || note.start_with?(':-1:')
+end
+
+
+ +
+ +
+
+ + for_commit?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 101
+def for_commit?
+  noteable_type == "Commit"
+end
+
+
+ +
+ +
+
+ + for_diff_line?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 105
+def for_diff_line?
+  line_code.present?
+end
+
+
+ +
+ +
+
+ + noteable() + + +
+ + +
+

override to return commits, which are not active record

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 71
+def noteable
+  if for_commit?
+    project.commit(commit_id)
+  else
+    super
+  end
+# Temp fix to prevent app crash
+# if note commit id doesnt exist
+rescue
+  nil
+end
+
+
+ +
+ +
+
+ + noteable_type_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 129
+def noteable_type_name
+  if noteable_type.present?
+    noteable_type.downcase
+  else
+    "wall"
+  end
+end
+
+
+ +
+ +
+
+ + notify_only_author?(user) + + +
+ + +
+

Check if we can notify commit author with email about our comment

+ +

If commit author email exist in project and commit author is not passed +user we can send email to him

+ +

params:

+ +
user - current user
+ +

return:

+ +
Boolean
+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 96
+def notify_only_author?(user)
+  for_commit? && commit_author &&
+    commit_author.email != user.email
+end
+
+
+ +
+ +
+
+ + upvote?() + + +
+ + +
+

Returns true if this is an upvote note, otherwise false is returned

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 119
+def upvote?
+  note.start_with?('+1') || note.start_with?(':+1:')
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file -- cgit v1.2.1