MOBILE-3205 forum: Hide subject on replies when not modified

main
Pau Ferrer Ocaña 2019-10-29 11:46:38 +01:00
parent 4bc90e892a
commit 6a262fd101
5 changed files with 27 additions and 9 deletions

View File

@ -70,9 +70,9 @@
</button>
</div>
<div class="addon-mod-forum-discussion-info">
<ion-avatar core-user-avatar [user]="discussion" item-start [courseId]="courseId"></ion-avatar>
<ion-avatar *ngIf="discussion.userfullname" core-user-avatar [user]="discussion" item-start [courseId]="courseId"></ion-avatar>
<div class="addon-mod-forum-discussion-author">
<h3>{{discussion.userfullname}}</h3>
<h3 *ngIf="discussion.userfullname">{{discussion.userfullname}}</h3>
<p *ngIf="discussion.groupname"><ion-icon name="people"></ion-icon> {{ discussion.groupname }}</p>
<p>{{discussion.created * 1000 | coreFormatDate: "strftimerecentfull"}}</p>
</div>

View File

@ -1,24 +1,24 @@
<div class="addon-mod_forum-post">
<ion-card-header text-wrap no-padding id="addon-mod_forum-post-{{post.id}}">
<ion-item text-wrap>
<div class="addon-mod-forum-post-title">
<div class="addon-mod-forum-post-title" *ngIf="displaySubject">
<h2 text-wrap>
<core-icon name="fa-map-pin" *ngIf="post.parent == 0 && post.pinned"></core-icon>
<core-icon name="fa-star" class="addon-forum-star" *ngIf="post.parent == 0 && !post.pinned && post.starred"></core-icon>
<core-format-text [text]="post.subject" contextLevel="module" [contextInstanceId]="forum && forum.cmid" [courseId]="courseId"></core-format-text>
</h2>
<ion-note float-end padding-left text-end *ngIf="trackPosts && !post.postread" [attr.aria-label]="'addon.mod_forum.unread' | translate">
<core-icon name="fa-circle" color="primary"></core-icon>
</ion-note>
</div>
<div class="addon-mod-forum-post-info">
<ion-avatar core-user-avatar [user]="post" item-start [courseId]="courseId"></ion-avatar>
<ion-avatar *ngIf="post.userfullname" core-user-avatar [user]="post" item-start [courseId]="courseId"></ion-avatar>
<div class="addon-mod-forum-post-author">
<h3>{{post.userfullname}}</h3>
<h3 *ngIf="post.userfullname">{{post.userfullname}}</h3>
<p *ngIf="post.groupname"><ion-icon name="people"></ion-icon> {{ post.groupname }}</p>
<p *ngIf="post.modified">{{post.modified * 1000 | coreFormatDate: "strftimerecentfull"}}</p>
<p *ngIf="!post.modified"><ion-icon name="time"></ion-icon> {{ 'core.notsent' | translate }}</p>
</div>
<ion-note float-end padding-left text-end *ngIf="trackPosts && !post.postread" [attr.aria-label]="'addon.mod_forum.unread' | translate">
<core-icon name="fa-circle" color="primary"></core-icon>
</ion-note>
</div>
</ion-item>
</ion-card-header>

View File

@ -42,6 +42,15 @@ ion-app.app-root addon-mod-forum-post .addon-mod_forum-post {
display: flex;
align-items: center;
}
.addon-mod-forum-post-info {
margin-top: 8px;
}
.addon-mod-forum-post-title + .addon-mod-forum-post-info {
margin-top: 0px;
}
.addon-mod-forum-post-title h2,
.addon-mod-forum-post-info .addon-mod-forum-post-author {
flex-grow: 1;

View File

@ -54,6 +54,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy {
uniqueId: string;
advanced = false; // Display all form fields.
tagsEnabled: boolean;
displaySubject = true;
protected syncId: string;
@ -78,6 +79,11 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy {
*/
ngOnInit(): void {
this.uniqueId = this.post.id ? 'reply' + this.post.id : 'edit' + this.post.parent;
const reTranslated = this.translate.instant('addon.mod_forum.re');
this.displaySubject = this.post.parent == 0 ||
(this.post.subject != this.defaultSubject && this.post.subject != 'Re: ' + this.defaultSubject &&
this.post.subject != reTranslated + this.defaultSubject);
}
/**

View File

@ -61,7 +61,7 @@ export class CoreFilesComponent implements OnInit, DoCheck {
*/
ngDoCheck(): void {
if (this.utils.isTrueOrOne(this.showInline)) {
// Check if there's any change in the extraData object.
// Check if there's any change in the files array.
const changes = this.differ.diff(this.files);
if (changes) {
this.renderInlineFiles();
@ -69,6 +69,9 @@ export class CoreFilesComponent implements OnInit, DoCheck {
}
}
/**
* Calculate contentText based on fils that can be rendered inline.
*/
protected renderInlineFiles(): void {
this.contentText = this.files.reduce((previous, file) => {
const text = this.mimetypeUtils.getEmbeddedHtml(file);