Commit a83bdf0b authored by Marcelo Rivera's avatar Marcelo Rivera Committed by Mark Harding
Browse files

[Sprint/HipsterHedgehog] (fix): only scroll bottom on new message if already on bottom

parent 609b05c1
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -202,6 +202,9 @@ export class CommentsThreadComponent {
            parent_path: parent_path,
            parent_path: parent_path,
        });
        });


        // if the list is scrolled to the bottom
        let scrolledToBottom = this.scrollView.nativeElement.scrollTop + this.scrollView.nativeElement.clientHeight >= this.scrollView.nativeElement.scrollHeight;

        if (comment) {
        if (comment) {
          await this.loadBlockedUsers();
          await this.loadBlockedUsers();
          this.comments.push(comment);
          this.comments.push(comment);
@@ -209,8 +212,11 @@ export class CommentsThreadComponent {


        this.detectChanges();
        this.detectChanges();


        if (scrolledToBottom) {
          this.commentsScrollEmitter.emit('bottom');
          this.commentsScrollEmitter.emit('bottom');
          this.scrollToBottom.next(true);
          this.scrollToBottom.next(true);
        }

      } catch (err) { };
      } catch (err) { };
    });
    });