From bd1d42617f383c429c895afee23ac0d156d2e989 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Nov 2016 16:47:05 -0600 Subject: [PATCH 01/53] tweaked css of landing page increased bottom margin on sections, and increased feather and size of box shadows --- mod-picker/app/assets/stylesheets/landing/content.scss | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mod-picker/app/assets/stylesheets/landing/content.scss b/mod-picker/app/assets/stylesheets/landing/content.scss index 4ca070784..2f53cc3a1 100644 --- a/mod-picker/app/assets/stylesheets/landing/content.scss +++ b/mod-picker/app/assets/stylesheets/landing/content.scss @@ -17,19 +17,21 @@ h1 { } h2 { + font-size: 1.5em; font-weight: normal; max-width: 900px; margin: 20px auto; } section { - padding: 60px; + padding-top: 60px; + padding-bottom: 120px; text-align: center; img { max-height: 50vh; margin-top: 20px; - box-shadow: 2px 2px 5px 2px $text_color; + box-shadow: 3px 3px 16px 1px $text_color; max-width: 95%; } } @@ -147,7 +149,7 @@ section.base { .low, .base { img { - box-shadow: 2px 2px 5px 2px darken($text_color, 14%); + box-shadow: 3px 3px 16px 1px darken($text_color, 14%); } } From 098c902d13c929c0f7ea45e2b3ff37c6b8b892e4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Nov 2016 19:20:19 -0600 Subject: [PATCH 02/53] edit now defaults to true on your active modlist --- mod-picker/app/assets/javascripts/Views/modList/modList.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod-picker/app/assets/javascripts/Views/modList/modList.js b/mod-picker/app/assets/javascripts/Views/modList/modList.js index c60540eb6..103adabf3 100644 --- a/mod-picker/app/assets/javascripts/Views/modList/modList.js +++ b/mod-picker/app/assets/javascripts/Views/modList/modList.js @@ -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 = { From a5ba45bc359f245ec3c7251e218312e441ad039a Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 17:04:05 -0800 Subject: [PATCH 03/53] created reputation abilities design document --- design/reputation abilities.txt | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 design/reputation abilities.txt diff --git a/design/reputation abilities.txt b/design/reputation abilities.txt new file mode 100644 index 000000000..62845e072 --- /dev/null +++ b/design/reputation abilities.txt @@ -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. \ No newline at end of file From e4f3b15bcada9a5ae85957ec9a69448968d99237 Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 17:04:21 -0800 Subject: [PATCH 04/53] updated ability.rb and user.rb for new reputation requirements --- mod-picker/app/models/ability.rb | 26 ++++++++++++++++---------- mod-picker/app/models/user.rb | 4 ++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/mod-picker/app/models/ability.rb b/mod-picker/app/models/ability.rb index 5f6930176..a1a174609 100644 --- a/mod-picker/app/models/ability.rb +++ b/mod-picker/app/models/ability.rb @@ -145,13 +145,13 @@ def initialize(user) cannot [:update, :hide], Mod, { disallow_contributors: true, mod_authors: { user_id: user.id, role: 1 } } # abilities tied to reputation - if user.reputation.overall >= 5 - # TODO: Remove this after beta - can :create, Tag # can create new tags + if user.reputation.overall >= 10 + # can create new help pages + can :create, HelpPage end if user.reputation.overall >= 20 - # TODO: Uncomment this after beta - #can :create, Tag # can create new tags + # can create new tags and curator requests + can :create, Tag can :create, CuratorRequest end if user.reputation.overall >= 40 @@ -161,11 +161,16 @@ def initialize(user) cannot :create, Correction, { correctable: { submitted_by: user.id } } can :create, Correction, { correctable_type: "Mod" } - # can agree/disagree with corrections, give reputation other users, and - # can create new help pages + # can agree/disagree with corrections can :create, AgreementMark - can :create, ReputationLink # can - can :create, HelpPage + end + if user.reputation.overall >= 80 + # can give reputation other users + can :create, ReputationLink + end + if user.reputation.overall >= 160 + # can add images to mods that have none + can :add_image, Mod end if user.reputation.overall >= 320 # can update compatibility notes, install order notes, and @@ -198,7 +203,7 @@ def initialize(user) can :update, UserBio, { user_id: user.id } # abilities tied to reputation - if user.reputation.overall >= 20 + if user.reputation.overall >= 10 can :set_avatar, User, id: user.id # custom avatar end if user.reputation.overall >= 1280 @@ -210,6 +215,7 @@ def initialize(user) settings = user.settings unless settings.present? && settings.allow_adult_content cannot :read, Mod, { has_adult_content: true } + cannot :read, Plugin, { has_adult_content: true } cannot :read, ModList, { has_adult_content: true } cannot :read, Review, { has_adult_content: true } cannot :read, CompatibilityNote, { has_adult_content: true } diff --git a/mod-picker/app/models/user.rb b/mod-picker/app/models/user.rb index bdacc3d5f..3d45755cb 100644 --- a/mod-picker/app/models/user.rb +++ b/mod-picker/app/models/user.rb @@ -145,11 +145,11 @@ def comments_disabled? end def has_auto_approval? - reputation.overall > 20 + reputation.overall > 40 end def has_mod_auto_approval? - reputation.overall > 80 + reputation.overall > 160 end def subscribed_to?(event) From da8bb4fb8d38b3f3c8282b504c4b3a06c0e30831 Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 17:04:36 -0800 Subject: [PATCH 05/53] updated reputation milestone messages in notificationsFactory --- .../Factories/notificationsFactory.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Factories/notificationsFactory.js b/mod-picker/app/assets/javascripts/Factories/notificationsFactory.js index c49a98ad9..0744ac00e 100644 --- a/mod-picker/app/assets/javascripts/Factories/notificationsFactory.js +++ b/mod-picker/app/assets/javascripts/Factories/notificationsFactory.js @@ -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 = From d081022c7f29d78ff8d2ea3877bfc4a68d50ff7d Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 17:09:45 -0800 Subject: [PATCH 06/53] fixed contributions dropdown being like one or two pixels off --- mod-picker/app/assets/stylesheets/main/header.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod-picker/app/assets/stylesheets/main/header.scss b/mod-picker/app/assets/stylesheets/main/header.scss index fa588c7b9..15fdee320 100644 --- a/mod-picker/app/assets/stylesheets/main/header.scss +++ b/mod-picker/app/assets/stylesheets/main/header.scss @@ -151,8 +151,8 @@ nav { } #contributions-dropdown { - left: 157px; - width: 180px; + left: 155px; + width: 182px; a { display: block; From 5fccc742adadab66461903c89e15a0745fa18c0b Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 17:20:49 -0800 Subject: [PATCH 07/53] created migration and updated static seeds to fix typos in quest category priorities --- ...0161114011433_fix_category_priority_typos.rb | 17 +++++++++++++++++ mod-picker/db/schema.rb | 2 +- mod-picker/db/static_seeds.rb | 4 ++-- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 mod-picker/db/migrate/20161114011433_fix_category_priority_typos.rb diff --git a/mod-picker/db/migrate/20161114011433_fix_category_priority_typos.rb b/mod-picker/db/migrate/20161114011433_fix_category_priority_typos.rb new file mode 100644 index 000000000..e9f1bed11 --- /dev/null +++ b/mod-picker/db/migrate/20161114011433_fix_category_priority_typos.rb @@ -0,0 +1,17 @@ +class FixCategoryPriorityTypos < ActiveRecord::Migration + def change + catQuests = Category.where(name: "Gameplay - Quests").first + catNewChars = Category.where(name: "New Characters").first + catImmersionAndRolePlaying = Category.where(name: "Gameplay - Immersion & Role-playing").first + + CategoryPriority.find_by( + dominant_id: catQuests.id, + recessive_id: catNewChars.id + ).update(description: 'New or altered quests often involve new characters.') + + CategoryPriority.find_by( + dominant_id: catQuests.id, + recessive_id: catImmersionAndRolePlaying.id + ).update(description: 'New or altered quests often increase gameplay immersion and offer new role-playing experiences.') + end +end diff --git a/mod-picker/db/schema.rb b/mod-picker/db/schema.rb index a1b535707..bfe0ffae9 100644 --- a/mod-picker/db/schema.rb +++ b/mod-picker/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161107235237) do +ActiveRecord::Schema.define(version: 20161114011433) do create_table "agreement_marks", id: false, force: :cascade do |t| t.integer "correction_id", limit: 4, null: false diff --git a/mod-picker/db/static_seeds.rb b/mod-picker/db/static_seeds.rb index 5d8bb853e..e88722444 100644 --- a/mod-picker/db/static_seeds.rb +++ b/mod-picker/db/static_seeds.rb @@ -546,12 +546,12 @@ def seed_categories CategoryPriority.create( dominant_id: catQuests.id, recessive_id: catNewChars.id, - description: 'New or alterred quests often involve new characters.' + description: 'New or altered quests often involve new characters.' ) CategoryPriority.create( dominant_id: catQuests.id, recessive_id: catImmersionAndRolePlaying.id, - description: 'New or alterred quests often increase gameplay immersion and offer new role-playing experiences.' + description: 'New or altered quests often increase gameplay immersion and offer new role-playing experiences.' ) CategoryPriority.create( dominant_id: catNewLands.id, From 9369de8a85cd4019947a2e822de9df1a3a1be4cf Mon Sep 17 00:00:00 2001 From: Mator Date: Sun, 13 Nov 2016 21:51:00 -0800 Subject: [PATCH 08/53] added md5 hash to mod options --- .../db/migrate/20161114054608_add_md5_hash_to_mod_options.rb | 5 +++++ mod-picker/db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 mod-picker/db/migrate/20161114054608_add_md5_hash_to_mod_options.rb diff --git a/mod-picker/db/migrate/20161114054608_add_md5_hash_to_mod_options.rb b/mod-picker/db/migrate/20161114054608_add_md5_hash_to_mod_options.rb new file mode 100644 index 000000000..2e11a7263 --- /dev/null +++ b/mod-picker/db/migrate/20161114054608_add_md5_hash_to_mod_options.rb @@ -0,0 +1,5 @@ +class AddMd5HashToModOptions < ActiveRecord::Migration + def change + add_column :mod_options, :md5_hash, :string, limit: 32, after: :size + end +end diff --git a/mod-picker/db/schema.rb b/mod-picker/db/schema.rb index bfe0ffae9..7ff3ca88c 100644 --- a/mod-picker/db/schema.rb +++ b/mod-picker/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161114011433) do +ActiveRecord::Schema.define(version: 20161114054608) do create_table "agreement_marks", id: false, force: :cascade do |t| t.integer "correction_id", limit: 4, null: false @@ -578,6 +578,7 @@ t.string "name", limit: 128, null: false t.string "display_name", limit: 128, null: false t.integer "size", limit: 8, default: 0, null: false + t.string "md5_hash", limit: 32 t.boolean "default", default: false, null: false t.boolean "is_fomod_option", default: false, null: false t.integer "asset_files_count", limit: 4, default: 0, null: false From 9a898d9ab79b0664700ea87ffd0e45d23163b700 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 11:13:52 -0800 Subject: [PATCH 09/53] fixed mod list incompatible_mod_ids including unapproved/hidden compatibility notes --- mod-picker/app/models/mod_list.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod-picker/app/models/mod_list.rb b/mod-picker/app/models/mod_list.rb index 9b6c2b561..653dda4e2 100644 --- a/mod-picker/app/models/mod_list.rb +++ b/mod-picker/app/models/mod_list.rb @@ -257,7 +257,7 @@ def incompatible_mod_ids return [] if mod_ids.empty? # get incompatible mod ids - incompatible_ids = CompatibilityNote.status([0, 1]).mod(mod_ids).pluck(:first_mod_id, :second_mod_id) + incompatible_ids = CompatibilityNote.visible.status([0, 1]).mod(mod_ids).pluck(:first_mod_id, :second_mod_id) # return array of unique mod ids from the notes, excluding mod list mod ids incompatible_ids.flatten(1).uniq - mod_ids end From 2c67e6f65e2c00a24b294805a866cf9062c15a4a Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 11:14:31 -0800 Subject: [PATCH 10/53] added md5 hash to mod option sanitization --- mod-picker/app/assets/javascripts/BackendAPI/modService.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mod-picker/app/assets/javascripts/BackendAPI/modService.js b/mod-picker/app/assets/javascripts/BackendAPI/modService.js index 42a1d85bc..4934e73f5 100644 --- a/mod-picker/app/assets/javascripts/BackendAPI/modService.js +++ b/mod-picker/app/assets/javascripts/BackendAPI/modService.js @@ -240,10 +240,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; }; @@ -256,6 +253,7 @@ 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, plugin_dumps: sanitizedPlugins, From 970a5bf1091ec88023e91c04830ec23a43a5c0fc Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 11:14:48 -0800 Subject: [PATCH 11/53] added md5 to accepted strong parameters in mods controller --- mod-picker/app/controllers/mods_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod-picker/app/controllers/mods_controller.rb b/mod-picker/app/controllers/mods_controller.rb index d69273f91..450151a00 100644 --- a/mod-picker/app/controllers/mods_controller.rb +++ b/mod-picker/app/controllers/mods_controller.rb @@ -400,7 +400,7 @@ def mod_params custom_sources_attributes: [:label, :url], required_mods_attributes: [:required_id], tag_names: [], - mod_options_attributes: [:name, :display_name, :size, :default, :is_fomod_option, + mod_options_attributes: [:name, :display_name, :size, :md5_hash, :default, :is_fomod_option, asset_paths: [], plugin_dumps: [:filename, :author, :description, :crc_hash, :record_count, :override_count, :file_size, master_plugins: [:filename, :crc_hash], @@ -418,7 +418,7 @@ def mod_update_params custom_sources_attributes: [:id, :label, :url, :_destroy], config_files_attributes: [:id, :filename, :install_path, :text_body, :_destroy], tag_names: [], - mod_options_attributes: [:id, :name, :display_name, :size, :default, :is_fomod_option, :_destroy, + mod_options_attributes: [:id, :name, :display_name, :size, :md5_hash, :default, :is_fomod_option, :_destroy, asset_paths: [], plugin_dumps: [:id, :filename, :author, :description, :crc_hash, :record_count, :override_count, :file_size, :_destroy, master_plugins: [:filename, :crc_hash], From dc46e81f1d361dbd985c09d140f849791ca6f5c4 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 11:13:52 -0800 Subject: [PATCH 12/53] fixed mod list incompatible_mod_ids including unapproved/hidden compatibility notes --- mod-picker/app/models/mod_list.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod-picker/app/models/mod_list.rb b/mod-picker/app/models/mod_list.rb index 9b6c2b561..653dda4e2 100644 --- a/mod-picker/app/models/mod_list.rb +++ b/mod-picker/app/models/mod_list.rb @@ -257,7 +257,7 @@ def incompatible_mod_ids return [] if mod_ids.empty? # get incompatible mod ids - incompatible_ids = CompatibilityNote.status([0, 1]).mod(mod_ids).pluck(:first_mod_id, :second_mod_id) + incompatible_ids = CompatibilityNote.visible.status([0, 1]).mod(mod_ids).pluck(:first_mod_id, :second_mod_id) # return array of unique mod ids from the notes, excluding mod list mod ids incompatible_ids.flatten(1).uniq - mod_ids end From 1792ba3088ab5ddb3b87582d5f87d5909f5974e8 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 14:14:36 -0800 Subject: [PATCH 13/53] refactor Correction.close method into multiple methods and added minimum vote checking --- mod-picker/app/models/concerns/correctable.rb | 7 ++++ mod-picker/app/models/correction.rb | 39 +++++++++++-------- mod-picker/app/models/mod.rb | 4 ++ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/mod-picker/app/models/concerns/correctable.rb b/mod-picker/app/models/concerns/correctable.rb index ff939439b..27c94046d 100644 --- a/mod-picker/app/models/concerns/correctable.rb +++ b/mod-picker/app/models/concerns/correctable.rb @@ -21,4 +21,11 @@ def compute_standing self.standing = :good end end + + def correction_passed(correction) + update_columns({ + standing: self.class.standing[:bad], + corrector_id: correction.submitted_by + }) + end end \ No newline at end of file diff --git a/mod-picker/app/models/correction.rb b/mod-picker/app/models/correction.rb index 7cadc7648..f95e7aebc 100644 --- a/mod-picker/app/models/correction.rb +++ b/mod-picker/app/models/correction.rb @@ -61,30 +61,35 @@ class Correction < ActiveRecord::Base after_save :recompute_correctable_standing after_destroy :recompute_correctable_standing + # CONSTANTS + MINIMUM_VOTES = 4 + + # METHODS def self.close(id) correction = Correction.find(id) if correction.status == :open - if correction.agree_count > @correction.disagree_count - correction.status = :passed - # if we're dealing with a mod, update the mod's status - if correction.correctable_type == 'Mod' - mod = correction.correctable - mod.update_columns(status: Mod.statuses[correction.mod_status]) - else - # if we're dealing with a contribution, update its standing and open for editing - contribution = correction.correctable - contribution.update_columns({ - standing: contribution.class.standing[:bad], - corrector_id: correction.submitted_by - }) - end - else - correction.status = :failed - end + correction.passed? ? correction.pass : correction.fail correction.save end end + def pass + self.status = :passed + correctable.correction_passed(self) + end + + def fail + self.status = :failed + end + + def has_minimum_votes? + agree_count + disagree_count >= MINIMUM_VOTES + end + + def passed? + has_minimum_votes? && agree_count > disagree_count + end + def mod_author_users if correctable_type == "Mod" correctable.author_users diff --git a/mod-picker/app/models/mod.rb b/mod-picker/app/models/mod.rb index 206350654..2bd4b0758 100644 --- a/mod-picker/app/models/mod.rb +++ b/mod-picker/app/models/mod.rb @@ -174,6 +174,10 @@ class Mod < ActiveRecord::Base # CALLBACKS before_save :touch_updated + def correction_passed(correction) + update_columns(status: Mod.statuses[correction.mod_status]) + end + def asset_file_paths mod_asset_files.eager_load(:asset_file).pluck(:subpath, :path).map { |item| item.join('') } end From c972cda517a2da4a5a66da92d94a008983a34b1b Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 14:15:01 -0800 Subject: [PATCH 14/53] reduced help page body paragraph margin left --- mod-picker/app/assets/stylesheets/help/content.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod-picker/app/assets/stylesheets/help/content.scss b/mod-picker/app/assets/stylesheets/help/content.scss index 0d94c8951..ac6ffb720 100644 --- a/mod-picker/app/assets/stylesheets/help/content.scss +++ b/mod-picker/app/assets/stylesheets/help/content.scss @@ -64,6 +64,6 @@ body { } .help-page-body p { - margin-left: 5px; + margin-left: 3px; } } From e4f71dd19b86e32f6124bc79df5c8a6f7f0f85a5 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 15:08:55 -0800 Subject: [PATCH 15/53] optimized landing page javascript loading --- mod-picker/app/assets/javascripts/landing.js | 6 ++++++ mod-picker/app/views/layouts/landing.html.erb | 10 +--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/mod-picker/app/assets/javascripts/landing.js b/mod-picker/app/assets/javascripts/landing.js index 80c7e89ce..bb2da2ee9 100644 --- a/mod-picker/app/assets/javascripts/landing.js +++ b/mod-picker/app/assets/javascripts/landing.js @@ -1,7 +1,13 @@ +//= require angular.min.1.5.1.js +//= require angular-animate.min.js //= require_self //= require ./polyfills.js //= require Directives/shared/sticky.js //= require Services/ObjectUtils.js +/* + Mod Picker Landing Page v1.0 + (c) 2016 Mod Picker, LLC. https://www.modpicker.com +*/ var app = angular.module('landing', [ 'ngAnimate' diff --git a/mod-picker/app/views/layouts/landing.html.erb b/mod-picker/app/views/layouts/landing.html.erb index fb9740449..09f5207ce 100644 --- a/mod-picker/app/views/layouts/landing.html.erb +++ b/mod-picker/app/views/layouts/landing.html.erb @@ -5,19 +5,11 @@ Mod Picker - <%= javascript_include_tag 'angular.min.1.5.1' %> + <%= javascript_include_tag 'landing' %> <%= stylesheet_link_tag 'landing/High Hrothgar' %> <%= yield %> - -<%= javascript_include_tag 'angular-ui-router.min' %> -<%= javascript_include_tag 'ct-ui-router-extras.min' %> -<%= javascript_include_tag 'angular-smooth-scroll.min' %> -<%= javascript_include_tag 'heartcode-canvasloader-min' %> -<%= javascript_include_tag 'angular-animate.min' %> -<%= javascript_include_tag 'landing' %> - \ No newline at end of file From 32b7d6372891ac4a4cee7b60bf7f1db78889b1fb Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 15:09:15 -0800 Subject: [PATCH 16/53] optimized help center javascript and css asset loading --- .../app/assets/javascripts/helpcenter.js | 11 +++++++++++ mod-picker/app/assets/stylesheets/help.scss | 1 + mod-picker/app/views/layouts/help.html.erb | 18 +++++------------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/mod-picker/app/assets/javascripts/helpcenter.js b/mod-picker/app/assets/javascripts/helpcenter.js index dfb085b1c..0f13db266 100644 --- a/mod-picker/app/assets/javascripts/helpcenter.js +++ b/mod-picker/app/assets/javascripts/helpcenter.js @@ -1,3 +1,10 @@ +//= require angular.min.1.5.1.js +//= require marked.min.js +//= require angular-marked.min.js +//= require angular-relative-date.min.js +//= require angular-animate.min.js +//= require simplemde.min.js +//= require spin.min.js //= require_self //= require ./polyfills.js //= require BackendAPI/backend.js @@ -15,6 +22,10 @@ //= require Services/pageUtils.js //= require Services/ObjectUtils.js //= require_tree ./Directives/help +/* + Mod Picker Help Center v1.0 + (c) 2016 Mod Picker, LLC. https://www.modpicker.com +*/ var app = angular.module('helpCenter', [ 'ngAnimate', 'hc.marked', 'relativeDate' diff --git a/mod-picker/app/assets/stylesheets/help.scss b/mod-picker/app/assets/stylesheets/help.scss index 676061ae8..e998280fb 100644 --- a/mod-picker/app/assets/stylesheets/help.scss +++ b/mod-picker/app/assets/stylesheets/help.scss @@ -1,4 +1,5 @@ @import +'simplemde.min', 'general/mixins', 'general/buttons', 'general/forms', diff --git a/mod-picker/app/views/layouts/help.html.erb b/mod-picker/app/views/layouts/help.html.erb index b91f317cc..90bbaaa7b 100644 --- a/mod-picker/app/views/layouts/help.html.erb +++ b/mod-picker/app/views/layouts/help.html.erb @@ -3,17 +3,17 @@ <%= yield :head %> + - <%= stylesheet_link_tag 'simplemde.min' %> - <%= javascript_include_tag 'angular.min.1.5.1' %> - + <%= stylesheet_link_tag 'help/High Hrothgar' %> + <%= javascript_include_tag 'helpcenter' %> + + - <%= stylesheet_link_tag 'help/High Hrothgar' %>
@@ -69,13 +69,5 @@ - -<%= javascript_include_tag 'marked.min' %> -<%= javascript_include_tag 'angular-marked.min' %> -<%= javascript_include_tag 'angular-relative-date.min' %> -<%= javascript_include_tag 'angular-animate.min' %> -<%= javascript_include_tag 'simplemde.min' %> -<%= javascript_include_tag 'spin.min' %> -<%= javascript_include_tag 'helpcenter' %> \ No newline at end of file From 33481265d8b77983b9433d9dafddb9a74d921c22 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 15:09:44 -0800 Subject: [PATCH 17/53] optimized main site javascript and css loading and display --- .../app/assets/javascripts/modpicker.js | 18 +++++++++++++++ mod-picker/app/assets/stylesheets/main.scss | 2 ++ .../app/views/layouts/application.html.erb | 23 ++----------------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/mod-picker/app/assets/javascripts/modpicker.js b/mod-picker/app/assets/javascripts/modpicker.js index 0a22a6345..5472c0595 100644 --- a/mod-picker/app/assets/javascripts/modpicker.js +++ b/mod-picker/app/assets/javascripts/modpicker.js @@ -1,3 +1,17 @@ +//= require angular.min.1.5.1.js +//= require marked.min.js +//= require bindonce.min.js +//= require angular-marked.min.js +//= require angular-drag-and-drop-lists.min.js +//= require angular-ui-router.min.js +//= require ct-ui-router-extras.min.js +//= require angular-smooth-scroll.min.js +//= require angular-relative-date.min.js +//= require rzslider.min.js +//= require angular-animate.min.js +//= require angular-elastic-input.min.js +//= require simplemde.min.js +//= require spin.min.js //= require_self //= require ./polyfills.js //= require_tree ./BackendAPI @@ -7,6 +21,10 @@ //= require_tree ./Services //= require_tree ./Views //= stub_tree Directives/help +/* + Mod Picker v1.0 + (c) 2016 Mod Picker, LLC. https://www.modpicker.com +*/ var app = angular.module('modPicker', [ 'ui.router', 'rzModule', 'ngAnimate', 'puElasticInput', 'hc.marked', 'smoothScroll', 'relativeDate', 'ct.ui.router.extras', 'dndLists', 'pasvaz.bindonce' diff --git a/mod-picker/app/assets/stylesheets/main.scss b/mod-picker/app/assets/stylesheets/main.scss index 5dade14f7..04fc0615a 100644 --- a/mod-picker/app/assets/stylesheets/main.scss +++ b/mod-picker/app/assets/stylesheets/main.scss @@ -1,4 +1,6 @@ @import +'rzslider.min', +'simplemde.min', 'general/mixins', 'general/urls', 'general/buttons', diff --git a/mod-picker/app/views/layouts/application.html.erb b/mod-picker/app/views/layouts/application.html.erb index 360cf1682..414444fd5 100644 --- a/mod-picker/app/views/layouts/application.html.erb +++ b/mod-picker/app/views/layouts/application.html.erb @@ -5,9 +5,8 @@ - <%= stylesheet_link_tag 'rzslider.min' %> - <%= stylesheet_link_tag 'simplemde.min' %> - <%= javascript_include_tag 'angular.min.1.5.1' %> + <%= javascript_include_tag 'modpicker' %> + '" /> - '" /> <%= yield %> - - - <%= javascript_include_tag 'marked.min' %> - <%= javascript_include_tag 'bindonce' %> - <%= javascript_include_tag 'angular-marked.min' %> - <%= javascript_include_tag 'angular-drag-and-drop-lists.min' %> - <%= javascript_include_tag 'angular-ui-router.min' %> - <%= javascript_include_tag 'ct-ui-router-extras.min' %> - <%= javascript_include_tag 'angular-smooth-scroll.min' %> - <%= javascript_include_tag 'heartcode-canvasloader-min' %> - <%= javascript_include_tag 'angular-relative-date.min' %> - <%= javascript_include_tag 'rzslider.min' %> - <%= javascript_include_tag 'angular-animate.min' %> - <%= javascript_include_tag 'angular-elastic-input.min' %> - <%= javascript_include_tag 'simplemde.min' %> - <%= javascript_include_tag 'spin.min' %> - <%= javascript_include_tag 'modpicker' %> From d47247dfdd822c04c4bd3bb47855b16efe01628f Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 15:09:56 -0800 Subject: [PATCH 18/53] added meta tags to landing page --- mod-picker/app/views/layouts/landing.html.erb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mod-picker/app/views/layouts/landing.html.erb b/mod-picker/app/views/layouts/landing.html.erb index 09f5207ce..6ace8a9eb 100644 --- a/mod-picker/app/views/layouts/landing.html.erb +++ b/mod-picker/app/views/layouts/landing.html.erb @@ -3,6 +3,19 @@ Mod Picker + + + + + + + + + + + + + <%= javascript_include_tag 'landing' %> From 882696df91fc538cb8c3fa4574be5596d66bcf21 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 15:56:27 -0800 Subject: [PATCH 19/53] now allowing compatibility option notes to not reference a compatibility mod option or compatibility plugin and still be valid --- mod-picker/app/assets/javascripts/Views/mod/modCompatibility.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Views/mod/modCompatibility.js b/mod-picker/app/assets/javascripts/Views/mod/modCompatibility.js index 3254ed76d..c75603150 100644 --- a/mod-picker/app/assets/javascripts/Views/mod/modCompatibility.js +++ b/mod-picker/app/assets/javascripts/Views/mod/modCompatibility.js @@ -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 From 7eb02bb91b4f6e3cfc958f17f855b1ea3857705f Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:00:23 -0800 Subject: [PATCH 20/53] fixed bug with grid/table item user select causing drag and drop deletion error --- mod-picker/app/assets/stylesheets/components/gridItems.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod-picker/app/assets/stylesheets/components/gridItems.scss b/mod-picker/app/assets/stylesheets/components/gridItems.scss index 3c8a867ee..448b5da3b 100644 --- a/mod-picker/app/assets/stylesheets/components/gridItems.scss +++ b/mod-picker/app/assets/stylesheets/components/gridItems.scss @@ -191,6 +191,10 @@ grid-items { } } +grid-item, table-item { + @include user-select(none); +} + table-items { display: block; overflow-x: auto; From 4829f8631d237d3a82bc7609edfed087531f940c Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:09:30 -0800 Subject: [PATCH 21/53] fixed bug with being able to break reputation +/- moderation action limits when using both actions --- .../javascripts/Factories/moderationActionsFactory.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Factories/moderationActionsFactory.js b/mod-picker/app/assets/javascripts/Factories/moderationActionsFactory.js index 506acb48b..23da3782e 100644 --- a/mod-picker/app/assets/javascripts/Factories/moderationActionsFactory.js +++ b/mod-picker/app/assets/javascripts/Factories/moderationActionsFactory.js @@ -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; @@ -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; From d1bf05a8bc9d33c4e42e44b539fd8e5e7e27e715 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:09:57 -0800 Subject: [PATCH 22/53] rewrote some code in the UserBio model to be a bit cleaner --- mod-picker/app/models/user_bio.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mod-picker/app/models/user_bio.rb b/mod-picker/app/models/user_bio.rb index ea51c1221..164c091c7 100644 --- a/mod-picker/app/models/user_bio.rb +++ b/mod-picker/app/models/user_bio.rb @@ -41,9 +41,7 @@ def verify_account(site, user_path) def verify_nexus_account(user_path) # exit if we don't have a nexus_user_path - if user_path.nil? - return false - end + return false if user_path.nil? # scrape using the Nexus Helper user_data = NexusHelper.scrape_user(user_path) @@ -75,9 +73,7 @@ def reset_nexus_account def verify_lover_account(user_path) # exit if we don't have an account_path - if user_path.nil? - return false - end + return false if user_path.nil? # scrape using the Lover Helper user_data = LoverHelper.scrape_user(user_path) @@ -109,9 +105,7 @@ def reset_lover_account def verify_workshop_account(user_path) # exit if we don't have a steam_username - if user_path.nil? - return - end + return false if user_path.nil? # scrape using the workshop helper user_data = WorkshopHelper.scrape_user(user_path) From f3f85bc761f0d0322ecb30c25c1c7b1d9ba41d92 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:24:24 -0800 Subject: [PATCH 23/53] cleaned up a bunch of code in the UserBio model --- mod-picker/app/models/user_bio.rb | 85 ++++++++++++------------------- 1 file changed, 32 insertions(+), 53 deletions(-) diff --git a/mod-picker/app/models/user_bio.rb b/mod-picker/app/models/user_bio.rb index 164c091c7..817975506 100644 --- a/mod-picker/app/models/user_bio.rb +++ b/mod-picker/app/models/user_bio.rb @@ -39,6 +39,26 @@ def verify_account(site, user_path) end end + def reset_account(site) + public_send("#{site}_verification_token=", get_token) + public_send("#{site}_user_path=", nil) + public_send("#{site}_username=", nil) + public_send("#{site}_date_joined=", nil) if respond_to?("#{site}_date_joined=") + public_send("#{site}_posts_count=", 0) if respond_to?("#{site}_posts_count=") + public_send("#{site}_submissions_count=", 0) if respond_to?("#{site}_submissions_count=") + public_send("#{site}_followers_count=", 0) if respond_to?("#{site}_followers_count=") + save + end + + def write_user_data(site, user_path, user_data, stat_data=nil) + public_send("#{site}_user_path=", user_path) + public_send("#{site}_username=", user_data[:username]) + public_send("#{site}_date_joined=", user_data[:date_joined]) if user_data.has_key?(:date_joined) + public_send("#{site}_posts_count=", user_data[:posts_count]) if user_data.has_key?(:posts_count) + public_send("#{site}_submissions_count=", stat_data[:submissions_count]) if stat_data.present? + public_send("#{site}_followers_count=", stat_data[:followers_count]) if stat_data.present? + end + def verify_nexus_account(user_path) # exit if we don't have a nexus_user_path return false if user_path.nil? @@ -46,29 +66,16 @@ def verify_nexus_account(user_path) # scrape using the Nexus Helper user_data = NexusHelper.scrape_user(user_path) - # verify the token + # verify the token, write data, populate mod author records, and save if user_data[:last_status] == nexus_verification_token - # write fields to bio - self.nexus_user_path = user_path - self.nexus_username = user_data[:username] - self.nexus_date_joined = user_data[:date_joined] - self.nexus_posts_count = user_data[:posts_count] - - # populate mod author records + write_user_data(:nexus, user_path, user_data) ModAuthor.link_author(NexusInfo, user_id, nexus_username) - - # save bio - save! + save end end def reset_nexus_account - self.nexus_verification_token = get_token - self.nexus_user_path = nil - self.nexus_username = nil - self.nexus_date_joined = nil - self.nexus_posts_count = 0 - save + reset_account(:nexus) end def verify_lover_account(user_path) @@ -78,29 +85,16 @@ def verify_lover_account(user_path) # scrape using the Lover Helper user_data = LoverHelper.scrape_user(user_path) - # verify the token + # verify the token, write data, populate mod author records, and save if user_data[:last_status] == lover_verification_token - # write fields to bio - self.lover_user_path = user_path - self.lover_username = user_data[:username] - self.lover_date_joined = user_data[:date_joined] - self.lover_posts_count = user_data[:posts_count] - - # populate mod author records + write_user_data(:lover, user_path, user_data) ModAuthor.link_author(LoverInfo, user_id, lover_username) - - # save bio - save! + save end end def reset_lover_account - self.lover_verification_token = get_token - self.lover_user_path = nil - self.lover_username = nil - self.lover_date_joined = nil - self.lover_posts_count = 0 - save + reset_account(:lover) end def verify_workshop_account(user_path) @@ -110,31 +104,16 @@ def verify_workshop_account(user_path) # scrape using the workshop helper user_data = WorkshopHelper.scrape_user(user_path) - # verify the token + # verify the token, scrape workshop stats, write data, populate mod author records, and save if user_data[:matched_comment] == workshop_verification_token - # scrape user's workshop stats workshop_stats = WorkshopHelper.scrape_workshop_stats(user_path) - - # write fields to bio - self.workshop_user_path = user_path - self.workshop_username = user_data[:username] - self.workshop_submissions_count = workshop_stats[:submissions_count] - self.workshop_followers_count = workshop_stats[:followers_count] - - # populate mod author records + write_user_data(:workshop, user_path, user_data, workshop_stats) ModAuthor.link_author(WorkshopInfo, user_id, workshop_username) - - # save bio - save! + save end end def reset_workshop_account - self.workshop_verification_token = get_token - self.workshop_user_path = nil - self.workshop_username = nil - self.workshop_submissions_count = 0 - self.workshop_followers_count = 0 - save + reset_account(:workshop) end end From 5f63f92521b00c8f4e08b19b9c7090b91542cfe2 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:29:51 -0800 Subject: [PATCH 24/53] further optimization of UserBio model --- mod-picker/app/models/user_bio.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mod-picker/app/models/user_bio.rb b/mod-picker/app/models/user_bio.rb index 817975506..2d99215ac 100644 --- a/mod-picker/app/models/user_bio.rb +++ b/mod-picker/app/models/user_bio.rb @@ -11,6 +11,13 @@ class UserBio < ActiveRecord::Base # CALLBACKS after_create :generate_verification_tokens + # CONSTANTS + SITE_CODES = { + "Nexus Mods" => "nexus", + "Lover's Lab" => "lover", + "Steam Workshop" => "workshop" + } + def get_token "ModPicker:#{SecureRandom.hex(4).to_s.upcase}" end @@ -22,20 +29,12 @@ def generate_verification_tokens self.save end - def verify_account(site, user_path) + def verify_account(site_label, user_path) begin - case site - when "Nexus Mods" - verify_nexus_account(user_path) - when "Lover's Lab" - verify_lover_account(user_path) - when "Steam Workshop" - verify_workshop_account(user_path) - else - false - end + method_name = "verify_#{SITE_CODES[site_label]}_account" + public_send(method_name, user_path) if respond_to?(method_name) rescue RestClient::NotFound => e - raise " we couldn't find a #{site} user at that URL" + raise " we couldn't find a #{site_label} user at that URL" end end From ca91660460661436548f3c246970024995593286 Mon Sep 17 00:00:00 2001 From: Mator Date: Mon, 14 Nov 2016 16:37:10 -0800 Subject: [PATCH 25/53] simplified theme resolution on the site (no more ng-init) --- mod-picker/app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod-picker/app/views/layouts/application.html.erb b/mod-picker/app/views/layouts/application.html.erb index 414444fd5..32e484b21 100644 --- a/mod-picker/app/views/layouts/application.html.erb +++ b/mod-picker/app/views/layouts/application.html.erb @@ -6,7 +6,7 @@ <%= javascript_include_tag 'modpicker' %> - '" /> + " ng-href="{{currentTheme}}" />