link_to_gfm, think twice [Meta]
Description
link_to_gfm
has been a good wrap helper of link_to(gfm())
, but cost of this helper is too high by two aspects:
- high computing resource (due to use of
Banzai.render
andNokogiri::HTML::DocumentFragment.parse
) - error-prune (See link_to_gfm on gitlab-org/gitlab-ce Issues)
This is a proposal to define a simple guideline to use the link_to_gfm
helper.
Proposal
- A single call of
link_to_gfm
is recommended only if GFM is effective in that context.- Consider to use
link_to
when GFM is not necessary.
- Consider to use
- Calling
link_to_gfm
in a loop is avoided without special reasons.- Use
link_to
almost always.
- Use
Current situation
path (in /app/views) | 1st argument of link_to_gfm
|
controller#action | 1 or N | issues/MRs | status |
---|---|---|---|---|---|
/projects/blame/show.html.haml | commit.title (updated by gitlab-foss!12900 (merged)) |
Projects::BlameController#show | N | - (cf. gitlab-foss#35163 (closed)) (introduced in gitlab-foss@eb06dd79) | - |
/projects/branches/_commit.html.haml | commit.title | Projects::BranchesController#index, Projects::TagsController#index, Projects::TagsController#show | N | - | - |
/projects/commits/_commit.html.haml | commit.title | Projects::CommitsController#show etc. | N or 1 | - (cf. gitlab-foss#34509 (moved)) | - |
/projects/commits/_inline_commit.html.haml | commit.title | Projects::CompareController#show | N | - | - |
/projects/deployments/_commit.html.haml | commit_title | Projects::EnvironmentsController#show | N | - | - |
/projects/tree/_tree_commit_column.html.haml | commit.full_title | Projects::RefsController#logs_tree.json | N | - | - |
/shared/projects/_project.html.haml | project.commit.title | Projects::ForksController#index | N | gitlab-foss#35742 (closed) gitlab-foss!13173 (closed) | |
/shared/milestones/_issuable.html.haml | issuable.title | Projects::MilestonesController#show, Groups::MilestonesController#show, Explorer::MilestonesController#show | N | gitlab-foss#34289 (closed) gitlab-foss!12444 (merged) | |
/projects/issues/_merge_requests.html.haml | merge_request.title | Projects::IssuesController#show | N | gitlab-foss!12451 (merged) | |
/shared/milestones/_milestone.html.haml | milestone.title | Projects::MilestonesController#index, Groups::MilestonesController#index, Explorer::MilestonesController#index | N | gitlab-foss!12451 (merged) |
Links / references
This was found when working on gitlab-foss!12444 (merged) and gitlab-foss!12451 (merged).
Edited by username-removed-100770