2018-10-16 12:21:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Notes
|
|
|
|
class BaseService < ::BaseService
|
|
|
|
def clear_noteable_diffs_cache(note)
|
|
|
|
if note.is_a?(DiffNote) &&
|
2019-11-21 04:06:16 -05:00
|
|
|
note.start_of_discussion? &&
|
2018-10-16 12:21:16 -04:00
|
|
|
note.position.unfolded_diff?(project.repository)
|
|
|
|
note.noteable.diffs.clear_cache
|
|
|
|
end
|
|
|
|
end
|
2019-08-08 09:18:57 -04:00
|
|
|
|
|
|
|
def increment_usage_counter(note)
|
|
|
|
Gitlab::UsageDataCounters::NoteCounter.count(:create, note.noteable_type)
|
|
|
|
end
|
2018-10-16 12:21:16 -04:00
|
|
|
end
|
|
|
|
end
|