Skip to content

Commit 93a9d1c

Browse files
committed
api: Add Note to Patch Serializer
Patch serializer returns a fields containing it's notes. Some notes may be filtered out depending on the request's user and on the note maintainer_only attribute Signed-off-by: andrepapoti <[email protected]>
1 parent 22cf45f commit 93a9d1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

patchwork/api/patch.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class PatchListSerializer(BaseHyperlinkedModelSerializer):
8585
mbox = SerializerMethodField()
8686
series = SeriesSerializer(read_only=True)
8787
comments = SerializerMethodField()
88+
notes = SerializerMethodField()
8889
check = SerializerMethodField()
8990
checks = SerializerMethodField()
9091
tags = SerializerMethodField()
@@ -108,6 +109,11 @@ def get_comments(self, patch):
108109
reverse('api-patch-comment-list', kwargs={'patch_id': patch.id})
109110
)
110111

112+
def get_notes(self, patch):
113+
return self.context.get('request').build_absolute_uri(
114+
reverse('api-patch-note-list', kwargs={'patch_id': patch.id})
115+
)
116+
111117
def get_check(self, instance):
112118
return instance.combined_check_state
113119

@@ -173,6 +179,7 @@ class Meta:
173179
'mbox',
174180
'series',
175181
'comments',
182+
'notes',
176183
'check',
177184
'checks',
178185
'tags',
@@ -191,6 +198,7 @@ class Meta:
191198
'mbox',
192199
'series',
193200
'comments',
201+
'notes',
194202
'check',
195203
'checks',
196204
'tags',

0 commit comments

Comments
 (0)