summaryrefslogtreecommitdiff
path: root/app/services/notes/base_service.rb
blob: 87f7cb0e8acbee183b58062a98197672f72f1fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Notes
  class BaseService < ::BaseService
    def clear_noteable_diffs_cache(note)
      if note.is_a?(DiffNote) &&
          note.start_of_discussion? &&
          note.position.unfolded_diff?(project.repository)
        note.noteable.diffs.clear_cache
      end
    end

    def increment_usage_counter(note)
      Gitlab::UsageDataCounters::NoteCounter.count(:create, note.noteable_type)
    end
  end
end