Advertisement:

Author Topic: Bug - Custom-fields!  (Read 466 times)

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Bug - Custom-fields!
« on: March 13, 2019, 10:37:51 am »
Hey,

Bug - Custom-fields!
Osclass 3.7.4 - bender 3.2.0

Step1: go to item-post.php
Step2: put something for searchable custom-fields, and leave the Title and description empty and hit apply to get error to fill out title and description.
Step3: as soon as you got error to fill out title and description, don't hit somewhere and directly go to search.php (or click website banner and then go search.php)
Step4: as you can see already searchable custom-fields have the values of custom-fields that you put in Step2.
Step5: these custom-fields values on search.php never be cleared. The only way to get rid of this is to load item-post.php one more time and then go back to search.php to clear it up.

Regards,
« Last Edit: March 13, 2019, 08:27:25 pm by Sophia_OS »

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Bug - Custom-fields!
« Reply #1 on: March 13, 2019, 10:48:39 pm »
Is this your browser's fill-in doing? Disable auto-fill forms (or whatever it's called in your browser).

Yes, this is a bug, definitely.
« Last Edit: March 13, 2019, 11:01:35 pm by dev101 »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Bug - Custom-fields!
« Reply #2 on: March 14, 2019, 12:26:01 am »
Interesting. I don't have custom fields if no category is selected in item post. Also, I don't have a link to search from item post.

If I choose a caregory in item post and then go to search, the custom fields are not displayed in search sidebar.

This is a particular case. Why a bug?  You should be able to change the custom field from search sidebar.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Bug - Custom-fields!
« Reply #3 on: March 14, 2019, 12:49:23 am »
It's an old issue, see here:

https://github.com/osclass/Osclass/issues/1798
https://github.com/osclass/Osclass/pull/1818

I've fixed this in my setup, but it's not plain Osclass, so not sure now (don't remember anymore) how that would work on plain Osclass. That's why I closed PR.

Problem is that in scenario Sophia explained, session data is still kept e.g. procedure of item posting is not completed properly/as expected, and so data never got to the stage to be removed in the first place, because script assumes author will revert to item editing/posting at some point. I don't think this is a common scenario ordinary users will encounter too frequently.
« Last Edit: March 14, 2019, 01:00:18 am by dev101 »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Bug - Custom-fields!
« Reply #4 on: March 14, 2019, 10:56:25 am »
Interesting. I don't have custom fields if no category is selected in item post. Also, I don't have a link to search from item post.

If I choose a caregory in item post and then go to search, the custom fields are not displayed in search sidebar.

This is a particular case. Why a bug?  You should be able to change the custom field from search sidebar.

You have to have searchable custom-fields to show up in search.php. check the code of original bender search.php.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Bug - Custom-fields!
« Reply #5 on: March 14, 2019, 11:07:01 am »
It's an old issue, see here:

https://github.com/osclass/Osclass/issues/1798
https://github.com/osclass/Osclass/pull/1818

I've fixed this in my setup, but it's not plain Osclass, so not sure now (don't remember anymore) how that would work on plain Osclass. That's why I closed PR.

Problem is that in scenario Sophia explained, session data is still kept e.g. procedure of item posting is not completed properly/as expected, and so data never got to the stage to be removed in the first place, because script assumes author will revert to item editing/posting at some point. I don't think this is a common scenario ordinary users will encounter too frequently.

This should be fixed! Because most users have phone memory issue and they fail to post an item with picture and they give up and leave the item-post.php page and they will have this problem forever until open the item-post.php page again.

Also this problem happens when we redirect after posting an item in item-post.php. i explained that in my this post down:

https://forums.osclass.org/general-help/how-to-put-a-redirect-url-on-the/msg165128/#msg165128


dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Bug - Custom-fields!
« Reply #6 on: March 14, 2019, 11:11:04 am »
I don't think this is critical at all, and by 'forever' problem is easily fixed simply by clearing the cookie.
Problem manifests only visually at html level, it does not affect search functionality in any way.
Also, you have some directions at a solution, you can try it out if you like.
Another way is to introduce a check point and screen every page request against failed item posting, which is a great unnecessary overhead imho.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Bug - Custom-fields!
« Reply #7 on: March 14, 2019, 11:40:32 am »
I don't think this is critical at all, and by 'forever' problem is easily fixed simply by clearing the cookie.
Problem manifests only visually at html level, it does not affect search functionality in any way.
Also, you have some directions at a solution, you can try it out if you like.
Another way is to introduce a check point and screen every page request against failed item posting, which is a great unnecessary overhead imho.

clearing the cookie?  :D websites designed for ordinary people! They don't know about cookies or other things! They just know how to open and close the browser! That's it! They go to other website or close the browser when they get a very small error or issue on the website! That's why we have to be very careful!

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Bug - Custom-fields!
« Reply #8 on: March 14, 2019, 03:19:08 pm »
Can we create a function to clear session data if item was not posted successfully? Probably.

Maybe saving a cookie or a local storage var with name "successful_post" which will on item post page load be set 0. When you click post, that cookie will be set to 1.

Then on search page you can make a function to check if that cookie exists and if it haves value 0. If yes, use ajax call to clear session and refresh search page.

Regards.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Bug - Custom-fields!
« Reply #9 on: March 14, 2019, 03:21:41 pm »
No need for cookies, you already have session.
Point is, for something that can occur in 0.01% you have to check each page request. Multiply that with 1000s concurrent requests and that starts to count.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Bug - Custom-fields!
« Reply #10 on: March 14, 2019, 07:19:07 pm »
Can we create a function to clear session data if item was not posted successfully? Probably.

Maybe saving a cookie or a local storage var with name "successful_post" which will on item post page load be set 0. When you click post, that cookie will be set to 1.

Then on search page you can make a function to check if that cookie exists and if it haves value 0. If yes, use ajax call to clear session and refresh search page.

Regards.

For getting this issue it doesn't have to be just unsuccessful posting! As i explained in my above posts, when we redirect to other post after posting successfully, we get this issue too.

In search.php for solving this issue we can not put a function to check the cookies/sessions and if there is custom-fields remove them. Because on normal way when we search by searchable custom-fields in advanced-search, page returns with custom-fields values and keep them to be able to search. So if you remove custom-fields values by function, then you can not search by custom-fields at all.
« Last Edit: March 14, 2019, 07:22:05 pm by Sophia_OS »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Bug - Custom-fields!
« Reply #11 on: April 10, 2019, 05:41:13 am »
You really wanna pass this BUG?