The discussion revolves around executing server-side code in a Discourse plugin when a button is clicked. Yogesh_Kbizsoft wants to run a scheduled job (e.g., Jobs/Scheduled/test_job.rb) via a button or URL, seeking guidance on triggering server-side code. pfaffman suggests using an Ajax request to an endpoint, referencing the subscription plugin as a model. Yogesh_g clarifies the goal: deleting posts for a user with many posts, where the default delete button fails due to a 503 error. They’ve written a cron job to delete 100 posts every two minutes. pfaffman advises running the task directly in the Rails console instead of creating a plugin. merefield supports this, recommending Rails’ ActiveRecord::Batches for efficient deletion. Yogesh_g admits unfamiliarity with Rails and asks for a command, while pfaffman suggests searching for PostDestroyer. Yogesh_g insists on a plugin due to non-technical clients and potential future scalability issues, emphasizing the need for improvements in Discourse’s default post deletion feature.
You’re still describing your solution and not the problem you’re solving. What do you want to do in that file? There may be a better way to trigger it. Knowing that will also make it easier to suggest something similar.
The subscription plugin adds an endpoint, so you might look at that. You’ll need to add a route in rails and then in ember add an action to your button that will call it.
I have a user with huge number of posts. I want to delete all posts of for that user the default delete all posts button giving 503 error. So I written a code schedule a cron job to run every 2 minutes and delete 100 posts at a time
Yes, you are but there are many such users on the site. And my client is non-technical person how will he that.I need to write a plugin as the client institng me
And also the issue can arises in other forums website. We really need to have a look at the issue I am facing. we can make improvements in default delete post feature in future update