Closed bartervg closed 1 year ago
EZ solution: submit the offer status of the user's page, along with the accept offer form submit. In the backend, check if it matches the current offer status. If it mismatches somewhere, output error.
Other things than the status can change, such as the contents of the offer. Assuming that all actions change the edited time, I think that would be the best value to check.
Yeah, that works.
Related to accepting a paused offer
https://github.com/bartervg/barter.vg/issues/254#issuecomment-813037770
New hidden input last_updated
added to the offer form.
I didn't know if this would break any userscripts. Therefore, it's in debug mode and the offer will be accepted, but there will be a caution notice.
If no one complains in the next few days, an offer will not be accepted if the last_updated
value does not equal the offer's updated time in the database.
/remind me to change offer acceptance in 1 week
@bartervg set a reminder for Oct 31st 2022
New hidden input
last_updated
added to the offer form.I didn't know if this would break any userscripts. Therefore, it's in debug mode and the offer will be accepted, but there will be a caution notice.
If no one complains in the next few days, an offer will not be accepted if the
last_updated
value does not equal the offer's updated time in the database.
I don't know of any scripts that accept offers. That would be a risky action to automate.
I don't know of any scripts that accept offers.
Then nothing to worry about breaking. Still, I'll wait to see if there are other bugs that would trigger this since not being able to accept offers would be very annoying.
@bartervg set a reminder for Oct 31st 2022
I missed this reminder.
If the offer update date in the database does not match the one in the browser, then the accept fails, and the error message is displayed.
No Change. Offer has not been accepted
The No Change
error is a broader error message that will display whenever the status change is not successful.
What problem does this feature address?
It's typical to leave an offer open, perhaps several of them in multiple tabs. However, the other side may change an offer and the changes won't be reflected until the page if reloaded. Pressing accept, fail or completed may not work, or it could lead to accepting a different offer than the one expected.
Describe a solution
If the offer has been modified, there should be a note that the offer changed when the page is reloaded and any actions submitted should be not go into effect. Each request could be timestamped based on the most recent view and then compared with the offer modified time.
It may be helpful to have a brief window to undo any offer action. This would be similar to the ~5 minute time to edit comments.
Examples of similar features
Accepting an offer that has been paused does not produce an error, but the accept action is silently ignored. Ideally, there would be an error message instead of the normal accepted message.