Skip to content

Commit

Permalink
news: shared chats intros (fixes #7490) (#7491)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi committed Jun 18, 2024
1 parent 5265321 commit 52edb20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.14.44",
"version": "0.14.45",
"myplanet": {
"latest": "v0.15.86",
"latest": "v0.15.94",
"min": "v0.15.78"
},
"scripts": {
Expand Down
22 changes: 11 additions & 11 deletions src/app/news/news-list-item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
<mat-card-content>
<div [ngClass]="{'show-less': showLess}" #content>
<planet-markdown class="img-wrap" [content]="item.doc.message"></planet-markdown>
</div>
<span class="primary-text-color cursor-pointer" *ngIf="(showExpand || !showLess) && !item.latestMessage" (click)="showLess = !showLess" i18n>{{ showLess ? 'Show More' : 'Show Less' }}</span>
<ng-container *ngIf="item.doc.chat">
<div class="chat-container">
<div *ngFor="let conversation of item.doc.news.conversations">
<p class="conversation-query" [planetChatOutput]="conversation.query"></p>
<p [ngClass]="{'conversation-error': conversation.error, 'conversation-response': !conversation.error}" [planetChatOutput]="conversation.response"></p>
<ng-container *ngIf="item.doc.chat">
<div class="chat-container">
<div *ngFor="let conversation of item.doc.news.conversations">
<p class="conversation-query" [planetChatOutput]="conversation.query"></p>
<p [ngClass]="{'conversation-error': conversation.error, 'conversation-response': !conversation.error}" [planetChatOutput]="conversation.response"></p>
</div>
</div>
</div>
</ng-container>
<ng-template #mdRender>
</ng-template>
</ng-container>
</div>
<span class="primary-text-color cursor-pointer" *ngIf="(showExpand || !showLess) && !item.latestMessage" (click)="showLess = !showLess" i18n>
{{ showLess ? 'Show More' : 'Show Less' }}
</span>
</mat-card-content>
<mat-card-actions class="display-flex">
<button mat-button *ngIf="editable || item.public === true" type="button" (click)="addReply(item.doc)" i18n>Reply</button>
Expand Down
5 changes: 3 additions & 2 deletions src/app/news/news-list-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export class NewsListItemComponent implements OnInit, OnChanges, AfterViewChecke
}

ngAfterViewChecked() {
const offsetHeight = this.content && this.content.nativeElement.children[0].children[0].children[0].offsetHeight;
const showExpand = offsetHeight && (offsetHeight > this.content.nativeElement.clientHeight);
const contentHeight = this.content && this.content.nativeElement.scrollHeight;
const containerHeight = this.content && this.content.nativeElement.offsetHeight;
const showExpand = contentHeight > containerHeight;
if (showExpand !== this.showExpand) {
this.showExpand = showExpand;
this.cdRef.detectChanges();
Expand Down

0 comments on commit 52edb20

Please sign in to comment.