From 4cf67e9231b3cb89eaf785d34481c6b4ad1fc0e8 Mon Sep 17 00:00:00 2001 From: Cinder Date: Mon, 4 Nov 2024 07:29:09 -0800 Subject: [PATCH 1/3] [Users] Minor fix to the profile page (#779) --- app/javascript/src/styles/specific/users.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/src/styles/specific/users.scss b/app/javascript/src/styles/specific/users.scss index c55a05407..a092d5814 100644 --- a/app/javascript/src/styles/specific/users.scss +++ b/app/javascript/src/styles/specific/users.scss @@ -160,10 +160,10 @@ div#c-users { grid-area: p-posts; display: flex; overflow: auto; - justify-content: space-between; + justify-content: flex-start; flex-wrap: wrap; - gap: 0.5em; + gap: 1em; padding: 0.5em; background: var(--color-section); @@ -176,7 +176,7 @@ div#c-users { } article.post-preview { - flex: 0 0 150px; + flex: 0 0 154px; margin: 0; img { max-width: unset !important; } } From ad567bfc9cee96e5429e00a9b80b0c04316409bc Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Mon, 4 Nov 2024 09:36:52 -0600 Subject: [PATCH 2/3] [HelpPages] Fix json & move modaction logging (#700) * Fix #492 (json error when no help pages exist) * Move modactions into class --- app/controllers/help_controller.rb | 22 ++++++---------------- app/models/help_page.rb | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index d79edc9dc..a3918a97d 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -3,8 +3,7 @@ class HelpController < ApplicationController respond_to :html, :json helper :wiki_pages - before_action :admin_only, only: [:new, :create, :edit, - :update, :destroy] + before_action :admin_only, except: %i[index show] def show if params[:id] =~ /\A\d+\Z/ @@ -18,16 +17,14 @@ class HelpController < ApplicationController redirect_to help_pages_path end end - format.json do - raise ActiveRecord::RecordNotFound if @help.blank? - render json: @help - end end end def index @help_pages = HelpPage.help_index - respond_with(@help_pages) + respond_with(@help_pages) do |format| + format.json { render json: @help_pages.to_json } + end end def new @@ -42,27 +39,20 @@ class HelpController < ApplicationController def create @help = HelpPage.create(help_params) - if @help.valid? - flash[:notice] = 'Help page created' - ModAction.log(:help_create, {name: @help.name, wiki_page: @help.wiki_page}) - end + flash[:notice] = "Help page created" if @help.valid? respond_with(@help) end def update @help = HelpPage.find(params[:id]) @help.update(help_params) - if @help.valid? - flash[:notice] = "Help entry updated" - ModAction.log(:help_update,{name: @help.name, wiki_page: @help.wiki_page}) - end + flash[:notice] = "Help entry updated" if @help.valid? respond_with(@help) end def destroy @help = HelpPage.find(params[:id]) @help.destroy - ModAction.log(:help_delete, {name: @help.name, wiki_page: @help.wiki_page}) respond_with(@help) end diff --git a/app/models/help_page.rb b/app/models/help_page.rb index 09b871f4a..bbb09fcc8 100644 --- a/app/models/help_page.rb +++ b/app/models/help_page.rb @@ -5,7 +5,10 @@ class HelpPage < ApplicationRecord validates :wiki_page, :name, presence: true normalizes :name, with: ->(name) { name.downcase.strip.tr(" ", "_") } validate :wiki_page_exists + after_create :log_create + after_update :log_update after_destroy :invalidate_cache + after_destroy :log_destroy after_save :invalidate_cache belongs_to :wiki, class_name: "WikiPage", foreign_key: "wiki_page", primary_key: "title" @@ -37,4 +40,20 @@ class HelpPage < ApplicationRecord def self.help_index Cache.fetch("help_index", expires_in: 12.hours) { HelpPage.all.sort_by(&:pretty_title) } end + + module LogMethods + def log_create + ModAction.log(:help_create, { name: name, wiki_page: wiki_page }) + end + + def log_update + ModAction.log(:help_update, { name: name, wiki_page: wiki_page }) + end + + def log_destroy + ModAction.log(:help_delete, { name: name, wiki_page: wiki_page }) + end + end + + include LogMethods end From f5b492241e4f2f65442ba8141cdbc8cfe46ee34d Mon Sep 17 00:00:00 2001 From: jmortiger Date: Mon, 4 Nov 2024 11:03:09 -0500 Subject: [PATCH 3/3] [Blacklist] Fix filter_util.js 'favcout' typo (#780) --- app/javascript/src/javascripts/utility/filter_util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/src/javascripts/utility/filter_util.js b/app/javascript/src/javascripts/utility/filter_util.js index 2fd316247..5b4fd7155 100644 --- a/app/javascript/src/javascripts/utility/filter_util.js +++ b/app/javascript/src/javascripts/utility/filter_util.js @@ -98,7 +98,7 @@ FilterUtils.normalizeData = (value, type) => { case "width": case "height": case "score": - case "favcout": + case "favcount": case "userid": return parseInt(value); case "rating":