Skip to content

Commit

Permalink
Merge pull request #137 from matortheeternal/dev
Browse files Browse the repository at this point in the history
Public Beta Hotfix Release v1.0.1
  • Loading branch information
matortheeternal authored Nov 16, 2016
2 parents ef14434 + 5d6358d commit 410fb4c
Show file tree
Hide file tree
Showing 55 changed files with 408 additions and 268 deletions.
35 changes: 35 additions & 0 deletions design/reputation abilities.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Not Banned
Comment on things. Star things. Update user settings/profile page.

Not restricted
Submit mods. Create notes/reviews. Add tags to mods/mod lists. Mark reviews/notes as helpful. Manage mods they are an author/curator for. Report things.

10 reputation
Custom Avatar. Create help pages.

20 reputation
Create new tags. Make curator requests.

40 reputation
Submit, discuss, and vote on corrections. Auto-approval for notes/reviews.

80 reputation
Endorse up to 5 other users

160 reputation
Auto-approval for submitted mods. Upload images for mods that have none.

320 reputation
Endorse up to 10 other users. Update notes from inactive users.

640 reputation
Endorse up to 15 other users.

1280 reputation
Custom user title. 1 free month of premium access.

2560 reputation
2 free months of premium access

5120 reputation
Lifetime premium access.
30 changes: 1 addition & 29 deletions mod-picker/app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,5 @@
//= link "help/High Hrothgar.css"
//= link "landing/High Hrothgar.css"
//= link legal.css
// landing page
// VENDOR ASSETS
//= link rzslider.min.css
//= link simplemde.min.css
//= link angular.min.1.5.1.js
//= link bindonce.js
//= link marked.min.js
//= link angular-marked.min.js
//= link angular-drag-and-drop-lists.min.js
//= link angular-ui-router.min.js
//= link ct-ui-router-extras.min.js
//= link angular-smooth-scroll.min.js
//= link heartcode-canvasloader-min.js
//= link angular-relative-date.min.js
//= link rzslider.min.js
//= link angular-animate.min.js
//= link angular-elastic-input.min.js
//= link simplemde.min.js
//= link spin.min.js
// TEMPORARY VENDOR ASSETS
//= link animate.css
//= link bootstrap.min.css
//= link bootstrap.min.js
//= link wow.min.js
//= link style-responsive.css
//= link jquery.countdown.min.js
//= link jquery.nicescroll.min.js
//= link jquery.smooth-scroll.js
//= link script.js
//= link logo.png
//= link modpicker-vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ app.service('configFilesService', function() {
};

