Class: GitlabCodeChangeActivity

Inherits:
CodeChangeActivity show all
Defined in:
lib/models/gitlab_code_change_activity.rb

Instance Attribute Summary

Attributes inherited from CodeChangeActivity

#author, #code_change, #created_at, #id, #is_self, #message

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CodeChangeActivity

#notified, #should_notify?

Constructor Details

#initialize(id, author, is_self, message, created_at, code_change) ⇒ GitlabCodeChangeActivity

Returns a new instance of GitlabCodeChangeActivity.



5
6
7
8
9
10
11
12
# File 'lib/models/gitlab_code_change_activity.rb', line 5

def initialize(id, author, is_self, message, created_at, code_change)
  @id = id
  @author = author
  @is_self = is_self
  @message = GitlabCodeChangeActivity.translate_message(message)
  @created_at = created_at
  @code_change = code_change
end

Class Method Details

.translate_message(message) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/models/gitlab_code_change_activity.rb', line 18

def self.translate_message(message)
  message.sub(/^(added \d+ commits?).*/m, '\1')
    .gsub("'", "")
    .gsub("\n", " ")
    .gsub("  ", " ")
    .gsub(">", "")
    .sub(/^\(/, "\\(")
    .sub(/^\[/, "\\[")
    .sub(/^-/, "\\-")
end

Instance Method Details

#messages_to_ignoreObject



14
15
16
# File 'lib/models/gitlab_code_change_activity.rb', line 14

def messages_to_ignore
  [/^marked the task .* as (completed|incomplete)$/, /^changed the description$/, /^resolved all threads$/]
end