Merge remote-tracking branch 'remotes/Discourse/main'
# Conflicts: # common/head_tag.html
This commit is contained in:
commit
93c9c848f0
4
.discourse-compatibility
Normal file
4
.discourse-compatibility
Normal file
@ -0,0 +1,4 @@
|
||||
< 3.5.0.beta5-dev: 470bf3773cd2c4f3e68324f1f18bee07bfdd06dc
|
||||
< 3.5.0.beta1-dev: eea53e651236b19aefb9805d3ba1ffb99514f641
|
||||
< 3.4.0.beta1-dev: fbaabb28b715d095e800e5b19c3e74378ea5d431
|
||||
< 3.3.0.beta1-dev: a488709d752505091c22d12581d1d624d3254d62
|
11
.github/workflows/discourse-theme.yml
vendored
Normal file
11
.github/workflows/discourse-theme.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
name: Discourse Theme
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: discourse/.github/.github/workflows/discourse-theme.yml@v1
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.discourse-site
|
1
.prettierrc.cjs
Normal file
1
.prettierrc.cjs
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@discourse/lint-configs/prettier");
|
2
.rubocop.yml
Normal file
2
.rubocop.yml
Normal file
@ -0,0 +1,2 @@
|
||||
inherit_gem:
|
||||
rubocop-discourse: stree-compat.yml
|
2
.streerc
Normal file
2
.streerc
Normal file
@ -0,0 +1,2 @@
|
||||
--print-width=100
|
||||
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
|
1
.template-lintrc.cjs
Normal file
1
.template-lintrc.cjs
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@discourse/lint-configs/template-lint");
|
8
Gemfile
Normal file
8
Gemfile
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
group :development do
|
||||
gem "rubocop-discourse"
|
||||
gem "syntax_tree"
|
||||
end
|
103
Gemfile.lock
Normal file
103
Gemfile.lock
Normal file
@ -0,0 +1,103 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (8.0.2)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
uri (>= 0.13.1)
|
||||
ast (2.4.3)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.4.1)
|
||||
bigdecimal (3.2.1)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.3)
|
||||
drb (2.2.3)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.12.2)
|
||||
language_server-protocol (3.17.0.5)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.7.0)
|
||||
minitest (5.25.5)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.8.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prettier_print (1.2.1)
|
||||
prism (1.4.0)
|
||||
racc (1.8.1)
|
||||
rack (3.1.15)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.10.0)
|
||||
rubocop (1.76.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.45.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.45.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-capybara (2.22.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-discourse (3.12.1)
|
||||
activesupport (>= 6.1)
|
||||
lint_roller (>= 1.1.0)
|
||||
rubocop (>= 1.73.2)
|
||||
rubocop-capybara (>= 2.22.0)
|
||||
rubocop-factory_bot (>= 2.27.0)
|
||||
rubocop-rails (>= 2.30.3)
|
||||
rubocop-rspec (>= 3.0.1)
|
||||
rubocop-rspec_rails (>= 2.31.0)
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.32.0)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.44.0, < 2.0)
|
||||
rubocop-rspec (3.6.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec_rails (2.31.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec (~> 3.5)
|
||||
ruby-progressbar (1.13.0)
|
||||
securerandom (0.4.1)
|
||||
syntax_tree (6.2.0)
|
||||
prettier_print (>= 1.2.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
uri (1.0.3)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-23
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
rubocop-discourse
|
||||
syntax_tree
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.9
|
3
eslint.config.mjs
Normal file
3
eslint.config.mjs
Normal file
@ -0,0 +1,3 @@
|
||||
import DiscourseRecommendedTheme from "@discourse/lint-configs/eslint-theme";
|
||||
|
||||
export default [...DiscourseRecommendedTheme];
|
60
javascripts/discourse/api-initializers/init-theme.js
Normal file
60
javascripts/discourse/api-initializers/init-theme.js
Normal file
@ -0,0 +1,60 @@
|
||||
import { apiInitializer } from "discourse/lib/api";
|
||||
|
||||
export default apiInitializer((api) => {
|
||||
api.onPageChange((url, title) => {
|
||||
const currentUser = api.getCurrentUser();
|
||||
|
||||
if (settings.exclude_groups.trim() && currentUser) {
|
||||
const excludedGroups = settings.exclude_groups
|
||||
.split(",")
|
||||
.map((g) => g.trim());
|
||||
const currentUserGroups = currentUser.groups.map((g) => g.name);
|
||||
if (excludedGroups.filter((g) => currentUserGroups.includes(g)).length) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const _paq = (window._paq = window._paq || []);
|
||||
window._paq_loaded = window._paq_loaded || false;
|
||||
|
||||
if (!window._paq_loaded) {
|
||||
let u = `//${settings.host_url}/`;
|
||||
_paq.push(["setTrackerUrl", u + "piwik.php"]);
|
||||
_paq.push(["setSiteId", settings.website_id]);
|
||||
let d = document,
|
||||
g = d.createElement("script"),
|
||||
s = d.getElementsByTagName("script")[0];
|
||||
g.type = "text/javascript";
|
||||
g.async = true;
|
||||
g.defer = true;
|
||||
g.src = u + "piwik.js";
|
||||
s.parentNode.insertBefore(g, s);
|
||||
window._paq_loaded = true;
|
||||
}
|
||||
|
||||
const userIdField = settings.user_id_tracking.trim();
|
||||
if (userIdField && currentUser && currentUser[userIdField]) {
|
||||
_paq.push(["setUserId", currentUser[userIdField]]);
|
||||
}
|
||||
|
||||
if (settings.subdomain_tracking) {
|
||||
const allDomains =
|
||||
"*" + document.domain.substring(document.domain.indexOf("."));
|
||||
_paq.push(["setCookieDomain", allDomains]);
|
||||
_paq.push(["setDomains", allDomains]);
|
||||
}
|
||||
|
||||
if (settings.do_not_track) {
|
||||
_paq.push(["setDoNotTrack", true]);
|
||||
}
|
||||
|
||||
if (settings.disable_cookies) {
|
||||
_paq.push(["disableCookies"]);
|
||||
}
|
||||
|
||||
_paq.push(["setCustomUrl", url]);
|
||||
_paq.push(["setDocumentTitle", title]);
|
||||
_paq.push(["trackPageView"]);
|
||||
_paq.push(["enableLinkTracking"]);
|
||||
});
|
||||
});
|
17
package.json
Normal file
17
package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@discourse/lint-configs": "2.25.0",
|
||||
"ember-template-lint": "7.8.1",
|
||||
"eslint": "9.28.0",
|
||||
"prettier": "3.5.3",
|
||||
"stylelint": "16.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 22",
|
||||
"npm": "please-use-pnpm",
|
||||
"yarn": "please-use-pnpm",
|
||||
"pnpm": "9.x"
|
||||
},
|
||||
"packageManager": "pnpm@9.15.5"
|
||||
}
|
3483
pnpm-lock.yaml
generated
Normal file
3483
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,3 +17,11 @@ subdomain_tracking:
|
||||
type: bool
|
||||
default: false
|
||||
description: Track visitors across main domain & subdomains, assuming discourse is on a subdomain.
|
||||
do_not_track:
|
||||
type: bool
|
||||
default: false
|
||||
description: So tracking requests will not be sent if visitors do not wish to be tracked.
|
||||
disable_cookies:
|
||||
type: bool
|
||||
default: false
|
||||
description: Disables all first party cookies. Existing Matomo cookies for this website will be deleted on the next pageview.
|
||||
|
7
spec/system/core_features_spec.rb
Normal file
7
spec/system/core_features_spec.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "Core features", type: :system do
|
||||
before { upload_theme_or_component }
|
||||
|
||||
it_behaves_like "having working core features"
|
||||
end
|
3
stylelint.config.mjs
Normal file
3
stylelint.config.mjs
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
extends: ["@discourse/lint-configs/stylelint"],
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user