Set noteable_type to WorkItem for work item notes
Context
-
Note
model has a polymorphic association to the underlying objectnoteable
e.g., aNote
belongs to anIssue
orMergeRequest
. -
Currently
WorkItem
is an AR model that inherits fromIssue
based on the same tableissues
while we're seeking to completely replaceIssue
withWorkItem
.
Problem
When updating a Note
object for WorkItems
, it must correctly load an issues
record using WorkItem
model. To ensure this noteable_type
must store the correct type.
Note.new(noteable: Issue.first).noteable_type # "Issue"
- Note.new(noteable: WorkItem.first).noteable_type # "Issue"
+ Note.new(noteable: WorkItem.first).noteable_type # "WorkItem"
For Note
, loading the correct model matters when quick actions are present in body
. To apply quick actions, we must first figure out which widgets are available for the note's work item.
Edited by euko