Allocating a response (comment)

(Evgeny) #1

I try to bring out (for testing) posts that are comments.

import { withPluginApi } from 'discourse/lib/plugin-api';
import RawHtml from 'discourse/widgets/raw-html';

//TABLE posts: reply_to_post_number integer

function attachSignature(api) {

  api.decorateWidget('post-contents:after-cooked', dec => {

    const attrs = dec.attrs;
    if (Ember.isEmpty(attrs.reply_to_post_number)) { return; }

    const currentUser = api.getCurrentUser();
    if (currentUser) {
    return new RawHtml({html: `<div class='reply-comm'>This is a comment on the number: ${attrs.reply_to_post_number}</div>`});

You can tell whether this code is written correctly?

Or I need to add a condition: if reply_to_post_number > 1 (or 0, Null ...)

Continuation: Adding to the comment css tags