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

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

July 2019 · 3 min read

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.

Don't Forget: Get Travel Health Insurance!

To make your trip a worry-free experience, TravelFeed recommends SafetyWing Nomad Insurance. It provides comprehensive health coverage while you travel, so you can focus on exploring, not the unexpected. Get a quote here

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

Travel Resources

Recommended by TravelFeed

Flights: We recommend checking Kiwi.com to find the best and cheapest flights .

Accomodation: Find great stays on Booking.com, Agoda and Hostelworld.

Travel Insurance: Medical emergencies abroad can be pricey, but travel health insurance is not. We always use SafetyWing for affordable and reliable coverage.

Transportation: Use 12go and Omio to find detailed bus and train schedules, making travel planning easier.

Car Rental: For hassle-free car hiring, DiscoverCars is our trusted choice with a wide selection of vehicles.

Internet: Got an eSIM compatible phone? Airalo is perfect for reliable internet access during your trip. Just install it before you go, and you're set!

Day Trips & Tours: We recommend GetYourGuide for a variety of well-organized and enjoyable activities.

Tickets: Save on entrance fees with Klook and Tiquets.

Travel Planner: Need a hand planning? Our free travel planner chatbot is your personal guide. Chat now.

Disclosure: Posts on TravelFeed may contain affiliate links. See affiliate disclosure.


Share this post

Comments

Read Next