Skip to content

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

DEV: Ensure `streamElement` consistency across components (#33638)

Sérgio Saquetimd8abc0ab11cb
diff --git a/app/assets/javascripts/discourse/app/components/post-stream.gjs b/app/assets/javascripts/discourse/app/components/post-stream.gjs
index 770d9acf1e1..dcb30ddc15b 100644
--- a/app/assets/javascripts/discourse/app/components/post-stream.gjs
+++ b/app/assets/javascripts/discourse/app/components/post-stream.gjs
@@ -324,6 +324,7 @@ export default class PostStream extends Component {
@showPagePublish={{fn @showPagePublish post}}
@showRawEmail={{fn @showRawEmail post}}
@showReadIndicator={{@showReadIndicator}}
+ @streamElement={{true}}
@togglePostSelection={{fn @togglePostSelection post}}
@togglePostType={{fn @togglePostType post}}
@toggleReplyAbove={{fn @toggleReplyAbove post}}
diff --git a/app/assets/javascripts/discourse/app/components/post.gjs b/app/assets/javascripts/discourse/app/components/post.gjs
index afea88f6eea..fbc04b1683d 100644
--- a/app/assets/javascripts/discourse/app/components/post.gjs
+++ b/app/assets/javascripts/discourse/app/components/post.gjs
@@ -454,6 +454,7 @@ export default class Post extends Component {
@post={{reply}}
@above={{true}}
@highlightTerm={{@highlightTerm}}
+ @streamElement={{@streamElement}}
/>
{{/each}}
</section>
@@ -509,6 +510,7 @@ export default class Post extends Component {
@post={{@post}}
@highlightTerm={{@highlightTerm}}
@decoratorState={{this.decoratorState}}
+ @streamElement={{@streamElement}}
/>
</PluginOutlet>
@@ -598,6 +600,7 @@ export default class Post extends Component {
}}
@post={{reply}}
@highlightTerm={{@highlightTerm}}
+ @streamElement={{@streamElement}}
/>
{{/each}}
diff --git a/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs b/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs
index 372dd125740..9a41ea0eced 100644
--- a/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs
@@ -40,7 +40,7 @@ export default class PostCookedHtml extends Component {
}
get isStreamElement() {
- return this.args.streamElement ?? true;
+ return this.args.streamElement ?? false;
}
@bind
@@ -69,7 +69,7 @@ export default class PostCookedHtml extends Component {
...extraArguments,
post: nestedPost,
decoratorState,
- streamElement: false,
+ streamElement: this.isStreamElement,
highlightTerm: this.highlightTerm,
extraDecorators: [
...this.extraDecorators,
@@ -104,6 +104,7 @@ export default class PostCookedHtml extends Component {
post: this.args.post,
renderGlimmer: helper.renderGlimmer,
renderNestedPostCookedHtml,
+ streamElement: this.isStreamElement,
});
if (typeof decorationCleanup === "function") {
diff --git a/app/assets/javascripts/discourse/app/components/post/embedded.gjs b/app/assets/javascripts/discourse/app/components/post/embedded.gjs
index a5f9bd4648e..c32c05c531c 100644
--- a/app/assets/javascripts/discourse/app/components/post/embedded.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/embedded.gjs
@@ -33,7 +33,7 @@ const PostEmbedded = <template>
<PostCookedHtml
@post={{@post}}
@highlightTerm={{@highlightTerm}}
- @streamElement={{false}}
+ @streamElement={{@streamElement}}
/>
</div>
</div>
diff --git a/app/assets/javascripts/discourse/app/components/post/quoted-content.gjs b/app/assets/javascripts/discourse/app/components/post/quoted-content.gjs
index eea80f4d873..82a4f243c4c 100644
--- a/app/assets/javascripts/discourse/app/components/post/quoted-content.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/quoted-content.gjs
@@ -254,7 +254,7 @@ export default class PostQuotedContent extends Component {
@decoratorState={{@decoratorState}}
@extraDecorators={{this.extraDecorators}}
@highlightTerm={{@highlightTerm}}
- @streamElement={{false}}
+ @streamElement={{@streamElement}}
/>
</div>
</:content>
diff --git a/app/assets/javascripts/discourse/app/components/post/small-action.gjs b/app/assets/javascripts/discourse/app/components/post/small-action.gjs
index 53c76b64475..db2863384bc 100644
--- a/app/assets/javascripts/discourse/app/components/post/small-action.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/small-action.gjs
@@ -196,7 +196,10 @@ export default class PostSmallAction extends Component {
{{#unless this.CustomComponent}}
{{#if @post.cooked}}
<div class="small-action-custom-message">
- <PostCookedHtml @post={{@post}} />
+ <PostCookedHtml
+ @post={{@post}}
+ @streamElement={{@streamElement}}
+ />
</div>
{{/if}}
{{/unless}}
diff --git a/app/assets/javascripts/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs b/app/assets/javascripts/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
index e6cd4a2689b..22a49ee1a04 100644
--- a/app/assets/javascripts/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
+++ b/app/assets/javascripts/discourse/app/lib/post-cooked-html-decorators/quote-controls.gjs
@@ -4,8 +4,15 @@ import PostQuotedContent from "discourse/components/post/quoted-content";
export default function quoteControls(element, context) {
// Extract required properties from context
- const { post, highlightTerm, ignoredUsers, decoratorState, owner, helper } =
- context;
+ const {
+ decoratorState,
+ helper,
+ highlightTerm,
+ ignoredUsers,
+ owner,
+ post,
+ streamElement,
+ } = context;
// Find all quote blocks in the element
const quotes = element.querySelectorAll("aside.quote");
@@ -60,6 +67,7 @@ export default function quoteControls(element, context) {
quotedPostNotFound: aside.classList.contains("quote-post-not-found"),
quotedPostNumber,
quotedTopicId,
+ streamElement,
title,
username,
wrapperElement: aside,
diff --git a/plugins/poll/assets/javascripts/discourse/initializers/extend-for-poll.gjs b/plugins/poll/assets/javascripts/discourse/initializers/extend-for-poll.gjs
index a1d038877f5..4962c1e051a 100644
--- a/plugins/poll/assets/javascripts/discourse/initializers/extend-for-poll.gjs
+++ b/plugins/poll/assets/javascripts/discourse/initializers/extend-for-poll.gjs
@@ -24,6 +24,8 @@ function attachPolls(elem, helper) {
let pollPost = post;
const quotedId = pollNode.closest(".expanded-quote")?.dataset.postId;
+
+ // TODO (glimmer-post-stream) the condition below is probably not needed after the widget are gone
if (quotedId && post.quoted[quotedId]) {
pollPost = EmberObject.create(post.quoted[quotedId]);
poll = new TrackedObject(pollPost.polls.find((p) => p.name === pollName));
diff --git a/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js b/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
index fce312c1c0e..04085303c81 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-in-reply-history-test.js
@@ -2,444 +2,453 @@ import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
-acceptance("Poll in a post reply history", function (needs) {
- needs.user();
- needs.settings({ poll_enabled: true });
+["enabled", "disabled"].forEach((postStreamMode) => {
+ acceptance(
+ `Poll in a post reply history (glimmer_post_stream_mode = ${postStreamMode})`,
+ function (needs) {
+ needs.user();
+ needs.settings({
+ poll_enabled: true,
+ glimmer_post_stream_mode: postStreamMode,
+ });
- needs.pretender((server, helper) => {
- server.get("/t/topic_with_poll_in_post_reply_history.json", () => {
- return helper.response({
- post_stream: {
- posts: [
- {
- id: 82,
- name: null,
- username: "admin1",
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- created_at: "2021-01-25T13:08:27.385Z",
- cooked: "<p>A reply to the poll.</p>",
- post_number: 4,
- post_type: 1,
- updated_at: "2021-01-25T13:08:27.385Z",
- reply_count: 0,
- reply_to_post_number: 2,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- readers_count: 0,
- score: 0.2,
- yours: true,
- topic_id: 25,
- topic_slug: "topic-with-a-poll-in-a-post-reply-history",
- display_username: null,
- primary_group_name: null,
- flair_url: null,
- flair_bg_color: null,
- flair_color: null,
- version: 1,
- can_edit: true,
- can_delete: true,
- can_recover: false,
- can_wiki: true,
- read: true,
- user_title: null,
- reply_to_user: {
- username: "admin1",
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- },
- bookmarked: false,
- bookmarks: [],
- actions_summary: [
+ needs.pretender((server, helper) => {
+ server.get("/t/topic_with_poll_in_post_reply_history.json", () => {
+ return helper.response({
+ post_stream: {
+ posts: [
{
- id: 3,
- can_act: true,
- },
- {
- id: 4,
- can_act: true,
- },
- {
- id: 8,
- can_act: true,
- },
- {
- id: 7,
- can_act: true,
+ id: 82,
+ name: null,
+ username: "admin1",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ created_at: "2021-01-25T13:08:27.385Z",
+ cooked: "<p>A reply to the poll.</p>",
+ post_number: 4,
+ post_type: 1,
+ updated_at: "2021-01-25T13:08:27.385Z",
+ reply_count: 0,
+ reply_to_post_number: 2,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ readers_count: 0,
+ score: 0.2,
+ yours: true,
+ topic_id: 25,
+ topic_slug: "topic-with-a-poll-in-a-post-reply-history",
+ display_username: null,
+ primary_group_name: null,
+ flair_url: null,
+ flair_bg_color: null,
+ flair_color: null,
+ version: 1,
+ can_edit: true,
+ can_delete: true,
+ can_recover: false,
+ can_wiki: true,
+ read: true,
+ user_title: null,
+ reply_to_user: {
+ username: "admin1",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ },
+ bookmarked: false,
+ bookmarks: [],
+ actions_summary: [
+ {
+ id: 3,
+ can_act: true,
+ },
+ {
+ id: 4,
+ can_act: true,
+ },
+ {
+ id: 8,
+ can_act: true,
+ },
+ {
+ id: 7,
+ can_act: true,
+ },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 3,
+ hidden: false,
+ trust_level: 1,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ reviewable_id: 0,
+ reviewable_score_count: 0,
+ reviewable_score_pending_count: 0,
},
],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 3,
- hidden: false,
- trust_level: 1,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- reviewable_id: 0,
- reviewable_score_count: 0,
- reviewable_score_pending_count: 0,
+ stream: [82],
},
- ],
- stream: [82],
- },
- timeline_lookup: [[1, 0]],
- suggested_topics: [
- {
- id: 7,
- title: "Welcome to Discourse",
- fancy_title: "Welcome to Discourse",
- slug: "welcome-to-discourse",
- posts_count: 1,
- reply_count: 0,
- highest_post_number: 1,
- image_url: null,
- created_at: "2021-01-07T15:36:44.707Z",
- last_posted_at: "2021-01-07T15:36:44.750Z",
- bumped: true,
- bumped_at: "2021-01-07T15:36:44.750Z",
- archetype: "regular",
- unseen: false,
- pinned: true,
- unpinned: null,
- excerpt:
- "The first paragraph of this pinned topic will be visible as a welcome message to all new visitors on your homepage. It’s important! Edit this into a brief description of your community: Who is it for? What can they fi&hellip;",
- visible: true,
- closed: false,
- archived: false,
- bookmarked: null,
- liked: null,
- like_count: 0,
- views: 1,
- category_id: 1,
- featured_link: null,
- posters: [
+ timeline_lookup: [[1, 0]],
+ suggested_topics: [
{
- extras: "latest single",
- description: "Original Poster, Most Recent Poster",
- user: {
- id: -1,
- username: "system",
- name: "system",
- avatar_template:
- "http://localhost:3000/images/discourse-logo-sketch-small.png",
- },
+ id: 7,
+ title: "Welcome to Discourse",
+ fancy_title: "Welcome to Discourse",
+ slug: "welcome-to-discourse",
+ posts_count: 1,
+ reply_count: 0,
+ highest_post_number: 1,
+ image_url: null,
+ created_at: "2021-01-07T15:36:44.707Z",
+ last_posted_at: "2021-01-07T15:36:44.750Z",
+ bumped: true,
+ bumped_at: "2021-01-07T15:36:44.750Z",
+ archetype: "regular",
+ unseen: false,
+ pinned: true,
+ unpinned: null,
+ excerpt:
+ "The first paragraph of this pinned topic will be visible as a welcome message to all new visitors on your homepage. It’s important! Edit this into a brief description of your community: Who is it for? What can they fi&hellip;",
+ visible: true,
+ closed: false,
+ archived: false,
+ bookmarked: null,
+ liked: null,
+ like_count: 0,
+ views: 1,
+ category_id: 1,
+ featured_link: null,
+ posters: [
+ {
+ extras: "latest single",
+ description: "Original Poster, Most Recent Poster",
+ user: {
+ id: -1,
+ username: "system",
+ name: "system",
+ avatar_template:
+ "http://localhost:3000/images/discourse-logo-sketch-small.png",
+ },
+ },
+ ],
},
- ],
- },
- {
- id: 20,
- title: "Polls testing. Just one poll in the comment",
- fancy_title: "Polls testing. Just one poll in the comment",
- slug: "polls-testing-just-one-poll-in-the-comment",
- posts_count: 3,
- reply_count: 1,
- highest_post_number: 3,
- image_url: null,
- created_at: "2021-01-21T09:21:35.102Z",
- last_posted_at: "2021-01-22T09:35:33.543Z",
- bumped: true,
- bumped_at: "2021-01-22T09:35:33.543Z",
- archetype: "regular",
- unseen: false,
- last_read_post_number: 3,
- unread_posts: 0,
- pinned: false,
- unpinned: null,
- visible: true,
- closed: false,
- archived: false,
- notification_level: 2,
- bookmarked: false,
- bookmarks: [],
- liked: false,
- like_count: 0,
- views: 3,
- category_id: 1,
- featured_link: null,
- posters: [
{
- extras: null,
- description: "Original Poster",
- user: {
- id: 2,
- username: "andrey1",
- name: "andrey1",
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/c0e974/{size}.png",
- },
+ id: 20,
+ title: "Polls testing. Just one poll in the comment",
+ fancy_title: "Polls testing. Just one poll in the comment",
+ slug: "polls-testing-just-one-poll-in-the-comment",
+ posts_count: 3,
+ reply_count: 1,
+ highest_post_number: 3,
+ image_url: null,
+ created_at: "2021-01-21T09:21:35.102Z",
+ last_posted_at: "2021-01-22T09:35:33.543Z",
+ bumped: true,
+ bumped_at: "2021-01-22T09:35:33.543Z",
+ archetype: "regular",
+ unseen: false,
+ last_read_post_number: 3,
+ unread_posts: 0,
+ pinned: false,
+ unpinned: null,
+ visible: true,
+ closed: false,
+ archived: false,
+ notification_level: 2,
+ bookmarked: false,
+ bookmarks: [],
+ liked: false,
+ like_count: 0,
+ views: 3,
+ category_id: 1,
+ featured_link: null,
+ posters: [
+ {
+ extras: null,
+ description: "Original Poster",
+ user: {
+ id: 2,
+ username: "andrey1",
+ name: "andrey1",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/c0e974/{size}.png",
+ },
+ },
+ {
+ extras: "latest",
+ description: "Most Recent Poster",
+ user: {
+ id: 3,
+ username: "admin1",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ },
+ },
+ ],
},
{
- extras: "latest",
- description: "Most Recent Poster",
- user: {
- id: 3,
- username: "admin1",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- },
+ id: 22,
+ title: "Polls testing. The whole test",
+ fancy_title: "Polls testing. The whole test",
+ slug: "polls-testing-the-whole-test",
+ posts_count: 12,
+ reply_count: 8,
+ highest_post_number: 12,
+ image_url: null,
+ created_at: "2021-01-21T09:55:20.135Z",
+ last_posted_at: "2021-01-22T11:59:31.561Z",
+ bumped: true,
+ bumped_at: "2021-01-22T11:59:31.561Z",
+ archetype: "regular",
+ unseen: false,
+ last_read_post_number: 12,
+ unread_posts: 0,
+ pinned: false,
+ unpinned: null,
+ visible: true,
+ closed: false,
+ archived: false,
+ notification_level: 2,
+ bookmarked: false,
+ bookmarks: [],
+ liked: false,
+ like_count: 0,
+ views: 4,
+ category_id: 1,
+ featured_link: null,
+ posters: [
+ {
+ extras: null,
+ description: "Original Poster",
+ user: {
+ id: 2,
+ username: "andrey1",
+ name: "andrey1",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/c0e974/{size}.png",
+ },
+ },
+ {
+ extras: "latest",
+ description: "Most Recent Poster",
+ user: {
+ id: 3,
+ username: "admin1",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ },
+ },
+ ],
},
],
- },
- {
- id: 22,
- title: "Polls testing. The whole test",
- fancy_title: "Polls testing. The whole test",
- slug: "polls-testing-the-whole-test",
- posts_count: 12,
- reply_count: 8,
- highest_post_number: 12,
- image_url: null,
- created_at: "2021-01-21T09:55:20.135Z",
- last_posted_at: "2021-01-22T11:59:31.561Z",
- bumped: true,
- bumped_at: "2021-01-22T11:59:31.561Z",
- archetype: "regular",
- unseen: false,
- last_read_post_number: 12,
- unread_posts: 0,
- pinned: false,
- unpinned: null,
+ id: 25,
+ title: "Topic with a poll in a post reply history",
+ fancy_title: "Topic with a poll in a post reply history",
+ posts_count: 4,
+ created_at: "2021-01-25T13:07:31.670Z",
+ views: 2,
+ reply_count: 2,
+ like_count: 0,
+ last_posted_at: "2021-01-25T13:08:27.385Z",
visible: true,
closed: false,
archived: false,
- notification_level: 2,
- bookmarked: false,
- bookmarks: [],
- liked: false,
- like_count: 0,
- views: 4,
+ has_summary: false,
+ archetype: "regular",
+ slug: "topic-with-a-poll-in-a-post-reply-history",
category_id: 1,
+ word_count: 25,
+ deleted_at: null,
+ user_id: 3,
featured_link: null,
- posters: [
+ pinned_globally: false,
+ pinned_at: null,
+ pinned_until: null,
+ image_url: null,
+ slow_mode_seconds: 0,
+ draft: null,
+ draft_key: "topic_25",
+ draft_sequence: 4,
+ posted: true,
+ unpinned: null,
+ pinned: false,
+ current_post_number: 4,
+ highest_post_number: 4,
+ last_read_post_number: 4,
+ last_read_post_id: 82,
+ deleted_by: null,
+ has_deleted: false,
+ actions_summary: [
{
- extras: null,
- description: "Original Poster",
- user: {
- id: 2,
- username: "andrey1",
- name: "andrey1",
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/c0e974/{size}.png",
- },
+ id: 4,
+ count: 0,
+ hidden: false,
+ can_act: true,
+ },
+ {
+ id: 8,
+ count: 0,
+ hidden: false,
+ can_act: true,
},
{
- extras: "latest",
- description: "Most Recent Poster",
- user: {
+ id: 7,
+ count: 0,
+ hidden: false,
+ can_act: true,
+ },
+ ],
+ chunk_size: 20,
+ bookmarked: false,
+ bookmarks: [],
+ topic_timer: null,
+ message_bus_last_id: 4,
+ participant_count: 1,
+ show_read_indicator: false,
+ thumbnails: null,
+ details: {
+ can_edit: true,
+ notification_level: 3,
+ notifications_reason_id: 1,
+ can_move_posts: true,
+ can_delete: true,
+ can_remove_allowed_users: true,
+ can_invite_to: true,
+ can_invite_via_email: true,
+ can_create_post: true,
+ can_reply_as_new_topic: true,
+ can_flag_topic: true,
+ can_convert_topic: true,
+ can_review_topic: true,
+ can_close_topic: true,
+ can_archive_topic: true,
+ can_split_merge_topic: true,
+ can_edit_staff_notes: true,
+ can_toggle_topic_visibility: true,
+ can_moderate_category: true,
+ can_remove_self_id: 3,
+ participants: [
+ {
id: 3,
username: "admin1",
name: null,
avatar_template:
"/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ post_count: 4,
+ primary_group_name: null,
+ flair_url: null,
+ flair_color: null,
+ flair_bg_color: null,
},
+ ],
+ created_by: {
+ id: 3,
+ username: "admin1",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
},
- ],
- },
- ],
- id: 25,
- title: "Topic with a poll in a post reply history",
- fancy_title: "Topic with a poll in a post reply history",
- posts_count: 4,
- created_at: "2021-01-25T13:07:31.670Z",
- views: 2,
- reply_count: 2,
- like_count: 0,
- last_posted_at: "2021-01-25T13:08:27.385Z",
- visible: true,
- closed: false,
- archived: false,
- has_summary: false,
- archetype: "regular",
- slug: "topic-with-a-poll-in-a-post-reply-history",
- category_id: 1,
- word_count: 25,
- deleted_at: null,
- user_id: 3,
- featured_link: null,
- pinned_globally: false,
- pinned_at: null,
- pinned_until: null,
- image_url: null,
- slow_mode_seconds: 0,
- draft: null,
- draft_key: "topic_25",
- draft_sequence: 4,
- posted: true,
- unpinned: null,
- pinned: false,
- current_post_number: 4,
- highest_post_number: 4,
- last_read_post_number: 4,
- last_read_post_id: 82,
- deleted_by: null,
- has_deleted: false,
- actions_summary: [
- {
- id: 4,
- count: 0,
- hidden: false,
- can_act: true,
- },
- {
- id: 8,
- count: 0,
- hidden: false,
- can_act: true,
- },
- {
- id: 7,
- count: 0,
- hidden: false,
- can_act: true,
- },
- ],
- chunk_size: 20,
- bookmarked: false,
- bookmarks: [],
- topic_timer: null,
- message_bus_last_id: 4,
- participant_count: 1,
- show_read_indicator: false,
- thumbnails: null,
- details: {
- can_edit: true,
- notification_level: 3,
- notifications_reason_id: 1,
- can_move_posts: true,
- can_delete: true,
- can_remove_allowed_users: true,
- can_invite_to: true,
- can_invite_via_email: true,
- can_create_post: true,
- can_reply_as_new_topic: true,
- can_flag_topic: true,
- can_convert_topic: true,
- can_review_topic: true,
- can_close_topic: true,
- can_archive_topic: true,
- can_split_merge_topic: true,
- can_edit_staff_notes: true,
- can_toggle_topic_visibility: true,
- can_moderate_category: true,
- can_remove_self_id: 3,
- participants: [
+ last_poster: {
+ id: 3,
+ username: "admin1",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
+ },
+ },
+ });
+ });
+
+ server.get("/posts/82/reply-history", () => {
+ return helper.response([
{
- id: 3,
- username: "admin1",
+ id: 80,
name: null,
+ username: "admin1",
avatar_template:
"/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- post_count: 4,
+ created_at: "2021-01-25T13:07:58.995Z",
+ cooked:
+ '<p>The poll:</p>\n<div class="poll" data-poll-status="open" data-poll-name="poll">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="5b8ee5ba2a43e258f93dbef9264bf1ad">Option A</li>\n<li data-poll-option-id="6872645f5d8ef2311883617a3a7d381b">Option B</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>',
+ post_number: 2,
+ post_type: 1,
+ updated_at: "2021-01-25T13:07:58.995Z",
+ reply_count: 2,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ readers_count: 0,
+ score: 10.2,
+ yours: false,
+ topic_id: 25,
+ topic_slug: "topic-with-a-poll-in-a-post-reply-history",
+ display_username: null,
primary_group_name: null,
flair_url: null,
- flair_color: null,
flair_bg_color: null,
- },
- ],
- created_by: {
- id: 3,
- username: "admin1",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- },
- last_poster: {
- id: 3,
- username: "admin1",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- },
- },
- });
- });
-
- server.get("/posts/82/reply-history", () => {
- return helper.response([
- {
- id: 80,
- name: null,
- username: "admin1",
- avatar_template: "/letter_avatar_proxy/v4/letter/a/bbce88/{size}.png",
- created_at: "2021-01-25T13:07:58.995Z",
- cooked:
- '<p>The poll:</p>\n<div class="poll" data-poll-status="open" data-poll-name="poll">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="5b8ee5ba2a43e258f93dbef9264bf1ad">Option A</li>\n<li data-poll-option-id="6872645f5d8ef2311883617a3a7d381b">Option B</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>',
- post_number: 2,
- post_type: 1,
- updated_at: "2021-01-25T13:07:58.995Z",
- reply_count: 2,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- readers_count: 0,
- score: 10.2,
- yours: false,
- topic_id: 25,
- topic_slug: "topic-with-a-poll-in-a-post-reply-history",
- display_username: null,
- primary_group_name: null,
- flair_url: null,
- flair_bg_color: null,
- flair_color: null,
- version: 1,
- can_edit: false,
- can_delete: false,
- can_recover: false,
- can_wiki: false,
- user_title: null,
- bookmarked: false,
- bookmarks: [],
- actions_summary: [],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 3,
- hidden: false,
- trust_level: 1,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- polls: [
- {
- name: "poll",
- type: "regular",
- status: "open",
- results: "always",
- options: [
- {
- id: "5b8ee5ba2a43e258f93dbef9264bf1ad",
- html: "Option A",
- votes: 0,
- },
+ flair_color: null,
+ version: 1,
+ can_edit: false,
+ can_delete: false,
+ can_recover: false,
+ can_wiki: false,
+ user_title: null,
+ bookmarked: false,
+ bookmarks: [],
+ actions_summary: [],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 3,
+ hidden: false,
+ trust_level: 1,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ polls: [
{
- id: "6872645f5d8ef2311883617a3a7d381b",
- html: "Option B",
- votes: 0,
+ name: "poll",
+ type: "regular",
+ status: "open",
+ results: "always",
+ options: [
+ {
+ id: "5b8ee5ba2a43e258f93dbef9264bf1ad",
+ html: "Option A",
+ votes: 0,
+ },
+ {
+ id: "6872645f5d8ef2311883617a3a7d381b",
+ html: "Option B",
+ votes: 0,
+ },
+ ],
+ voters: 0,
+ chart_type: "bar",
+ title: null,
},
],
- voters: 0,
- chart_type: "bar",
- title: null,
},
- ],
- },
- ]);
- });
- });
+ ]);
+ });
+ });
- test("renders and extends", async function (assert) {
- await visit("/t/-/topic_with_poll_in_post_reply_history");
- await click(".reply-to-tab");
- assert.dom(".poll").exists("poll is rendered");
- assert.dom(".poll-buttons").exists("poll is extended");
- });
+ test("renders and extends", async function (assert) {
+ await visit("/t/-/topic_with_poll_in_post_reply_history");
+ await click(".reply-to-tab");
+ assert.dom(".poll").exists("poll is rendered");
+ assert.dom(".poll-buttons").exists("poll is extended");
+ });
+ }
+ );
});
diff --git a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js b/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
index 82a131c373a..6a1f74bc90e 100644
--- a/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
+++ b/plugins/poll/test/javascripts/acceptance/poll-quote-test.js
@@ -2,432 +2,441 @@ import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
-acceptance("Poll quote", function (needs) {
- needs.user();
- needs.settings({ poll_enabled: true });
+["enabled", "disabled"].forEach((postStreamMode) => {
+ acceptance(
+ `Poll quote (glimmer_post_stream_mode = ${postStreamMode})`,
+ function (needs) {
+ needs.user();
+ needs.settings({
+ poll_enabled: true,
+ glimmer_post_stream_mode: postStreamMode,
+ });
- needs.pretender((server, helper) => {
- server.get("/posts/by_number/130/1", () => {
- return helper.response({
- id: 133,
- name: null,
- username: "bianca",
- avatar_template: "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- created_at: "2020-08-17T12:05:24.577Z",
- cooked:
- '<div class="poll" data-poll-status="open" data-poll-name="poll1" data-poll-results="always" data-poll-charttype="bar" data-poll-type="regular">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="bf48cd4958a17180e2a298e246988f94">Alpha</li>\n<li data-poll-option-id="c19aa835729ab0413a84a2c9850c4005">Beta</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>\n<div class="poll" data-poll-status="open" data-poll-name="poll2" data-poll-results="always" data-poll-charttype="bar" data-poll-type="regular">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="def034c6770c6fd3754c054ef9ec4721">First</li>\n<li data-poll-option-id="e0f55d1a981683789bec2a0b05eb70ef">Second</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>',
- post_number: 1,
- post_type: 1,
- updated_at: "2020-08-17T12:05:24.577Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- readers_count: 0,
- score: 0.2,
- yours: true,
- topic_id: 130,
- topic_slug: "topic-with-two-polls",
- display_username: null,
- primary_group_name: null,
- flair_url: null,
- flair_bg_color: null,
- flair_color: null,
- version: 1,
- can_edit: true,
- can_delete: false,
- can_recover: false,
- can_wiki: true,
- user_title: "Tester",
- title_is_group: false,
- bookmarked: false,
- bookmarks: [],
- raw: "[poll name=poll1 type=regular results=always chartType=bar]\n* Alpha\n* Beta\n[/poll]\n\n[poll name=poll2 type=regular results=always chartType=bar]\n* First\n* Second\n[/poll]",
- actions_summary: [
- {
- id: 3,
- can_act: true,
- },
- {
- id: 4,
- can_act: true,
- },
- {
- id: 8,
- can_act: true,
- },
- {
- id: 7,
- can_act: true,
- },
- ],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- trust_level: 0,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- reviewable_id: null,
- reviewable_score_count: 0,
- reviewable_score_pending_count: 0,
- calendar_details: [],
- polls: [
- {
- name: "poll1",
- type: "regular",
- status: "open",
- results: "always",
- options: [
+ needs.pretender((server, helper) => {
+ server.get("/posts/by_number/130/1", () => {
+ return helper.response({
+ id: 133,
+ name: null,
+ username: "bianca",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ created_at: "2020-08-17T12:05:24.577Z",
+ cooked:
+ '<div class="poll" data-poll-status="open" data-poll-name="poll1" data-poll-results="always" data-poll-charttype="bar" data-poll-type="regular">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="bf48cd4958a17180e2a298e246988f94">Alpha</li>\n<li data-poll-option-id="c19aa835729ab0413a84a2c9850c4005">Beta</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>\n<div class="poll" data-poll-status="open" data-poll-name="poll2" data-poll-results="always" data-poll-charttype="bar" data-poll-type="regular">\n<div>\n<div class="poll-container">\n<ul>\n<li data-poll-option-id="def034c6770c6fd3754c054ef9ec4721">First</li>\n<li data-poll-option-id="e0f55d1a981683789bec2a0b05eb70ef">Second</li>\n</ul>\n</div>\n<div class="poll-info">\n<p>\n<span class="info-number">0</span>\n<span class="info-label">voters</span>\n</p>\n</div>\n</div>\n</div>',
+ post_number: 1,
+ post_type: 1,
+ updated_at: "2020-08-17T12:05:24.577Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ readers_count: 0,
+ score: 0.2,
+ yours: true,
+ topic_id: 130,
+ topic_slug: "topic-with-two-polls",
+ display_username: null,
+ primary_group_name: null,
+ flair_url: null,
+ flair_bg_color: null,
+ flair_color: null,
+ version: 1,
+ can_edit: true,
+ can_delete: false,
+ can_recover: false,
+ can_wiki: true,
+ user_title: "Tester",
+ title_is_group: false,
+ bookmarked: false,
+ bookmarks: [],
+ raw: "[poll name=poll1 type=regular results=always chartType=bar]\n* Alpha\n* Beta\n[/poll]\n\n[poll name=poll2 type=regular results=always chartType=bar]\n* First\n* Second\n[/poll]",
+ actions_summary: [
+ {
+ id: 3,
+ can_act: true,
+ },
+ {
+ id: 4,
+ can_act: true,
+ },
{
- id: "bf48cd4958a17180e2a298e246988f94",
- html: "Alpha",
- votes: 0,
+ id: 8,
+ can_act: true,
},
{
- id: "c19aa835729ab0413a84a2c9850c4005",
- html: "Beta",
- votes: 0,
+ id: 7,
+ can_act: true,
},
],
- voters: 0,
- chart_type: "bar",
- },
- {
- name: "poll2",
- type: "regular",
- status: "open",
- results: "always",
- options: [
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ trust_level: 0,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ reviewable_id: null,
+ reviewable_score_count: 0,
+ reviewable_score_pending_count: 0,
+ calendar_details: [],
+ polls: [
{
- id: "def034c6770c6fd3754c054ef9ec4721",
- html: "First",
- votes: 0,
+ name: "poll1",
+ type: "regular",
+ status: "open",
+ results: "always",
+ options: [
+ {
+ id: "bf48cd4958a17180e2a298e246988f94",
+ html: "Alpha",
+ votes: 0,
+ },
+ {
+ id: "c19aa835729ab0413a84a2c9850c4005",
+ html: "Beta",
+ votes: 0,
+ },
+ ],
+ voters: 0,
+ chart_type: "bar",
},
{
- id: "e0f55d1a981683789bec2a0b05eb70ef",
- html: "Second",
- votes: 0,
+ name: "poll2",
+ type: "regular",
+ status: "open",
+ results: "always",
+ options: [
+ {
+ id: "def034c6770c6fd3754c054ef9ec4721",
+ html: "First",
+ votes: 0,
+ },
+ {
+ id: "e0f55d1a981683789bec2a0b05eb70ef",
+ html: "Second",
+ votes: 0,
+ },
+ ],
+ voters: 0,
+ chart_type: "bar",
},
],
- voters: 0,
- chart_type: "bar",
- },
- ],
- });
- });
+ });
+ });
- server.get("/t/topic_with_two_quoted_polls.json", () => {
- return helper.response({
- post_stream: {
- posts: [
- {
- id: 134,
- name: null,
- username: "bianca",
- avatar_template:
- "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- created_at: "2020-08-17T12:08:24.043Z",
- cooked:
- '<aside class="quote quote-modified" data-post="1" data-topic="130">\n <div class="title">\n <div class="quote-controls"></div>\n <img alt="" width="20" height="20" src="/letter_avatar_proxy/v4/letter/b/3be4f8/40.png" class="avatar">\n <a href="//forum.example.com/t/topic-with-two-polls/130">Topic with two polls</a> \n </div>\n <blockquote>\n <a href="/t/topic-with-two-polls/130/1">poll</a>\n<a href="/t/topic-with-two-polls/130/1">poll</a>\n </blockquote>\n</aside>\n',
- post_number: 1,
- post_type: 1,
- updated_at: "2020-08-17T12:08:24.043Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- readers_count: 0,
- score: 0,
- yours: true,
- topic_id: 131,
- topic_slug: "topic-with-two-quoted-polls",
- display_username: null,
- primary_group_name: null,
- flair_url: null,
- flair_bg_color: null,
- flair_color: null,
- version: 1,
- can_edit: true,
- can_delete: false,
- can_recover: false,
- can_wiki: true,
- link_counts: [
- {
- url: "http://forum.example.com/t/topic-with-two-polls/130",
- internal: true,
- reflection: false,
- title: "Topic with two polls",
- clicks: 0,
- },
- ],
- read: true,
- user_title: "Tester",
- title_is_group: false,
- bookmarked: false,
- bookmarks: [],
- actions_summary: [
- {
- id: 3,
- can_act: true,
- },
- {
- id: 4,
- can_act: true,
- },
- {
- id: 8,
- can_act: true,
- },
+ server.get("/t/topic_with_two_quoted_polls.json", () => {
+ return helper.response({
+ post_stream: {
+ posts: [
{
- id: 7,
- can_act: true,
+ id: 134,
+ name: null,
+ username: "bianca",
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ created_at: "2020-08-17T12:08:24.043Z",
+ cooked:
+ '<aside class="quote quote-modified" data-post="1" data-topic="130">\n <div class="title">\n <div class="quote-controls"></div>\n <img alt="" width="20" height="20" src="/letter_avatar_proxy/v4/letter/b/3be4f8/40.png" class="avatar">\n <a href="//forum.example.com/t/topic-with-two-polls/130">Topic with two polls</a> \n </div>\n <blockquote>\n <a href="/t/topic-with-two-polls/130/1">poll</a>\n<a href="/t/topic-with-two-polls/130/1">poll</a>\n </blockquote>\n</aside>\n',
+ post_number: 1,
+ post_type: 1,
+ updated_at: "2020-08-17T12:08:24.043Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ readers_count: 0,
+ score: 0,
+ yours: true,
+ topic_id: 131,
+ topic_slug: "topic-with-two-quoted-polls",
+ display_username: null,
+ primary_group_name: null,
+ flair_url: null,
+ flair_bg_color: null,
+ flair_color: null,
+ version: 1,
+ can_edit: true,
+ can_delete: false,
+ can_recover: false,
+ can_wiki: true,
+ link_counts: [
+ {
+ url: "http://forum.example.com/t/topic-with-two-polls/130",
+ internal: true,
+ reflection: false,
+ title: "Topic with two polls",
+ clicks: 0,
+ },
+ ],
+ read: true,
+ user_title: "Tester",
+ title_is_group: false,
+ bookmarked: false,
+ bookmarks: [],
+ actions_summary: [
+ {
+ id: 3,
+ can_act: true,
+ },
+ {
+ id: 4,
+ can_act: true,
+ },
+ {
+ id: 8,
+ can_act: true,
+ },
+ {
+ id: 7,
+ can_act: true,
+ },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ trust_level: 0,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ reviewable_id: 0,
+ reviewable_score_count: 0,
+ reviewable_score_pending_count: 0,
+ calendar_details: [],
},
],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- trust_level: 0,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- reviewable_id: 0,
- reviewable_score_count: 0,
- reviewable_score_pending_count: 0,
- calendar_details: [],
+ stream: [134],
},
- ],
- stream: [134],
- },
- timeline_lookup: [[1, 0]],
- suggested_topics: [
- {
- id: 7,
- title: "Welcome to Discourse",
- fancy_title: "Welcome to Discourse",
- slug: "welcome-to-discourse",
+ timeline_lookup: [[1, 0]],
+ suggested_topics: [
+ {
+ id: 7,
+ title: "Welcome to Discourse",
+ fancy_title: "Welcome to Discourse",
+ slug: "welcome-to-discourse",
+ posts_count: 1,
+ reply_count: 0,
+ highest_post_number: 1,
+ image_url: null,
+ created_at: "2020-08-11T12:43:04.894Z",
+ last_posted_at: "2020-08-11T12:43:04.959Z",
+ bumped: true,
+ bumped_at: "2020-08-11T12:43:04.959Z",
+ archetype: "regular",
+ unseen: false,
+ last_read_post_number: 1,
+ unread_posts: 0,
+ pinned: false,
+ unpinned: true,
+ visible: true,
+ closed: false,
+ archived: false,
+ notification_level: 1,
+ bookmarked: false,
+ bookmarks: [],
+ liked: false,
+ tags: [],
+ like_count: 0,
+ views: 1,
+ category_id: 1,
+ featured_link: null,
+ posters: [
+ {
+ extras: "latest single",
+ description: "Original Poster, Most Recent Poster",
+ user: {
+ id: 5,
+ username: "foo2",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/f/8edcca/{size}.png",
+ },
+ },
+ ],
+ },
+ {
+ id: 130,
+ title: "Topic with two polls",
+ fancy_title: "Topic with two polls",
+ slug: "topic-with-two-polls",
+ posts_count: 1,
+ reply_count: 0,
+ highest_post_number: 1,
+ image_url: null,
+ created_at: "2020-08-17T12:05:24.500Z",
+ last_posted_at: "2020-08-17T12:05:24.577Z",
+ bumped: true,
+ bumped_at: "2020-08-17T12:05:24.577Z",
+ archetype: "regular",
+ unseen: false,
+ last_read_post_number: 1,
+ unread_posts: 0,
+ pinned: false,
+ unpinned: null,
+ visible: true,
+ closed: false,
+ archived: false,
+ notification_level: 3,
+ bookmarked: false,
+ bookmarks: [],
+ liked: false,
+ tags: [],
+ like_count: 0,
+ views: 1,
+ category_id: 1,
+ featured_link: null,
+ posters: [
+ {
+ extras: "latest single",
+ description: "Original Poster, Most Recent Poster",
+ user: {
+ id: 1,
+ username: "bianca",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ },
+ },
+ ],
+ },
+ ],
+ tags: [],
+ id: 131,
+ title: "Topic with two quoted polls",
+ fancy_title: "Topic with two quoted polls",
posts_count: 1,
+ created_at: "2020-08-17T12:08:23.918Z",
+ views: 1,
reply_count: 0,
- highest_post_number: 1,
- image_url: null,
- created_at: "2020-08-11T12:43:04.894Z",
- last_posted_at: "2020-08-11T12:43:04.959Z",
- bumped: true,
- bumped_at: "2020-08-11T12:43:04.959Z",
- archetype: "regular",
- unseen: false,
- last_read_post_number: 1,
- unread_posts: 0,
- pinned: false,
- unpinned: true,
+ like_count: 0,
+ last_posted_at: "2020-08-17T12:08:24.043Z",
visible: true,
closed: false,
archived: false,
- notification_level: 1,
- bookmarked: false,
- bookmarks: [],
- liked: false,
- tags: [],
- like_count: 0,
- views: 1,
+ has_summary: false,
+ archetype: "regular",
+ slug: "topic-with-two-quoted-polls",
category_id: 1,
+ word_count: 9,
+ deleted_at: null,
+ user_id: 1,
featured_link: null,
- posters: [
+ pinned_globally: false,
+ pinned_at: null,
+ pinned_until: null,
+ image_url: null,
+ draft: null,
+ draft_key: "topic_131",
+ draft_sequence: 0,
+ posted: true,
+ unpinned: null,
+ pinned: false,
+ current_post_number: 1,
+ highest_post_number: 1,
+ last_read_post_number: 1,
+ last_read_post_id: 134,
+ deleted_by: null,
+ has_deleted: false,
+ actions_summary: [
{
- extras: "latest single",
- description: "Original Poster, Most Recent Poster",
- user: {
- id: 5,
- username: "foo2",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/f/8edcca/{size}.png",
- },
+ id: 4,
+ count: 0,
+ hidden: false,
+ can_act: true,
+ },
+ {
+ id: 8,
+ count: 0,
+ hidden: false,
+ can_act: true,
+ },
+ {
+ id: 7,
+ count: 0,
+ hidden: false,
+ can_act: true,
},
],
- },
- {
- id: 130,
- title: "Topic with two polls",
- fancy_title: "Topic with two polls",
- slug: "topic-with-two-polls",
- posts_count: 1,
- reply_count: 0,
- highest_post_number: 1,
- image_url: null,
- created_at: "2020-08-17T12:05:24.500Z",
- last_posted_at: "2020-08-17T12:05:24.577Z",
- bumped: true,
- bumped_at: "2020-08-17T12:05:24.577Z",
- archetype: "regular",
- unseen: false,
- last_read_post_number: 1,
- unread_posts: 0,
- pinned: false,
- unpinned: null,
- visible: true,
- closed: false,
- archived: false,
- notification_level: 3,
+ chunk_size: 20,
bookmarked: false,
bookmarks: [],
- liked: false,
- tags: [],
- like_count: 0,
- views: 1,
- category_id: 1,
- featured_link: null,
- posters: [
- {
- extras: "latest single",
- description: "Original Poster, Most Recent Poster",
- user: {
+ topic_timer: null,
+ message_bus_last_id: 2,
+ participant_count: 1,
+ queued_posts_count: 0,
+ show_read_indicator: false,
+ thumbnails: null,
+ can_vote: false,
+ vote_count: null,
+ user_voted: false,
+ details: {
+ notification_level: 3,
+ notifications_reason_id: 1,
+ can_move_posts: true,
+ can_edit: true,
+ can_delete: true,
+ can_remove_allowed_users: true,
+ can_invite_to: true,
+ can_invite_via_email: true,
+ can_create_post: true,
+ can_reply_as_new_topic: true,
+ can_flag_topic: true,
+ can_convert_topic: true,
+ can_review_topic: true,
+ can_close_topic: true,
+ can_archive_topic: true,
+ can_split_merge_topic: true,
+ can_edit_staff_notes: true,
+ can_remove_self_id: 1,
+ participants: [
+ {
id: 1,
username: "bianca",
name: null,
avatar_template:
"/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ post_count: 1,
+ primary_group_name: null,
+ flair_url: null,
+ flair_color: null,
+ flair_bg_color: null,
},
+ ],
+ created_by: {
+ id: 1,
+ username: "bianca",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ },
+ last_poster: {
+ id: 1,
+ username: "bianca",
+ name: null,
+ avatar_template:
+ "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
},
- ],
- },
- ],
- tags: [],
- id: 131,
- title: "Topic with two quoted polls",
- fancy_title: "Topic with two quoted polls",
- posts_count: 1,
- created_at: "2020-08-17T12:08:23.918Z",
- views: 1,
- reply_count: 0,
- like_count: 0,
- last_posted_at: "2020-08-17T12:08:24.043Z",
- visible: true,
- closed: false,
- archived: false,
- has_summary: false,
- archetype: "regular",
- slug: "topic-with-two-quoted-polls",
- category_id: 1,
- word_count: 9,
- deleted_at: null,
- user_id: 1,
- featured_link: null,
- pinned_globally: false,
- pinned_at: null,
- pinned_until: null,
- image_url: null,
- draft: null,
- draft_key: "topic_131",
- draft_sequence: 0,
- posted: true,
- unpinned: null,
- pinned: false,
- current_post_number: 1,
- highest_post_number: 1,
- last_read_post_number: 1,
- last_read_post_id: 134,
- deleted_by: null,
- has_deleted: false,
- actions_summary: [
- {
- id: 4,
- count: 0,
- hidden: false,
- can_act: true,
- },
- {
- id: 8,
- count: 0,
- hidden: false,
- can_act: true,
- },
- {
- id: 7,
- count: 0,
- hidden: false,
- can_act: true,
- },
- ],
- chunk_size: 20,
- bookmarked: false,
- bookmarks: [],
- topic_timer: null,
- message_bus_last_id: 2,
- participant_count: 1,
- queued_posts_count: 0,
- show_read_indicator: false,
- thumbnails: null,
- can_vote: false,
- vote_count: null,
- user_voted: false,
- details: {
- notification_level: 3,
- notifications_reason_id: 1,
- can_move_posts: true,
- can_edit: true,
- can_delete: true,
- can_remove_allowed_users: true,
- can_invite_to: true,
- can_invite_via_email: true,
- can_create_post: true,
- can_reply_as_new_topic: true,
- can_flag_topic: true,
- can_convert_topic: true,
- can_review_topic: true,
- can_close_topic: true,
- can_archive_topic: true,
- can_split_merge_topic: true,
- can_edit_staff_notes: true,
- can_remove_self_id: 1,
- participants: [
- {
- id: 1,
- username: "bianca",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- post_count: 1,
- primary_group_name: null,
- flair_url: null,
- flair_color: null,
- flair_bg_color: null,
},
- ],
- created_by: {
- id: 1,
- username: "bianca",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- },
- last_poster: {
- id: 1,
- username: "bianca",
- name: null,
- avatar_template:
- "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- },
- },
- pending_posts: [],
+ pending_posts: [],
+ });
+ });
});
- });
- });
- test("renders and extends", async function (assert) {
- await visit("/t/-/topic_with_two_quoted_polls");
- await click(".quote-controls");
- assert.dom(".poll").exists({ count: 2 }, "polls are rendered");
- assert.dom(".poll-buttons").exists({ count: 2 }, "polls are extended");
- });
+ test("renders and extends", async function (assert) {
+ await visit("/t/-/topic_with_two_quoted_polls");
+ await click(".quote-controls .quote-toggle");
+ assert.dom(".poll").exists({ count: 2 }, "polls are rendered");
+ assert.dom(".poll-buttons").exists({ count: 2 }, "polls are extended");
+ });
+ }
+ );
});