Refactor for_display to pass article instead of params (#19376)

* Refactor for_display to pass article instead of params

* Refactor: use options in FilteredAdsQuery, deconstruct article in DisplayAd.for_display

* Typo

* Restore applicable comments
This commit is contained in:
Joshua Wehner 2023-04-26 16:57:10 +02:00 committed by GitHub
parent 793c6b75b6
commit 7a9d71666f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 301 deletions

View file

@ -1,16 +1,16 @@
---
name: "[Core Team Only]: New Approved Feature"
about: This template is for Core Team only. For feature requests, please use GitHub
name: '[Core Team Only]: New Approved Feature'
about:
This template is for Core Team only. For feature requests, please use GitHub
Discussions.
title: ''
labels: ''
assignees: ''
---
<!-- ⚠️⚠️⚠️ This issue template is for Core Team only to outline approved features. For new Feature Requests, please use GitHub Discussions: https://github.com/forem/forem/discussions -->
## Is this feature related to a problem? Please describe.
## Is this feature related to a problem? Please describe.
<!-- Be sure to cover the Who / What / Why. IE: As a (role), I want (function) so that (value).-->

View file

@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Before creating a bug report, try disabling browser extensions to see if the bug is still present. -->

View file

@ -15,10 +15,7 @@ class DisplayAdsController < ApplicationController
area: params[:placement_area],
user_signed_in: user_signed_in?,
user_id: current_user&.id,
organization_id: @article&.organization_id,
permit_adjacent_sponsors: ArticleDecorator.new(@article).permit_adjacent_sponsors?,
article_tags: @article&.decorate&.cached_tag_list_array || [],
article_id: @article&.id,
article: ArticleDecorator.new(@article),
)
if @display_ad && !session_current_user_id

View file

@ -49,17 +49,17 @@ class DisplayAd < ApplicationRecord
scope :seldom_seen, -> { where("impressions_count < ?", LOW_IMPRESSION_COUNT) }
def self.for_display(area:, user_signed_in:, organization_id: nil, article_id: nil,
article_tags: [], permit_adjacent_sponsors: true, user_id: nil)
def self.for_display(area:, user_signed_in:, user_id: nil, article: nil)
permit_adjacent = article ? article.permit_adjacent_sponsors? : true
ads_for_display = DisplayAds::FilteredAdsQuery.call(
display_ads: self,
area: area,
organization_id: organization_id,
user_signed_in: user_signed_in,
article_id: article_id,
article_id: article&.id,
article_tags: article&.cached_tag_list_array || [],
organization_id: article&.organization_id,
permit_adjacent_sponsors: permit_adjacent,
user_id: user_id,
article_tags: article_tags,
permit_adjacent_sponsors: permit_adjacent_sponsors,
)
case rand(99) # output integer from 0-99

View file

@ -4,6 +4,9 @@ module DisplayAds
new(...).call
end
# @param area [String] the site area where the ad is visible
# @param user_signed_in [Boolean] whether or not the visitor is signed-in
# @param display_ads [DisplayAd] can be a filtered scope or Arel relationship
def initialize(area:, user_signed_in:, organization_id: nil, article_tags: [],
permit_adjacent_sponsors: true, article_id: nil, display_ads: DisplayAd,
user_id: nil)

View file

