Commit Graph

538 Commits

Author SHA1 Message Date
Isaac Janzen 554f03f3da
FEATURE: Add group and category restrictions to house ads (#205)
# Description

This PR adds the ability to apply **group** and **category** restrictions to a **house ad**.

# What is included
- In order to get the group and category selectors to work within `admin/assets/javascripts/discourse/controllers/admin-plugins-house-ads-show.js` I needed to modernize the file. 
- I dropped the `bufferedProperty` implementation in favor of a vanilla ember approach
- I added `category_ids` and `group_ids` to our house ads model
- I added tests for group / category restrictions
- I added a preview button to display the house ad
- `/site.json` would return a object called `house_creatives` and a list of key value pairs that matched the ad name with the html, like so:
```js
{ AD_KEY: ad.html }
```
I need access to the category ids on the client to conditionally render the house ads so the new format will be: 
```js
{ AD_KEY: { html: ad.html, category_ids: ad.category_ids } }
```

# Screenshots
<img width="658" alt="Screenshot 2024-04-08 at 2 39 22 PM" src="https://github.com/discourse/discourse-adplugin/assets/50783505/b44b386d-65a1-4a2a-a487-d735b13357dd">

# Preview Video

https://github.com/discourse/discourse-adplugin/assets/50783505/6d0d8253-afef-4e15-b6fc-c6f696efd169
2024-04-09 11:54:11 -06:00
Loïc Guitaut c4227de1b5 DEV: Fix new Rubocop offenses 2024-03-05 18:12:49 +01:00
Selase Krakani 84d9b1a6da
DEV: Pin plugin for Discourse < 3.3.0.beta1-dev (#203) 2024-02-29 13:48:36 -07:00
Discourse Translator Bot 062efc8a54
Update translations (#202) 2024-02-23 09:42:33 +01:00
David Taylor 32f18893ec
FEATURE: Improve DFP / Ad-manager Content-Security-Policy compat (#201)
Switching to cross-domain iframes is recommended by google here: https://developers.google.com/publisher-tag/guides/content-security-policy
2024-02-19 12:35:22 +00:00
Blake Erickson b0c95114ea
FIX: Calculate no ads for groups server side (#200)
If the selected group to not display ads to had its visibility set to
not be visible then this setting wouldn't work correctly because that
group wouldn't be available client side. The change moves that group
check to be server side so that we can correctly see all the groups that
should not see ads.
2024-02-15 14:52:15 -07:00
David Taylor 1677f7ae39
DEV: Pass `post` instead of `transformedPost` to post-bottom-ad (#199)
Changes in 0948d6b19e caused the post-bottom-ad component to start receiving the widget-ised 'transformedPost' instead of the original `post` model. In most cases this difference didn't matter, but it did cause noticable issues with `@model.category` and `@model.topic`.

This commit also deletes the unused `post-bottom/discourse-adplugin.hbs` connector. In the past, the adplugin itself was defining the post-bottom outlet. But now, we use RenderGlimmer to load the `post-bottom-ad` directly.
2024-02-14 13:59:36 +00:00
Discourse Translator Bot 751916b8e3
Update translations (#198) 2024-02-13 16:11:16 +01:00
Blake Erickson 9581367239
FIX: Add exclude groups for each ad platforms (#197)
With the new group system for displaying ads we no longer can check if a
user belongs to a trust level group lower than specified. The other
problem is that ALL users including staff and higher trust levels all
belong to trust level 0. So without this fix if we say that an ad should
be visible to trust level 0 users then it will be shown to all users.

This fix adds a new default setting for each ad platform for excluding
trust level 3, 4, and staff users from being shown ads.

- Make display_groups hidden (they will be removed in a later commit)
- Switch to using only exclude_groups instead of display groups and
  exclude groups
- rename showToDisplayGroups to showXAds for each provider
2024-02-08 19:42:40 -07:00
Blake Erickson 6b5412826f
DEV: Update migration to match new site settings (#196)
Forgot to update these values in the previous PR.

Follow up to: https://github.com/discourse/discourse-adplugin/pull/195
2024-01-31 11:17:56 -07:00
Blake Erickson 6f8ff34ffa
DEV: Convert TL settings to groups (#195)
* DEV: Convert TL settings to groups

This change converts the TL site settings in this plugin to use groups
instead.

See: https://meta.discourse.org/t/283408

Co-authored-by: Martin Brennan <martin@discourse.org>
2024-01-31 11:04:24 -07:00
Discourse Translator Bot 19ac017dd4
Update translations (#194) 2024-01-16 14:54:13 +01:00
Jarek Radosz 429c9644de
DEV: Update linting (#191) 2024-01-15 11:24:24 +00:00
David Taylor de7d8ce497
DEV: Resolve more link-to deprecations for ember upgrade (#193) 2024-01-09 20:07:04 +00:00
David Taylor 51af568c92
DEV: Resolve link-to deprecation for Ember upgrade (#192) 2023-12-13 14:59:32 +00:00
Martin Brennan 1d39cd8c80
Update plugin.rb metadata (#183)
Co-authored-by: AlexDev <104522507+alexdevlaeminck@users.noreply.github.com>
2023-11-08 11:16:53 -08:00
David Taylor 36f4ebc64b
DEV: Abort placing adsense if Ember component is destroyed (#190)
This should avoid surprising error messages being printed to the console
2023-11-08 10:44:39 +11:00
David Taylor 789be84744
DEV: Log errors from adsense (#189) 2023-11-07 22:44:02 +00:00
David Taylor c88bb59d81
FIX: Fully re-render ads when navigating between pages (#188)
In the past, the ad plugin relied on two side-effects to achieve this behaviour:

1. Components being fully destroyed/rendered when navigating between pages. This stopped working when Discourse core moved to the more efficient 'loading slider' UI

2. The `listLoading` argument. This was an implementation detail of the old discovery routing infrastructure. Core recently overhauled this and removed the `listLoading` argument, because loading is now handled properly by the Ember router.

Instead of these two properties, we can use the `currentRoute` property of Ember's router service to trigger changes when navigating between pages. A common `{{#each` trick is used to fully destroy/re-render components even if the ad network is unchanged.
2023-11-07 21:12:30 +00:00
Discourse Translator Bot 5ad841de0b
Update translations (#184) 2023-11-07 21:31:35 +01:00
David Taylor 0948d6b19e DEV: Refactor initializer to use RenderGlimmer and registerWidgetShim 2023-11-07 18:37:39 +00:00
David Taylor 3828578d5d DEV: Restructure file locations
- Colocate components / connectors
- Move admin UI files to `admin/assets` so they are only served to admins
2023-11-07 18:37:39 +00:00
David Taylor dbafb3b277 DEV: Update tests to use qunit-dom 2023-11-07 18:14:12 +00:00
David Taylor 86ef7da2eb DEV: Apply eslint --fix 2023-11-07 18:14:12 +00:00
David Taylor 32a43a850f DEV: Update linting config 2023-11-07 18:14:12 +00:00
dependabot[bot] 8931e2a07e
Bump @babel/traverse from 7.20.10 to 7.23.2 (#182)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.20.10 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 18:26:49 +02:00
Discourse Translator Bot 44f49725f8
Update translations (#181) 2023-08-29 15:50:11 +02:00
Discourse Translator Bot 3a89fbdd9a
Update translations (#180) 2023-08-23 09:28:54 +02:00
Penar Musaraj 8f51e0e4c0
DEV: Pin plugin for Discourse 3.1 stable (#179) 2023-08-22 13:45:25 -05:00
Discourse Translator Bot 30c49eb50d
Update translations (#178) 2023-08-08 15:42:08 +02:00
dependabot[bot] 8cb9628f0d
Bump word-wrap from 1.2.3 to 1.2.4 (#177)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 01:00:58 +02:00
dependabot[bot] b4aa9a05be
Bump semver from 6.3.0 to 6.3.1 (#176)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 10:37:40 +02:00
Discourse Translator Bot db0097b8f8
Update translations (#175) 2023-07-04 18:13:14 +02:00
Discourse Translator Bot bade14daa0
Update translations (#174) 2023-06-27 16:39:17 +02:00
Isaac Janzen 743478d593
DEV: Use angle bracket syntax (#172) 2023-05-26 09:20:47 -05:00
Kris 58205cc9ac
UX: introduce min-height for responsive ads (#170) 2023-04-25 16:19:48 -04:00
Discourse Translator Bot d3005f26af
Update translations (#169) 2023-04-11 15:44:40 +02:00
Osama Sayegh c2057a5056
FEATURE: Add per-ad visibility settings for anons and logged-in users (#168)
This commit adds 2 new settings to house ads to control whether an ad is shown to anonymous users and logged in users. Existing ads that were created before this feature will default to true for both settings; i.e., they will remain to be visible to both anonymous and logged-in users, but it will be possible to change the settings. Turning off both settings will effectively disable the ad completely.
2023-04-07 17:56:22 +03:00
Discourse Translator Bot bfd4438b97
Update translations (#167) 2023-02-21 17:11:00 +01:00
Rishabh 4d2ec950d0
Ensure README images are pointing to discourse/gh-owned repositories (#166) 2023-01-25 17:30:08 +05:30
discoursebot 165ecdefc5
DEV: Update CI workflows (#165)
Co-authored-by: discoursebuild <build@discourse.org>
2023-01-10 18:02:36 +00:00
David Taylor c519b4bc92
DEV: Update eslint-config-discourse, use prettier for hbs (#163) 2023-01-04 13:34:08 +01:00
Discourse Translator Bot dc48bea931
Update translations (#164) 2022-12-30 17:49:25 +01:00
David Taylor c73ac98748
DEV: Introduce syntax_tree for ruby formatting (#161) 2022-12-29 13:29:26 +01:00
Discourse Translator Bot ff6b767796
Update translations (#160) 2022-12-28 13:31:54 +01:00
Discourse Translator Bot 116795aff3
Update translations (#159) 2022-11-29 15:35:21 +01:00
dependabot[bot] fd6ac11ee9
Bump minimatch from 3.0.4 to 3.1.2 (#157)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-27 17:33:42 +01:00
Discourse Translator Bot 203eedb915
Update translations (#156) 2022-11-16 11:36:55 +01:00
discoursebot 8ac32a06c3
DEV: Update CI workflows (#155)
Co-authored-by: discoursebuild <build@discourse.org>
2022-11-07 12:45:46 -06:00
Discourse Translator Bot f52ac0775f
Update translations (#154) 2022-11-02 15:12:51 +01:00