mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
127 stars 41 forks source link

implement "rotating" tag shelf #8403

Closed eviljeff closed 3 years ago

eviljeff commented 3 years ago

We want to have a shelf for tags on the homepage, but we want to "rotate" (randomly select) which tag shelf is shown.

There is currently the ability to create arbitrary shelves that would show content from any valid API response that returns add-ons, and in some ways rotating is similar to the primary hero shelf, which shows a randomly selected promoted add-on, but we don't want to have to create 44 shelves, each one defining a different &tag=xxx value.

ioanarusiczki commented 3 years ago

@eviljeff What's the API endpoint I could use in Postman?

eviljeff commented 3 years ago

What's the API endpoint I could use in Postman?

If a Shelf (& module) is enabled, with endpoint "random tag", then the results will be returned via /api/v5/shelves/ with the other enabled shelves. On each API call the tag=xxx in the underlying search url will be different. There isn't currently (#17497) any threshold or filtering for addons appearing in the shelf, or any default ordering - though extra criteria can be specified in the criteria field similarly to a search shelf.

ioanarusiczki commented 3 years ago

@eviljeff

on AMO dev:

results

eviljeff commented 3 years ago
* the frontend also started returning results , every time I refresh the page I get different add-ons but most of the times I get less than 4(but I left 4 as default for each shelf in django), sometimes a shelf is empty and I think there should be enough tags in order to rotate 4 each time  - is that good for now?

Do you mean that the shelf should contain more than 4 addons (because there are more than 4 addons tagged with that tag, and that fit whatever other criteria you entered, if you entered extra criteria) but doesn't?

Did you find an easy way to identify which tag was actually used in the shelf if there wasn't a "see more..." link?

ioanarusiczki commented 3 years ago

@eviljeff

I only assume that the reason I sometimes get less than 4 is because there might not be enough addons tagged for a specific tag because it's not quite easy for me to identify which is the tag used by a shelf.

I did not add extra criteria - this is the content of a shelf.

I tried testing it on AMO stage - but I cannot save a random-tag shelf because I get an error -> No add-ons found. Check parameters - e.g., "type". Criteria is ?promoted=recommended&sort=random&type=extension and there's one addon I tagged https://addons.allizom.org/en-US/developers/addon/recommended/edit This worked on -dev Friday.

eviljeff commented 3 years ago

I tried testing it on AMO stage - but I cannot save a random-tag shelf because I get an error -> No add-ons found. Check parameters - e.g., "type". Criteria is ?promoted=recommended&sort=random&type=extension and there's one addon I tagged https://addons.allizom.org/en-US/developers/addon/recommended/edit This worked on -dev Friday.

The form does a query with a single tag for sanity - the first Tag in django admin - which I suspect might be dynamic theme on stage because (that tag was removed on addons-dev on Thursday so will still exist on stage).

ioanarusiczki commented 3 years ago

@eviljeff I enabled on -stage a shelf using random-tag endpoint. I used the search API to check the number returned, for example: ?promoted=recommended&sort=random&type=extension&tag=privacy - 4 addons found

frontend:

should be ok

See more https://addons.allizom.org/en-US/firefox/search/?promoted=recommended&sort=random&type=extension&tag=privacy returns 4 extensions.

Should be fine. I'm marking this issue verified - FF90(Win10).