Skip to content

Commit 2f8abd5

Browse files
authored
Merge pull request #3548 from alfonso-salces/MOBILE-4251
MOBILE-4251 Feedback: Avoid displaying the preview button to students
2 parents f84a0c6 + 87a0721 commit 2f8abd5

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

scripts/langindex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,7 @@
21052105
"core.nopasswordchangeforced": "local_moodlemobileapp",
21062106
"core.nopermissionerror": "local_moodlemobileapp",
21072107
"core.nopermissions": "error",
2108+
"core.nopermissiontoaccesspage": "error",
21082109
"core.noresults": "moodle",
21092110
"core.noselection": "form",
21102111
"core.notapplicable": "local_moodlemobileapp",

src/addons/mod/feedback/components/index/addon-mod-feedback-index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

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

src/addons/mod/feedback/pages/form/form.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
109109

110110
await this.fetchData();
111111

112+
if (!this.access || this.access.isempty || (!this.access.canedititems && !this.access.canviewreports)) {
113+
CoreDomUtils.showErrorModal(Translate.instant('core.nopermissiontoaccesspage'));
114+
115+
CoreNavigator.back();
116+
117+
return;
118+
}
119+
112120
if (!this.feedback) {
113121
return;
114122
}

src/core/lang.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
"nopasswordchangeforced": "You cannot proceed without changing your password.",
215215
"nopermissionerror": "Sorry, but you do not currently have permissions to do that",
216216
"nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}}).",
217+
"nopermissiontoaccesspage": "You don't have permission to access this page.",
217218
"noresults": "No results",
218219
"noselection": "No selection",
219220
"notapplicable": "n/a",

0 commit comments

Comments
 (0)