I accidently added tag A as synonym under tag A (accidently, on phone).
- Delete synonym gives error 500
- Unlink button gives error 422
- Delete tag gives unknown error
Might be helpful
- I can rename tag A to B and the synonym also gets edited.
- Having 0 or 1 post with tag A makes no different for the errors above.
Can someone reproduce this?
That seems like something that should not be allowed to happen. I’m assuming that you ended up with something like this:
I’m testing this on my local development site. After creating the synonym, clicking the “Remove Synonym” button gives a
422 error. Clicking the trash icon for the synonym doesn’t give me a
500 error, instead it completely deletes the tag.
I think some protection should be added to prevent a tag from being set as its own synonym.
Thanks for checking this issue.
Hmm ok that is different from my installation. I have no way to delete the tag or synonym at this point.
What version of DIscourse is your site on?
I just upgraded to the newest build:
The behavior is the same as my OP.
We should assign this next week @eviltrout, adding a tag as a synonym of itself is … not good.
Opening this topic per @MarcP’s request. He is not able to delete the tag even via console.
./launcher enter app
tag = Tag.find_by_name("tag_name")
The above is not working for Marc while it’s working for me. Can you expand your issue here Marc?
The command @techAPJ send me did not work for me, however I ran the (slightly different) commands found in: How can I delete a tag in development database (on local)?
I got the following results, trying to delete my tag “testing” which has a synonym tag: “testing”.
 pry(main)> t = Tag.find_by_name('testing')
created_at: Wed, 11 Nov 2020 04:38:06 UTC +00:00,
updated_at: Thu, 19 Nov 2020 03:44:35 UTC +00:00,
 pry(main)> t.destroy!
SystemStackError: stack level too deep
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-126.96.36.199/lib/active_record/reflection.rb:120:in `_reflect_on_association'
DB.exec("delete from tags where name = 'testing'")
This worked! Thanks Sam Have a nice week.