Skip to content

Commit

Permalink
deprecate old setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pfaffman committed Aug 9, 2024
1 parent 50429f2 commit 03dc8fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ export function decorateInlineLink(element) {
containers.forEach((container) => {
const href = container.href;

let linkMap = settings.affiliate_link_map;
if (linkMap,split(",") === "example.com") {

Check failure on line 13 in javascripts/discourse/api-initializers/discourse-affiliate-linker.js

View workflow job for this annotation

GitHub Actions / ci / linting

Unexpected use of comma operator

Check failure on line 13 in javascripts/discourse/api-initializers/discourse-affiliate-linker.js

View workflow job for this annotation

GitHub Actions / ci / linting

'split' is not defined
console.error("Please configure the affiliate_link_map setting. Affilliate_link_map is deprecated");

Check failure on line 14 in javascripts/discourse/api-initializers/discourse-affiliate-linker.js

View workflow job for this annotation

GitHub Actions / ci / linting

Unexpected console statement
linkMap = settings.affilliate_link_map;
}
settings.affilliate_link_map.split("|").forEach((linkMap) => {

Check failure on line 17 in javascripts/discourse/api-initializers/discourse-affiliate-linker.js

View workflow job for this annotation

GitHub Actions / ci / linting

'linkMap' is already declared in the upper scope on line 12 column 9
const [hostname, link] = linkMap.split(",").map(item => item.trim());
const [hostname, link] = linkMap.split(",").map((item) => item.trim());

if (!hostname || !link) {
console.error("Invalid affiliate link map entry:", linkMap);

Check failure on line 21 in javascripts/discourse/api-initializers/discourse-affiliate-linker.js

View workflow job for this annotation

GitHub Actions / ci / linting

Unexpected console statement
Expand Down
4 changes: 4 additions & 0 deletions settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
affilliate_link_map:
default: "digitalocean.com,https://m.do.co/c/a5bf212d9a92"
type: "list"
description: "Deprecated. Use affiliate_link_map instead."
affiliate_link_map:
default: "example.com,https://example.com/affilliate/1234"
type: "list"
description: "hostname,referal link"

0 comments on commit 03dc8fd

Please sign in to comment.