mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Added validation to check if user add image ou video and prevent to create publication withou it
This commit is contained in:
@@ -293,9 +293,9 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log(content)
|
||||
this.filecontent = true;
|
||||
let fileObject;
|
||||
if(this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||
if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,'+ content.data,
|
||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video'
|
||||
}
|
||||
@@ -405,6 +405,7 @@ export class NewPublicationPage implements OnInit {
|
||||
if (this.Form.invalid) return false
|
||||
|
||||
|
||||
if (this.seletedContent.length != 0) {
|
||||
|
||||
if (this.publicationType == '3') {
|
||||
const loader = this.toastService.loading()
|
||||
@@ -534,7 +535,6 @@ export class NewPublicationPage implements OnInit {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
|
||||
this.close();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
|
||||
@@ -551,6 +551,10 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
this.PublicationFolderService.getPublicationsIds(this.folderId)
|
||||
|
||||
} else {
|
||||
this.httpErrorHandle.validationMessagge("noFileSelected")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -741,7 +745,7 @@ export class NewPublicationPage implements OnInit {
|
||||
let resultUrl = decodeURIComponent(element.url);
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
let fileObject;
|
||||
if(this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
@@ -750,7 +754,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,'+ this.removeTextBeforeSlash(content.data, ','),
|
||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user