Skip to content

Commit

Permalink
Merge branch 'feature/fix-game-specific-issues' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
matortheeternal committed Jan 24, 2017
2 parents 8f51861 + 3011fa3 commit 0dea2a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ app.service('modListService', function(backend, $q, userTitleService, contributi
};

this.retrieveModList = function(modListId) {
return backend.retrieve('/mod_lists/' + modListId);
return backend.retrieve('/mod_lists/' + modListId, {
game: window._current_game_id
});
};

this.retrieveActiveModList = function() {
Expand Down
4 changes: 3 additions & 1 deletion mod-picker/app/assets/javascripts/BackendAPI/modService.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ app.service('modService', function(backend, $q, pageUtils, objectUtils, contribu

this.retrieveMod = function(modId) {
var action = $q.defer();
backend.retrieve('/mods/' + modId).then(function(data) {
backend.retrieve('/mods/' + modId, {
game: window._current_game_id
}).then(function(data) {
service.associateModImage(data.mod);
action.resolve(data);
}, function(response) {
Expand Down
3 changes: 2 additions & 1 deletion mod-picker/app/controllers/mod_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ModListsController < ApplicationController
before_action :check_sign_in, only: [:create, :set_active, :update, :import, :update_tags, :create_star, :destroy_star]
before_action :set_mod_list, only: [:show, :hide, :clone, :add, :update, :import, :update_tags, :tools, :mods, :plugins, :export_modlist, :export_plugins, :export_links, :config_files, :analysis, :comments]
before_action :set_mod_list, only: [:hide, :clone, :add, :update, :import, :update_tags, :tools, :mods, :plugins, :export_modlist, :export_plugins, :export_links, :config_files, :analysis, :comments]
before_action :soft_set_mod_list, only: [:set_active]

# GET /mod_lists
Expand All @@ -17,6 +17,7 @@ def index

# GET /mod_lists/1
def show
@mod_list = ModList.game(params[:game]).find(params[:id])
authorize! :read, @mod_list, message: "You are not allowed to view this mod list."
star = current_user.present? && ModListStar.exists?(mod_list_id: @mod_list.id, user_id: current_user.id)
render json: {
Expand Down
6 changes: 3 additions & 3 deletions mod-picker/app/controllers/mods_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def search

# GET /mods/1
def show
@mod = Mod.includes(:custom_sources, :plugins, {mod_authors: :user}, {tags: :submitter}, {required_mods: :required_mod}, {required_by: :mod}).find(params[:id])
@mod = Mod.game(params[:game]).includes(:custom_sources, :plugins, {mod_authors: :user}, {tags: :submitter}, {required_mods: :required_mod}, {required_by: :mod}).find(params[:id])
authorize! :read, @mod, message: "You are not allowed to view this mod."

# set up boolean variables
Expand All @@ -35,8 +35,8 @@ def show
incompatible = false
if current_user.present?
star = ModStar.exists?(mod_id: @mod.id, user_id: current_user.id)
if current_user.active_mod_list_id.present?
mod_list = current_user.active_mod_list
if current_user.active_mod_list(@mod.game_id).present?
mod_list = current_user.active_mod_list(@mod.game_id)
in_mod_list = mod_list.mod_list_mod_ids.include?(@mod.id)
incompatible = mod_list.incompatible_mod_ids.include?(@mod.id)
end
Expand Down

0 comments on commit 0dea2a7

Please sign in to comment.