huginn / huginn

Create agents that monitor and act on your behalf. Your agents are standing by!
MIT License
43.12k stars 3.75k forks source link

Deleting an agent from the agent's `show` action will redirect to non-existent agent #531

Closed amoeba closed 8 years ago

amoeba commented 10 years ago

As in the subject, deleting an agent from the agent's show action will attempt to redirect the user back to the agent's show action which will result in an error. Is this intended behavior?

A quick scan (I'm new to Huginn) shows that you can only find a link to destroy and agent in two locations: (1) the agents list and the agent's show action itself. In both cases, the user probably wants to be redirected to the agents list.

The current method in https://github.com/cantino/huginn/blob/master/app/controllers/agents_controller.rb:

def destroy
    @agent = current_user.agents.find(params[:id])
    @agent.destroy

    respond_to do |format|
      format.html { redirect_back "'#{@agent.name}' deleted" }
      format.json { head :no_content }
    end
  end

If you agree, I could PR this.

cantino commented 10 years ago

Welcome @amoeba! Definitely not intended behavior. :smile: We'd love a PR!

amoeba commented 10 years ago

Great, I'll write one up this morning.

0xdevalias commented 9 years ago

I believe this is fixed now.

virtadpt commented 9 years ago

It would appear that this bug has reappeared. I've been able to reproduce it reliably after upgrading to commit a76c68bffbcbd3ec4bea937a87dab9ec7e0cc590.

cantino commented 8 years ago

Is this fixed for you @virtadpt?

amoeba commented 8 years ago

Just an FYI, I'm not reproducing this with a Huginn instance I refreshed from source two weeks ago.

cantino commented 8 years ago

Going to go ahead and close because I believe this is fixed. Please re-open if not!

virtadpt commented 8 years ago

This issue's been dead as disco for many months (the last time it popped up was a regression). I think it's well and truly done now.