Discourse Category Headers theme component

Those tags are part of the category description. I can try to put a html-safe on it, but I’m not sure if this will introduce vulnerabilities?

What is the error in the console with this blank page? Is it the one posted above?

Apologies, could you elaborate a little more on this? Thanks!

@NateDhaliwal I’m not sure! I’m sorry, I have no idea what these errors correspond to or how to find the one that directly relates to that page.

Did you take a look at how other components handle that?
I’d assume it’s save. At least I have the impression the official category banner component uses html-safe without any separate escaping too

2 Likes

FWIW This one appears to be an issue with something trying to use the old route rather than the new /admin/config/user-fields.json one.

It also has a mention of:

So maybe @RGJ may know more? :crossed_fingers:

1 Like

TL;DR no. :slight_smile:

Long version:

This is an internal plugin that we use on our hosting (similar to CDCK “hosted site”) that adds some extra features that we need to host the site. This specific line replaces the multisite “not found” with a more verbose error message which indicates that the owner of the site has probably misconfigured their DNS.

Since it patches the multisite middleware, every request on every site we host goes through it. If you see this plugin in a stack trace, and the line lib/middleware/enforce_hostname.rb is immediately above it, it is a normal call and not a cause of the issue.

3 Likes

Are you on the stable branch? Maybe the update caused the plugin to be broken on stable. Then it could help if an entry was added to the compatibility file.

2 Likes

@Moin I don’t know, how can I check what branch I’m on?

1 Like

Yes, you’re on stable @jackierenee.

And it indeed looks like what Moin said, the theme component was updated but there was no compatibility pin. @Rhidian @NateDhaliwal

5 Likes

Thanks for confirming @RGJ

So, do I need to simply wait for the compatibility pin before adding this component back to our site?

I’m working on a PR that should hopefully fix this issue.

3 Likes

Yes :+1:

1 Like

Sure.

Without the Theme Component, the text in the category description is --font-up-3 by default. This is via the .category-heading class. I think that this has grown in recent times.

With the Theme Component, the text in the category description is --font-0. This can be bumped up to --font-up-1(larger) or font-up-2(largest). Neither of these achieve the new normal!

1 Like

Righto, so is this okay?
smaller → --font-up-2
normal → --font-up-3
larger → --font-up-4
largest → --font-up-5
Cc: @Rhidian

1 Like

Hi @jackierenee , I’ve merged a PR. Could you try updating and see if it works?

1 Like

Hi @NateDhaliwal I just tried updating and added the component back to my site. Category pages are still blank.

And if I try to use it in combination with the minimal category boxes, I get a blank homepage also.

Maybe I’m doing something wrong, but I don’t know how to solve it.

I also got an error at the top of my site now:

One more bit, I think this is the error log that is related to that error message:

Message (4472 copies reported)

[db6814] ActionController::RoutingError (No route matches [GET] "/admin/customize/user_fields.json")
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/processing_request.rb:12:in `call'
lib/middleware/request_tracker.rb:385:in `call'


Backtrace

actionpack (7.2.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:35:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'
logster (2.20.0) lib/logster/middleware/reporter.rb:40:in `call'
railties (7.2.2.1) lib/rails/rack/logger.rb:41:in `call_app'
railties (7.2.2.1) lib/rails/rack/logger.rb:29:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/request_id.rb:33:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
plugins/z-communiteq-features/plugin.rb:142:in `call'
rack (2.2.10) lib/rack/method_override.rb:24:in `call'
rack (2.2.10) lib/rack/sendfile.rb:110:in `call'
rack-mini-profiler (3.3.1) lib/mini_profiler.rb:191:in `call'
lib/middleware/processing_request.rb:12:in `call'
message_bus (4.3.8) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:385:in `call'
actionpack (7.2.2.1) lib/action_dispatch/middleware/remote_ip.rb:96:in `call'
rails_multisite (6.1.0) lib/rails_multisite/middleware.rb:26:in `call'
plugins/z-communiteq-features/plugin.rb:168:in `call'
railties (7.2.2.1) lib/rails/engine.rb:535:in `call'
railties (7.2.2.1) lib/rails/railtie.rb:226:in `public_send'
railties (7.2.2.1) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.10) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.10) lib/rack/urlmap.rb:58:in `each'
rack (2.2.10) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `<main>'

Env

HTTP HOSTS: community.eaie.org

Thanks!

Are there any errors in the browser console?
Could you share your Discourse version you’re currently on? This in the /admin page.
Thanks!

Hi @NateDhaliwal, sorry, I don’t know what errors in the browser console means exactly.

I believe this is the version of discourse that I’m running: Discourse 3.4.6 - GitHub - discourse/discourse: A platform for community discussion. Free, open, simple. version 3d149ba8244585f4bcb41db77aa8825e72468bdb

Hi @NateDhaliwal sorry, I was able to figure it out, here are some of the errors:

Discourse v3.4.6 — https://github.com/discourse/discourse/commits/3d149ba824 — Ember v5.12.0
category-header.gjs:51 Uncaught TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at V.end (index.js:78:1)
    at V._run (index.js:78:1)
    at V.run (index.js:78:1)
    at d (deprecate.js:100:1)
    at Object.success (video-placeholder.js:39:1)
    at l (jquery.js:10:1)
    at Object.fireWith [as resolveWith] (jquery.js:10:1)
    at C (jquery.js:10:1)
    at XMLHttpRequest.<anonymous> (jquery.js:10:1)Understand this error
category-header.gjs:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._renderRoot (index.js:78:1)
    at io._appendDefinition (index.js:78:1)
    at io.appendOutletView (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at index.js:78:1Understand this error
category-header.gjs:51 Uncaught TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at V.end (index.js:78:1)
    at V._runExpiredTimers (index.js:78:1)Understand this error
category-header.gjs:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'mobileView')
    at get showHeader (category-header.gjs:51:61)
    at eE (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at index.js:78:1
    at index.js:78:1
    at X (index.js:78:1)
    at T (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at Object.evaluate (index.js:78:1)
    at tV.evaluateSyscall (index.js:78:1)
    at tV.evaluateInner (index.js:78:1)
    at tV.evaluateOuter (index.js:78:1)
    at t1.next (index.js:78:1)
    at t1._execute (index.js:78:1)
    at t1.execute (index.js:78:1)
    at t2.sync (index.js:78:1)
    at t6.render (index.js:78:1)
    at index.js:78:1
    at tx (index.js:78:1)
    at io._renderRoots (index.js:78:1)
    at io._renderRootsTransaction (index.js:78:1)
    at io._revalidate (index.js:78:1)
    at invoke (index.js:78:1)
    at m.flush (index.js:78:1)
    at g.flush (index.js:78:1)
    at V._end (index.js:78:1)
    at index.js:78:1Understand this error
1 Like

That is very odd. It’s strange that this error is appearing now, as this.site.mobileView was in the original version :thinking:. I cannot repo this with latest tests-passed, could this be a limitation of stable (though, it seems unlikely - core uses this as well).