<commit_before>define [
  'Backbone'
  'jquery'
  'i18n!external_tools'
  'str/htmlEscape'
  'jst/ExternalTools/RateToolView'
  'compiled/models/AppReview'
], (Backbone, $, I18n, htmlEscape, template, AppReview) ->

  class RateToolView extends Backbone.View
    template: template
    tagName: 'form'
    id: 'rate_app_form'

    els:
      '#rate-app-star': '$rateAppStar'
      'textarea[name="review_text"]': '$reviewText'

    afterRender: ->
      @$reviewText.html(@model.get('comments'))

      @$rateAppStar.raty
        path     : '/images/raty/'
        size     : 24
        starOff  : 'star-off-big.png'
        starOn   : 'star-on-big.png'
        score    : @model.get('rating')
        click: (score, evt) ->
          $('.alert-error').remove()

      @$el.dialog(
        title: I18n.t 'dialog_title_rate_tool', 'How do you rate this tool?'
        width: 520
        height: "auto"
        resizable: true
        close: => @$el.remove()
        buttons: [
          text: I18n.t('buttons.cancel', 'Cancel')
          click: -> $(this).dialog('close')
        ,<commit_msg>prevent self-XSS when rating an app, fixes CNVS-17657<commit_after>define [
  'Backbone'
  'jquery'
  'i18n!external_tools'
  'str/htmlEscape'
  'jst/ExternalTools/RateToolView'
  'compiled/models/AppReview'
], (Backbone, $, I18n, htmlEscape, template, AppReview) ->

  class RateToolView extends Backbone.View
    template: template
    tagName: 'form'
    id: 'rate_app_form'

    els:
      '#rate-app-star': '$rateAppStar'
      'textarea[name="review_text"]': '$reviewText'

    afterRender: ->
      @$reviewText.val(@model.get('comments'))

      @$rateAppStar.raty
        path     : '/images/raty/'
        size     : 24
        starOff  : 'star-off-big.png'
        starOn   : 'star-on-big.png'
        score    : @model.get('rating')
        click: (score, evt) ->
          $('.alert-error').remove()

      @$el.dialog(
        title: I18n.t 'dialog_title_rate_tool', 'How do you rate this tool?'
        width: 520
        height: "auto"
        resizable: true
        close: => @$el.remove()
        buttons: [
          text: I18n.t('buttons.cancel', 'Cancel')
          click: -> $(this).dialog('close')
        ,
{'fraction_non_alphanumeric': 0.15519568151147098, 'fraction_numerical': 0.013945119208277103, 'mean_word_length': 2.289940828402367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1214568', 'n_tokens_mistral': 781, 'n_tokens_neox': 749, 'n_words': 143}