Merge pull request #3548 from alfonso-salces/MOBILE-4251

MOBILE-4251 Feedback: Avoid displaying the preview button to students
main
Dani Palou 2023-02-17 08:17:24 +01:00 committed by GitHub
commit 2f8abd57bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View File

@ -2105,6 +2105,7 @@
"core.nopasswordchangeforced": "local_moodlemobileapp", "core.nopasswordchangeforced": "local_moodlemobileapp",
"core.nopermissionerror": "local_moodlemobileapp", "core.nopermissionerror": "local_moodlemobileapp",
"core.nopermissions": "error", "core.nopermissions": "error",
"core.nopermissiontoaccesspage": "error",
"core.noresults": "moodle", "core.noresults": "moodle",
"core.noselection": "form", "core.noselection": "form",
"core.notapplicable": "local_moodlemobileapp", "core.notapplicable": "local_moodlemobileapp",

View File

@ -36,7 +36,7 @@
<div collapsible-footer *ngIf="!showLoading" slot="fixed"> <div collapsible-footer *ngIf="!showLoading" slot="fixed">
<div class="list-item-limited-width adaptable-buttons-row" <div class="list-item-limited-width adaptable-buttons-row"
*ngIf="access && (access.canedititems || access.canviewreports || !access.isempty)"> *ngIf="access && !access.isempty && (access.canedititems || access.canviewreports)">
<ion-button expand="block" fill="outline" (click)="gotoAnswerQuestions(true)" class="ion-margin ion-text-wrap"> <ion-button expand="block" fill="outline" (click)="gotoAnswerQuestions(true)" class="ion-margin ion-text-wrap">
<ion-icon name="fas-search" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-search" slot="start" aria-hidden="true"></ion-icon>
{{ 'addon.mod_feedback.preview' | translate }} {{ 'addon.mod_feedback.preview' | translate }}

View File

@ -109,6 +109,14 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
await this.fetchData(); await this.fetchData();
if (!this.access || this.access.isempty || (!this.access.canedititems && !this.access.canviewreports)) {
CoreDomUtils.showErrorModal(Translate.instant('core.nopermissiontoaccesspage'));
CoreNavigator.back();
return;
}
if (!this.feedback) { if (!this.feedback) {
return; return;
} }

View File

@ -214,6 +214,7 @@
"nopasswordchangeforced": "You cannot proceed without changing your password.", "nopasswordchangeforced": "You cannot proceed without changing your password.",
"nopermissionerror": "Sorry, but you do not currently have permissions to do that", "nopermissionerror": "Sorry, but you do not currently have permissions to do that",
"nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).", "nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
"nopermissiontoaccesspage": "You don't have permission to access this page.",
"noresults": "No results", "noresults": "No results",
"noselection": "No selection", "noselection": "No selection",
"notapplicable": "n/a", "notapplicable": "n/a",