[Travel Feed] Unable to broadcast if permlink was used in a previous post

in #utopian-io5 years ago

Project Information

Repository: https://github.com/travelfeed-io/travelfeed-io/
Project Name: Travel Feed

Describe the bug

If a user attempts to create a post with the same title and therefore the same permlink as a post they previously created by the post cannot be submitted due to broadcast errors.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the create post within travel feed.
  2. Enter a title that you have used previously on another post (the post should not have the parent_permlink of "travelfeed", therefore it should have been created on another front end.
  3. Enter any post body that meets the validation of 250 words.
  4. Publish the post
  5. Note that the post cannot be created.

Expected behavior
When a user creates that has the same title that was previously used on another post, the permlink that is created from the title should be adjusted to make it unique, a check should me made to identify if the permlink that is attempting to be submitted is valid to be used.

Error in Console

DevTools_-_travelfeed_io_dashboard_publish_and_TravelBlog__Publish_-_TravelFeed__The_Travel_Community

error: "server_error"
error_description: "equal( com.parent_permlink, o.parent_permlink ): The permlink of a comment cannot change."

Request Payload

{
   "operations":[
      [
         "comment",
         {
            "parent_author":"",
            "parent_permlink":"travelfeed",
            "author":"votezilla",
            "permlink":"test",
            "title":"Test",
            "body":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sed arcu interdum, luctus augue eget, rhoncus turpis. Etiam id erat non metus mattis pellentesque nec non ante. Nunc eu tristique risus, eget consequat turpis. Cras iaculis sodales justo consequat faucibus. Etiam suscipit vitae risus et gravida.",
            "json_metadata":"{\"tags\":[\"travelfeed\"],\"app\":\"travelfeed/1.0.0\",\"community\":\"travelfeed\",\"image\":[],\"links\":[],\"users\":[]}"
         }
      ]
   ]
}

Note: The permlink of "test" as mentioned in the payload was previously used on another post

Solution

Prior to the broadcast add a middleware that checks that if a user a permalink exists, in the event that it does exist, a random string could be appended to the post to make it unique. In the event, it doesn't exist no change is required.

Environment

  • Browser: Google Chrome (Version 75.0.3770.100 (Official Build) (64-bit))
  • Device: MacBook Pro (Retina, 15-inch, Late 2013)
  • Operating system: MacOS Mojave Version 10.14.4

Note: In a further investigation by the project owner, issues also arise when you attempt to edit a post that has the same parent_permlink of "travelfeed" and instead of creating a new post, it instead edits the previously created post that shares the same parent_permlink and permlink.

GitHub Account
A link to my GitHub account can be found here:

https://github.com/tobias-g1

A link to the issue reported on GitHub can be found here:

https://github.com/travelfeed-io/travelfeed-io/issues/114

Sort:  

Hi @tobias-g, thanks for making this contribution

The report is very well detailed. I like that you included an analysis. It helped bring to light what exactly went wrong. Your correspondence with the PO is something that other hunters should emulate. I love that you provided answers and even suggested possible solutions to the PO's questions.

Thanks again for the report. I look forward to more of your reports

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for your review, @fego! Keep up the good work!

Hi @tobias-g!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hi, @tobias-g!

You just got a 0.83% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

As previously discussed on Github, thanks a lot for this bug report, keep them coming if you discover any other bugs! I will fix and other bugs this in two weeks when I'm done with university exams and can fully focus on TravelFeed!
~ @jpphotography

Hey, @tobias-g!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @tobias-g! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 12000 upvotes. Your next target is to reach 13000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!