Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions reader/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,14 @@ def base_props(request):
chatbot_version = chatbot_version if is_int(chatbot_version) else None

# Chatbot props (passed through base_props for ReaderApp)
is_sefaria_staff = user_data["is_moderator"] or user_data["_email"].endswith("@sefaria.org")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is problematic. we have user definition in the db, and that takes a different logic. if we need another level of moderator, this is what we should do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we do need different logic. Hey, I'm not sure I understand. What do you recommend we do?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it seems we should use user.is_staff. if for some reason we need something that is not staff or moderator, we should have a new attribute for User

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean, although I think this would be cluttering the DB for the wrong reason. Let me go back to Mickey and check what we want to do.

chatbot_data = {
"chatbot_user_token": None,
"chatbot_enabled": False,
"chatbot_api_base_url": CHATBOT_API_BASE_URL,
"chatbot_version": chatbot_version,
"chatbot_origin": f"sefaria-{os.getenv('SENTRY_ENVIRONMENT', 'local')}",
"chatbot_is_sefaria_staff": is_sefaria_staff,
'chatbot_max_input_chars': remoteConfigCache.get(CHATBOT_MAX_INPUT_CHARS, default=500),
'chatbot_welcome_messages': get_chatbot_welcome_messages(),
}
Expand Down
2 changes: 1 addition & 1 deletion static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
user-id={this.props.chatbot_user_token}
api-base-url={chatBotApiBaseUrl}
origin={this.props.chatbot_origin}
is-moderator={this.props.is_moderator || undefined}
is-staff={this.props.chatbot_is_sefaria_staff || undefined}
default-open="false"
placement="right"
mode="floating" //this simply defines the initial mode which can be toggled by the user
Expand Down
Loading