<commit_before>const dummyMembership = {
  save: () => {},
  dummy: true
}

module.exports = function checkAndSetMembership (req, res, next) {
  var communityId = req.param('communityId')
  // if no community id is specified, continue.
  // this is for Search, which can be limited to a specific community
  // or performed across all communities a user can access.
  if (!communityId) {
    return next()
  }

  return Community.findActive(communityId)
  .then(community => {
    if (!community) return res.notFound()

    var allowed
    res.locals.community = community
<commit_msg>make checkAndSetMembership pass when communityId='all'<commit_after>const dummyMembership = {
  save: () => {},
  dummy: true
}

module.exports = function checkAndSetMembership (req, res, next) {
  var communityId = req.param('communityId')
  // if no community id is specified, continue.
  // this is for routes that can be limited to a specific community
  // or performed across all communities a user can access, e.g. search and
  // getting a user's list of followed tags.
  if (!communityId || communityId === 'all') {
    return next()
  }

  return Community.findActive(communityId)
  .then(community => {
    if (!community) return res.notFound()

    var allowed
    res.locals.community = community

{'fraction_non_alphanumeric': 0.10733590733590734, 'fraction_numerical': 0.0, 'mean_word_length': 3.595744680851064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '654978', 'n_tokens_mistral': 381, 'n_tokens_neox': 363, 'n_words': 130}