FEATURE: Implement edit functionality for post notices (#11140)

All post notice related custom fields were moved to a single one.
This commit is contained in:
Dan Ungureanu
2020-11-11 14:49:53 +02:00
committed by GitHub
parent 84e2915e71
commit ab314218d3
27 changed files with 250 additions and 224 deletions

View File

@@ -616,10 +616,12 @@ class PostCreator
.first
if !last_post_time
@post.custom_fields[Post::NOTICE_TYPE] = Post.notices[:new_user]
@post.custom_fields[Post::NOTICE] = { type: Post.notices[:new_user] }
elsif SiteSetting.returning_users_days > 0 && last_post_time < SiteSetting.returning_users_days.days.ago
@post.custom_fields[Post::NOTICE_TYPE] = Post.notices[:returning_user]
@post.custom_fields[Post::NOTICE_ARGS] = last_post_time.iso8601
@post.custom_fields[Post::NOTICE] = {
type: Post.notices[:returning_user],
last_posted_at: last_post_time.iso8601
}
end
end

View File

@@ -35,7 +35,7 @@ class TopicView
end
def self.default_post_custom_fields
@default_post_custom_fields ||= [Post::NOTICE_TYPE, Post::NOTICE_ARGS, "action_code_who"]
@default_post_custom_fields ||= [Post::NOTICE, "action_code_who"]
end
def self.post_custom_fields_allowlisters