<commit_before>TentStatus.Models.StatusPost = class StatusPostModel extends TentStatus.Models.Post
  @model_name: 'post'
  @post_type: new TentClient.PostType(TentStatus.config.POST_TYPES.STATUS)

  @validate: (attrs, options = {}) ->
    errors = []

    if (attrs.content?.text and attrs.content.text.match /^[\s\r\t]*$/) || (options.validate_empty and attrs.content?.text == "")
      errors.push { text: 'Status must not be empty' }

    if attrs.content?.text and TentStatus.Helpers.numChars(attrs.content.text) > TentStatus.config.MAX_STATUS_LENGTH
      errors.push { text: "Status must be no more than #{TentStatus.config.MAX_STATUS_LENGTH} characters" }

    return errors if errors.length
    null

  fetchReplies: (options = {}) =>
    collection = TentStatus.Collections.StatusReplies.find(entity: @get('entity'), post_id: @get('id'))

    unless collection
      collection = new TentStatus.Collections.StatusReplies(entity: @get('entity'), post_id: @get('id'))

      # Handle updating collection when replying to the post
      TentStatus.Models.StatusPost.on 'create:success', (post, xhr) =>
        return unless post.get('type') is TentStatus.config.POST_TYPES.STATUS_REPLY<commit_msg>Fix posts count in profile<commit_after>TentStatus.Models.StatusPost = class StatusPostModel extends TentStatus.Models.Post
  @model_name: 'post'
  @post_type: new TentClient.PostType(TentStatus.config.POST_TYPES.STATUS)

  @validate: (attrs, options = {}) ->
    errors = []

    if (attrs.content?.text and attrs.content.text.match /^[\s\r\t]*$/) || (options.validate_empty and attrs.content?.text == "")
      errors.push { text: 'Status must not be empty' }

    if attrs.content?.text and TentStatus.Helpers.numChars(attrs.content.text) > TentStatus.config.MAX_STATUS_LENGTH
      errors.push { text: "Status must be no more than #{TentStatus.config.MAX_STATUS_LENGTH} characters" }

    return errors if errors.length
    null

  @fetchCount: (params, options = {}) ->
    params.types ?= [
      @post_type.toStringWithoutFragment()
    ]

    super(params, options)

  fetchReplies: (options = {}) =>
    collection = TentStatus.Collections.StatusReplies.find(entity: @get('entity'), post_id: @get('id'))

    unless collection
      collection = new TentStatus.Collections.StatusReplies(entity: @get('entity'), post_id: @get('id'))

      # Handle updating collection when replying to the post
      TentStatus.Models.StatusPost.on 'create:success', (post, xhr) =>
        return unless post.get('type') is TentStatus.config.POST_TYPES.STATUS_REPLY
{'fraction_non_alphanumeric': 0.1328125, 'fraction_numerical': 0.0, 'mean_word_length': 4.111776447105789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4224249', 'n_tokens_mistral': 788, 'n_tokens_neox': 794, 'n_words': 172}