Skip to content
Snippets Groups Projects

Load issue templates from repository

Merged Felipe Cardozo requested to merge issue_18656 into master

part of #18656 (closed)

Does this MR meet the acceptance criteria?

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 1 module Gitlab
    2 module Template
    3 class IssueTemplate < BaseTemplate
  • @felipe_artur Do you think we can benefit from having some unit tests for templates-related classes?

  • @felipe_artur Just a few questions :tada: !

  • 10 11 end
    11 12
    12 13 def content
    13 File.read(@path)
    14 self.class.finder(@project_id).read(@path)
    14 15 end
    15 16
    16 17 class << self
    17 def all
    18 self.categories.keys.flat_map { |cat| by_category(cat) }
    18 def finder(project_id = nil)
    19 if repo_template?
    20 Gitlab::Template::RepoTemplateFinder.new(project_id, base_dir, extension, categories)
    21 else
    22 Gitlab::Template::LocalTemplateFinder.new(base_dir, extension, categories)
    23 end
    • What do you think about instantiating finder in a concrete class? Using a common interface for each finder (constructor in particular) may allow us to just create a def self.finder method that will return a class of a finder for a concrete class, and initialize it in constructor. With this approach it would be possible to remove repo_template?. I would be great to simplify API of template classes a little, so :thumbsup: for a small refactoring here.

    • Outdated comment i think. We did this right?

  • Felipe Cardozo Added 1 commit:

    Added 1 commit:

    • db334308 - Load issue templates from repository
  • Luke Bennett mentioned in merge request !5031 (closed)

    mentioned in merge request !5031 (closed)

  • Felipe Cardozo Marked the task CHANGELOG entry added as completed

    Marked the task CHANGELOG entry added as completed

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading