Commit Graph

190 Commits

Author SHA1 Message Date
David Taylor 7685ebf396
DEV: Update to native class syntax (#230) 2024-11-29 10:11:21 +00:00
David Taylor 119d331759
DEV: Update linting (#227) 2024-11-20 15:43:19 +01:00
David Taylor 1d3baa5519
DEV: Update eslint config (#225) 2024-11-19 11:18:26 +01:00
Arpit Jalan ec53a0d6b8
FIX: add a fix for cases where ad record is not found (#214) 2024-07-05 13:00:18 +05:30
Arpit Jalan 9b72130fdf
FIX: show non-restricted ads instead of not showing ads at all (#213)
In some cases where there were category restricted house ads we were not
showing ads on reload. This commit filter out all the ads that should
not be shown on current page, leaving only allowed ads. So now we'll
show ads on every reload in all the cases.

Internal ticket: t130920
2024-06-27 22:13:54 +05:30
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
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
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 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
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
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 86ef7da2eb DEV: Apply eslint --fix 2023-11-07 18:14:12 +00:00
David Taylor c519b4bc92
DEV: Update eslint-config-discourse, use prettier for hbs (#163) 2023-01-04 13:34:08 +01:00
Roman Rizzi 4940d0ea19
FIX: Ensure we won't render the connector if there are no ads (#148) 2022-07-14 15:58:29 -03:00
Roman Rizzi d9b739f803
FIX: Don't render the connector when we shouldn't display an ad in the topic list item. (#146)
We expose the ad-slot logic to determine which ads are potentially available for each slot and don't render the connector when there are none. Leaking the component logic is not ideal, but I don't see a better solution given the
current design.
2022-07-12 16:13:18 -03:00
Arpit Jalan 5901a52dbc
FEATURE: support placing ads between topic list for house ads (#143)
* init

* more

* Pass td and colspan to component

* various fixes for house ads between n topics and add a test

* Make adComponents condition easier to read

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>
2022-07-07 08:53:29 -03:00
Isaac Janzen fb73dda584
DEV: Remove 'htmlSafe' string prototype extensions (#140)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-06-01 11:37:01 -05:00
Jarek Radosz 7e2a490b67
DEV: Fix imports (#132) 2022-03-06 19:52:19 +01:00
Jarek Radosz c788b7bf1f
DEV: Lose the es6 suffix (#131) 2022-03-05 17:23:41 +01:00
Martin Brennan 55045bba3c
DEV: Update code for eslint object-shorthand-rule. See 4f7aba06c0 (#119) 2021-11-10 11:58:31 +11:00
tshenry f2171a51c3
FIX: use imports instead of Discourse global (#118)
Replaces `Discourse.Site` with the imported equivalent and `Discourse.SiteSettings` with `this.siteSettings`
2021-09-21 11:27:10 -07:00
Joffrey JAFFEUX 6438000ed4
DEV: prettier 2.2.1 (#101) 2021-01-27 10:36:36 +01:00
jjaffeux 9adaef17cc Revert "DEV: enforces no-var (#94)"
This reverts commit 9ad0133624.
2020-10-13 15:42:21 +02:00
Joffrey JAFFEUX 9ad0133624
DEV: enforces no-var (#94) 2020-10-13 11:40:33 +02:00
Joffrey JAFFEUX 15b2c1a05e
REFACTOR: loadGoogle doesn't take any argument (#92) 2020-09-23 15:05:23 +02:00
Joffrey JAFFEUX 30dad0281d
DEV: apply coding standards (#91) 2020-09-04 13:24:14 +02:00
jjaffeux 5afca0aaa1 linting 2020-08-21 16:48:41 +02:00
Lawrence Thorpe 8439608f17
FIX: isFluid parameter for in-feed adsense units (#90)
Fixes issue in #89
2020-08-21 10:24:12 -04:00
Lawrence Thorpe 50788a876e
Add support for adsense fluid format for in-feed (#89) 2020-08-21 09:53:34 -04:00
Joffrey JAFFEUX 914735767a
FIX: re-revert db4f5f99 with updated tests (#88)
The tests were using an incorrect value for the site setting (the name of the group instead of the id).

`no_ads_for_groups` shows groups names in the UI byt actually stores IDs.
2020-08-04 08:03:22 +02:00
Penar Musaraj db4f5f990d
Revert "FIX: removes part of the 2.4 legacy code forgotten (#87)"
This reverts commit c27d5f8e85.
2020-08-03 21:44:10 -04:00
Joffrey JAFFEUX c27d5f8e85
FIX: removes part of the 2.4 legacy code forgotten (#87)
no_ads_for_groups returns a list of ids
2020-08-03 21:01:51 +02:00
Bianca Nenciu 3fc872520e
FIX: CodeFund is shutting down (#85) 2020-07-10 18:09:32 +03:00
Robin Ward 3d0ee3f28a FIX: Prettier 2020-06-25 15:50:21 -04:00
Robin Ward 05967a8d52 FIX: Plugin was broken in stable 2020-06-25 14:51:14 -04:00
Rafael dos Santos Silva 4ded0bdba9
DEV: Fix usage of deprecated global 2020-06-04 17:30:26 -03:00
Joffrey JAFFEUX 270799166b
REFACTOR: applies discourse core coding practices (#82) 2020-03-23 09:40:29 +01:00
Neil Lalonde cd82a905ae
Load Google Ad Manager code from doubleclick.net
https://support.google.com/admanager/answer/1638622?hl=en
2020-03-13 14:24:54 -04:00
jjaffeux af346fc1c2 FIX: makes houses hads work with sk2 2020-02-07 10:34:58 +01:00
Gerhard Schlager 275921ac70
Make prettier happy 2020-01-16 00:12:27 +01:00
Neil Lalonde 116f9dd238 FEATURE: add support for fluid ad size in Google Ad Manager
No width or height will be set on containers when ad size is fluid.
2020-01-15 16:52:02 -05:00
David Taylor cf27a7be64 DEV: Stop loading external scripts while running tests (#81)
* DEV: Stop loading external scripts while running tests

* Revert "Turn of CSP for tests"

This reverts commit db1bf99277. It had no effect, since CSP is set by the server, and this was only affecting the client
2020-01-06 10:01:40 -07:00
Penar Musaraj 155d9f904c Import Promise from RSVP 2019-11-22 11:04:36 -05:00
Penar Musaraj b59f841944 DEV: Respect radix rule in eslint-config-discourse 1.0.6 2019-11-18 10:07:55 -05:00
Neil Lalonde 8d4df6df91 Rename house ad routes so ad blockers don't detect them
adplugin, house_ads, house_ad_settings become
pluginad, house_creatives, and house_settings.
2019-10-08 17:41:13 -04:00
Sam Saffron 02f9145751 lint file
AdButler is not a whitelisted constant, access it via window.
2019-09-17 13:46:32 +10:00
Neil Lalonde 51c1b89a62 Prettier 2019-09-16 14:35:58 -04:00