MOBILE-3833 forum: Display Q&A message for students
parent
1eab0204b0
commit
7383dc1974
|
@ -657,6 +657,7 @@
|
|||
"addon.mod_forum.posttoforum": "forum",
|
||||
"addon.mod_forum.posttomygroups": "forum",
|
||||
"addon.mod_forum.privatereply": "forum",
|
||||
"addon.mod_forum.qandanotify": "forum",
|
||||
"addon.mod_forum.re": "forum",
|
||||
"addon.mod_forum.refreshposts": "local_moodlemobileapp",
|
||||
"addon.mod_forum.removefromfavourites": "forum",
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
</ion-item>
|
||||
</ion-card>
|
||||
|
||||
<!-- Q&A message. -->
|
||||
<ion-card class="core-info-card" *ngIf="showQAMessage">
|
||||
<ion-item>
|
||||
<ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
|
||||
<ion-label>{{ 'addon.mod_forum.qandanotify' | translate }}</ion-label>
|
||||
</ion-item>
|
||||
</ion-card>
|
||||
|
||||
<ng-container *ngIf="forum">
|
||||
<core-empty-box *ngIf="!discussions || discussions.empty" icon="far-comments"
|
||||
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
||||
|
|
|
@ -85,6 +85,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
|||
sortOrders: AddonModForumSortOrder[] = [];
|
||||
canPin = false;
|
||||
hasOfflineRatings = false;
|
||||
showQAMessage = false;
|
||||
sortOrderSelectorModalOptions: ModalOptions = {
|
||||
component: AddonModForumSortOrderSelectorComponent,
|
||||
};
|
||||
|
@ -404,6 +405,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
|||
const cutoffDateReached = AddonModForumHelper.isCutoffDateReached(forum)
|
||||
&& !accessInfo.cancanoverridecutoff;
|
||||
this.canAddDiscussion = !!forum.cancreatediscussions && !cutoffDateReached;
|
||||
this.showQAMessage = forum.type === 'qanda' && !accessInfo.canviewqandawithoutposting;
|
||||
|
||||
return;
|
||||
}),
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
"posttoforum": "Post to forum",
|
||||
"posttomygroups": "Post a copy to all groups",
|
||||
"privatereply": "Reply privately",
|
||||
"qandanotify": "This is a question and answer forum. In order to see other responses to these questions, you must first post your answer",
|
||||
"re": "Re:",
|
||||
"refreshposts": "Refresh posts",
|
||||
"removefromfavourites": "Unstar this discussion",
|
||||
|
|
|
@ -84,6 +84,14 @@
|
|||
</ion-item>
|
||||
</ion-card>
|
||||
|
||||
<!-- Q&A message. -->
|
||||
<ion-card class="core-info-card" *ngIf="showQAMessage">
|
||||
<ion-item>
|
||||
<ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
|
||||
<ion-label>{{ 'addon.mod_forum.qandanotify' | translate }}</ion-label>
|
||||
</ion-item>
|
||||
</ion-card>
|
||||
|
||||
<div *ngIf="startingPost" class="ion-margin-bottom">
|
||||
<addon-mod-forum-post [post]="startingPost" [discussion]="discussion" [courseId]="courseId" [highlight]="true"
|
||||
[discussionId]="discussionId" [component]="component" [componentId]="cmId" [formData]="formData"
|
||||
|
|
|
@ -105,6 +105,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
|||
cmId?: number;
|
||||
canPin = false;
|
||||
availabilityMessage: string | null = null;
|
||||
showQAMessage = false;
|
||||
leavingPage = false;
|
||||
|
||||
protected forumId?: number;
|
||||
|
@ -493,6 +494,11 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
|||
});
|
||||
}
|
||||
|
||||
// Show Q&A message if user hasn't posted.
|
||||
const currentUserId = CoreSites.getCurrentSiteUserId();
|
||||
this.showQAMessage = forum.type === 'qanda' && !accessInfo.canviewqandawithoutposting &&
|
||||
!posts.some(post => post.author.id === currentUserId);
|
||||
|
||||
return;
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue