Skip to content
Snippets Groups Projects
Commit cdad2c4e authored by ncamera's avatar ncamera
Browse files

Arreglar traducciones en archivos.component

parent 19fcaaf4
No related branches found
No related tags found
1 merge request!1Se actualiza Angular a la versión 13 y se resuelven vulnerabilidades
......@@ -316,9 +316,7 @@ export class ArchivosComponent {
// Si el archivo es del alumno, se puede eliminar.
// No se controla por creador, dado que los compartidos mantienen este atributo
if (!this.archivos.some((arch) => arch.id == this.archivoSeleccionado.id)) {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noPermissionDelete").value
);
this.showNotification("warning", "i18n.warning.file.noPermissionDelete");
return;
}
......@@ -334,18 +332,14 @@ export class ArchivosComponent {
seleccionarDirectorioAMover() {
if (!this.archivoSeleccionado) {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noSelected").value
);
this.showNotification("warning", "i18n.warning.file.noSelected");
return;
}
// Si el archivo es del alumno, se puede mover.
// No se controla por creador, dado que los compartidos mantienen este atributo
if (!this.archivos.some((arch) => arch.id == this.archivoSeleccionado.id)) {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noPermissionMove").value
);
this.showNotification("warning", "i18n.warning.file.noPermissionMove");
return;
}
......@@ -447,51 +441,47 @@ export class ArchivosComponent {
};
cargarArchivo() {
if (this.archivoSeleccionado) {
if (this.archivoSeleccionado.directorio) {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noSelected").value,
false
);
if (!this.archivoSeleccionado) {
this.showNotification("warning", "i18n.warning.file.noSelected");
return;
}
if (this.archivoSeleccionado.directorio) {
this.translateService
.get("i18n.warning.file.noSelected")
.subscribe((res) => this.notifService.warning(res, false));
return;
}
// Si el archivo es compartido con el grupo, editabe y no lo he editado, lo voy a buscar al servidor.
if (
this.archivosCompartidos.some(
(arch) => arch.id == this.archivoSeleccionado.id
) &&
this.archivoSeleccionado.editable &&
this.archivoSeleccionado.archivoOrigenId == -1
) {
if (this.hayArchivoMio()) {
this.seleccionarArchivoMio();
this.sessionService.setArchivo(this.archivoSeleccionado);
this.router.navigate(["/matefun"]);
} else {
//Si el archivo es compartido con el grupo, editabe y no lo he editado, lo voy a buscar al servidor.
if (
this.archivosCompartidos.some(
(arch) => arch.id == this.archivoSeleccionado.id
) &&
this.archivoSeleccionado.editable &&
this.archivoSeleccionado.archivoOrigenId == -1
) {
if (this.hayArchivoMio()) {
this.seleccionarArchivoMio();
this.sessionService.setArchivo(this.archivoSeleccionado);
this.router.navigate(["/matefun"]);
} else {
let cedula = this.authService.getUser().cedula;
this.haskellService
.getCopiaArchivoCompartidoGrupo(
cedula,
this.archivoSeleccionado.id
)
.subscribe(
(archivo) => {
this.sessionService.setArchivo(archivo);
this.router.navigate(["/matefun"]);
},
(error) => {
console.log(error);
}
);
}
} else {
this.sessionService.setArchivo(this.archivoSeleccionado);
this.router.navigate(["/matefun"]);
}
let cedula = this.authService.getUser().cedula;
this.haskellService
.getCopiaArchivoCompartidoGrupo(cedula, this.archivoSeleccionado.id)
.subscribe(
(archivo) => {
this.sessionService.setArchivo(archivo);
this.router.navigate(["/matefun"]);
},
(error) => {
console.log(error);
}
);
}
} else {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noSelected").value
);
this.sessionService.setArchivo(this.archivoSeleccionado);
this.router.navigate(["/matefun"]);
}
}
......@@ -631,7 +621,7 @@ export class ArchivosComponent {
// Antes que nada, se chequea que empiece con mayúscula
if (!STARTS_WITH_CAPITAL_LETTER_REGEX.test(nombre)) {
alert(this.translateService.get("i18n.warning.file.capitalLetter").value);
this.showNotification("warning", "i18n.warning.file.capitalLetter");
return;
}
......@@ -760,9 +750,7 @@ export class ArchivosComponent {
const selectedGroup = event.detail;
if (!selectedGroup) {
this.notifService.error(
this.translateService.get("i18n.warning.group.select").value
);
this.showNotification("error", "i18n.warning.group.select");
return;
}
......@@ -770,9 +758,7 @@ export class ArchivosComponent {
.compartirArchivoGrupo(selectedGroup, this.archivoSeleccionado.id)
.subscribe(
() => {
this.notifService.success(
this.translateService.get("i18n.msg.file.shared").value
);
this.showNotification("success", "i18n.msg.file.shared");
// Cerrar el modal en caso de éxito
this.modalShareFileOpened = false;
......@@ -848,9 +834,7 @@ export class ArchivosComponent {
compartirArchivo() {
if (!this.archivoSeleccionado) {
this.notifService.warning(
this.translateService.get("i18n.warning.file.noSelected").value
);
this.showNotification("warning", "i18n.warning.file.noSelected");
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment