Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove legacy reviewable component shims and unused code (#38010)

Krzysztof Kotlarek4e2a5a8fc063
diff --git a/frontend/discourse/app/components/reviewable-conversation-post.gjs b/frontend/discourse/app/components/reviewable-conversation-post.gjs
deleted file mode 100644
index aef40132ac5..00000000000
--- a/frontend/discourse/app/components/reviewable-conversation-post.gjs
+++ /dev/null
@@ -1,28 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import { gte } from "@ember/object/computed";
-import { LinkTo } from "@ember/routing";
-import { htmlSafe } from "@ember/template";
-import { tagName } from "@ember-decorators/component";
-
-@tagName("")
-export default class ReviewableConversationPost extends Component {
- @gte("index", 1) showUsername;
-
- <template>
- <div ...attributes>
- {{#if this.post}}
- <div class="reviewable-conversation-post">
- {{#if this.showUsername}}
- <LinkTo
- @route="user"
- @model={{this.post.user}}
- class="username"
- >@{{this.post.user.username}}</LinkTo>
- {{/if}}
- {{htmlSafe this.post.excerpt}}
- </div>
- {{/if}}
- </div>
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-flagged-post.gjs b/frontend/discourse/app/components/reviewable-flagged-post.gjs
deleted file mode 100644
index c3edfa1defc..00000000000
--- a/frontend/discourse/app/components/reviewable-flagged-post.gjs
+++ /dev/null
@@ -1,93 +0,0 @@
-import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
-import { action } from "@ember/object";
-import didInsert from "@ember/render-modifiers/modifiers/did-insert";
-import DButton from "discourse/components/d-button";
-import PluginOutlet from "discourse/components/plugin-outlet";
-import ReviewableCreatedBy from "discourse/components/reviewable-created-by";
-import ReviewablePostEdits from "discourse/components/reviewable-post-edits";
-import ReviewablePostHeader from "discourse/components/reviewable-post-header";
-import ReviewableTopicLink from "discourse/components/reviewable-topic-link";
-import lazyHash from "discourse/helpers/lazy-hash";
-import { bind } from "discourse/lib/decorators";
-import highlightWatchedWords from "discourse/lib/highlight-watched-words";
-import { i18n } from "discourse-i18n";
-
-export default class ReviewableFlaggedPost extends Component {
- @tracked isCollapsed = false;
- @tracked isLongPost = false;
- maxPostHeight = 300;
-
- @action
- toggleContent() {
- this.isCollapsed = !this.isCollapsed;
- }
-
- @bind
- calculatePostBodySize(element) {
- if (element?.offsetHeight > this.maxPostHeight) {
- this.isCollapsed = true;
- this.isLongPost = true;
- } else {
- this.isCollapsed = false;
- this.isLongPost = false;
- }
- }
-
- get collapseButtonProps() {
- if (this.isCollapsed) {
- return {
- label: "review.show_more",
- icon: "chevron-down",
- };
- }
- return {
- label: "review.show_less",
- icon: "chevron-up",
- };
- }
-
- <template>
- <div class="flagged-post-header">
- <ReviewableTopicLink @reviewable={{@reviewable}} />
- <ReviewablePostEdits @reviewable={{@reviewable}} />
- </div>
-
- <div class="post-contents-wrapper">
- <ReviewableCreatedBy @user={{@reviewable.target_created_by}} />
- <div class="post-contents">
- <ReviewablePostHeader
- @reviewable={{@reviewable}}
- @createdBy={{@reviewable.target_created_by}}
- />
- <div
- class="post-body {{if this.isCollapsed 'is-collapsed'}}"
- {{didInsert this.calculatePostBodySize @reviewable}}
- >
- {{#if @reviewable.blank_post}}
- <p>{{i18n "review.deleted_post"}}</p>
- {{else}}
- {{highlightWatchedWords @reviewable.cooked @reviewable}}
- {{/if}}
- </div>
-
- {{#if this.isLongPost}}
- <DButton
- @action={{this.toggleContent}}
- @label={{this.collapseButtonProps.label}}
- @icon={{this.collapseButtonProps.icon}}
- class="btn-default btn-icon post-body__toggle-btn"
- />
- {{/if}}
- <span>
- <PluginOutlet
- @name="after-reviewable-flagged-post-body"
- @connectorTagName="div"
- @outletArgs={{lazyHash model=@reviewable}}
- />
- </span>
- {{yield}}
- </div>
- </div>
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-histories.gjs b/frontend/discourse/app/components/reviewable-histories.gjs
deleted file mode 100644
index 90ec34f3933..00000000000
--- a/frontend/discourse/app/components/reviewable-histories.gjs
+++ /dev/null
@@ -1,44 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import { filterBy } from "@ember/object/computed";
-import { tagName } from "@ember-decorators/component";
-import UserLink from "discourse/components/user-link";
-import avatar from "discourse/helpers/avatar";
-import formatDate from "discourse/helpers/format-date";
-import reviewableHistoryDescription from "discourse/helpers/reviewable-history-description";
-import { i18n } from "discourse-i18n";
-
-@tagName("")
-export default class ReviewableHistories extends Component {
- @filterBy("histories", "created", false) filteredHistories;
-
- <template>
- {{#if this.filteredHistories}}
- <table class="reviewable-histories">
- <thead>
- <tr>
- <th colspan="3">{{i18n "review.history.title"}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each this.filteredHistories as |rh|}}
- {{#unless rh.created}}
- <tr>
- <td>
- {{reviewableHistoryDescription rh}}
- </td>
- <td>
- <UserLink @user={{this.rs.user}}>
- {{avatar rh.created_by imageSize="tiny"}}
- {{rh.created_by.username}}
- </UserLink>
- </td>
- <td>{{formatDate rh.created_at format="medium"}}</td>
- </tr>
- {{/unless}}
- {{/each}}
- </tbody>
- </table>
- {{/if}}
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-post-header.gjs b/frontend/discourse/app/components/reviewable-post-header.gjs
deleted file mode 100644
index dee4531ed8d..00000000000
--- a/frontend/discourse/app/components/reviewable-post-header.gjs
+++ /dev/null
@@ -1,27 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import { concat } from "@ember/helper";
-import { tagName } from "@ember-decorators/component";
-import ReviewableCreatedByName from "discourse/components/reviewable-created-by-name";
-import icon from "discourse/helpers/d-icon";
-import { i18n } from "discourse-i18n";
-
-@tagName("")
-export default class ReviewablePostHeader extends Component {
- <template>
- <ReviewableCreatedByName @user={{this.createdBy}} />
- {{#if this.reviewable.reply_to_post_number}}
- <a
- href={{concat
- this.reviewable.topic_url
- "/"
- this.reviewable.reply_to_post_number
- }}
- class="reviewable-reply-to"
- >
- {{icon "share"}}
- <span>{{i18n "review.in_reply_to"}}</span>
- </a>
- {{/if}}
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-queued-post.gjs b/frontend/discourse/app/components/reviewable-queued-post.gjs
deleted file mode 100644
index 25f75398eb8..00000000000
--- a/frontend/discourse/app/components/reviewable-queued-post.gjs
+++ /dev/null
@@ -1,114 +0,0 @@
-import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
-import { hash } from "@ember/helper";
-import { on } from "@ember/modifier";
-import { action } from "@ember/object";
-import { service } from "@ember/service";
-import CookText from "discourse/components/cook-text";
-import DButton from "discourse/components/d-button";
-import RawEmailModal from "discourse/components/modal/raw-email";
-import ReviewableCreatedBy from "discourse/components/reviewable-created-by";
-import ReviewablePostHeader from "discourse/components/reviewable-post-header";
-import ReviewableTags from "discourse/components/reviewable-tags";
-import ReviewableTopicLink from "discourse/components/reviewable-topic-link";
-import categoryBadge from "discourse/helpers/category-badge";
-import icon from "discourse/helpers/d-icon";
-import highlightWatchedWords from "discourse/lib/highlight-watched-words";
-
-export default class ReviewableQueuedPost extends Component {
- @service modal;
-
- @tracked isCollapsed = false;
- @tracked isLongPost = false;
- @tracked postBodyHeight = 0;
- maxPostHeight = 300;
-
- @action
- showRawEmail(event) {
- event?.preventDefault();
- this.modal.show(RawEmailModal, {
- model: {
- rawEmail: this.args.reviewable.payload.raw_email,
- },
- });
- }
-
- @action
- toggleContent() {
- this.isCollapsed = !this.isCollapsed;
- }
-
- get collapseButtonProps() {
- if (this.isCollapsed) {
- return {
- label: "review.show_more",
- icon: "chevron-down",
- };
- }
- return {
- label: "review.show_less",
- icon: "chevron-up",
- };
- }
-
- @action
- setPostBodyHeight(offsetHeight) {
- this.postBodyHeight = offsetHeight;
-
- if (this.postBodyHeight > this.maxPostHeight) {
- this.isCollapsed = true;
- this.isLongPost = true;
- } else {
- this.isCollapsed = false;
- this.isLongPost = false;
- }
- }
-
- <template>
- <ReviewableTopicLink @reviewable={{@reviewable}}>
- <div class="title-text">
- {{icon "square-plus" title="review.new_topic"}}
- {{highlightWatchedWords @reviewable.payload.title @reviewable}}
- </div>
- {{categoryBadge @reviewable.category}}
- <ReviewableTags @tags={{@reviewable.payload.tags}} />
- {{#if @reviewable.payload.via_email}}
- <a href {{on "click" this.showRawEmail}} class="show-raw-email">
- {{icon "envelope" title="post.via_email"}}
- </a>
- {{/if}}
- </ReviewableTopicLink>
-
- <div class="post-contents-wrapper">
- <ReviewableCreatedBy @user={{@reviewable.target_created_by}} />
-
- <div class="post-contents">
- <ReviewablePostHeader
- @reviewable={{@reviewable}}
- @createdBy={{@reviewable.target_created_by}}
- />
-
- <CookText
- class="post-body {{if this.isCollapsed 'is-collapsed'}}"
- @rawText={{highlightWatchedWords @reviewable.payload.raw @reviewable}}
- @categoryId={{@reviewable.category_id}}
- @topicId={{@reviewable.topic_id}}
- @paintOneboxes={{false}}
- @opts={{hash removeMissing=true}}
- @onOffsetHeightCalculated={{this.setPostBodyHeight}}
- />
-
- {{#if this.isLongPost}}
- <DButton
- @action={{this.toggleContent}}
- @label={{this.collapseButtonProps.label}}
- @icon={{this.collapseButtonProps.icon}}
- class="btn-default btn-icon post-body__toggle-btn"
- />
- {{/if}}
-
- {{yield}}
- </div>
- </div>
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-refresh/created-by.gjs b/frontend/discourse/app/components/reviewable-refresh/created-by.gjs
deleted file mode 100644
index 01cd1e65433..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/created-by.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import CreatedBy from "discourse/components/reviewable/created-by";
-
-export default CreatedBy;
diff --git a/frontend/discourse/app/components/reviewable-refresh/flagged-post.gjs b/frontend/discourse/app/components/reviewable-refresh/flagged-post.gjs
deleted file mode 100644
index 17543f8c0d2..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/flagged-post.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import FlaggedPost from "discourse/components/reviewable/flagged-post";
-
-export default FlaggedPost;
diff --git a/frontend/discourse/app/components/reviewable-refresh/item.gjs b/frontend/discourse/app/components/reviewable-refresh/item.gjs
deleted file mode 100644
index 1915366d904..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/item.gjs
+++ /dev/null
@@ -1,4 +0,0 @@
-export { registerReviewableTypeLabel } from "discourse/components/reviewable/item";
-import Item from "discourse/components/reviewable/item";
-
-export default Item;
diff --git a/frontend/discourse/app/components/reviewable-refresh/post.gjs b/frontend/discourse/app/components/reviewable-refresh/post.gjs
deleted file mode 100644
index f682c1e8414..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/post.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import Post from "discourse/components/reviewable/post";
-
-export default Post;
diff --git a/frontend/discourse/app/components/reviewable-refresh/queued-post.gjs b/frontend/discourse/app/components/reviewable-refresh/queued-post.gjs
deleted file mode 100644
index 34636d5c400..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/queued-post.gjs
+++ /dev/null
@@ -1,2 +0,0 @@
-export default QueuedPost;
-import QueuedPost from "discourse/components/reviewable/queued-post";
diff --git a/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs b/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs
deleted file mode 100644
index 1592ecaa309..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import TopicLink from "discourse/components/reviewable/topic-link";
-
-export default TopicLink;
diff --git a/frontend/discourse/app/components/reviewable-refresh/user.gjs b/frontend/discourse/app/components/reviewable-refresh/user.gjs
deleted file mode 100644
index 9a303959943..00000000000
--- a/frontend/discourse/app/components/reviewable-refresh/user.gjs
+++ /dev/null
@@ -1,3 +0,0 @@
-import User from "discourse/components/reviewable/user";
-
-export default User;
diff --git a/frontend/discourse/app/components/reviewable-score.gjs b/frontend/discourse/app/components/reviewable-score.gjs
deleted file mode 100644
index 0197d4ced5a..00000000000
--- a/frontend/discourse/app/components/reviewable-score.gjs
+++ /dev/null
@@ -1,73 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import { gt } from "@ember/object/computed";
-import { tagName } from "@ember-decorators/component";
-import UserLink from "discourse/components/user-link";
-import avatar from "discourse/helpers/avatar";
-import icon from "discourse/helpers/d-icon";
-import formatDate from "discourse/helpers/format-date";
-import reviewableStatus from "discourse/helpers/reviewable-status";
-import discourseComputed from "discourse/lib/decorators";
-
-@tagName("")
-export default class ReviewableScore extends Component {
- @gt("rs.status", 0) showStatus;
-
- @discourseComputed("rs.score_type.title", "reviewable.target_created_by")
- title(title, targetCreatedBy) {
- if (title && targetCreatedBy) {
- return title.replace(
- /{{username}}|%{username}/,
- targetCreatedBy.username
- );
- }
-
- return title;
- }
-
- <template>
- <tr class="reviewable-score">
- <td class="user">
- <UserLink @user={{this.rs.user}}>
- {{avatar this.rs.user imageSize="tiny"}}
- {{this.rs.user.username}}
- </UserLink>
- </td>
-
- <td>
- {{formatDate this.rs.created_at format="tiny"}}
- </td>
-
- <td>
- {{icon this.rs.score_type.icon}}
- {{this.title}}
- </td>
-
- {{#if this.showStatus}}
- <td class="reviewed-by">
- {{#if this.rs.reviewed_by}}
- <UserLink @user={{this.rs.reviewed_by}}>
- {{avatar this.rs.reviewed_by imageSize="tiny"}}
- {{this.rs.reviewed_by.username}}
- </UserLink>
- {{else}}
- &mdash;
- {{/if}}
- </td>
-
- <td>
- {{#if this.rs.reviewed_by}}
- {{formatDate this.rs.reviewed_at format="tiny"}}
- {{/if}}
- </td>
-
- <td>
- {{reviewableStatus this.rs.status this.reviewable.type}}
- </td>
-
- {{else}}
- <td colspan="4"></td>
- {{/if}}
- </tr>
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-scores.gjs b/frontend/discourse/app/components/reviewable-scores.gjs
deleted file mode 100644
index 3259b694cbc..00000000000
--- a/frontend/discourse/app/components/reviewable-scores.gjs
+++ /dev/null
@@ -1,59 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import { htmlSafe } from "@ember/template";
-import { tagName } from "@ember-decorators/component";
-import ReviewableConversationPost from "discourse/components/reviewable-conversation-post";
-import ReviewableScore from "discourse/components/reviewable-score";
-import { i18n } from "discourse-i18n";
-
-@tagName("")
-export default class ReviewableScores extends Component {
- <template>
- {{#if this.reviewable.reviewable_scores}}
- <div class="reviewable-scores__table-wrapper">
- <table class="reviewable-scores">
- <thead>
- <tr>
- <th>{{i18n "review.scores.submitted_by"}}</th>
- <th>{{i18n "review.scores.date"}}</th>
- <th>{{i18n "review.scores.type"}}</th>
- <th>{{i18n "review.scores.reviewed_by"}}</th>
- <th>{{i18n "review.scores.reviewed_timestamp"}}</th>
- <th>{{i18n "review.scores.status"}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each this.reviewable.reviewable_scores as |rs|}}
- <ReviewableScore @rs={{rs}} @reviewable={{this.reviewable}} />
- {{/each}}
- </tbody>
- </table>
- </div>
-
- {{#each this.reviewable.reviewable_scores as |rs|}}
- {{#if rs.reason}}
- <div class="reviewable-score-reason">{{htmlSafe rs.reason}}</div>
- {{/if}}
- {{#if rs.context}}
- <div class="reviewable-score-context">{{htmlSafe rs.context}}</div>
- {{/if}}
-
- {{#if rs.reviewable_conversation}}
- <div class="reviewable-conversation">
- {{#each rs.reviewable_conversation.conversation_posts as |p index|}}
- <ReviewableConversationPost @post={{p}} @index={{index}} />
- {{/each}}
- <div class="controls">
- <a
- href={{rs.reviewable_conversation.permalink}}
- class="btn btn-small"
- >
- {{i18n "review.conversation.view_full"}}
- </a>
- </div>
- </div>
- {{/if}}
- {{/each}}
- {{/if}}
- </template>
-}
diff --git a/frontend/discourse/app/components/reviewable-user.js b/frontend/discourse/app/components/reviewable-user.js
deleted file mode 100644
index 9a303959943..00000000000
--- a/frontend/discourse/app/components/reviewable-user.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import User from "discourse/components/reviewable/user";
-
-export default User;
diff --git a/spec/system/page_objects/pages/refreshed_review.rb b/spec/system/page_objects/pages/refreshed_review.rb
deleted file mode 100644
index 005e1b040e2..00000000000
--- a/spec/system/page_objects/pages/refreshed_review.rb
+++ /dev/null
@@ -1,195 +0,0 @@
-# frozen_string_literal: true
-
-module PageObjects
- module Pages
- class RefreshedReview < PageObjects::Pages::Base
- REVIEWABLE_ACTION_DROPDOWN = ".reviewable-action-dropdown"
-
- def visit_reviewable(reviewable)
- page.visit("/review/#{reviewable.id}")
- self
- end
-
- def click_timeline_tab
- find(".action-list li.timeline").click
- end
-
- def click_insights_tab
- find(".action-list li.insights").click
- end
-
- def select_bundled_action(reviewable, value, bundle_id = nil)
- within(reviewable_by_id(reviewable.id)) do
- if bundle_id
- dropdown_selector = "#{REVIEWABLE_ACTION_DROPDOWN}.#{bundle_id.dasherize}"
- dropdown = PageObjects::Components::SelectKit.new(dropdown_selector)
- dropdown.expand
- dropdown.select_row_by_value(value)
- else
- dropdown_count = all(REVIEWABLE_ACTION_DROPDOWN).count
- dropdown_count.times do |index|
- dropdown_selector = "#{REVIEWABLE_ACTION_DROPDOWN}:nth-of-type(#{index + 1})"
- dropdown = PageObjects::Components::SelectKit.new(dropdown_selector)
- dropdown.expand
- if dropdown.expanded_component.has_css?(
- ".select-kit-row[data-value='#{value}']",
- wait: 0,
- )
- dropdown.select_row_by_value(value)
- break
- else
- dropdown.collapse
- end
- end
- end
- end
- end
-
- def select_action(reviewable, value)
- within(reviewable_by_id(reviewable.id)) do
- find(".reviewable-action.#{value.dasherize}").click
- end
- end
-
- def has_reviewable_with_rejected_status?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--rejected") }
- end
-
- def has_rejected_item_in_timeline?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_text?("Rejected by") }
- end
-
- def has_reviewable_with_pending_status?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--pending") }
- end
-
- def has_reviewable_with_approved_status?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--approved") }
- end
-
- def has_approved_item_in_timeline?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_text?("Approved by") }
- end
-
- def has_reviewable_with_ignored_status?(reviewable)
- within(reviewable_by_id(reviewable.id)) { page.has_css?(".review-item__status.--ignored") }
- end
-
- def has_reviewable_with_scrubbed_by?(reviewable, scrubbed_by)
- within(reviewable_by_id(reviewable.id)) do
- page.has_css?(".reviewable-user-details.scrubbed-by .value", text: scrubbed_by)
- end
- end
-
- def has_reviewable_with_scrubbed_reason?(reviewable, scrubbed_reason)
- within(reviewable_by_id(reviewable.id)) do
- page.has_css?(".reviewable-user-details.scrubbed-reason .value", text: scrubbed_reason)
- end
- end
-
- def has_reviewable_with_scrubbed_at?(reviewable, scrubbed_at)
- within(reviewable_by_id(reviewable.id)) do
- page.has_css?(".reviewable-user-details.scrubbed-at .value", text: scrubbed_at)
- end
- end
-
- def click_edit_post_button
- find(".reviewable-action.edit").click
- end
-
- def click_scrub_user_button
- find(".user-scrub").click
- end
-
- def fill_post_content(content)
- find(".d-editor-input").fill_in(with: content)
- end
-
- def save_post_edit
- find(".reviewable-action.save-edit").click
- end
-
- def has_ip_lookup_info?
- page.has_css?(".reviewable-ip-lookup")
- end
-
- def has_ip_location?(location)
- page.has_text?(location)
- end
-
- def has_ip_hostname?(hostname)
- page.has_text?(hostname)
- end
-
- def has_ip_organization?(organization)
- page.has_text?(organization)
- end
-
- def has_other_accounts_link?(count:)
- page.has_button?(I18n.t("js.ip_lookup.other_accounts_with_ip", count: count))
- end
-
- def click_other_accounts_link
- find(".ip-lookup-other-accounts-link").click
- end
-
- def has_ip_lookup_modal?
- page.has_css?(".ip-lookup-other-accounts-modal")
- end
-
- def has_account_in_modal?(username)
- within(".ip-lookup-other-accounts-modal") { page.has_text?(username) }
- end
-
- def click_claim_reviewable
- find(".reviewable-claimed-topic .claim").click
- end
-
- def click_unclaim_reviewable
- find(".reviewable-claimed-topic .unclaim").click
- end
-
- def has_context_question?(reviewable, text)
- within(reviewable_by_id(reviewable.id)) do
- page.has_css?(".review-item__aside-title", text: text)
- end
- end
-
- def has_created_at_history_item?
- expect(page).to have_css(".timeline-event__icon .d-icon-pen-to-square")
- expect(page).to have_text("Post created by")
- end
-
- def has_claimed_history_item?(user)
- expect(page).to have_css(".timeline-event__icon .d-icon-user-plus")
- expect(page).to have_text("Claimed by")
- end
-
- def has_unclaimed_history_item?(user)
- expect(page).to have_css(".timeline-event__icon .d-icon-user-xmark")
- expect(page).to have_text("Unclaimed by")
- end
-
- def has_history_items?(count:)
- expect(page).to have_css(".timeline-event", count: count)
- end
-
- def has_reviewables?(reviewables)
- reviewable_ids = reviewables.map(&:id)
- page.has_css?(".review-item", count: reviewables.size) &&
- reviewable_ids.all? { |id| page.has_css?(".review-item[data-reviewable-id='#{id}']") }
- end
-
- private
-
- def reviewable_by_id(id)
- find(".review-item[data-reviewable-id=\"#{id}\"]")
- end
-
- def reviewable_action_dropdown
- @reviewable_action_dropdown ||=
- PageObjects::Components::SelectKit.new(REVIEWABLE_ACTION_DROPDOWN)
- end
- end
- end
-end