Skip to content

Commit

Permalink
Allow plugins for non-premium
Browse files Browse the repository at this point in the history
  • Loading branch information
Arie committed May 11, 2020
1 parent a1cf52a commit 2ae1a89
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion app/behaviour/reservation_validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def self.included(mod)
validates_with Reservations::OnlyOneFutureReservationPerUserValidator, unless: :donator?
validates_with Reservations::StartsNotTooFarInFutureValidator, unless: :donator?
validates_with Reservations::MapIsValidValidator
validates_with Reservations::PluginsDisabledValidator, unless: :gameye?
validates_with Reservations::GameyeLocationSelectedValidator, if: :gameye?
validates_with Reservations::CustomWhitelistValidator

Expand Down
11 changes: 0 additions & 11 deletions app/validators/reservations/plugins_disabled_validator.rb

This file was deleted.

6 changes: 3 additions & 3 deletions app/views/reservations/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
= f.input :rcon, as: :string, placeholder: "The RCON password to control the server", disabled: !@reservation.schedulable?
= f.input :first_map, collection: MapUpload.available_maps, :input_html => { :class => "select2" }, disabled: !@reservation.schedulable?
= f.input :tv_password, as: :string, placeholder: "Password for STV, default tv", disabled: !@reservation.schedulable?
= f.input :enable_plugins, as: :boolean, hint: "Enable SOAP DM and MGE (premium only)", disabled: (!current_user.donator? || !@reservation.schedulable? )
= f.input :enable_demos_tf, as: :boolean, hint: "Enable uploading STVs to demos.tf (and get SOAP+MGE too for free)", disabled: !@reservation.schedulable?
= f.input :enable_plugins, as: :boolean, hint: "Enable plugins", disabled: !@reservation.schedulable?
= f.input :enable_demos_tf, as: :boolean, hint: "Enable uploading STVs to demos.tf", disabled: !@reservation.schedulable?
= f.association :server_config, collection: ServerConfig.ordered, hint: "Specify a league config to run on each map start", input_html: { class: "select2" }
= f.input :whitelist_type, :label => "Item whitelist" do
.form-control.whitelist
Expand Down Expand Up @@ -74,5 +74,5 @@
= render "datepicker_javascript_options"

:javascript
var canEnablePlugins = #{(!current_user.donator? || !@reservation.schedulable? )};
var canEnablePlugins = #{@reservation.schedulable?};
var reservationSchedulable = #{@reservation.schedulable?}
5 changes: 1 addition & 4 deletions spec/models/reservation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,9 @@
reservation.should have(1).errors_on(:server_id)
end

it "doesn't allow plugins for non donators" do
it "allows plugins for non donators" do
reservation = build :reservation
reservation.enable_plugins = true
reservation.should have(1).errors_on(:enable_plugins)

reservation.user.stub(donator?: true)
reservation.should have(:no).errors_on(:enable_plugins)
end

Expand Down

0 comments on commit 2ae1a89

Please sign in to comment.