this.addCustomConfigFile = function(model, customConfigFile) {
customConfigFile.active = true;
var foundGroup = model.find(function(group) {
return group.name === 'Custom';
});
if (foundGroup) {
foundGroup.children.push(customConfigFile);
foundGroup.activeConfig = customConfigFile;
} else {
var group = {
name: 'Custom',
activeConfig: customConfigFile,
children: [customConfigFile]
};
model.push(group);
Expand Down
9 changes: 4 additions & 5 deletions mod-picker/app/assets/javascripts/BackendAPI/modService.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ app.service('modService', function(backend, $q, pageUtils, objectUtils, contribu
_destroy: plugin._destroy,
author: plugin.author,
filename: plugin.filename,
is_esm: plugin.is_esm,
crc_hash: plugin.crc_hash,
description: plugin.description,
file_size: plugin.file_size,
Expand All @@ -240,10 +241,7 @@ app.service('modService', function(backend, $q, pageUtils, objectUtils, contribu
};

this.sanitizePlugins = function(plugins) {
var sanitizedPlugins = [];
plugins.forEach(function(plugin) {
sanitizedPlugins.push(service.sanitizePlugin(plugin));
});
var sanitizedPlugins = plugins.map(service.sanitizePlugin);
objectUtils.deleteEmptyProperties(sanitizedPlugins, 1);
return sanitizedPlugins;
};
Expand All @@ -256,8 +254,9 @@ app.service('modService', function(backend, $q, pageUtils, objectUtils, contribu
name: option.name,
display_name: option.display_name,
size: option.size,
md5_hash: option.md5_hash,
default: option.default,
is_fomod_option: option.is_fomod_option,
is_installer_option: option.is_fomod_option || option.is_installer_option,
plugin_dumps: sanitizedPlugins,
asset_paths: option.assets
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,29 @@ app.controller('modAnalysisManagerController', function($scope, $rootScope, plug
option.base_name = option.name.replace(regex, '');
};

$scope.optionMatches = function(option, oldOption) {
var namesMatch = option.base_name === oldOption.base_name;
var fileSizesMatch = option.size == oldOption.size;
return namesMatch || fileSizesMatch;
$scope.optionNamesMatch = function(option, oldOption) {
return option.name === oldOption.name;
};

$scope.optionSizesMatch = function(option, oldOption) {
return option.size == oldOption.size;
};

$scope.findOldOption = function(oldOptions, option) {
return oldOptions.find(function(oldOption) {
return $scope.optionNamesMatch(option, oldOption) &&
$scope.optionSizesMatch(option, oldOption);
}) || oldOptions.find(function(oldOption) {
return $scope.optionNamesMatch(option, oldOption);
}) || oldOptions.find(function(oldOption) {
return $scope.optionSizesMatch(option, oldOption);
});
};

$scope.loadExistingOption = function(option) {
var oldOptions = $scope.mod.mod_options;
if (!oldOptions) return;
var oldOption = oldOptions.find(function(oldOption) {
return $scope.optionMatches(option, oldOption);
});
var oldOption = $scope.findOldOption(oldOptions, option);
if (oldOption) {
option.id = oldOption.id;
option.display_name = angular.copy(oldOption.display_name);
Expand All @@ -120,7 +131,9 @@ app.controller('modAnalysisManagerController', function($scope, $rootScope, plug
$scope.prepareModOption = function(option) {
$scope.getBaseName(option);
option.display_name = angular.copy(option.base_name);
option.nestedAssets = assetUtils.getNestedAssets(option.assets);
if (option.assets && option.assets.length) {
option.nestedAssets = assetUtils.getNestedAssets(option.assets);
}
$scope.loadExistingOption(option);
};

Expand Down
2 changes: 1 addition & 1 deletion mod-picker/app/assets/javascripts/Factories/baseFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ app.service('baseFactory', function() {
name: "",
size: 0,
default: false,
is_fomod_option: false
is_installer_option: false
}
},
mod_list_mod_options: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
app.service('moderationActionsFactory', function(userService) {
this.buildActions = function($scope) {
$scope.repCounter = 0;

// functions
$scope.addRep = function() {
if ($scope.added && !$scope.subtracted) return;
$scope.added = true;
if ($scope.repCounter > 0) return;
$scope.repCounter += 1;
userService.addRep($scope.user.id).then(function() {
$scope.$emit("successMessage", "Increased "+$scope.user.username+"'s reputation by 5");
$scope.user.reputation.overall += 5;
Expand All @@ -17,8 +19,8 @@ app.service('moderationActionsFactory', function(userService) {
};

$scope.subtractRep = function() {
if ($scope.subtracted && !$scope.added) return;
$scope.subtracted = true;
if ($scope.repCounter < 0) return;
$scope.repCounter -= 1;
userService.subtractRep($scope.user.id).then(function() {
$scope.$emit("successMessage", "Reduced "+$scope.user.username+"'s reputation by 5");
$scope.user.reputation.overall -= 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ app.service('notificationsFactory', function() {
};

this.permissions = [
"",
"You can now use a custom avatar and create new tags.",
"You can now submit, discuss, and vote on corrections.",
"You can now endorse up to 5 other users.",
"You can now submit mods to the platform.",
"You can now endorse up to 10 other users.",
"You can now endorse up to 15 other users.",
"You can now set your own user title."
/*10*/ "You can now use a custom avatar and create help pages.",
/*20*/ "You can create new tags and make curator requests.",
/*40*/ "You can now submit, discuss, and vote on corrections.",
/*80*/ "You can now endorse up to 5 other users. Reviews and Notes you submit are now automatically approved.",
/*160*/ "Mods you submit are now automatically approved. You can now upload images for mods that have none.",
/*320*/ "You can now endorse up to 10 other users. You can now update notes made by inactive users.",
/*640*/ "You can now endorse up to 15 other users.",
/*1280*/ "You can now use a custom user title."
];

var noteContentLink =
Expand Down
3 changes: 3 additions & 0 deletions mod-picker/app/assets/javascripts/Services/imageUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ app.service('imageUtils', function() {
file: new File([blob], filename),
src: URL.createObjectURL(blob)
});
imageObj.sizes.sort(function(a, b) {
return (a.height || a.size) - (b.height || b.size);
});
apply();
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ app.service('modLoaderService', function(sitesFactory, assetUtils) {

this.loadAssets = function(mod) {
mod.mod_options.forEach(function(option) {
if (!option.asset_file_paths) return;
if (!option.asset_file_paths || !option.asset_file_paths.length) return;
option.nestedAssets = assetUtils.getNestedAssets(option.asset_file_paths);
});
};
Expand Down
3 changes: 1 addition & 2 deletions mod-picker/app/assets/javascripts/Services/sortUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ app.service('sortUtils', function($q, categoryService, colorsFactory, modListSer
groups[0].children.push(item);
}
// non-official ESMs go into the ESMs group
else if (handlingPlugins && plugin.filename.endsWith('.esm')) {
// TODO: Check ESM flag instead once we have it
else if (handlingPlugins && plugin.is_esm) {
groups[1].children.push(item);
}
// for everything else we create groups based on the primary category of the mod
Expand Down
30 changes: 27 additions & 3 deletions mod-picker/app/assets/javascripts/Views/mod/modAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ app.controller('modAnalysisController', function($scope, $stateParams, $state, m
var errorTypes = $scope.mod.currentPlugin.plugin_errors;
errorTypes.forEach(function(errorType) {
if (errorType.benign) return;
$scope.noCriticalErrors = $scope.noCriticalErrors && !errorType.length;
$scope.noCriticalErrors = $scope.noCriticalErrors && !errorType.errors.length;
});
};

Expand All @@ -55,9 +55,33 @@ app.controller('modAnalysisController', function($scope, $stateParams, $state, m
$scope.showBenignErrors = !$scope.showBenignErrors;
};

$scope.getStatePluginOptionId = function(optionIds) {
if ($stateParams.plugin) {
var foundPlugin = $scope.mod.plugins.find(function(plugin) {
return plugin.id == $stateParams.plugin;
});
if (foundPlugin) optionIds.push(foundPlugin.mod_option_id);
}
};

$scope.getStateParamOptionIds = function(optionIds) {
if ($stateParams.options) {
$stateParams.options.split(',').forEach(function(optionId) {
if (optionIds.indexOf(optionId) == -1) optionIds.push(optionId);
});
}
};

$scope.getStateOptionIds = function() {
var optionIds = [];
$scope.getStatePluginOptionId(optionIds);
$scope.getStateParamOptionIds(optionIds);
return optionIds;
};

$scope.setCurrentSelection = function() {
// set active options
var optionIds = $stateParams.options ? $stateParams.options.split(',') : [];
// enable mod options
var optionIds = $scope.getStateOptionIds();
$scope.mod.options.forEach(function(option) {
option.active = option.default || optionIds.indexOf(option.id) > -1;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ app.controller('modCompatibilityController', function($scope, $stateParams, $sta
var statusValid = true;
if (note.status === "compatibility_mod") {
statusValid = !!note.compatibility_mod_id;
} else if (note.status === "compatibility_option") {
statusValid = note.compatibility_option_id || note.compatibility_plugin_id;
}

// compatibility note is valid if all parts valid
Expand Down
5 changes: 4 additions & 1 deletion mod-picker/app/assets/javascripts/Views/modList/modList.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ app.controller('modListController', function($scope, $rootScope, $q, $state, $st
$scope.originalModList = angular.copy($scope.mod_list);
$scope.removedModIds = [];

// default to editing modlist if it's the current user's active modlist
$scope.editing = $scope.activeModList;

// initialize local variables
$scope.tabs = tabsFactory.buildModListTabs($scope.mod_list);
$scope.pages = {
Expand Down Expand Up @@ -457,7 +460,7 @@ app.controller('modListController', function($scope, $rootScope, $q, $state, $st
};

$scope.updateCounters = function(updatedModList) {
var counts = ["tools_count", "mods_count", "plugins_count", "config_files_count"];
var counts = ["tools_count", "mods_count", "plugins_count"];
counts.forEach(function(count) {
$scope.mod_list[count] = updatedModList[count];
});
Expand Down
16 changes: 12 additions & 4 deletions mod-picker/app/assets/javascripts/Views/modList/modListMods.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,25 @@ app.controller('modListModsController', function($scope, $rootScope, $timeout, $
modListMod.mod.mod_options.forEach(function(option) {
if (option.default) {
option.active = true;
modListMod.mod_list_mod_options.push({
mod_option_id: option.id
var options = modListMod.mod_list_mod_options;
var existingModOption = options.find(function(mlOption) {
return mlOption.mod_option_id == option.id;
});
$rootScope.$broadcast('modOptionAdded', option);
if (!existingModOption) {
options.push({ mod_option_id: option.id });
$rootScope.$broadcast('modOptionAdded', option);
}
}
});
};

$scope.removeActiveModOptions = function(modListMod) {
modListMod.mod_list_mod_options.forEach(function(option) {
$rootScope.$broadcast('modOptionRemoved', option.mod_option_id);
});
modListMod.mod_list_mod_options = [];
modListMod.mod && modListMod.mod.mod_options.forEach(function(option) {
if (option.active) $rootScope.$broadcast('modOptionRemoved', option.id);
option.active = false;
});
};

Expand Down
15 changes: 11 additions & 4 deletions mod-picker/app/assets/javascripts/Views/modList/modListPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ app.controller('modListPluginsController', function($scope, $q, $timeout, catego
customPlugin.compatibility_note_id = compatibilityNoteId;
};

$scope.forModOptionPlugins = function(modOptionId, callback) {
listUtils.forEachItem($scope.model.plugins, function(modListPlugin) {
if (!modListPlugin.plugin) return;
if (modListPlugin.plugin.mod_option_id == modOptionId) {
callback(modListPlugin);
}
});
};

// CUSTOM CALLBACKS
$scope.addCustomPluginCallback = function(options) {
if (options.noteId) {
Expand Down Expand Up @@ -132,14 +141,12 @@ app.controller('modListPluginsController', function($scope, $q, $timeout, catego
data.mod_list_plugins.forEach($scope.addNewPluginItem);
});
$scope.$on('modOptionRemoved', function(event, modOptionId) {
var model = $scope.model.plugins;
listUtils.forMatchingItems(model, 'mod_option_id', modOptionId, $scope.removePlugin);
$scope.forModOptionPlugins(modOptionId, $scope.removePlugin);
listUtils.forMatching($scope.plugins_store, 'mod_option_id', modOptionId, listUtils.destroyItem);
});
$scope.$on('modOptionAdded', function(event, modOption) {
var modOptionId = modOption.id;
var model = $scope.model.plugins;
listUtils.forMatchingItems(model, 'mod_option_id', modOptionId, $scope.recoverPlugin);
$scope.forModOptionPlugins(modOptionId, $scope.recoverPlugin);
listUtils.forMatching($scope.plugins_store, 'mod_option_id', modOptionId, listUtils.recoverItem);
$scope.addModOptionPluginsToStore(modOption);
});
Expand Down
Loading

0 comments on commit 410fb4c

Please sign in to comment.