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

Option for public mods to display icon in forum/qa #3255

Merged
merged 3 commits into from
Jul 9, 2017

Conversation

thomas-daniels
Copy link
Member

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.

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.
@@ -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)
Copy link
Collaborator

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)

@@ -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] =
Copy link
Collaborator

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.

@thomas-daniels
Copy link
Member Author

all fixed @ornicar

@ornicar ornicar merged commit e8f5c76 into lichess-org:master Jul 9, 2017
@ornicar
Copy link
Collaborator

ornicar commented Jul 9, 2017

it's on stage

@thomas-daniels thomas-daniels deleted the mod-icon-forum-post branch July 11, 2017 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants