FEATURE: Fallback to system users when creating new TopicEmbed (#12386)

Previosly, if the topic embed request had a missing username parameter,
and SiteSetting.embed_by_username was empty we would fail to create the
new topic and not show any errors.

Now we will fallback using the priority:

1. Username parameter
2. SiteSetting.embed_by_username
3. SiteSetting.site_contact_username
4. system user
This commit is contained in:
Rafael dos Santos Silva 2021-03-15 11:58:53 -03:00 committed by GitHub
parent 0d3b7a3a82
commit f8d9f09370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ class TopicRetriever
def fetch_http
if @author_username.nil?
username = SiteSetting.embed_by_username.downcase
username = SiteSetting.embed_by_username.presence || SiteSetting.site_contact_username.presence || Discourse.system_user.username
else
username = @author_username
end