-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Option for public mods to display icon in forum/qa #3255
Option for public mods to display icon in forum/qa #3255
Conversation
Closes lichess-org#754. Closes lichess-org#1092. Partial lichess-org#931. This is possible for forum posts (also the first post of a topic) and Q&A answers (not questions, because that doesn't seem useful at all). Above the 'Submit' button, there is a checkbox to tell if you want to display a moderator icon next to your name. If a non-PublicMod tries to add this checkbox himself, the `modIcon` Option[Boolean] is still set to None and no icon will appear.
modules/forum/src/main/PostApi.scala
Outdated
@@ -41,7 +41,8 @@ final class PostApi( | |||
lang = lang map (_.language), | |||
troll = ctx.troll, | |||
hidden = topic.hidden, | |||
categId = categ.id | |||
categId = categ.id, | |||
modIcon = (data.modIcon.getOrElse(false) && ctx.me.map(MasterGranter(_.PublicMod)).getOrElse(false)).fold(Some(true), None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
booleanOption.getOrElse(false)
== ~booleanOption
(twice)
.fold(Some(a), None)
== .option(a)
modules/qa/src/main/QaApi.scala
Outdated
@@ -161,7 +162,7 @@ final class QaApi( | |||
private implicit val voteBSONHandler = Macros.handler[Vote] | |||
private implicit val answerBSONHandler = Macros.handler[Answer] | |||
|
|||
def create(data: AnswerData, q: Question, user: User): Fu[Answer] = | |||
def create(data: AnswerData, q: Question, user: User)(implicit ctx: UserContext): Fu[Answer] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the context needed here? We already have the user
who posts the answer.
all fixed @ornicar |
it's on stage |
Closes #754. Closes #1092. Partial #931.
This is possible for forum posts (also the first post of a topic) and Q&A
answers (not questions, because that doesn't seem useful at all).
Above the 'Submit' button, there is a checkbox to tell if you want to
display a moderator icon next to your name.
If a non-PublicMod tries to add this checkbox himself, the
modIcon
Option[Boolean] is still set to None and no icon will appear.