<commit_before>#
# Namespace for the Socializer engine
#
module Socializer
  class MembershipsController < ApplicationController
    before_action :authenticate_user
    before_action :set_membership, only: [:approve, :confirm, :decline]

    # POST /memberships
    def create
      @group = Group.find_by(id: params[:membership][:group_id])
      @group.join(current_user)
      redirect_to @group
    end

    # DELETE /memberships/1
    def destroy
      @membership = current_user.memberships.find_by(id: params[:id])
      @group = @membership.group
      @group.leave(current_user)
      redirect_to @group
    end

    # POST /memberships/1/approve
    def approve
      @membership.approve
      redirect_to @membership.group
    end

    # POST /memberships/1/confirm
    def confirm
      @membership.confirm
      redirect_to @membership.group
    end

    # POST /memberships/1/decline
    def decline
      @membership.decline
      redirect_to pending_invites_groups_path
    end

    private

    def set_membership
      @membership = Membership.find_by(id: params[:id])
    end
  end
end<commit_msg>change pending_invites_groups_path to groups_pending_invites_path<commit_after>#
# Namespace for the Socializer engine
#
module Socializer
  class MembershipsController < ApplicationController
    before_action :authenticate_user
    before_action :set_membership, only: [:approve, :confirm, :decline]

    # POST /memberships
    def create
      @group = Group.find_by(id: params[:membership][:group_id])
      @group.join(current_user)
      redirect_to @group
    end

    # DELETE /memberships/1
    def destroy
      @membership = current_user.memberships.find_by(id: params[:id])
      @group = @membership.group
      @group.leave(current_user)
      redirect_to @group
    end

    # POST /memberships/1/approve
    def approve
      @membership.approve
      redirect_to @membership.group
    end

    # POST /memberships/1/confirm
    def confirm
      @membership.confirm
      redirect_to @membership.group
    end

    # POST /memberships/1/decline
    def decline
      @membership.decline
      redirect_to groups_pending_invites_path
    end

    private

    def set_membership
      @membership = Membership.find_by(id: params[:id])
    end
  end
end
{'fraction_non_alphanumeric': 0.07874015748031496, 'fraction_numerical': 0.003499562554680665, 'mean_word_length': 2.970486111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4664544', 'n_tokens_mistral': 738, 'n_tokens_neox': 697, 'n_words': 154}