<commit_before>module Mconf
  module ApprovalModule

    def self.included base
      base.before_create :automatically_approve, unless: :require_approval?
    end

    def automatically_approve
      self.approved = true
    end

    # Starts the process of sending a notification to the model that was approved.
    def create_approval_notification(approved_by)
      create_activity 'approved', owner: approved_by
    end

    def approve!
      update_attributes(approved: true)
    end

    # Sets the user as not approved
    def disapprove!
      update_attributes(approved: false)
    end

    # Should be overrided in the model to denote whether it needs to be approved
    def needs_approval?
      false
    end
  end
end<commit_msg>The reference to the user that approved the space is now stored.<commit_after>module Mconf
  module ApprovalModule

    def self.included base
      base.before_create :automatically_approve, unless: :require_approval?
    end

    def automatically_approve
      self.approved = true
    end

    # Starts the process of sending a notification to the model that was approved.
    def create_approval_notification(approved_by)
      create_activity 'approved', owner: approved_by, recipient: approved_by, parameters: {:username => approved_by.name }
    end

    def approve!
      update_attributes(approved: true)
    end

    # Sets the user as not approved
    def disapprove!
      update_attributes(approved: false)
    end

    # Should be overrided in the model to denote whether it needs to be approved
    def needs_approval?
      false
    end
  end
end
{'fraction_non_alphanumeric': 0.045369794903666875, 'fraction_numerical': 0.0, 'mean_word_length': 3.0966921119592876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '95140', 'n_tokens_mistral': 455, 'n_tokens_neox': 423, 'n_words': 161}