Skip to content
Repos

DevPlaceApp

C++ 739 B25 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-posts 5.1 (callbacks receive the comment). A small copy of the comment fields the callbacks need, so
// closures built every frame do not copy whole comment trees.
#include <string>

#include "model/Comment.hpp"
#include "model/Vote.hpp"

namespace dp {

struct CommentRef {
  std::string id;          // Comment.data.id (API id)
  std::string prefixedId;  // Comment.id ("comment:" + data.id), anchors and reply targets
  std::string userId;
  std::string targetType;
  std::string targetId;
  std::string content;
  Vote myVote;

  static CommentRef from(const Comment& c) {
    return {c.data.id, c.id(), c.data.userId, c.data.targetType, c.data.targetId, c.data.content, c.myVote};
  }
};

}  // namespace dp
43.4ms