All files / app/component/comment comment.component.html

30.13% Statements 66/219
31.7% Branches 26/82
0% Functions 0/14
38.8% Lines 52/134

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 2011x 3x   1x                                   1x                             1x       3x 1x       1x 3x                       3x 1x   1x 3x                               3x 1x   3x 3x     3x 1x                           3x                 1x 3x       1x       1x 3x     1x 1x   1x 3x       1x   3x       1x   3x   1x   3x     1x   3x       1x   3x     1x   3x     1x     1x 3x             1x 3x 3x         1x 3x     1x             1x           3x        
<ng-container *mobxAutorun>
  @if (collapsed) {
    <div class="comment-container info collapsed" tabindex="0">
      <span class="comment-expand fake-link" (click)="store.local.setRefToggled('comment:' + ref.url, !(collapsed = false))" i18n>[+]</span>&nbsp;
      @if (authors.length) {
        @if (authorExts$ | async; as xs) {
          @for (x of xs; track x.tag + x.origin) {
            <a class="user tag"
               [title]="formatAuthor(x.tag + x.origin)"
               [routerLink]="['/tag', x.tag + x.origin]"
               [appTitle]="x">{{ x.name || formatAuthor(x.tag + x.origin) }}</a>
          }
        } @else {
          @for (t of authors; track t) {
            <a class="user tag"
               [title]="formatAuthor(t)"
               [routerLink]="['/tag', t]">{{ formatAuthor(t) }}</a>
          }
        }
      }
      @if (store.view.isVoteSorted && admin.getPlugin('plugin/user/vote/up')) {
        <span class="vote-score" i18n>{{ score }} points&nbsp;</span>
      }
      <span [title]="ref.created?.toISO()">{{ ref.created?.toRelative() }}</span>
      @if (!modifiedIsSubmitted) {
        <span [title]="ref.modified!.toRelative()">* </span>
      }
      @for (icon of icons; track icon) {
        @if (showIcon(icon)) {
          <span class="icon"
                [class.filter-toggle]="icon.tag"
                (click)="clickIcon(icon, store.hotkey)"
                [appTitle]="icon"
                [ref]="ref">{{ icon.label }}</span>
        }
      }
      ({comments, plural, =1 {1&thinsp;child} other {{{ comments }}&thinsp;children}})
    </div>
  }
 
  @if (deleted && (comments || responses)) {
    <div class="comment-container info collapsed" tabindex="0" i18n>
      deleted comment
    </div>
  }
  <div class="row">
    @if (store.view.isVoteSorted && !collapsed && !deleted && store.account.user && admin.getPlugin('plugin/user/vote/up')) {
      <div class="voting">
        <div class="vote-up"
             [class.on]="upvote"
             (click)="voteUp()"></div>
        @if (admin.getPlugin('plugin/user/vote/down')) {
          <div class="vote-down"
               [class.on]="downvote"
               (click)="voteDown()"></div>
        }
      </div>
    }
    @if (!collapsed && !deleted) {
      <div class="comment-container" tabindex="0">
        <div class="info">
          <span class="comment-collapse fake-link" (click)="store.local.setRefToggled('comment:' + ref.url, !(collapsed = true))">[&ndash;]</span>&nbsp;
          @if (authors.length) {
            @if (authorExts$ | async; as xs) {
              @for (x of xs; track x.tag + x.origin) {
                <a class="user tag"
                   [title]="formatAuthor(x.tag + x.origin)"
                   [routerLink]="['/tag', x.tag + x.origin]"
                   [appTitle]="x">{{ x.name || formatAuthor(x.tag + x.origin) }}</a>
              }
            } @else {
              @for (t of authors; track t) {
                <a class="user tag"
                   [title]="formatAuthor(t)"
                   [routerLink]="['/tag', t]">{{ formatAuthor(t) }}</a>
              }
            }
          }
          @if (admin.getPlugin('plugin/user/vote/up')) {
            <span class="vote-score" i18n>{{ score }} points&nbsp;</span>
          }
          <span [title]="ref.created?.toISO()">{{ ref.created?.toRelative() }}</span>
          @if (!modifiedIsSubmitted) {
            <span [title]="'last edited ' + ref.modified!.toRelative()">* </span>
          }
          @if (tagged.length) {
            <span i18n> tagged
              @if (tagExts$ | async; as xs) {
                @for (x of xs; track x.tag) {
                  <a class="tag"
                     [routerLink]="['/tag', x.tag]"
                     [appTitle]="x.tag">{{ x.name || '#' + x.tag }}</a>
                }
              } @else {
                @for (t of tagged; track t) {
                  <a class="tag" [routerLink]="['/tag', t]">{{ t }}</a>
                }
              }
            </span>
          }
          @for (icon of icons; track icon) {
            @if (showIcon(icon)) {
              <span class="icon"
                    [class.filter-toggle]="icon.tag"
                    (click)="clickIcon(icon, store.hotkey)"
                    [appTitle]="icon"
                    [ref]="ref">{{ icon.label }}</span>
            }
          }
        </div>
        @if (editing) {
          <app-comment-edit #editComponent [ref]="ref"
                            [commentEdited$]="commentEdited$"></app-comment-edit>
        } @else {
          <app-viewer class="comment-body"
                      [expand]="false"
                      [ref]="ref"></app-viewer>
        }
        <div class="actions">
          <a [routerLink]="['/ref', ref.url, 'comments']"
             [queryParams]="{ origin: nonLocalOrigin }"
             (click)="store.view.preloadRef(ref)"
             i18n>permalink</a>
          <a class="fake-link"
             (click)="replying = !replying"
             i18n>reply</a>
          @if (responses) {
            <a [routerLink]="['/ref', ref.url, 'responses']"
               [queryParams]="{ origin: nonLocalOrigin }"
               (click)="store.view.preloadRef(ref)"
               i18n>{responses, plural, =1 {1&thinsp;citation} other {{{ responses }}&thinsp;citations}}</a>
          }
          @if (sources > 2) {
            <a [routerLink]="['/ref', ref.url, 'sources']"
               [queryParams]="{ origin: nonLocalOrigin }"
               (click)="store.view.preloadRef(ref)"
               i18n>{{ sources }}&thinsp;sources</a>
          }
          @if (writeAccess) {
            <a class="fake-link"
               (click)="editing = !editing" i18n>edit</a>
          }
          @if (store.account.mod || taggingAccess) {
            <app-confirm-action #action
                                [class.force-delete]="deleteAccess"
                                [action]="store.hotkey ? forceDelete$ : delete$" i18n>delete</app-confirm-action>
          }
          @if (taggingAccess) {
            <app-inline-tag #action
                            [action]="tag$"
                            [tags]="ref.tags"
                            i18n>tag</app-inline-tag>
          }
          @if (canInvoice) {
            <a [routerLink]="['/submit/invoice']"
               [queryParams]="{ url: ref.url }"
               i18n>invoice</a>
          }
          <app-action-list [ref]="ref"
                           [showDownload]="false"
                           [groupedActions]="groupedActions"></app-action-list>
        </div>
      </div>
    }
  </div>
  @if (replying) {
    <app-comment-reply #replyComponent [autofocus]="true"
                       [to]="ref"
                       [showCancel]="true"
                       [tags]="replyTags"
                       (save)="newComments$.next($event)"></app-comment-reply>
  }
  <div class="comment-children"
       [class.hidden-without-removing]="collapsed">
    <app-comment-thread #threadComponent [source]="ref.url"
                        [scrollToLatest]="scrollToLatest"
                        [depth]="depth! - 1"
                        [context]="context + 1"
                        [newComments$]="newComments$"></app-comment-thread>
  </div>
  @if (!collapsed && ((depth === 1 && comments) || moreComments)) {
    @if (context < maxContext) {
      <span class="fake-link load-more no-select"
            (click)="loadMore()" i18n>
        load more comments
      </span>
    } @else {
      <a class="load-more"
         [routerLink]="['/ref', ref.url, 'comments']"
         [queryParams]="{ origin: nonLocalOrigin }"
         (click)="store.view.preloadRef(ref)" i18n>
        continue this thread
      </a>
    }
  }
 
  @for (e of serverError; track e) {
    <div class="error">{{ e }}</div>
  }
</ng-container>