mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 09:13:47 +08:00
34d04e7507
When a post has some replies, and the user click on the button to show them, we would load ALL the replies. This could lead to DoS if there were a very large number of replies. This adds support for pagination to these post replies. Internal ref t/129773 FIX: Duplicated parent posts DEV: Query refactor
44 lines
1.2 KiB
Ruby
44 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class Post < PageObjects::Components::Base
|
|
def initialize(post_number)
|
|
@post_number = post_number
|
|
end
|
|
|
|
def show_replies
|
|
find("#post_#{@post_number} .show-replies").click
|
|
end
|
|
|
|
def load_more_replies
|
|
find("#embedded-posts__bottom--#{@post_number} .load-more-replies").click
|
|
end
|
|
|
|
def has_replies?(count: nil)
|
|
find("#embedded-posts__bottom--#{@post_number}").has_css?(".reply", count:)
|
|
end
|
|
|
|
def has_more_replies?
|
|
find("#embedded-posts__bottom--#{@post_number}").has_css?(".load-more-replies")
|
|
end
|
|
|
|
def has_loaded_all_replies?
|
|
find("#embedded-posts__bottom--#{@post_number}").has_no_css?(".load-more-replies")
|
|
end
|
|
|
|
def show_parent_posts
|
|
find("#post_#{@post_number} .reply-to-tab").click
|
|
end
|
|
|
|
def has_parent_posts?(count: nil)
|
|
find("#embedded-posts__top--#{@post_number}").has_css?(".reply", count:)
|
|
end
|
|
|
|
def has_no_parent_post_content?(content)
|
|
find("#embedded-posts__top--#{@post_number}").has_no_content?(content)
|
|
end
|
|
end
|
|
end
|
|
end
|