Ok the bug isn’t with discourse-translator but the plugin happens to trigger the bug.
To replica, run the following commands. Somehow saving a post with an img wrapped in lightbox will remove the lightbox even though the Post#raw hasn’t been changed.
[2] pry(main)> post = Post.last
[3] pry(main)> post.cooked
=> "<p><div class=\"lightbox-wrapper\"><a data-download-href=\"//localhost:3000/uploads/default/34784374092783e2fef84b8bc96d9b54c11ceea0\" href=\"//localhost:3000/uploads/default/original/1X/34784374092783e2fef84b8bc96d9b54c11ceea0.gif\" class=\"lightbox\" title=\"Sword reworks.gif\"><img src=\"//localhost:3000/uploads/default/optimized/1X/34784374092783e2fef84b8bc96d9b54c11ceea0_1_690x276.gif\" width=\"690\" height=\"276\"><div class=\"meta\">\n<span class=\"filename\">Sword reworks.gif</span><span class=\"informations\">1000x400 1000 KB</span><span class=\"expand\"></span>\n</div></a></div></p>\n\n<p>This is a test post</p>"
[4] pry(main)> post.save!
(0.2ms) BEGIN
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 [["id", 1]]
Topic Load (0.5ms) SELECT "topics".* FROM "topics" WHERE ("topics"."deleted_at" IS NULL) AND "topics"."id" = 11 LIMIT 1 [["id", 11]]
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 [["id", 1]]
SQL (0.3ms) UPDATE "posts" SET "cooked" = '<p><img src="/uploads/default/original/1X/34784374092783e2fef84b8bc96d9b54c11ceea0.gif" width="690" height="276"></p>
<p>This is a test post</p>', "baked_at" = '2016-10-23 16:51:22.486791', "updated_at" = '2016-10-23 16:51:22.487000' WHERE "posts"."id" = 28 [["cooked", "<p><img src=\"/uploads/default/original/1X/34784374092783e2fef84b8bc96d9b54c11ceea0.gif\" width=\"690\" height=\"276\"></p>\n\n<p>This is a test post</p>"], ["baked_at", Sun, 23 Oct 2016 16:51:22 UTC +00:00], ["updated_at", Sun, 23 Oct 2016 16:51:22 UTC +00:00], ["id", 28]]
(0.1ms) SAVEPOINT active_record_1
UserAction Load (0.3ms) SELECT "user_actions".* FROM "user_actions" WHERE "user_actions"."action_type" = 5 AND "user_actions"."user_id" = 1 AND "user_actions"."acting_user_id" = 1 AND "user_actions"."target_post_id" = 28 AND "user_actions"."target_topic_id" = 11 LIMIT 1 [["action_type", 5], ["user_id", 1], ["acting_user_id", 1], ["target_post_id", 28], ["target_topic_id", 11]]
(0.1ms) RELEASE SAVEPOINT active_record_1
Category Load (0.3ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = 1 LIMIT 1 [["id", 1]]
(2.5ms) COMMIT
=> true
[5] pry(main)> post.cooked
=> "<p><img src=\"/uploads/default/original/1X/34784374092783e2fef84b8bc96d9b54c11ceea0.gif\" width=\"690\" height=\"276\"></p>\n\n<p>This is a test post</p>"