mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-27312 Allow uploading 10 files per post (#16235)
* Allow uploading 10 files per post * Increase Post.Fileids column size to fit 10 files * Add Post.Fileids column changes to DB v531 * Fix current_schema_version Co-authored-by: Claudio Costa <cstcld91@gmail.com> * Update store/sqlstore/upgrade.go Co-authored-by: Claudio Costa <cstcld91@gmail.com> * Fix schema version Co-authored-by: Diogo Lima Nicolau <diogo.lima.nicolau@cern.ch> Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com> Co-authored-by: Claudio Costa <cstcld91@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Ungültige Datei-Ids. Uploads sind auf maximal fünf Dateien begrenzt. Bitte verwenden Sie zusätzliche Nachrichten für mehr Dateien."
|
||||
"translation": "Ungültige Datei-Ids. Uploads sind auf maximal zehn Dateien begrenzt. Bitte verwenden Sie zusätzliche Nachrichten für mehr Dateien."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -7780,7 +7780,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Identificadores de archivo son inválidos. Toma en cuenta que la carga de archivos está limitado a un máximo de 5 archivos. Por favor utiliza mensajes adicionales para agregar más archivos."
|
||||
"translation": "Identificadores de archivo son inválidos. Toma en cuenta que la carga de archivos está limitado a un máximo de 10 archivos. Por favor utiliza mensajes adicionales para agregar más archivos."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Identifiants de fichier invalide. Notez que les envois sont limités à 5 fichiers maximum. Veuillez utiliser d'autres messages pour envoyer plus de fichiers."
|
||||
"translation": "Identifiants de fichier invalide. Notez que les envois sont limités à 10 fichiers maximum. Veuillez utiliser d'autres messages pour envoyer plus de fichiers."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Id file non valido. I caricamenti sono limitati ad un massimo di 5 file. Utilizzare più pubblicazioni per più file."
|
||||
"translation": "Id file non valido. I caricamenti sono limitati ad un massimo di 10 file. Utilizzare più pubblicazioni per più file."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4611,7 +4611,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4621,7 +4621,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Nieprawidłowe identyfikatory plików. Pamiętaj, że przesłane pliki są ograniczone maksymalnie do 5 plików. Użyj dodatkowych wpisów, aby uzyskać więcej plików."
|
||||
"translation": "Nieprawidłowe identyfikatory plików. Pamiętaj, że przesłane pliki są ograniczone maksymalnie do 10 plików. Użyj dodatkowych wpisów, aby uzyskać więcej plików."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Ids do arquivo inválido. Observe que os uploads estão limitados a cinco arquivos no máximo. Por favor, use publicações adicionais para mais arquivos."
|
||||
"translation": "Ids do arquivo inválido. Observe que os uploads estão limitados a dez arquivos no máximo. Por favor, use publicações adicionais para mais arquivos."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4621,7 +4621,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Identitatea fișierului invalidă. Rețineți că încărcările sunt limitate la maxim 5 fișiere. Utilizați postări suplimentare pentru mai multe fișiere."
|
||||
"translation": "Identitatea fișierului invalidă. Rețineți că încărcările sunt limitate la maxim 10 fișiere. Utilizați postări suplimentare pentru mai multe fișiere."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4621,7 +4621,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Неверные идентификаторы файлов. Обратите внимание, что загрузка ограничена максимум 5 файлами. Пожалуйста, используйте дополнительные сообщения для большего количества файлов."
|
||||
"translation": "Неверные идентификаторы файлов. Обратите внимание, что загрузка ограничена максимум 10 файлами. Пожалуйста, используйте дополнительные сообщения для большего количества файлов."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4616,7 +4616,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Dosya kodları geçersiz. Bir iletide en çok 5 dosya yüklenebileceğini unutmayın. Daha fazla dosya yüklemek için ek iletiler gönderin."
|
||||
"translation": "Dosya kodları geçersiz. Bir iletide en çok 10 dosya yüklenebileceğini unutmayın. Daha fazla dosya yüklemek için ek iletiler gönderin."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4621,7 +4621,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
|
||||
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files."
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -4611,7 +4611,7 @@
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.file_ids.app_error",
|
||||
"translation": "无效的文件 id。上传只允许最多 5 个文件。请考虑创建新的消息以上传更多文件。"
|
||||
"translation": "无效的文件 id。上传只允许最多 10 个文件。请考虑创建新的消息以上传更多文件。"
|
||||
},
|
||||
{
|
||||
"id": "model.post.is_valid.filenames.app_error",
|
||||
|
||||
@@ -45,7 +45,8 @@ const (
|
||||
POST_EPHEMERAL = "system_ephemeral"
|
||||
POST_CHANGE_CHANNEL_PRIVACY = "system_change_chan_privacy"
|
||||
POST_ADD_BOT_TEAMS_CHANNELS = "add_bot_teams_channels"
|
||||
POST_FILEIDS_MAX_RUNES = 150
|
||||
POST_MAX_FILES = 10
|
||||
POST_FILEIDS_MAX_RUNES = 300
|
||||
POST_FILENAMES_MAX_RUNES = 4000
|
||||
POST_HASHTAGS_MAX_RUNES = 1000
|
||||
POST_MESSAGE_MAX_RUNES_V1 = 4000
|
||||
@@ -325,10 +326,14 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(ArrayToJson(o.FileIds)) > POST_FILEIDS_MAX_RUNES {
|
||||
if len(o.FileIds) > POST_MAX_FILES {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.file_ids.app_error", nil, "id="+o.Id, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(ArrayToJson(o.FileIds)) > POST_FILEIDS_MAX_RUNES {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.file_ids.app_error", nil, "id="+o.Id, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(StringInterfaceToJson(o.GetProps())) > POST_PROPS_MAX_RUNES {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ CREATE TABLE `Posts` (
|
||||
`Props` text,
|
||||
`Hashtags` text,
|
||||
`Filenames` text,
|
||||
`FileIds` varchar(150) DEFAULT NULL,
|
||||
`FileIds` varchar(300) DEFAULT NULL,
|
||||
`HasReactions` tinyint(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `idx_posts_update_at` (`UpdateAt`),
|
||||
|
||||
@@ -398,7 +398,7 @@ CREATE TABLE public.posts (
|
||||
props character varying(8000),
|
||||
hashtags character varying(1000),
|
||||
filenames character varying(4000),
|
||||
fileids character varying(150),
|
||||
fileids character varying(300),
|
||||
hasreactions boolean
|
||||
);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ func newSqlPostStore(sqlStore *SqlStore, metrics einterfaces.MetricsInterface) s
|
||||
table.ColMap("Hashtags").SetMaxSize(1000)
|
||||
table.ColMap("Props").SetMaxSize(8000)
|
||||
table.ColMap("Filenames").SetMaxSize(model.POST_FILENAMES_MAX_RUNES)
|
||||
table.ColMap("FileIds").SetMaxSize(150)
|
||||
table.ColMap("FileIds").SetMaxSize(300)
|
||||
}
|
||||
|
||||
return s
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
CURRENT_SCHEMA_VERSION = VERSION_5_30_0
|
||||
VERSION_5_31_0 = "5.31.0"
|
||||
VERSION_5_30_0 = "5.30.0"
|
||||
VERSION_5_29_0 = "5.29.0"
|
||||
VERSION_5_28_1 = "5.28.1"
|
||||
@@ -194,6 +195,7 @@ func upgradeDatabase(sqlStore *SqlStore, currentModelVersionString string) error
|
||||
upgradeDatabaseToVersion5281(sqlStore)
|
||||
upgradeDatabaseToVersion529(sqlStore)
|
||||
upgradeDatabaseToVersion530(sqlStore)
|
||||
upgradeDatabaseToVersion531(sqlStore)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -949,3 +951,11 @@ func upgradeDatabaseToVersion530(sqlStore *SqlStore) {
|
||||
saveSchemaVersion(sqlStore, VERSION_5_30_0)
|
||||
}
|
||||
}
|
||||
|
||||
func upgradeDatabaseToVersion531(sqlStore *SqlStore) {
|
||||
// if shouldPerformUpgrade(sqlStore, VERSION_5_30_0, VERSION_5_31_0) {
|
||||
// allow 10 files per post
|
||||
sqlStore.AlterColumnTypeIfExists("Posts", "FileIds", "text", "varchar(300)")
|
||||
// saveSchemaVersion(sqlStore, VERSION_5_31_0)
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user