Skip to content

Commit c4d1b68

Browse files
committed
Adjust delete comment
1 parent 5cea35d commit c4d1b68

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

monitor/controller.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def post_comment(
137137
)
138138

139139
if not c:
140-
return falcon.HTTP_BAD_REQUEST
140+
return falcon.HTTP_NOT_FOUND
141141

142142
if token != c.authToken:
143143
return falcon.HTTP_FORBIDDEN
@@ -185,7 +185,7 @@ def update_comment(
185185
)
186186

187187
if not c:
188-
return falcon.HTTP_BAD_REQUEST
188+
return falcon.HTTP_NOT_FOUND
189189

190190
if token != c.authToken:
191191
return falcon.HTTP_FORBIDDEN
@@ -234,14 +234,23 @@ def delete_comment(
234234
)
235235

236236
if not c:
237-
return falcon.HTTP_BAD_REQUEST
237+
return falcon.HTTP_NOT_FOUND
238238

239239
if token != c.authToken:
240240
return falcon.HTTP_FORBIDDEN
241241

242-
database.delete_framecomment(
242+
fc = database.select_framecomment_for_component_and_comment(
243243
conn=conn,
244-
comment=body.get('commenttext'),
245244
comp=c,
245+
comment=body.get('comment'),
246246
)
247-
return falcon.HTTP_NO_CONTENT
247+
248+
if fc:
249+
database.delete_framecomment(
250+
conn=conn,
251+
comment=body.get('comment'),
252+
comp=c,
253+
)
254+
return falcon.HTTP_NO_CONTENT
255+
else:
256+
return falcon.HTTP_NOT_FOUND

0 commit comments

Comments
 (0)