<commit_before>{ parse, format } = require 'url'

#
# Checks for the presence of a microsite flag in the query string,
# as well as query params for fair_id, fair_name, and profile_id,
# then sets up the locals such that there are the needed skeleton
# models for rendering the fair header and attaching a search view to it
#

module.exports = (req, res, next) ->
  microsite = res.locals.sd.MICROSITE =
    (qs = req.query).microsite? and qs.fair_id? and qs.fair_name? and qs.profile_id?

  if microsite
    Profile   = require '../../models/profile.coffee'
    Fair      = require '../../models/fair.coffee'

    fair = res.locals.micrositeFair = new Fair
      id: qs.fair_id
      name: qs.fair_name
      organizer: profile_id: qs.profile_id

    image_url   = "#{res.locals.sd.ARTSY_URL}/api/v1/profile/#{qs.profile_id}/image"
    image_url   = image_url + "?xapp_token=#{res.locals.sd.ARTSY_XAPP_TOKEN}" if res.locals.sd.ARTSY_XAPP_TOKEN?

    profile = res.locals.micrositeProfile = new Profile id: qs.profile_id, image_url: image_url

    res.locals.sd.MICROSITE_FAIR      = fair.toJSON()
    res.locals.sd.MICROSITE_PROFILE   = profile.toJSON()

  next()
<commit_msg>Always hide the default Artsy logo header in the microsite context<commit_after>{ parse, format } = require 'url'

#
# Checks for the presence of a microsite flag in the query string,
# as well as query params for fair_id, fair_name, and profile_id,
# then sets up the locals such that there are the needed skeleton
# models for rendering the fair header and attaching a search view to it
#

module.exports = (req, res, next) ->
  microsite = res.locals.sd.MICROSITE =
    (qs = req.query).microsite? and qs.fair_id? and qs.fair_name? and qs.profile_id?

  if microsite
    Profile   = require '../../models/profile.coffee'
    Fair      = require '../../models/fair.coffee'

    fair = res.locals.micrositeFair = new Fair
      id: qs.fair_id
      name: qs.fair_name
      organizer: profile_id: qs.profile_id

    image_url   = "#{res.locals.sd.ARTSY_URL}/api/v1/profile/#{qs.profile_id}/image"
    image_url   = image_url + "?xapp_token=#{res.locals.sd.ARTSY_XAPP_TOKEN}" if res.locals.sd.ARTSY_XAPP_TOKEN?

    profile = res.locals.micrositeProfile = new Profile id: qs.profile_id, image_url: image_url

    res.locals.sd.MICROSITE_FAIR      = fair.toJSON()
    res.locals.sd.MICROSITE_PROFILE   = profile.toJSON()
    res.locals.sd.HIDE_HEADER         = true

  next()

{'fraction_non_alphanumeric': 0.11174551386623165, 'fraction_numerical': 0.0008156606851549756, 'mean_word_length': 3.280977312390925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6251476', 'n_tokens_mistral': 897, 'n_tokens_neox': 852, 'n_words': 222}