2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

FIX: Various fixes to support posts with no user (#8877)

* Do not grant badges for posts with no user
* Ensure instructions are correct in Change Owner modal
* Hide user-dependent actions from posts with no user
* Make PostRevisor work with posts with no user
* Ensure posts with no user can be deleted
* discourse-narrative-bot should ignore posts with no user
* Skip TopicLink creation for posts with no user
This commit is contained in:
Dan Ungureanu 2020-03-11 14:03:20 +02:00 committed by GitHub
parent 6fdb4c33a6
commit 0754c7c404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 12 deletions

View file

@ -1,6 +1,8 @@
{{#d-modal-body class='change-ownership'}}
<span>
{{i18n 'topic.change_owner.instructions' count=selectedPostsCount old_user=selectedPostsUsername}}
{{i18n (if selectedPostsUsername 'topic.change_owner.instructions' 'topic.change_owner.instructions_without_old_user')
count=selectedPostsCount
old_user=selectedPostsUsername}}
</span>
<form>

View file

@ -73,7 +73,7 @@ export function buildManageButtons(attrs, currentUser, siteSettings) {
});
}
if (currentUser.staff) {
if (attrs.user_id && currentUser.staff) {
if (siteSettings.enable_badges) {
contents.push({
icon: "certificate",

View file

@ -108,7 +108,7 @@ class TopicLink < ActiveRecord::Base
end
def self.extract_from(post)
return if post.blank? || post.whisper?
return if post.blank? || post.whisper? || post.user_id.blank?
current_urls = []
reflected_ids = []