@ -9,14 +9,10 @@
"/api/articles": {
"post": {
"summary": "Publish article",
"tags": [
"articles"
],
"tags": ["articles"],
"description": "This endpoint allows the client to create a new article.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.",
"operationId": "createArticle",
"parameters": [
],
"parameters": [],
"responses": {
"201": {
"description": "An Article",
@ -46,9 +42,7 @@
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": "",
"tags": [
],
"tags": [],
"body_html": "<p><strong>New</strong> body for the article</p>\n\n",
"body_markdown": "**New** body for the article",
"user": {
@ -100,12 +94,8 @@
},
"get": {
"summary": "Published articles",
"security": [
],
"tags": [
"articles"
],
"security": [],
"tags": ["articles"],
"description": "This endpoint allows the client to retrieve a list of articles.\n\n\"Articles\" are all the posts that users create on DEV that typically\nshow up in the feed. They can be a blog post, a discussion question,\na help thread etc. but is referred to as article within the code.\n\nBy default it will return featured, published articles ordered\nby descending popularity.\n\nIt supports pagination, each page will contain `30` articles by default.",
"operationId": "getArticles",
"parameters": [
@ -162,11 +152,7 @@
"description": "Using this parameter will allow the client to check which articles are fresh or rising.\n If `state=fresh` the server will return fresh articles.\n If `state=rising` the server will return rising articles.\n This param can be used in conjuction with `username`, only if set to `all`.",
"schema": {
"type": "string",
"enum": [
"fresh",
"rising",
"all"
]
"enum": ["fresh", "rising", "all"]
},
"example": "fresh"
},
@ -223,9 +209,7 @@
"published_at": "2023-04-14T14:45:32Z",
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": [
"discuss"
],
"tag_list": ["discuss"],
"tags": "discuss",
"user": {
"name": "Versie \"Luana\" \\:/ Runolfsson",
@ -266,12 +250,8 @@
"/api/articles/latest": {
"get": {
"summary": "Published articles sorted by published date",
"security": [
],
"tags": [
"articles"
],
"security": [],
"tags": ["articles"],
"description": "This endpoint allows the client to retrieve a list of articles. ordered by descending publish date.\n\nIt supports pagination, each page will contain 30 articles by default.",
"operationId": "getLatestArticles",
"parameters": [
@ -311,11 +291,7 @@
"published_at": "2023-04-14T14:45:32Z",
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": [
"javascript",
"html",
"discuss"
],
"tag_list": ["javascript", "html", "discuss"],
"tags": "javascript, html, discuss",
"user": {
"name": "Starla \"Eric\" \\:/ Kunde",
@ -356,11 +332,7 @@
"published_at": "2023-04-14T14:45:32Z",
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": [
"javascript",
"html",
"discuss"
],
"tag_list": ["javascript", "html", "discuss"],
"tags": "javascript, html, discuss",
"user": {
"name": "Jeanne \"Donnette\" \\:/ Waelchi",
@ -401,11 +373,7 @@
"published_at": "2023-04-14T14:45:32Z",
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": [
"javascript",
"html",
"discuss"
],
"tag_list": ["javascript", "html", "discuss"],
"tags": "javascript, html, discuss",
"user": {
"name": "Jerrell \"Essie\" \\:/ Runolfsdottir",
@ -439,12 +407,8 @@
"/api/articles/{id}": {
"get": {
"summary": "Published article by id",
"security": [
],
"tags": [
"articles"
],
"security": [],
"tags": ["articles"],
"description": "This endpoint allows the client to retrieve a single published article given its `id`.",
"operationId": "getArticleById",
"parameters": [
@ -486,9 +450,7 @@
"last_comment_at": "2023-04-14T14:45:32Z",
"reading_time_minutes": 1,
"tag_list": "discuss",
"tags": [
"discuss"
],
"tags": ["discuss"],
"body_html": "<p>Etsy you probably haven't heard of them carry humblebrag 90's try-hard. Distillery asymmetrical godard trust fund quinoa pug paleo. Letterpress green juice plaid.</p>\n\n<p>Organic +1 pour-over banh mi disrupt listicle. Cronut offal flexitarian twee health poutine cred. Hashtag godard church-key etsy put a bird on it.</p>\n\n",
"body_markdown": "---\ntitle: Pale Kings and Princes179\npublished: true\ntags: discuss\ndate: \nseries: \ncanonical_url: \n\n---\n\nEtsy you probably haven't heard of them carry humblebrag 90's try-hard. Distillery asymmetrical godard trust fund quinoa pug paleo. Letterpress green juice plaid.\n\n\nOrganic +1 pour-over banh mi disrupt listicle. Cronut offal flexitarian twee health poutine cred. Hashtag godard church-key etsy put a bird on it.\n\n",
"user": {
@ -531,9 +493,7 @@
},
"put": {
"summary": "Update an article by id",
"tags": [
"articles"
],
"tags": ["articles"],
"description": "This endpoint allows the client to update an existing article.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.",
"operationId": "updateArticle",
"parameters": [
@ -579,9 +539,7 @@
"last_comment_at": "2023-04-14T14:45:33Z",
"reading_time_minutes": 1,
"tag_list": "",
"tags": [
],
"tags": [],
"body_html": "<p><strong>New</strong> body for the article</p>\n\n",
"body_markdown": "**New** body for the article",
"user": {
@ -646,12 +604,8 @@
"/api/articles/{username}/{slug}": {
"get": {
"summary": "Published article by path",
"security": [
],
"tags": [
"articles"
],
"security": [],
"tags": ["articles"],
"description": "This endpoint allows the client to retrieve a single published article given its `path`.",
"operationId": "getArticleByPath",
"parameters": [
@ -701,9 +655,7 @@
"last_comment_at": "2023-04-14T14:45:33Z",
"reading_time_minutes": 1,
"tag_list": "discuss",
"tags": [
"discuss"
],
"tags": ["discuss"],
"body_html": "<p>Normcore williamsburg try-hard artisan. Vinyl park shoreditch gastropub vegan knausgaard.</p>\n\n<p>Ethical trust fund intelligentsia pbr&amp;b. Brunch seitan pug waistcoat farm-to-table flexitarian health. Tumblr banh mi goth retro diy.</p>\n\n",
"body_markdown": "---\ntitle: Noli Me Tangere183\npublished: true\ntags: discuss\ndate: \nseries: \ncanonical_url: \n\n---\n\nNormcore williamsburg try-hard artisan. Vinyl park shoreditch gastropub vegan knausgaard.\n\n\nEthical trust fund intelligentsia pbr&b. Brunch seitan pug waistcoat farm-to-table flexitarian health. Tumblr banh mi goth retro diy.\n\n",
"user": {
@ -748,10 +700,7 @@
"/api/articles/me": {
"get": {
"summary": "User's articles",
"tags": [
"articles",
"users"
],
"tags": ["articles", "users"],
"description": "This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.\n\nPublished articles will be in reverse chronological publication order.\n\nIt will return published articles with pagination. By default a page will contain 30 articles.",
"operationId": "getUserArticles",
"parameters": [
@ -778,9 +727,7 @@
"description": "A List of the authenticated user's Articles",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -796,10 +743,7 @@
"/api/articles/me/published": {
"get": {
"summary": "User's published articles",
"tags": [
"articles",
"users"
],
"tags": ["articles", "users"],
"description": "This endpoint allows the client to retrieve a list of published articles on behalf of an authenticated user.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.\n\nPublished articles will be in reverse chronological publication order.\n\nIt will return published articles with pagination. By default a page will contain 30 articles.",
"operationId": "getUserPublishedArticles",
"parameters": [
@ -826,9 +770,7 @@
"description": "A List of the authenticated user's Articles",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -844,10 +786,7 @@
"/api/articles/me/unpublished": {
"get": {
"summary": "User's unpublished articles",
"tags": [
"articles",
"users"
],
"tags": ["articles", "users"],
"description": "This endpoint allows the client to retrieve a list of unpublished articles on behalf of an authenticated user.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.\n\nUnpublished articles will be in reverse chronological creation order.\n\nIt will return unpublished articles with pagination. By default a page will contain 30 articles.",
"operationId": "getUserUnpublishedArticles",
"parameters": [
@ -874,9 +813,7 @@
"description": "A List of the authenticated user's Articles",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -892,10 +829,7 @@
"/api/articles/me/all": {
"get": {
"summary": "User's all articles",
"tags": [
"articles",
"users"
],
"tags": ["articles", "users"],
"description": "This endpoint allows the client to retrieve a list of all articles on behalf of an authenticated user.\n\n\"Articles\" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.\n\nIt will return both published and unpublished articles with pagination.\n\nUnpublished articles will be at the top of the list in reverse chronological creation order. Published articles will follow in reverse chronological publication order.\n\nBy default a page will contain 30 articles.",
"operationId": "getUserAllArticles",
"parameters": [
@ -922,9 +856,7 @@
"description": "A List of the authenticated user's Articles",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -940,9 +872,7 @@
"/api/articles/{id}/unpublish": {
"put": {
"summary": "Unpublish an article",
"tags": [
"articles"
],
"tags": ["articles"],
"description": "This endpoint allows the client to unpublish an article.\n\nThe user associated with the API key must have any 'admin' or 'moderator' role.\n\nThe article will be unpublished and will no longer be visible to the public. It will remain\nin the database and will set back to draft status on the author's posts dashboard. Any\nnotifications associated with the article will be deleted. Any comments on the article\nwill remain.",
"operationId": "unpublishArticle",
"parameters": [
@ -1001,12 +931,8 @@
"/api/comments": {
"get": {
"summary": "Comments",
"security": [
],
"tags": [
"comments"
],
"security": [],
"tags": ["comments"],
"description": "This endpoint allows the client to retrieve all comments belonging to an article or podcast episode as threaded conversations.\n\nIt will return the all top level comments with their nested comments as threads. See the format specification for further details.",
"operationId": "getCommentsByArticleId",
"parameters": [
@ -1052,9 +978,7 @@
"profile_image": "/uploads/user/profile_image/1332/241b2d6f-ec6d-4590-b57f-3a2ce673f9de.jpeg",
"profile_image_90": "/uploads/user/profile_image/1332/241b2d6f-ec6d-4590-b57f-3a2ce673f9de.jpeg"
},
"children": [
]
"children": []
}
],
"schema": {
@ -1083,12 +1007,8 @@
"/api/comments/{id}": {
"get": {
"summary": "Comment by id",
"security": [
],
"tags": [
"comments"
],
"security": [],
"tags": ["comments"],
"description": "This endpoint allows the client to retrieve a comment as well as his descendants comments.\n\n It will return the required comment (the root) with its nested descendants as a thread.\n\n See the format specification for further details.",
"operationId": "getCommentById",
"parameters": [
@ -1123,9 +1043,7 @@
"profile_image": "/uploads/user/profile_image/1339/08f5cd26-743e-4957-af23-540b7ded60d6.jpeg",
"profile_image_90": "/uploads/user/profile_image/1339/08f5cd26-743e-4957-af23-540b7ded60d6.jpeg"
},
"children": [
]
"children": []
}
}
}
@ -1147,18 +1065,14 @@
"/api/display_ads": {
"get": {
"summary": "display ads",
"tags": [
"display ads"
],
"tags": ["display ads"],
"description": "This endpoint allows the client to retrieve a list of all display ads.",
"responses": {
"200": {
"description": "successful",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -1183,13 +1097,9 @@
},
"post": {
"summary": "display ads",
"tags": [
"display ads"
],
"tags": ["display ads"],
"description": "This endpoint allows the client to create a new display ad.",
"parameters": [
],
"parameters": [],
"responses": {
"200": {
"description": "successful",
@ -1284,9 +1194,7 @@
"/api/display_ads/{id}": {
"get": {
"summary": "display ad",
"tags": [
"display ads"
],
"tags": ["display ads"],
"description": "This endpoint allows the client to retrieve a single display ad, via its id.",
"parameters": [
{
@ -1358,9 +1266,7 @@
},
"put": {
"summary": "display ads",
"tags": [
"display ads"
],
"tags": ["display ads"],
"description": "This endpoint allows the client to update the attributes of a single display ad, via its id.",
"parameters": [
{
@ -1452,9 +1358,7 @@
"/api/display_ads/{id}/unpublish": {
"put": {
"summary": "unpublish",
"tags": [
"display ads"
],
"tags": ["display ads"],
"description": "This endpoint allows the client to remove a display ad from rotation by un-publishing it.",
"parameters": [
{
@ -1502,10 +1406,7 @@
"/api/follows/tags": {
"get": {
"summary": "Followed Tags",
"tags": [
"followed_tags",
"tags"
],
"tags": ["followed_tags", "tags"],
"description": "This endpoint allows the client to retrieve a list of the tags they follow.",
"operationId": "getFollowedTags",
"responses": {
@ -1551,9 +1452,7 @@
"/api/followers/users": {
"get": {
"summary": "Followers",
"tags": [
"followers"
],
"tags": ["followers"],
"description": "This endpoint allows the client to retrieve a list of the followers they have.\n \"Followers\" are users that are following other users on the website.\n It supports pagination, each page will contain 80 followers by default.",
"operationId": "getFollowers",
"parameters": [
@ -1655,12 +1554,8 @@
"/api/organizations/{username}": {
"get": {
"summary": "An organization",
"tags": [
"organizations"
],
"security": [
],
"tags": ["organizations"],
"security": [],
"description": "This endpoint allows the client to retrieve a single organization by their username",
"operationId": "getOrganization",
"parameters": [
@ -1720,13 +1615,8 @@
"/api/organizations/{username}/users": {
"get": {
"summary": "Organization's users",
"tags": [
"organizations",
"users"
],
"security": [
],
"tags": ["organizations", "users"],
"security": [],
"description": "This endpoint allows the client to retrieve a list of users belonging to the organization\n\nIt supports pagination, each page will contain `30` users by default.",
"operationId": "getOrgUsers",
"parameters": [
@ -1804,13 +1694,8 @@
"/api/organizations/{username}/articles": {
"get": {
"summary": "Organization's Articles",
"tags": [
"organizations",
"articles"
],
"security": [
],
"tags": ["organizations", "articles"],
"security": [],
"description": "This endpoint allows the client to retrieve a list of Articles belonging to the organization\n\nIt supports pagination, each page will contain `30` users by default.",
"operationId": "getOrgArticles",
"parameters": [
@ -1858,11 +1743,7 @@
"published_at": "2023-04-14T14:45:38Z",
"last_comment_at": "2023-04-14T14:45:38Z",
"reading_time_minutes": 1,
"tag_list": [
"javascript",
"html",
"discuss"
],
"tag_list": ["javascript", "html", "discuss"],
"tags": "javascript, html, discuss",
"user": {
"name": "Annabell \"Tyron\" \\:/ West",
@ -1909,12 +1790,8 @@
"/api/pages": {
"get": {
"summary": "show details for all pages",
"security": [
],
"tags": [
"pages"
],
"security": [],
"tags": ["pages"],
"description": "This endpoint allows the client to retrieve details for all Page objects.",
"responses": {
"200": {
@ -1952,13 +1829,9 @@
},
"post": {
"summary": "pages",
"tags": [
"pages"
],
"tags": ["pages"],
"description": "This endpoint allows the client to create a new page.",
"parameters": [
],
"parameters": [],
"responses": {
"200": {
"description": "successful",
@ -2069,12 +1942,8 @@
"/api/pages/{id}": {
"get": {
"summary": "show details for a page",
"security": [
],
"tags": [
"pages"
],
"security": [],
"tags": ["pages"],
"description": "This endpoint allows the client to retrieve details for a single Page object, specified by ID.",
"parameters": [
{
@ -2121,9 +1990,7 @@
},
"put": {
"summary": "update details for a page",
"tags": [
"pages"
],
"tags": ["pages"],
"description": "This endpoint allows the client to retrieve details for a single Page object, specified by ID.",
"parameters": [
{
@ -2213,9 +2080,7 @@
},
"delete": {
"summary": "remove a page",
"tags": [
"pages"
],
"tags": ["pages"],
"description": "This endpoint allows the client to delete a single Page object, specified by ID.",
"parameters": [
{
@ -2291,12 +2156,8 @@
"/api/podcast_episodes": {
"get": {
"summary": "Podcast Episodes",
"security": [
],
"tags": [
"podcast_episodes"
],
"security": [],
"tags": ["podcast_episodes"],
"description": "This endpoint allows the client to retrieve a list of podcast episodes.\n \"Podcast episodes\" are episodes belonging to podcasts.\n It will only return active (reachable) podcast episodes that belong to published podcasts available on the platform, ordered by descending publication date.\n It supports pagination, each page will contain 30 articles by default.",
"operationId": "getPodcastEpisodes",
"parameters": [
@ -2363,9 +2224,7 @@
"/api/profile_images/{username}": {
"get": {
"summary": "A Users or organizations profile image",
"tags": [
"profile images"
],
"tags": ["profile images"],
"description": "This endpoint allows the client to retrieve a user or organization profile image information by its\n corresponding username.",
"operationId": "getProfileImage",
"parameters": [
@ -2417,9 +2276,7 @@
"/api/reactions/toggle": {
"post": {
"summary": "toggle reaction",
"tags": [
"reactions"
],
"tags": ["reactions"],
"description": "This endpoint allows the client to toggle the user's reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will remove the \"like\" from the user",
"parameters": [
{
@ -2452,11 +2309,7 @@
"required": true,
"schema": {
"type": "string",
"enum": [
"Comment",
"Article",
"User"
]
"enum": ["Comment", "Article", "User"]
}
}
],
@ -2492,9 +2345,7 @@
"/api/reactions": {
"post": {
"summary": "create reaction",
"tags": [
"reactions"
],
"tags": ["reactions"],
"description": "This endpoint allows the client to create a reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will return the previous \"like\"",
"parameters": [
{
@ -2527,11 +2378,7 @@
"required": true,
"schema": {
"type": "string",
"enum": [
"Comment",
"Article",
"User"
]
"enum": ["Comment", "Article", "User"]
}
}
],
@ -2567,9 +2414,7 @@
"/api/readinglist": {
"get": {
"summary": "Readinglist",
"tags": [
"readinglist"
],
"tags": ["readinglist"],
"description": "This endpoint allows the client to retrieve a list of articles that were saved to a Users readinglist.\n It supports pagination, each page will contain `30` articles by default",
"operationId": "getReadinglist",
"parameters": [
@ -2596,9 +2441,7 @@
"description": "A list of articles in the users readinglist",
"content": {
"application/json": {
"example": [
],
"example": [],
"schema": {
"type": "array",
"items": {
@ -2614,12 +2457,8 @@
"/api/tags": {
"get": {
"summary": "Tags",
"tags": [
"tags"
],
"security": [
],
"tags": ["tags"],
"security": [],
"description": "This endpoint allows the client to retrieve a list of tags that can be used to tag articles.\n\nIt will return tags ordered by popularity.\n\nIt supports pagination, each page will contain 10 tags by default.",
"operationId": "getTags",
"parameters": [
@ -2670,9 +2509,7 @@
"/api/users/me": {
"get": {
"summary": "The authenticated user",
"tags": [
"users"
],
"tags": ["users"],
"description": "This endpoint allows the client to retrieve information about the authenticated user",
"operationId": "getUserMe",
"responses": {
@ -2719,9 +2556,7 @@
"/api/users/{id}": {
"get": {
"summary": "A User",
"tags": [
"users"
],
"tags": ["users"],
"description": "This endpoint allows the client to retrieve a single user, either by id\nor by the user's username.\n\nFor complete documentation, see the v0 API docs: https://developers.forem.com/api/v0#tag/users/operation/getUser",
"operationId": "getUser",
"parameters": [
@ -2754,9 +2589,7 @@
"/api/users/{id}/unpublish": {
"put": {
"summary": "Unpublish a User's Articles and Comments",
"tags": [
"users"
],
"tags": ["users"],
"description": "This endpoint allows the client to unpublish all of the articles and\ncomments created by a user.\n\nThe user associated with the API key must have any 'admin' or 'moderator' role.\n\nThis specified user's articles and comments will be unpublished and will no longer be\nvisible to the public. They will remain in the database and will set back to draft status\non the specified user's dashboard. Any notifications associated with the specified user's\narticles and comments will be deleted.\n\nNote this endpoint unpublishes articles and comments asychronously: it will return a 204 NO CONTENT\nstatus code immediately, but the articles and comments will not be unpublished until the\nrequest is completed on the server.",
"operationId": "unpublishUser",
"parameters": [
@ -2805,9 +2638,7 @@
"/api/users/{id}/suspend": {
"put": {
"summary": "Suspend a User",
"tags": [
"users"
],
"tags": ["users"],
"description": "This endpoint allows the client to suspend a user.\n\nThe user associated with the API key must have any 'admin' or 'moderator' role.\n\nThis specified user will be assigned the 'suspended' role. Suspending a user will stop the\nuser from posting new posts and comments. It doesn't delete any of the user's content, just\nprevents them from creating new content while suspended. Users are not notified of their suspension\nin the UI, so if you want them to know about this, you must notify them.",
"operationId": "suspendUser",
"parameters": [
@ -2856,14 +2687,10 @@
"/api/admin/users": {
"post": {
"summary": "Invite a User",
"tags": [
"users"
],
"tags": ["users"],
"description": "This endpoint allows the client to trigger an invitation to the provided email address.\n\n It requires a token from a user with `super_admin` privileges.",
"operationId": "postAdminUsersCreate",
"parameters": [
],
"parameters": [],
"responses": {
"200": {
"description": "Successful"
@ -2905,13 +2732,8 @@
"/api/videos": {
"get": {
"summary": "Articles with a video",
"tags": [
"videos",
"articles"
],
"security": [
],
"tags": ["videos", "articles"],
"security": [],
"description": "This endpoint allows the client to retrieve a list of articles that are uploaded with a video.\n\nIt will only return published video articles ordered by descending popularity.\n\nIt supports pagination, each page will contain 24 articles by default.",
"operationId": "videos",
"parameters": [
@ -2976,9 +2798,7 @@
],
"security": [
{
"api-key": [
]
"api-key": []
}
],
"components": {
@ -3373,11 +3193,7 @@
"format": "float"
}
},
"required": [
"id",
"name",
"points"
]
"required": ["id", "name", "points"]
},
"Tag": {
"description": "Representation of a tag",
@ -3447,12 +3263,7 @@
"description": "Controls what kind of layout the page is rendered in"
}
},
"required": [
"title",
"slug",
"description",
"template"
]
"required": ["title", "slug", "description", "template"]
},
"PodcastEpisodeIndex": {
"description": "Representation of a podcast episode returned in a list",
@ -3745,31 +3556,19 @@
},
"display_to": {
"type": "string",
"enum": [
"all",
"logged_in",
"logged_out"
],
"enum": ["all", "logged_in", "logged_out"],
"default": "all",
"description": "Potentially limits visitors to whom the ad is visible"
},
"type_of": {
"type": "string",
"enum": [
"in_house",
"community",
"external"
],
"enum": ["in_house", "community", "external"],
"default": "in_house",
"description": "Types of the billboards:\nin_house (created by admins),\ncommunity (created by an entity, appears on entity's content),\nexternal ( created by an entity, or a non-entity, can appear everywhere)\n"
}
},
"required": [
"name",
"body_markdown",
"placement_area"
]
"required": ["name", "body_markdown", "placement_area"]
}
}
}
}
}