Revert "MM-27312 Allow uploading 10 files per post (#16235)" (#16908)

This reverts commit 8e2986e5ed.
Этот коммит содержится в:
Claudio Costa
2021-02-10 20:19:05 +01:00
коммит произвёл GitHub
родитель d8b94836cf
Коммит 6b35b933a8
19 изменённых файлов: 19 добавлений и 25 удалений

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Ungültige Datei-Ids. Uploads sind auf maximal zehn Dateien begrenzt. Bitte verwenden Sie zusätzliche Nachrichten für mehr Dateien." "translation": "Ungültige Datei-Ids. Uploads sind auf maximal fünf Dateien begrenzt. Bitte verwenden Sie zusätzliche Nachrichten für mehr Dateien."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -7936,7 +7936,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files." "translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "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 10 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 5 archivos. Por favor utiliza mensajes adicionales para agregar más archivos."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"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." "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."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Id file non valido. I caricamenti sono limitati ad un massimo di 10 file. Utilizzare più pubblicazioni per più file." "translation": "Id file non valido. I caricamenti sono limitati ad un massimo di 5 file. Utilizzare più pubblicazioni per più file."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4547,7 +4547,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files." "translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files." "translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4557,7 +4557,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "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 10 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 5 plików. Użyj dodatkowych wpisów, aby uzyskać więcej plików."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"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." "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."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4557,7 +4557,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "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 10 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 5 fișiere. Utilizați postări suplimentare pentru mai multe fișiere."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4557,7 +4557,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Неверные идентификаторы файлов. Обратите внимание, что загрузка ограничена максимум 10 файлами. Пожалуйста, используйте дополнительные сообщения для большего количества файлов." "translation": "Неверные идентификаторы файлов. Обратите внимание, что загрузка ограничена максимум 5 файлами. Пожалуйста, используйте дополнительные сообщения для большего количества файлов."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4552,7 +4552,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"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." "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."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4557,7 +4557,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "Invalid file ids. Note that uploads are limited to 10 files maximum. Please use additional posts for more files." "translation": "Invalid file ids. Note that uploads are limited to 5 files maximum. Please use additional posts for more files."
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -4547,7 +4547,7 @@
}, },
{ {
"id": "model.post.is_valid.file_ids.app_error", "id": "model.post.is_valid.file_ids.app_error",
"translation": "无效的文件 id。上传只允许最多 10 个文件。请考虑创建新的消息以上传更多文件。" "translation": "无效的文件 id。上传只允许最多 5 个文件。请考虑创建新的消息以上传更多文件。"
}, },
{ {
"id": "model.post.is_valid.filenames.app_error", "id": "model.post.is_valid.filenames.app_error",

Просмотреть файл

@@ -45,8 +45,7 @@ const (
POST_EPHEMERAL = "system_ephemeral" POST_EPHEMERAL = "system_ephemeral"
POST_CHANGE_CHANNEL_PRIVACY = "system_change_chan_privacy" POST_CHANGE_CHANNEL_PRIVACY = "system_change_chan_privacy"
POST_ADD_BOT_TEAMS_CHANNELS = "add_bot_teams_channels" POST_ADD_BOT_TEAMS_CHANNELS = "add_bot_teams_channels"
POST_MAX_FILES = 10 POST_FILEIDS_MAX_RUNES = 150
POST_FILEIDS_MAX_RUNES = 300
POST_FILENAMES_MAX_RUNES = 4000 POST_FILENAMES_MAX_RUNES = 4000
POST_HASHTAGS_MAX_RUNES = 1000 POST_HASHTAGS_MAX_RUNES = 1000
POST_MESSAGE_MAX_RUNES_V1 = 4000 POST_MESSAGE_MAX_RUNES_V1 = 4000
@@ -340,12 +339,8 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
return NewAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id, http.StatusBadRequest) return NewAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id, http.StatusBadRequest)
} }
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 { 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) return NewAppError("Post.IsValid", "model.post.is_valid.file_ids.app_error", nil, "id="+o.Id, http.StatusBadRequest)
} }
if utf8.RuneCountInString(StringInterfaceToJson(o.GetProps())) > POST_PROPS_MAX_RUNES { if utf8.RuneCountInString(StringInterfaceToJson(o.GetProps())) > POST_PROPS_MAX_RUNES {

Просмотреть файл

@@ -626,7 +626,7 @@ CREATE TABLE `Posts` (
`Props` text, `Props` text,
`Hashtags` text, `Hashtags` text,
`Filenames` text, `Filenames` text,
`FileIds` varchar(300) DEFAULT NULL, `FileIds` varchar(150) DEFAULT NULL,
`HasReactions` tinyint(1) DEFAULT NULL, `HasReactions` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`Id`), PRIMARY KEY (`Id`),
KEY `idx_posts_update_at` (`UpdateAt`), KEY `idx_posts_update_at` (`UpdateAt`),

Просмотреть файл

@@ -398,7 +398,7 @@ CREATE TABLE public.posts (
props character varying(8000), props character varying(8000),
hashtags character varying(1000), hashtags character varying(1000),
filenames character varying(4000), filenames character varying(4000),
fileids character varying(300), fileids character varying(150),
hasreactions boolean hasreactions boolean
); );

Просмотреть файл

@@ -86,7 +86,7 @@ func newSqlPostStore(sqlStore *SqlStore, metrics einterfaces.MetricsInterface) s
table.ColMap("Hashtags").SetMaxSize(1000) table.ColMap("Hashtags").SetMaxSize(1000)
table.ColMap("Props").SetMaxSize(8000) table.ColMap("Props").SetMaxSize(8000)
table.ColMap("Filenames").SetMaxSize(model.POST_FILENAMES_MAX_RUNES) table.ColMap("Filenames").SetMaxSize(model.POST_FILENAMES_MAX_RUNES)
table.ColMap("FileIds").SetMaxSize(300) table.ColMap("FileIds").SetMaxSize(150)
} }
return s return s

Просмотреть файл

@@ -963,7 +963,6 @@ func upgradeDatabaseToVersion531(sqlStore *SqlStore) {
func upgradeDatabaseToVersion532(sqlStore *SqlStore) { func upgradeDatabaseToVersion532(sqlStore *SqlStore) {
// if shouldPerformUpgrade(sqlStore, Version5310, Version5320) { // if shouldPerformUpgrade(sqlStore, Version5310, Version5320) {
// allow 10 files per post // allow 10 files per post
sqlStore.AlterColumnTypeIfExists("Posts", "FileIds", "text", "varchar(300)")
sqlStore.CreateColumnIfNotExists("ThreadMemberships", "UnreadMentions", "bigint", "bigint", "0") sqlStore.CreateColumnIfNotExists("ThreadMemberships", "UnreadMentions", "bigint", "bigint", "0")
sqlStore.CreateColumnIfNotExistsNoDefault("Channels", "Shared", "tinyint(1)", "boolean") sqlStore.CreateColumnIfNotExistsNoDefault("Channels", "Shared", "tinyint(1)", "boolean")
sqlStore.CreateColumnIfNotExistsNoDefault("Reactions", "UpdateAt", "bigint", "bigint") sqlStore.CreateColumnIfNotExistsNoDefault("Reactions", "UpdateAt", "bigint", "bigint")