Commit Graph

33 Commits

Author SHA1 Message Date
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
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 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 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 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
Roman Rizzi 469771db1d
DEV: Skip assertion temporarily. (#145)
The code-review plugin overrides the core's topic-list template, which makes all the connectors for the outlets there stop working. I'm temporarily skipping this assertion until we remove the override.
2022-07-07 15:07:16 -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
Jarek Radosz c788b7bf1f
DEV: Lose the es6 suffix (#131) 2022-03-05 17:23:41 +01:00
David Taylor 912e68e587 DEV: Import test helpers 2022-01-25 14:41:53 +00:00
Jarek Radosz d5cf5776d9
DEV: Fix deprecated imports (#120) 2021-11-12 19:13:46 +01:00
discoursebot 112fe8f4cb
DEV: Update CI workflows (#98)
* DEV: Update CI workflows

* DEV: Fix linting

Co-authored-by: justindirose <justindirose@users.noreply.github.com>
2021-01-04 14:42:25 -06:00
Roman Rizzi 4bf6420b91
REFACTOR: Use the new format for acceptance tests. (#97) 2020-12-29 13:01:26 -03:00
Joffrey JAFFEUX 30dad0281d
DEV: apply coding standards (#91) 2020-09-04 13:24:14 +02: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
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
Blake Erickson db1bf99277 Turn of CSP for tests 2020-01-03 16:30:34 -07:00
Neil Lalonde b500ea171f DEV: Add tests for no_ads_for_categories 2019-09-11 12:18:42 -04:00
Joffrey JAFFEUX 8c3fe62e90 DEV: new API s/replaceCurrentUser/updateCurrentUser
See https://github.com/discourse/discourse/pull/7769
2019-06-14 10:59:32 +02:00
Neil Lalonde 7af8f1d46b FEATURE: new setting to disable ads based on category of current page
Use the "no ads for categories" setting to define which category pages
(topic list and topics) should not render any ads.
2019-06-05 16:00:24 -04:00
Neil Lalonde 2ca0adca05 Fix failing js test 2019-05-08 13:44:25 -04:00
Neil Lalonde 10ab104cd8 JS test for mixed ads 2019-05-08 11:17:40 -04:00
Neil Lalonde 1bd80e1afe FEATURE: House Ads
Allows creating ads within Discourse admin at Plugins > House Ads.
Write the ads in html and style them with CSS in themes.
2019-05-03 11:39:34 -04:00
Neil Lalonde 5272995e74 FEATURE: use groups to control who sees ads 2019-05-03 11:39:34 -04:00
Neil Lalonde 369d5dfc9e oops revert again "FEATURE: use groups to control who sees ads" and all later" 2019-04-17 16:02:19 -04:00
Neil Lalonde b105da53e8 disable js tests
works on my machine, but breaks build
2019-04-17 15:53:41 -04:00
Neil Lalonde e6bcd96d8e FEATURE: use groups to control who sees ads" and all later 2019-04-17 15:40:50 -04:00
Neil Lalonde 50d258dc37 Revert "FEATURE: use groups to control who sees ads" and all later
Revert "Updates to codefund-ad"
Revert "Updates to carbonads-ad"
Revert "Updates to amazon-product-links"
2019-04-17 15:37:09 -04:00
Neil Lalonde 4fd7caffd6 FEATURE: use groups to control who sees ads
A new setting has been added in Admin > Settings > Ad Plugin called
"no ads for groups". Add group names to this list. If a user belongs
to any of the groups, they will not see any ads. This is an alternative
to using trust level settings like "adsense through trust level".
2019-04-17 11:36:50 -04:00
Neil Lalonde 943acbfeb1 Add some js tests, and update adsense js 2019-04-17 11:36:47 -04:00
Sarah Ni 647eecd95b master - more consistent naming for dfp settings and removed test folder 2015-09-10 12:07:36 +10:00
vi 9daa9ad3fe Added test file 2015-09-01 10:05:03 +10:00