bartervg / barter.vg

Track and hold discussion on Barter.vg bugs, enhancements, and other issues
https://barter.vg
MIT License
20 stars 4 forks source link

Possible to accept offer that has been changed without seeing the changes #259

Closed bartervg closed 1 year ago

bartervg commented 3 years ago

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.

Revadike commented 3 years 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.

bartervg commented 3 years ago

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.

Revadike commented 3 years ago

Yeah, that works.

bartervg commented 1 year ago

Related to accepting a paused offer

254

https://github.com/bartervg/barter.vg/issues/254#issuecomment-813037770

bartervg commented 1 year ago

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. image

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.

bartervg commented 1 year ago

/remind me to change offer acceptance in 1 week

reminders[bot] commented 1 year ago

@bartervg set a reminder for Oct 31st 2022

Revadike commented 1 year ago

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. image

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.

bartervg commented 1 year ago

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 commented 1 year ago

@bartervg set a reminder for Oct 31st 2022

I missed this reminder.

image 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.