Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gevorgmansuryan
Copy link
Contributor

@gevorgmansuryan gevorgmansuryan requested a review from luke- April 21, 2025 21:31
@gevorgmansuryan gevorgmansuryan self-assigned this Apr 21, 2025
@what-the-diff
Copy link

what-the-diff bot commented Apr 21, 2025

PR Summary

  • Addition of Optimistic Locking to Post and Comment
    The Post and Comment features have been enhanced by integrating a method known as Optimistic Locking. This aims to prevent overrides of changes when multiple users attempt to update the same Post or Comment at the same time, thereby preserving the integrity of data.

  • Update to Database Tables
    The database tables for Post and Comment have been modified to support this addition. A new column named 'version' has been added to accommodate this locking mechanism.

  • Changes to Comment Controller and Model
    The Comment Controller now implements this optimistic locking feature during editing actions. It's designed to handle situations where an older version of a comment is being edited, ensuring recent changes aren't overwritten. Similar updates have been made to the Comment Model.

  • Changes to Post Controller and Model
    The same measures have been implemented for Posts as well, thus preventing unwittingly overwriting others' changes here too. Both the Controller and Model for Posts have been updated to work with optimistic locking.

  • Update to Comment and Post Edit Views
    The views for editing Comments and Posts have been updated to include a field for 'version'. This allows for tracking and control of the version being edited, which is key to the implementation of the optimistic locking feature.

@luke-
Copy link
Contributor

luke- commented Apr 21, 2025

@gevorgmansuryan Thank you for the implementation.

It would probably be better to use the existing updated_at to recognize whether the content has been updated in the meantime. (Instead of a new version attribute).

In principle, I like such check here, but would put this feature/PR on hold for now. Maybe we could also use the live module in future, to inform the user of changed content before save.

@luke- luke- marked this pull request as draft April 21, 2025 21:47
@gevorgmansuryan
Copy link
Contributor Author

@luke- requested changes are done

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.

3 participants