Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ublog: disclose sponsored content, affiliate links or commercial advertisement in posts #17121

Merged
merged 6 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/ublog/src/main/UblogForm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class UblogForm(val captcher: CaptchaApi, langList: LangList):
"live" -> boolean,
"discuss" -> boolean,
"sticky" -> boolean,
"ads" -> boolean,
"gameId" -> of[GameId],
"move" -> text
)(UblogPostData.apply)(unapply)
Expand All @@ -43,6 +44,7 @@ final class UblogForm(val captcher: CaptchaApi, langList: LangList):
live = post.live,
discuss = ~post.discuss,
sticky = ~post.sticky,
ads = ~post.ads,
gameId = GameId(""),
move = ""
)
Expand All @@ -60,6 +62,7 @@ object UblogForm:
live: Boolean,
discuss: Boolean,
sticky: Boolean,
ads: Boolean,
gameId: GameId,
move: String
) extends WithCaptcha:
Expand All @@ -77,6 +80,7 @@ object UblogForm:
live = false,
discuss = Option(false),
sticky = Option(false),
ads = Option(false),
created = UblogPost.Recorded(user.id, nowInstant),
updated = none,
lived = none,
Expand All @@ -98,6 +102,7 @@ object UblogForm:
live = live,
discuss = Option(discuss),
sticky = Option(sticky),
ads = Option(ads),
updated = UblogPost.Recorded(user.id, nowInstant).some,
lived = prev.lived.orElse(live.option(UblogPost.Recorded(user.id, nowInstant)))
)
Expand Down
1 change: 1 addition & 0 deletions modules/ublog/src/main/UblogPost.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ case class UblogPost(
live: Boolean,
discuss: Option[Boolean],
sticky: Option[Boolean],
ads: Option[Boolean], // boo!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

created: UblogPost.Recorded,
updated: Option[UblogPost.Recorded],
lived: Option[UblogPost.Recorded],
Expand Down
12 changes: 12 additions & 0 deletions modules/ublog/src/main/ui/UblogFormUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ final class UblogFormUi(helpers: Helpers, ui: UblogUi)(
form("sticky"),
trans.ublog.stickyPost(),
help = trans.ublog.stickyPostHelp().some
),
form3.checkbox(
form("ads"),
"Includes promotion",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "promoted / sponsored content"

help = ads.some
)
)
)
Expand Down Expand Up @@ -195,3 +200,10 @@ final class UblogFormUi(helpers: Helpers, ui: UblogUi)(
cls := "text",
targetBlank
)(trans.ublog.blogTips())

val ads = a(
dataIcon := Icon.InfoCircle,
href := routes.Cms.lonePage(CmsPageKey("blog-etiquette")),
cls := "text",
targetBlank
)("Mandatory for sponsored content, affiliate links or commercial advertisement")
5 changes: 5 additions & 0 deletions modules/ublog/src/main/ui/UblogPostUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ final class UblogPostUi(helpers: Helpers, ui: UblogUi)(
post.topics.map: topic =>
a(href := routes.Ublog.topic(topic.url, 1))(topic.value)
),
(~post.ads).option(
div(dataIcon := Icon.InfoCircle, cls := "ublog-post__ads_disclosure text")(
"Disclosure: This post contains sponsored content, affiliate links or commercial advertisement"
)
),
strong(cls := "ublog-post__intro")(post.intro),
div(cls := "ublog-post__markup expand-text")(markup),
post.isLichess.option(
Expand Down
10 changes: 10 additions & 0 deletions ui/bits/css/ublog/_post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
&__tier {
margin-inline-start: 1em;
}
&__ads_disclosure {
@extend %box-radius;

border-radius: 20px;
padding: 1rem;
background: $c-bg-zebra2;
text-align: center;
font-size: 1.2em;
margin-bottom: 1em;
}
&__like {
font-weight: bold;
cursor: pointer;
Expand Down