[MM-54770] Add ability to export profile pictures and fix importing them (#25042)
* add ability to export pp and fix import * remove unused nopSeeker * remove debug log * fix shadow vars * generate a warning instead of an error when unable to export profile picture * fix merge conflicts --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -82,6 +82,7 @@ func init() {
|
||||
|
||||
BulkExportCmd.Flags().Bool("all-teams", true, "Export all teams from the server.")
|
||||
BulkExportCmd.Flags().Bool("with-archived-channels", false, "Also exports archived channels.")
|
||||
BulkExportCmd.Flags().Bool("with-profile-pictures", false, "Also exports profile pictures.")
|
||||
BulkExportCmd.Flags().Bool("attachments", false, "Also export file attachments.")
|
||||
BulkExportCmd.Flags().Bool("archive", false, "Outputs a single archive file.")
|
||||
|
||||
@@ -240,6 +241,11 @@ func bulkExportCmdF(command *cobra.Command, args []string) error {
|
||||
return errors.Wrap(err, "with-archived-channels flag error")
|
||||
}
|
||||
|
||||
includeProfilePictures, err := command.Flags().GetBool("with-profile-pictures")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "with-profile-pictures flag error")
|
||||
}
|
||||
|
||||
fileWriter, err := os.Create(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -255,6 +261,7 @@ func bulkExportCmdF(command *cobra.Command, args []string) error {
|
||||
opts.IncludeAttachments = attachments
|
||||
opts.CreateArchive = archive
|
||||
opts.IncludeArchivedChannels = withArchivedChannels
|
||||
opts.IncludeProfilePictures = includeProfilePictures
|
||||
if err := a.BulkExport(rctx, fileWriter, filepath.Dir(outPath), nil /* nil job since it's spawned from CLI */, opts); err != nil {
|
||||
CommandPrintErrorln(err.Error())
|
||||
return err
|
||||
|
||||
@@ -101,6 +101,7 @@ func init() {
|
||||
|
||||
ExportCreateCmd.Flags().Bool("no-attachments", false, "Exclude file attachments from the export file.")
|
||||
ExportCreateCmd.Flags().Bool("include-archived-channels", false, "Include archived channels in the export file.")
|
||||
ExportCreateCmd.Flags().Bool("include-profile-pictures", false, "Include profile pictures in the export file.")
|
||||
|
||||
ExportDownloadCmd.Flags().Bool("resume", false, "Set to true to resume an export download.")
|
||||
_ = ExportDownloadCmd.Flags().MarkHidden("resume")
|
||||
@@ -142,6 +143,11 @@ func exportCreateCmdF(c client.Client, command *cobra.Command, args []string) er
|
||||
data["include_archived_channels"] = "true"
|
||||
}
|
||||
|
||||
includeProfilePictures, _ := command.Flags().GetBool("include-profile-pictures")
|
||||
if includeProfilePictures {
|
||||
data["include_profile_pictures"] = "true"
|
||||
}
|
||||
|
||||
job, _, err := c.CreateJob(context.TODO(), &model.Job{
|
||||
Type: model.JobTypeExportProcess,
|
||||
Data: data,
|
||||
|
||||
@@ -22,6 +22,7 @@ Options
|
||||
|
||||
-h, --help help for create
|
||||
--include-archived-channels Include archived channels in the export file.
|
||||
--include-profile-pictures Include profile pictures in the export file.
|
||||
--no-attachments Exclude file attachments from the export file.
|
||||
|
||||
Options inherited from parent commands
|
||||
|
||||
Ссылка в новой задаче
Block a user