-
Notifications
You must be signed in to change notification settings - Fork 113
fix(view): Update API views when removing a view #149
Conversation
@@ -622,13 +622,29 @@ public ImageEntity getPicture(String apiId) { | |||
@Override | |||
public void deleteViewFromAPIs(final String viewId) { | |||
findAll().forEach(api -> { | |||
if (api.getViews() | |||
if (api.getViews() != null && api.getViews() | |||
.removeIf(view -> view.equals(viewId))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sur the removeIf is necessary here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's your stuff guy...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? I mean not anymore necessary with your refactor...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why but I let you apply necessary changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are doing a remove of view twice : once by the removeIf, and on the remove() method...
} | ||
}); | ||
} | ||
|
||
private void removeView(String apiId, String viewId) throws TechnicalManagementException { | ||
try { | ||
Optional<Api> optApi = apiRepository.findById(apiId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not better to give the api object in parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so let's do required changes...
2318b57
to
a4930d0
Compare
Closes gravitee-io/issues#317