Uh oh!
There was an error while loading. Please reload this page.
[WIP] Fix 404 on removing a comment - #182
Conversation
appinteractive
commented
Nov 23, 2018
Think this will break as the soft delete hook must stay inside the all hook part to my knowledge. |
ionphractal
commented
Nov 23, 2018
I only found that it had to be inside But like this it still shows the notice so I suggest it works correctly. |
appinteractive
commented
Nov 23, 2018
Okay thanks for double checking that! 🙂 |
Gerald1614
commented
Nov 24, 2018
Hi, i just tested the fix 247 with this fix and i confirm it is doign what is expected to do. when i delete a comment the backend returns no error message when comment is deleted and my promise is solved. |
roschaefer
commented
Nov 30, 2018
@appinteractive is it safe to merge? |
appinteractive
commented
Dec 3, 2018
No it’s not as the moderator would delete the comment permanently without leaving a trace. That’s not intended as far as I can tell. Or do I not get it wrong? |
appinteractive
commented
Dec 3, 2018
Also somehow the build is falling. |
ionphractal
commented
Dec 3, 2018
@appinteractive I did not say the moderator can erase it without a trace... (I said: if the Btw. I don't know what is intended, but the change should behave almost the same as without, because the Could you please elaborate on what the expected behavior is (your specs) and I will see what I can do about it. |
appinteractive
commented
Dec 3, 2018
If I correctly understand, your change only soft deletes wheh a user deletes it in the Frontend, but not when it’s triggered on the server or by an admin or moderator. That’s the confusing part for me. I ask me why you did it exactly that way. Before it was done without that restriction if I read it correctly. That’s one of the problems with the feathers hooks, they get very complex (mostly hidden) very fast and you get that Bad feeling. The codacy part, it will be removed tomorrow completely anyway. It stopped working as they changed something on their side. |
ionphractal
commented
Dec 3, 2018
Ah could it be that you mean because I added Anyway I'll do some research on this and come back then. Thanks for the hint! |
ionphractal
commented
Dec 9, 2018
So, to retain exact behavior as before, with the exception of the single case when restrictToOwner is called, I used the following pseudo code to understand what feathers does. This is the way it was before any modification (in order how the hooks were executed): Because unless conditions are quite a head twister (for me at least), I rewrote it to using if conditions: To fix the 404 behavior, it would have to be: With feathers hooks syntax, that seems to be (omitting Does that make sense? Btw. when I tested, I notice that I don't see a delete button in neither the moderator nor the administrator view for comments. But that is a WebApp "issue" ( |
Codecov Report
@@ Coverage Diff @@## develop #182 +/- ##
==========================================
Coverage ? 66.64% ==========================================
Files ? 146 Lines ? 1925 Branches ? 0 ==========================================
Hits ? 1283 Misses ? 642 Partials ? 0
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@## develop #182 +/- ##
==========================================
Coverage ? 66.64% ==========================================
Files ? 146 Lines ? 1925 Branches ? 0 ==========================================
Hits ? 1283 Misses ? 642 Partials ? 0
Continue to review full report at Codecov.
|
At the moment, the API returns 404 when deleting a comment. This prevents implementation of Human-Connection/WebApp#347 .
It turns out the issue lies in the before all hook
softDelete, which seems to be somewhat incompatible or rather order sensitive with therestrictToOwnerhook.feathersjs-ecosystem/feathers-hooks-common#185
I don't have enough experience with feathersjs, but it seems this error can be mitigated by changing the hook order when
restrictToOwneris used, without sacrificing functionality.What are your thoughts on that? @roschaefer@appinteractive