Opened 3 years ago

Last modified 3 months ago

#186 new enhancement

Delete translation set

Reported by: abdessamad idrissi Owned by: somebody
Milestone: 1.0 Priority: major
Version: Component: General
Keywords: has-patch 2nd-opinion Cc: willmot


It would be a good idea to allow admins to delete a complete translation set.

Attachments (1)

186.diff (4.2 KB) - added by willmot 2 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 @vanillalounge3 years ago

'Translation set' in GP-speak, means the whole language, translated or not. Being able to delete this might not be a good idea for admins (in the sense of validators), although it does make sense for superadmins.

comment:2 @abdessamad idrissi3 years ago

Yes that's what I mean; deleting created translations sets - the same as super admins being able to delete projects.

To experiment, I created a test translation set and now I want to delete it and let only the real project translations... But there's no function to do that yet.

comment:3 @defries2 years ago

  • Milestone set to 1.0

comment:4 @willmot2 years ago

  • Cc willmot added
  • Keywords has-patch needs-testing added

Had a bash at this, we're running the attached patch on translate.hmn.md.

It adds a (delete) link after (edit) when viewing a single translation set.

Currently it just deletes the translation set from the gp_translation_sets table, it doesn't delete the associated translated strings from gp_translations.

@willmot2 years ago

comment:5 @tcrsavage2 years ago

Tested this on translate.happytables.com

Seems to work nicely

comment:6 follow-up: @vanillalounge2 years ago

it doesn't delete the associated translated strings from gp_translations.

Should it? Needs feedback.

comment:7 in reply to: ↑ 6 @willmot2 years ago

  • Keywords 2nd-opinion added; needs-testing removed

Replying to vanillalounge:

it doesn't delete the associated translated strings from gp_translations.

Should it? Needs feedback.

The reason I didn't bother deleting the actual strings is that's also the behaviour of the other delete functions (delete project for example).

If it's decided that deleting a project / translation set should also delete all strings as well then I'd be happy to add the patch.

comment:8 @willmot2 years ago

Anything I can do to get this patch committed? It's been running on both of our GlotPress installs for a while.

comment:9 @markoheijnen2 years ago

I will test the logic when I have time. It seems like there is a capability check missing in delete_get() but I don't know the code on that place so I can be wrong. Having unit tests to test the delete_get() logic would help.

comment:10 @vanillalounge23 months ago

I've played around a bit with this patch. Some notes:

  • Project in gp_projects gets deleted.
  • Everything in gp_translation_sets and gp_translations remains.

Which makes me wonder if it's the right approach, or why doesn't everything get deleted. Since entries in gp_translation_sets are associated with a project_id (gone after project delete) and entries in gp_translation are associated with a translation_set_id, it looks like we're left with a bunch of "floating", unattached entries in both tables.

Assuming the above approach is sound, I suggest to expand the patch to delete those, too.

comment:11 @slackbot3 months ago

This ticket was mentioned in Slack in #glotpress by markoheijnen. View the logs.

Note: See TracTickets for help on using tickets.