<commit_before>class WishlistAbility

  # Stuff like class AbilityDecorator goes here.

  include CanCan::Ability

  def initialize(user)
    # Anyone can create a wishlist
    can :index, Spree::Wishlist do
      !user.new_record?
    end

    can :create, Spree::Wishlist
    # You can your own wishlists, and everyone cas see public ones
    can :read, Spree::Wishlist do |wishlist|
      wishlist.user == user || wishlist.is_public?
    end
    # You can only change your own wishlist
    can [:read, :move, :update, :edit, :destroy], Spree::Wishlist do |wishlist|
      wishlist.user == user
    end

    can :create, Spree::WishedProduct do |wished_product|
      !user.new_record?
    end

    can :read, Spree::WishedProduct do |wished_product|
      wished_product.wishlist.user == user || wished_product.wishlist.is_public?
    end
    can [:index, :update, :delete], Spree::WishedProduct do |wished_product|
      wished_product.wishlist.user == user
    end
  end
end

<commit_msg>The correct check is for destroy not delete<commit_after>class WishlistAbility

  # Stuff like class AbilityDecorator goes here.

  include CanCan::Ability

  def initialize(user)
    # Anyone can create a wishlist
    can :index, Spree::Wishlist do
      !user.new_record?
    end

    can :create, Spree::Wishlist
    # You can your own wishlists, and everyone cas see public ones
    can :read, Spree::Wishlist do |wishlist|
      wishlist.user == user || wishlist.is_public?
    end
    # You can only change your own wishlist
    can [:read, :move, :update, :edit, :destroy], Spree::Wishlist do |wishlist|
      wishlist.user == user
    end

    can :create, Spree::WishedProduct do |wished_product|
      !user.new_record?
    end

    can :read, Spree::WishedProduct do |wished_product|
      wished_product.wishlist.user == user || wished_product.wishlist.is_public?
    end
    can [:index, :update, :destroy], Spree::WishedProduct do |wished_product|
      wished_product.wishlist.user == user
    end
  end
end


{'fraction_non_alphanumeric': 0.09519087754090233, 'fraction_numerical': 0.0, 'mean_word_length': 3.3119658119658117, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3707444', 'n_tokens_mistral': 668, 'n_tokens_neox': 660, 'n_words': 193}