When importing a Category from file, is there any way to ensure the uploaded Topics will remain private? I’ve done a test import into a local Discourse dev env setup and the Category security settings were reset, such that those new Topics would be viewable by Everyone.
I know I can do the import:file[category-export.json] and then immediately change the Category security to be viewable only by the users in a certain Group, but I’m concerned about what happens in the interim time - firstly there may be a short time that Everyone can see that content, and secondly that email notifications may go out (or be scheduled) for Everyone, even once the settings are changed.
Because the import:file rake task only takes one argument (the filename), there doesn’t seem to be any way to set the ‘destination Category’ in which I want the import to be stored.
I’ve tried creating the Category first, with the same Category Name and slug, but this fails with the error:
Failed to import category (ID = 5, name = CATEGORY_NAME): Validation failed: Category Name has already been taken, Slug is already in use
The single test import Topic I included in that .json file did get imported but it was created in Uncategorized, which if anything is worse than it getting created in an openly visible Category.
I’ve thought about any other ways I can do this securely but have not got any good ideas at the moment. Any thoughts from the community?
Actually, it looks like this was just my dim-wittedness front and centre here.
The default behaviour of the import:file rake task (which invokes ImportExport::Importer) is to copy exactly the permissions over from the source Category. I only found this out from looking over the source code.
And it did exactly this. The reason my destination category didn’t have the permissions I had been hoping for was that I had forgotten to set those permissions correctly in the source! I was moving a category in an already private forum (entire forum is private so that category was See/Reply/Create to Everyone in there) into a more open forum (in which those posts needed to be in a secure category - See/Reply/Create for Admins only initially)
I agree - since Category import is something that can only really be done in the real live environment, one might want the permissions to default to admin-only until the import has been checked and everyone is satisfied it’s OK. Better that than spamming users with notifications about bulk imports.