Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in toggle edit mode #4608

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

hishamco
Copy link
Contributor

No description provided.

@sbwalker
Copy link
Member

@hishamco I tested the current logic and it does not actually seem to be an "issue"? This line of code is only executed for personalized pages - and the functionality works as expected. The only "problem" appears to be that it sets PageState.EditMode when its not required - however this does not affect the behavior of the application. Please explain if I am missing something based on your own testing.

@@ -147,8 +147,7 @@
{
if (PageState.Page.IsPersonalizable && PageState.User != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Registered))
{
PageState.EditMode = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how you set the EditMode then check it in the line after?!!

Copy link
Member

@sbwalker sbwalker Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run the application and step into the code with a debugger? When I did this I can see that the PageState.EditMode is set to true, and then the browser is navigated to a Url with a querystring parameter of "?edit=true" - which works fine as that is what the end user is expecting. I am not saying the code is perfect - my question to you was if your testing was resulting in behavior which was causing a functional issue with the application, and if so if you could explain the problem.

Copy link
Contributor Author

@hishamco hishamco Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said in another PR I'm trying to test the functionality from within the code to improve the quality

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what you mean by "testing the functionality from within the code"? Does this mean that you are not actually testing the code at run-time, but instead using static code analyzers to identify potential issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not testing the code at the runtime, sometimes I identifying the bugs by observation or static code analyzers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it sounds like the answer to my earlier question is that you did not experience any functional problems with the application ie. this is not an "issue" according to the standard definition. This is an optimization to code which is already working properly. In general my philosophy in these cases is "if it aint broke then dont fix it" as there are often unexpected side effects. In this case the change is very straightforward and easy to test/validate so I will merge the PR.

@sbwalker sbwalker merged commit d954e3f into oqtane:dev Sep 13, 2024
1 check passed
@hishamco hishamco deleted the toggle-edit-mode branch September 13, 2024 19:58
@hishamco
Copy link
Contributor Author

@sbwalker shall I start some unit tests that examine several scenarios that might break the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants