Skip to content

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

DEV: Improve post HTML decoration and viewport tracking (#33608)

Sérgio Saquetim55dc3797c2db
diff --git a/app/assets/javascripts/discourse/app/components/decorated-html.gjs b/app/assets/javascripts/discourse/app/components/decorated-html.gjs
index dc027ca0cc3..973a62c9db7 100644
--- a/app/assets/javascripts/discourse/app/components/decorated-html.gjs
+++ b/app/assets/javascripts/discourse/app/components/decorated-html.gjs
@@ -14,7 +14,7 @@ const detachedDocument = document.implementation.createHTMLDocument("detached");
export default class DecoratedHtml extends Component {
renderGlimmerInfos = new TrackedArray();
- decoratedContent = helperFn((args, on) => {
+ decoratedContent = helperFn(({ decorateArgs }, on) => {
const cookedDiv = this.elementToDecorate;
const helper = new DecorateHtmlHelper({
@@ -25,12 +25,17 @@ export default class DecoratedHtml extends Component {
on.cleanup(() => helper.teardown());
const decorateFn = this.args.decorate;
- untrack(() => decorateFn?.(cookedDiv, helper));
+
+ // force parameters explicity declarated in `decorateArgs` to be tracked despite the
+ // use of `untrack` below
+ decorateArgs && Object.values(decorateArgs);
+
+ untrack(() => decorateFn?.(cookedDiv, helper, decorateArgs));
document.adoptNode(cookedDiv);
const afterAdoptDecorateFn = this.args.decorateAfterAdopt;
- untrack(() => afterAdoptDecorateFn?.(cookedDiv, helper));
+ untrack(() => afterAdoptDecorateFn?.(cookedDiv, helper, decorateArgs));
return cookedDiv;
});
@@ -54,7 +59,7 @@ export default class DecoratedHtml extends Component {
}
<template>
- {{~this.decoratedContent~}}
+ {{~this.decoratedContent decorateArgs=@decorateArgs~}}
{{~#each this.renderGlimmerInfos as |info|~}}
{{~#if info.append}}
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 9a41ea0eced..35ccc8fc4d1 100644
--- a/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/cooked-html.gjs
@@ -1,11 +1,11 @@
import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { TrackedMap } from "@ember-compat/tracked-built-ins";
import curryComponent from "ember-curry-component";
import DecoratedHtml from "discourse/components/decorated-html";
+import lazyHash from "discourse/helpers/lazy-hash";
import { bind } from "discourse/lib/decorators";
import { isRailsTesting, isTesting } from "discourse/lib/environment";
import { makeArray } from "discourse/lib/helpers";
@@ -30,7 +30,6 @@ export default class PostCookedHtml extends Component {
@service appEvents;
@service currentUser;
- @tracked highlighted = false;
#pendingDecoratorCleanup = [];
#decoratorState = this.args.decoratorState || new TrackedMap();
@@ -44,7 +43,7 @@ export default class PostCookedHtml extends Component {
}
@bind
- decorateBeforeAdopt(element, helper) {
+ decorateBeforeAdopt(element, helper, args) {
this.#cleanupDecorations();
[...POST_COOKED_DECORATORS, ...this.extraDecorators].forEach(
@@ -70,7 +69,7 @@ export default class PostCookedHtml extends Component {
post: nestedPost,
decoratorState,
streamElement: this.isStreamElement,
- highlightTerm: this.highlightTerm,
+ highlightTerm: args.highlightTerm,
extraDecorators: [
...this.extraDecorators,
...makeArray(extraDecorators),
@@ -87,9 +86,9 @@ export default class PostCookedHtml extends Component {
data: {
post: this.args.post,
cooked: this.cooked,
- highlightTerm: this.highlightTerm,
- isIgnored: this.isIgnored,
- ignoredUsers: this.ignoredUsers,
+ highlightTerm: args.highlightTerm,
+ isIgnored: args.isIgnored,
+ ignoredUsers: args.ignoredUsers,
},
decoratorState,
cooked: this.cooked,
@@ -97,9 +96,9 @@ export default class PostCookedHtml extends Component {
currentUser: this.currentUser,
extraDecorators: this.extraDecorators,
helper,
- highlightTerm: this.highlightTerm,
- ignoredUsers: this.ignoredUsers,
- isIgnored: this.isIgnored,
+ highlightTerm: args.highlightTerm,
+ ignoredUsers: args.ignoredUsers,
+ isIgnored: args.isIgnored,
owner,
post: this.args.post,
renderGlimmer: helper.renderGlimmer,
@@ -187,6 +186,11 @@ export default class PostCookedHtml extends Component {
@className="cooked"
@decorate={{this.decorateBeforeAdopt}}
@decorateAfterAdopt={{this.decorateAfterAdopt}}
+ @decorateArgs={{lazyHash
+ highlightTerm=this.highlightTerm
+ isIgnored=this.isIgnored
+ ignoredUsers=this.ignoredUsers
+ }}
@html={{htmlSafe this.cooked}}
@model={{@post}}
/>
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 db2863384bc..5d41ec31bc5 100644
--- a/app/assets/javascripts/discourse/app/components/post/small-action.gjs
+++ b/app/assets/javascripts/discourse/app/components/post/small-action.gjs
@@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
import { htmlSafe } from "@ember/template";
+import { TrackedMap } from "@ember-compat/tracked-built-ins";
import DButton from "discourse/components/d-button";
import PostCookedHtml from "discourse/components/post/cooked-html";
import UserAvatar from "discourse/components/user-avatar";
@@ -53,6 +54,8 @@ export function resetGroupPostSmallActionCodes() {
}
export default class PostSmallAction extends Component {
+ decoratorState = new TrackedMap();
+
@cached
get CustomComponent() {
return applyValueTransformer("post-small-action-custom-component", null, {
@@ -198,6 +201,8 @@ export default class PostSmallAction extends Component {
<div class="small-action-custom-message">
<PostCookedHtml
@post={{@post}}
+ @decoratorState={{this.decoratorState}}
+ @highlightTerm={{@highlightTerm}}
@streamElement={{@streamElement}}
/>
</div>
diff --git a/app/assets/javascripts/discourse/app/modifiers/post-stream-viewport-tracker.js b/app/assets/javascripts/discourse/app/modifiers/post-stream-viewport-tracker.js
index 27befa9dee6..3a1cb59b4b5 100644
--- a/app/assets/javascripts/discourse/app/modifiers/post-stream-viewport-tracker.js
+++ b/app/assets/javascripts/discourse/app/modifiers/post-stream-viewport-tracker.js
@@ -3,6 +3,7 @@ import { htmlSafe } from "@ember/template";
import { modifier } from "ember-modifier";
import discourseDebounce from "discourse/lib/debounce";
import { bind } from "discourse/lib/decorators";
+import { isTesting } from "discourse/lib/environment";
import DiscourseURL from "discourse/lib/url";
/**
@@ -59,7 +60,9 @@ let cloakingEnabled = true;
/**
* Globally disables the cloaking mechanism for all posts
*
- * USE ONLY FOR TESTING PURPOSES.
+ * @returns {void}
+ * @example
+ * disableCloaking(); // Disables cloaking for testing
*/
export function disableCloaking() {
cloakingEnabled = false;
@@ -75,6 +78,11 @@ const cloakingPrevented = { topicId: null, posts: new Set() };
* the DOM nodes can cause side effects, e.g., a video playing
*
* @param {number} postId - The ID of the post to prevent from cloaking
+ * @param {boolean} [prevent=true] - Whether to prevent cloaking (true) or allow it (false)
+ * @returns {void}
+ * @example
+ * preventCloaking(123, true); // Prevents post 123 from being cloaked
+ * preventCloaking(123, false); // Allows post 123 to be cloaked again
*/
export function preventCloaking(postId, prevent = true) {
if (prevent) {
@@ -86,23 +94,30 @@ export function preventCloaking(postId, prevent = true) {
/**
* A WeakMap storing post models for DOM elements.
- * Maps elements in the post stream to their corresponding post.
- * Uses WeakMap to avoid memory leaks when elements are removed.
+ * Maps elements in the post stream to their corresponding post models.
+ * Uses WeakMap to avoid memory leaks when elements are removed from the DOM.
*
* @type {WeakMap<HTMLElement, Object>}
*/
const elementsToPost = new WeakMap();
+/**
+ * PostStreamViewportTracker manages viewport tracking and cloaking for post streams.
+ * This class provides performance optimization by tracking visible posts and implementing
+ * a cloaking mechanism that replaces off-screen posts with placeholder elements.
+ */
export default class PostStreamViewportTracker {
/**
* Reference to the bottom boundary element used for eyeline calculations
- * @type {HTMLElement}
+ * @type {HTMLElement|null}
+ * @private
*/
#bottomBoundaryElement;
/**
* Distance beyond viewport to keep posts uncloaked (calculated from viewport height)
* @type {number}
+ * @private
*/
#cloakOffset;
@@ -110,36 +125,42 @@ export default class PostStreamViewportTracker {
* Map of post IDs to their styles when cloaked
* Used to maintain correct scroll position when posts are cloaked
* @type {Object<number, {height: number, margin: string}>}
+ * @private
*/
#cloakedPostsStyle = {};
/**
* IntersectionObserver that tracks which posts should be cloaked/uncloaked
- * @type {IntersectionObserver}
+ * @type {IntersectionObserver|null}
+ * @private
*/
#cloakingObserver;
/**
* Callback function to notify when the current post changes
- * @type {Function}
+ * @type {Function|null}
+ * @private
*/
#currentPostChanged;
/**
* Reference to the DOM element of the current post being viewed
- * @type {HTMLElement}
+ * @type {HTMLElement|null}
+ * @private
*/
#currentPostElement;
/**
* Callback function to notify when the scroll position within the current post changes
- * @type {Function}
+ * @type {Function|null}
+ * @private
*/
#currentPostScrolled;
/**
* Debug element used to visualize the eyeline position
- * @type {HTMLElement}
+ * @type {HTMLElement|null}
+ * @private
*/
#eyelineDebugElement;
@@ -147,12 +168,14 @@ export default class PostStreamViewportTracker {
* Offset from the top of the viewport for the site header
* Used in calculations to determine visible posts
* @type {number}
+ * @private
*/
#headerOffset;
/**
* Set of posts' DOM nodes being observed by the intersection observers
* @type {Set<HTMLElement>}
+ * @private
*/
#observedPostElements = new Set();
@@ -160,6 +183,7 @@ export default class PostStreamViewportTracker {
* Map of post numbers to their post models and DOM elements that are currently on screen
* Used to track which posts are visible in the viewport for eyeline calculations and screen tracking
* @type {Object<number, {post: Object, element: HTMLElement}>}
+ * @private
*/
#postsOnScreen = {};
@@ -167,36 +191,42 @@ export default class PostStreamViewportTracker {
* Map to store scheduled/debounced timers for various tracker functions
* Used to track and cancel pending timers when the component is destroyed
* @type {Map<Function, number>}
+ * @private
*/
#scheduledTimers = new Map();
/**
* Reference to the screen track service for tracking post visibility
- * @type {Object}
+ * @type {Object|null}
+ * @private
*/
#screenTrackService;
/**
* Callback function to update the cloaking boundaries in the parent component
- * @type {Function}
+ * @type {Function|null}
+ * @private
*/
#setCloakingBoundaries;
/**
* Set of post numbers that are currently uncloaked (visible or near viewport)
* @type {Set<number>}
+ * @private
*/
#uncloakedPostNumbers = new Set();
/**
* IntersectionObserver that tracks which posts are visible in the viewport
- * @type {IntersectionObserver}
+ * @type {IntersectionObserver|null}
+ * @private
*/
#viewportObserver;
/**
* Reference to the wrapper element containing all posts
- * @type {HTMLElement}
+ * @type {HTMLElement|null}
+ * @private
*/
#wrapperElement;
@@ -209,6 +239,7 @@ export default class PostStreamViewportTracker {
* @param {Array} _ - Modifier positional params (unused)
* @param {Object} trackedArgs - Additional tracked arguments that trigger cleanup when changed
* @returns {Function} Cleanup function that removes the reference when the element is destroyed
+ * @private
*/
#registerBottomBoundary = modifier((element, _, trackedArgs) => {
this.#bottomBoundaryElement = element;
@@ -229,8 +260,9 @@ export default class PostStreamViewportTracker {
*
* @type {Modifier}
* @param {HTMLElement} element - The post element to register
- * @param {Array} [post] - The post model associated with the element
+ * @param {Array} [post] - Array containing the post model associated with the element
* @returns {Function} Cleanup function that removes observers when the element is destroyed
+ * @private
*/
#registerPost = modifier((element, [post]) => {
elementsToPost.set(element, post);
@@ -266,8 +298,10 @@ export default class PostStreamViewportTracker {
* @param {number} options.headerOffset - Offset from top of viewport for site header
* @param {Object} options.screenTrack - Screen tracking service
* @param {Function} options.setCloakingBoundaries - Callback to update cloaking boundaries
+ * @param {number} options.topicId - ID of the current topic
* @param {Object} options.trackedArgs - Additional tracked arguments that trigger cleanup when changed
* @returns {Function} Cleanup function that removes observers, event listeners and clears state
+ * @private
*/
#setup = modifier(
(
@@ -310,8 +344,8 @@ export default class PostStreamViewportTracker {
trackedArgs && Object.values(trackedArgs);
schedule("afterRender", () => {
- // forces updates performed when the scroll is triggered
- this.#scrollTriggered();
+ // forces updates performed when the scroll is triggered to be performed after the initial rendering
+ this.#scrollTriggered(true);
});
// cleanup
@@ -339,6 +373,7 @@ export default class PostStreamViewportTracker {
/**
* Cleans up resources when the tracker is destroyed
* Disconnects intersection observers and clears DOM references
+ * @returns {void}
*/
destroy() {
// cancel scheduled timers
@@ -360,7 +395,7 @@ export default class PostStreamViewportTracker {
/**
* Returns a map of post numbers to their post models and DOM elements that are currently on screen
- * @returns {Object<number, {post: Object, element: HTMLElement}>}
+ * @returns {Object<number, {post: Object, element: HTMLElement}>} Map of visible posts
*/
get postsOnScreen() {
return this.#postsOnScreen;
@@ -368,7 +403,7 @@ export default class PostStreamViewportTracker {
/**
* Returns the modifier for registering the bottom boundary element
- * @returns {Modifier}
+ * @returns {Modifier} The bottom boundary registration modifier
*/
get registerBottomBoundary() {
return this.#registerBottomBoundary;
@@ -376,7 +411,7 @@ export default class PostStreamViewportTracker {
/**
* Returns the modifier for registering post elements
- * @returns {Modifier}
+ * @returns {Modifier} The post registration modifier
*/
get registerPost() {
return this.#registerPost;
@@ -384,7 +419,7 @@ export default class PostStreamViewportTracker {
/**
* Returns the main setup modifier
- * @returns {Modifier}
+ * @returns {Modifier} The setup modifier
*/
get setup() {
return this.#setup;
@@ -437,6 +472,7 @@ export default class PostStreamViewportTracker {
* Updates the cloaking state based on post visibility
*
* @param {IntersectionObserverEntry} entry - The intersection observer entry
+ * @returns {void}
*/
@bind
trackCloakedPosts(entry) {
@@ -496,6 +532,7 @@ export default class PostStreamViewportTracker {
* to update the current post and eyeline position
*
* @param {IntersectionObserverEntry} entry - The intersection observer entry
+ * @returns {void}
*/
@bind
trackVisiblePosts(entry) {
@@ -527,6 +564,7 @@ export default class PostStreamViewportTracker {
/**
* Event handler for scroll events
* Debounces scroll events to avoid performance issues
+ * @returns {void}
*/
@bind
onScroll() {
@@ -541,6 +579,7 @@ export default class PostStreamViewportTracker {
* Debounces resize events and updates cloaking boundaries
*
* @param {Event} event - The resize event
+ * @returns {void}
*/
@bind
onWindowResize(event) {
@@ -555,6 +594,64 @@ export default class PostStreamViewportTracker {
);
}
+ /**
+ * Gets the testing wrapper element for test environment
+ * @private
+ * @returns {HTMLElement} The ember-testing container element
+ */
+ get #testWrapperElement() {
+ return document.getElementById("ember-testing");
+ }
+
+ /**
+ * Gets the total document height, accounting for test environment
+ * @private
+ * @returns {number} The total scrollable height of the document
+ */
+ get #documentHeight() {
+ return isTesting()
+ ? this.#testWrapperElement.scrollHeight
+ : Math.max(
+ document.body.scrollHeight,
+ document.documentElement.scrollHeight
+ );
+ }
+
+ /**
+ * Gets the viewport height, accounting for test environment
+ * @private
+ * @returns {number} The height of the viewport
+ */
+ get #viewportHeight() {
+ return isTesting()
+ ? this.#testWrapperElement.offsetHeight
+ : window.innerHeight;
+ }
+
+ /**
+ * Gets the current scroll position, accounting for test environment
+ * @private
+ * @returns {number} The current vertical scroll position
+ */
+ get #scrollPosition() {
+ return isTesting() ? this.#testWrapperElement.scrollTop : window.scrollY;
+ }
+
+ /**
+ * Gets the top boundary position for post visibility calculations
+ * In production, accounts for header offset if the wrapper element top is less than header offset
+ * @private
+ * @returns {number} The top boundary position in viewport coordinates
+ */
+ get #topBoundary() {
+ return isTesting()
+ ? this.#wrapperElement.getBoundingClientRect().top
+ : Math.max(
+ this.#headerOffset,
+ this.#wrapperElement.getBoundingClientRect().top
+ ) + 1;
+ }
+
/**
* Calculates the position of the "eyeline" - the horizontal line in the viewport
* that determines which post is considered the current post
@@ -563,22 +660,17 @@ export default class PostStreamViewportTracker {
* moves from the top of the viewport (when at the beginning of the topic)
* to the bottom of the viewport (when at the end of the topic)
*
+ * @private
* @returns {number} The vertical offset of the eyeline in viewport coordinates
*/
#calculateEyelineViewportOffset() {
// Get viewport and scroll data
- const viewportHeight = window.innerHeight;
- const scrollPosition = window.scrollY;
- const documentHeight = Math.max(
- document.body.scrollHeight,
- document.documentElement.scrollHeight
- );
+ const viewportHeight = this.#viewportHeight;
+ const scrollPosition = this.#scrollPosition;
+ const documentHeight = this.#documentHeight;
// Calculate boundaries
- const topBoundary = Math.max(
- this.#headerOffset,
- this.#wrapperElement.getBoundingClientRect().top
- );
+ const topBoundary = this.#topBoundary;
const bottomBoundary =
this.#bottomBoundaryElement?.getBoundingClientRect()?.top ??
viewportHeight;
@@ -606,7 +698,9 @@ export default class PostStreamViewportTracker {
/**
* Notifies the parent component that the current post has changed
*
+ * @private
* @param {Object} event - Event data containing the new current post
+ * @returns {void}
*/
#currentPostWasChanged(event) {
this.#currentPostChanged(event);
@@ -616,8 +710,10 @@ export default class PostStreamViewportTracker {
* Notifies the parent component about scroll position changes within the current post
* Only triggers if the element matches the current post element
*
+ * @private
* @param {Object} params - Parameters containing element and scroll data
* @param {HTMLElement} params.element - The post element
+ * @returns {void}
*/
#currentPostWasScrolled({ element, ...event }) {
if (element !== this.#currentPostElement) {
@@ -631,11 +727,24 @@ export default class PostStreamViewportTracker {
* Finds the post that contains the eyeline position and updates the current post
* Also calculates the percentage scrolled within that post
*
+ * @private
* @param {number} eyeLineOffset - The vertical position of the eyeline
+ * @returns {void}
*/
#findPostMatchingEyeline(eyeLineOffset) {
let target, percentScrolled;
- for (const { element } of Object.values(this.#postsOnScreen)) {
+
+ // Get target elements from posts currently visible on screen
+ let targetElements = Object.values(this.#postsOnScreen).map(
+ (post) => post.element
+ );
+
+ // If no posts are visible on screen, fall back to all observed post elements
+ if (!targetElements.length) {
+ targetElements = this.#observedPostElements;
+ }
+
+ for (const element of targetElements) {
const { top, bottom } = element.getBoundingClientRect();
if (eyeLineOffset >= top && eyeLineOffset <= bottom) {
@@ -657,6 +766,7 @@ export default class PostStreamViewportTracker {
/**
* Creates a new IntersectionObserver with the specified callback and options
*
+ * @private
* @param {Function} callback - The function to call when intersection changes
* @param {Object} options - Observer configuration options
* @param {string} options.rootMargin - Margin around the root element
@@ -679,6 +789,8 @@ export default class PostStreamViewportTracker {
* Creates two observers:
* 1. cloakingObserver - tracks which posts should be cloaked/uncloaked
* 2. viewportObserver - tracks which posts are visible in the viewport
+ * @private
+ * @returns {void}
*/
#resetViewportObservers() {
this.#cloakingObserver?.disconnect();
@@ -710,7 +822,9 @@ export default class PostStreamViewportTracker {
* Sets up or removes event listeners for scroll and resize events
* Also handles page show events for back-forward cache
*
- * @param {boolean} addListeners - Whether to add (true) or remove (false) listeners
+ * @private
+ * @param {boolean} [addListeners=true] - Whether to add (true) or remove (false) listeners
+ * @returns {void}
*/
#setupEventListeners(addListeners = true) {
if (!addListeners) {
@@ -741,7 +855,9 @@ export default class PostStreamViewportTracker {
* Creates or removes the debug element that visualizes the eyeline position
* Only active when DEBUG_EYELINE is true
*
- * @param {boolean} addElement - Whether to add (true) or remove (false) the debug element
+ * @private
+ * @param {boolean} [addElement=true] - Whether to add (true) or remove (false) the debug element
+ * @returns {void}
*/
#setupEyelineDebugElement(addElement = true) {
if (DEBUG_EYELINE) {
@@ -758,22 +874,34 @@ export default class PostStreamViewportTracker {
}
/**
- * Handles scroll events by calculating the new eyeline position
- * and finding the post that matches that position
- * Also updates the debug element if enabled
+ * Handles scroll events by calculating the new eyeline position and finding the post that matches that position.
+ * The eyeline position determines which post is considered current based on the scroll position.
+ *
+ * When called, this method:
+ * 1. Calculates the current eyeline position in the viewport
+ * 2. Updates post tracking to find the current visible post at that position
+ * 3. Updates the debug visual element if DEBUG_EYELINE is enabled
+ *
+ * @private
+ * @param {boolean} [immediate=false] - If true, processes the eyeline updates synchronously instead of debounced
+ * @returns {void}
*/
- #scrollTriggered() {
+ #scrollTriggered(immediate = false) {
const eyelineOffset = this.#calculateEyelineViewportOffset();
- this.#scheduledTimers.set(
- this.#findPostMatchingEyeline,
- discourseDebounce(
- this,
+ if (immediate) {
+ this.#findPostMatchingEyeline(eyelineOffset);
+ } else {
+ this.#scheduledTimers.set(
this.#findPostMatchingEyeline,
- eyelineOffset,
- SCROLL_BATCH_INTERVAL_MS
- )
- );
+ discourseDebounce(
+ this,
+ this.#findPostMatchingEyeline,
+ eyelineOffset,
+ SCROLL_BATCH_INTERVAL_MS
+ )
+ );
+ }
if (DEBUG_EYELINE) {
this.#updateEyelineDebugElementPosition(eyelineOffset);
@@ -784,6 +912,8 @@ export default class PostStreamViewportTracker {
* Updates the cloaking boundaries based on which posts are currently uncloaked
* Finds the minimum and maximum post numbers that should remain uncloaked
* and notifies the parent component
+ * @private
+ * @returns {void}
*/
#updateCloakBoundaries() {
const uncloakedPostNumbers = Array.from(this.#uncloakedPostNumbers);
@@ -804,10 +934,11 @@ export default class PostStreamViewportTracker {
* Updates the cloak offset based on the current viewport height
* The cloak offset determines how far beyond the viewport posts remain uncloaked
*
+ * @private
* @returns {boolean} Whether the offset was changed
*/
#updateCloakOffset() {
- const newOffset = Math.ceil(window.innerHeight * SLACK_FACTOR);
+ const newOffset = Math.ceil(this.#viewportHeight * SLACK_FACTOR);
if (newOffset === this.#cloakOffset) {
return false;
@@ -821,7 +952,9 @@ export default class PostStreamViewportTracker {
* Updates the current post element reference and notifies the parent component
* if the post model has changed
*
+ * @private
* @param {HTMLElement} newElement - The new post element to set as current
+ * @returns {void}
*/
#updateCurrentPost(newElement) {
if (this.#currentPostElement === newElement) {
@@ -842,6 +975,8 @@ export default class PostStreamViewportTracker {
/**
* Updates the screen tracking service with the list of posts currently on screen
* Separates posts into all visible posts and read posts
+ * @private
+ * @returns {void}
*/
#updateScreenTracking() {
const onScreenPostsNumbers = [];
@@ -861,6 +996,8 @@ export default class PostStreamViewportTracker {
/**
* Handles window resize events by updating the cloak offset
* and resetting the viewport observers if needed
+ * @private
+ * @returns {void}
*/
#windowResizeTriggered() {
if (this.#updateCloakOffset()) {
@@ -872,7 +1009,9 @@ export default class PostStreamViewportTracker {
* Updates the position of the eyeline debug element
* Only used when DEBUG_EYELINE is true
*
+ * @private
* @param {number} viewportOffset - The vertical position for the eyeline
+ * @returns {void}
*/
#updateEyelineDebugElementPosition(viewportOffset) {
if (this.#eyelineDebugElement) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js
index d544fa3f349..92eee2add2e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js
@@ -111,7 +111,7 @@ acceptance("Search - Full Page", function (needs) {
assert.dom(".no-results-suggestion").exists();
assert.dom(".google-search-form").exists();
- await fillIn(".search-query", "discourse");
+ await fillIn(".search-query", "consectetur");
await click(".search-cta");
assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
@@ -120,7 +120,7 @@ acceptance("Search - Full Page", function (needs) {
test("search for personal messages", async function (assert) {
await visit("/search");
- await fillIn(".search-query", "discourse in:messages");
+ await fillIn(".search-query", "consectetur in:messages");
await click(".search-cta");
assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
@@ -538,11 +538,11 @@ acceptance("Search - Full Page", function (needs) {
test("adds visited class to visited topics", async function (assert) {
await visit("/search");
- await fillIn(".search-query", "discourse");
+ await fillIn(".search-query", "consectetur");
await click(".search-cta");
assert.dom(".visited").doesNotExist();
- await fillIn(".search-query", "discourse visited");
+ await fillIn(".search-query", "consectetur visited");
await click(".search-cta");
assert.dom(".visited").exists({ count: 1 });
});
@@ -550,7 +550,7 @@ acceptance("Search - Full Page", function (needs) {
test("result link click tracking is invoked", async function (assert) {
await visit("/search");
- await fillIn(".search-query", "discourse");
+ await fillIn(".search-query", "consectetur");
await click(".search-cta");
await click("a.search-link:first-child");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js
index a2595176d77..ef803350099 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js
@@ -24,7 +24,7 @@ acceptance("Search - Mobile", function (needs) {
.dom(".advanced-filters[open]")
.exists("it should expand advanced search filters");
- await fillIn(".search-query", "discourse");
+ await fillIn(".search-query", "consectetur");
await click(".search-cta");
assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
@@ -38,7 +38,7 @@ acceptance("Search - Mobile", function (needs) {
assert
.dom("input.full-page-search")
.hasValue(
- "discourse",
+ "consectetur",
"does not reset input when hitting search icon again"
);
});
diff --git a/app/assets/javascripts/discourse/tests/fixtures/search-fixtures.js b/app/assets/javascripts/discourse/tests/fixtures/search-fixtures.js
index 5e5d95c4c8d..c9e9a59a286 100644
--- a/app/assets/javascripts/discourse/tests/fixtures/search-fixtures.js
+++ b/app/assets/javascripts/discourse/tests/fixtures/search-fixtures.js
@@ -8,8 +8,7 @@ export default {
avatar_template: "/letter_avatar_proxy/v4/letter/s/bcef8e/{size}.png",
created_at: "2020-12-22T05:50:15.898Z",
like_count: 0,
- blurb:
- "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 find here? Why should they come here? Where can they read more (links, resources, ...",
+ blurb: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum...",
post_number: 1,
topic_id: 130,
},
@@ -17,28 +16,27 @@ export default {
topics: [
{
id: 130,
- title: "Welcome to Discourse",
- fancy_title: "Welcome to Discourse",
- slug: "welcome-to-discourse",
- posts_count: 1,
- reply_count: 0,
- highest_post_number: 1,
- created_at: "2020-12-22T05:50:15.837Z",
- last_posted_at: "2020-12-22T05:50:15.898Z",
+ archetype: "private_message",
+ archived: false,
+ bookmarked: false,
bumped: true,
bumped_at: "2020-12-22T05:50:15.898Z",
- archetype: "regular",
- unseen: false,
- pinned: true,
+ category_id: null,
+ closed: false,
+ created_at: "2020-07-05T09:28:36.260Z",
+ excerpt: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum",
+ fancy_title: "Lorem ipsum dolor sit amet",
+ highest_post_number: 1,
+ last_posted_at: "2020-07-05T09:28:36.371Z",
+ liked: false,
+ pinned: false,
+ posts_count: 1,
+ reply_count: 0,
+ slug: "lorem-ipsum-dolor-sit-amet",
+ title: "Lorem ipsum dolor sit amet",
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! \nEdit this into a brief description of your community: \n\nWho is it for?\nWhat can they fi&hellip;",
+ unseen: false,
visible: true,
- closed: false,
- archived: false,
- bookmarked: null,
- liked: null,
- category_id: 1,
},
],
users: [],
@@ -48,7 +46,7 @@ export default {
more_posts: null,
more_users: null,
more_categories: null,
- term: "discourse",
+ term: "consectetur",
search_log_id: 2,
more_full_page_results: null,
can_create_topic: false,
@@ -160,7 +158,7 @@ export default {
uploaded_avatar_id: 3281,
created_at: "2014-04-12T22:22:07.930Z",
cooked:
- '<p>So you want to set up Discourse on Ubuntu to hack on and develop with?</p>\n\n<p>We\'ll assume that you don\'t have Ruby/Rails/Postgre/Redis installed on your Ubuntu system. Let\'s begin!</p>\n\n<p><em>Although this guide assumes that you are using Ubuntu, but the set-up instructions will work fine for any Debian based distribution.</em></p>\n\n<p><em>(If you want to install Discourse for production use, see <a href="https://github.com/discourse/discourse/blob/main/docs/INSTALL.md">our install guide</a>)</em></p>\n\n<h2>Install Discourse Dependencies</h2>\n\n<p>Run <a href="https://github.com/techAPJ/install-rails/blob/master/linux">this script</a> in terminal, to setup Rails development environment:</p>\n\n<pre><code>bash &lt;(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/9/9df737ab44032f2f671ac15513456bc668314591.png" class="lightbox" title="linux_script.png"><img src="//cdn.example.com/optimized/2X/9/9df737ab44032f2f671ac15513456bc668314591_1_690x189.png" width="690" height="189"><div class="meta">\n<span class="filename">linux_script.png</span><span class="informations">770x211 9.62 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>This will install following new packages on your system:</p>\n\n<ul>\n<li><a href="http://git-scm.com/">Git</a></li>\n<li><a href="https://github.com/sstephenson/rbenv">rbenv</a></li>\n<li><a href="https://github.com/sstephenson/ruby-build">ruby-build</a></li>\n<li>\n<a href="https://www.ruby-lang.org/">Ruby</a> (stable)</li>\n<li><a href="http://rubyonrails.org/">Rails</a></li>\n<li><a href="http://www.postgresql.org/">PostgreSQL</a></li>\n<li><a href="https://sqlite.org/">SQLite</a></li>\n<li><a href="http://redis.io/">Redis</a></li>\n<li><a href="http://bundler.io/">Bundler</a></li>\n<li><a href="http://www.imagemagick.org/">ImageMagick</a></li>\n</ul>\n\n<p>Install Phantomjs:</p>\n\n<p>For 32 bit machine:</p>\n\n<pre><code>cd /usr/local/share\nsudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-i686.tar.bz2\nsudo tar xvf phantomjs-1.9.8-linux-i686.tar.bz2\nsudo rm phantomjs-1.9.8-linux-i686.tar.bz2\nsudo ln -s /usr/local/share/phantomjs-1.9.8-linux-i686/bin/phantomjs /usr/local/bin/phantomjs\ncd</code></pre>\n\n<p>For 64 bit machine:</p>\n\n<pre><code>cd /usr/local/share\nsudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo tar xvf phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo rm phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo ln -s /usr/local/share/phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs\ncd</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/0/0781669e092e0bdc29f8ec1830193503e884fd56.png" class="lightbox" title="phantomjs.png"><img src="//cdn.example.com/optimized/2X/0/0781669e092e0bdc29f8ec1830193503e884fd56_1_690x121.png" width="690" height="121"><div class="meta">\n<span class="filename">phantomjs.png</span><span class="informations">969x171 10.1 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p><em>In case you have any of this package pre-installed and don\'t want to run entire script, see the <a href="https://github.com/techAPJ/install-rails/blob/master/linux">script</a> and pick the packages you don\'t have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.</em></p>\n\n<p>Now that we have installed Discourse dependencies, let\'s move on to install Discourse itself.</p>\n\n<h2>Clone Discourse</h2>\n\n<p>Clone the Discourse repository in <code>~/discourse</code> folder:</p>\n\n<pre><code>git clone https://github.com/discourse/discourse.git ~/discourse</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/2/23578e144aa4c37d7e577d570d34789add1078f1.png" class="lightbox" title="git_clone.png"><img src="//cdn.example.com/optimized/2X/2/23578e144aa4c37d7e577d570d34789add1078f1_1_690x97.png" width="690" height="97"><div class="meta">\n<span class="filename">git_clone.png</span><span class="informations">967x137 7.73 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<h2>Setup Database</h2>\n\n<p>Open psql prompt as postgre user</p>\n\n<pre><code>sudo -u postgres psql postgres</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/1/1cb9e5198b2695904204c2b1434427b610468610.png" class="lightbox" title="pg.png"><img src="//cdn.example.com/optimized/2X/1/1cb9e5198b2695904204c2b1434427b610468610_1_690x177.png" width="690" height="177"><div class="meta">\n<span class="filename">pg.png</span><span class="informations">725x187 5.79 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Create role <strong>with the same name as your ubuntu system username</strong> with <em>discourse</em> as password:</p>\n\n<pre><code>CREATE ROLE discourse WITH LOGIN ENCRYPTED PASSWORD \'discourse\' CREATEDB SUPERUSER;</code></pre>\n\n<p>In the above command, I named the role as <strong>discourse</strong>, this means that my ubuntu system username is <strong>discourse</strong>. (<em>It is necessary for role name to be same as system username, otherwise migrations will not run</em>)</p>\n\n<p>Check that you have successfully created <strong>discourse</strong> role:</p>\n\n<pre><code>\\du</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/6/60439a04daa4efc8756a9528873cffb61c327bee.png" class="lightbox" title="pg_user.png"><img src="//cdn.example.com/optimized/2X/6/60439a04daa4efc8756a9528873cffb61c327bee_1_690x176.png" width="690" height="176"><div class="meta">\n<span class="filename">pg_user.png</span><span class="informations">725x185 7.5 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Create <strong>discourse_development</strong> and <strong>discourse_test</strong> database:</p>\n\n<pre><code>CREATE DATABASE discourse_development WITH OWNER discourse ENCODING \'UTF8\' TEMPLATE template0;\nCREATE DATABASE discourse_test WITH OWNER discourse ENCODING \'UTF8\' TEMPLATE template0;</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/1/183b46c7f1ffaa024e7c99884fbcc022da2c91b4.png" class="lightbox" title="pg_db.png"><img src="//cdn.example.com/optimized/2X/1/183b46c7f1ffaa024e7c99884fbcc022da2c91b4_1_690x136.png" width="690" height="136"><div class="meta">\n<span class="filename">pg_db.png</span><span class="informations">724x143 6.82 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_development</strong> database as <strong>discourse</strong> user:</p>\n\n<pre><code>psql -d discourse_development -U discourse -h localhost</code></pre>\n\n<p>When prompted for password, provide the password which you set at the time of creating role, if you followed the guide as is, the password is <strong>discourse</strong></p>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/0/04f4c1e4b3dd8ea1d183f653a77d35baca8c1201.png" class="lightbox" title="pg_dev.png"><img src="//cdn.example.com/optimized/2X/0/04f4c1e4b3dd8ea1d183f653a77d35baca8c1201_1_690x300.png" width="690" height="300"><div class="meta">\n<span class="filename">pg_dev.png</span><span class="informations">726x316 13.4 KB</span><span class="expand"></span>\n</div></a></div></p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_test</strong> database as <strong>discourse</strong> user:</p>\n\n<pre><code>psql -d discourse_test -U discourse -h localhost</code></pre>\n\n<p>When prompted for password, provide the password which you set at the time of creating role, if you followed the guide as is, the password is <strong>discourse</strong></p>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/d/d2a25de9f227831bf66107ab2ddc1a7abafca2f4.png" class="lightbox" title="pg_test.png"><img src="//cdn.example.com/optimized/2X/d/d2a25de9f227831bf66107ab2ddc1a7abafca2f4_1_690x302.png" width="690" height="302"><div class="meta">\n<span class="filename">pg_test.png</span><span class="informations">726x318 12.9 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>You have set-up the database successfully!</p>\n\n<h2>Bootstrap Discourse</h2>\n\n<p>Switch to your Discourse folder:</p>\n\n<pre><code>cd ~/discourse</code></pre>\n\n<p>Install the needed gems</p>\n\n<pre><code>bundle install</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/e/e1e8390c232c20f6b532c80927cec07185a8e556.png" class="lightbox" title="bundle.png"><img src="//cdn.example.com/optimized/2X/e/e1e8390c232c20f6b532c80927cec07185a8e556_1_690x236.png" width="690" height="236"><div class="meta">\n<span class="filename">bundle.png</span><span class="informations">724x248 9.75 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Now that you have successfully configured database connection, run this command:</p>\n\n<pre><code>bundle exec rake db:migrate db:test:prepare db:seed_fu</code></pre>\n\n<p>Now, try running the specs: </p>\n\n<pre><code>bundle exec rake autospec</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/8/8a645e90108980cea7fa06a524ecbf1558e142f1.png" class="lightbox" title="specs.png"><img src="//cdn.example.com/optimized/2X/8/8a645e90108980cea7fa06a524ecbf1558e142f1_1_690x253.png" width="690" height="253"><div class="meta">\n<span class="filename">specs.png</span><span class="informations">717x263 8.63 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Start rails server:</p>\n\n<pre><code>bundle exec rails server</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/a/a8e7892e23bbfe3e613ebc6062605989de83310c.png" class="lightbox" title="server.png"><img src="//cdn.example.com/optimized/2X/a/a8e7892e23bbfe3e613ebc6062605989de83310c_1_690x218.png" width="690" height="218"><div class="meta">\n<span class="filename">server.png</span><span class="informations">724x229 10.8 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>You should now be able to connect to discourse app on <a href="http://localhost:3000">http://localhost:3000</a> - try it out!</p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/3/3f2fbcd03c5a30b08c51155130418085da77744e.png" class="lightbox" title="discourse_start.png"><img src="//cdn.example.com/optimized/2X/3/3f2fbcd03c5a30b08c51155130418085da77744e_1_690x188.png" width="690" height="188"><div class="meta">\n<span class="filename">discourse_start.png</span><span class="informations">1919x525 20.3 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<h2>Configure Mail and Create New Account</h2>\n\n<p>We will use <a href="http://mailcatcher.me/">MailCatcher</a> to serve emails in development environment. Install and run MailCatcher:</p>\n\n<pre><code>gem install mailcatcher\nmailcatcher --http-ip 0.0.0.0</code></pre>\n\n<p>Create new account:</p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/3X/1/d/1d2e710b0865e78868c74d6cc54f96d1e2eb9303.png" class="lightbox" title="create_account.png"><img src="//cdn.example.com/optimized/3X/1/d/1d2e710b0865e78868c74d6cc54f96d1e2eb9303_1_690x384.png" width="690" height="384"><div class="meta">\n<span class="filename">create_account.png</span><span class="informations">720x401 13.5 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Check confirmation email by going to MailCatcher web interface at <a href="http://localhost:1080/">http://localhost:1080/</a></p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/3X/2/9/292a2cb247b37770cf4506f8745fdc39753e547e.png" class="lightbox" title="mc_sign_up_email.png"><img src="//cdn.example.com/optimized/3X/2/9/292a2cb247b37770cf4506f8745fdc39753e547e_1_690x172.png" width="690" height="172"><div class="meta">\n<span class="filename">mc_sign_up_email.png</span><span class="informations">1919x480 21.5 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p><em>If you did not receive the email, try running this in console</em>: <code>bundle exec sidekiq -q default</code></p>\n\n<p>Click the confirmation link and your account will be activated!</p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png" class="lightbox" title="disc_normal_acc.png"><img src="//cdn.example.com/optimized/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9_1_690x154.png" width="690" height="154"><div class="meta">\n<span class="filename">disc_normal_acc.png</span><span class="informations">1919x430 21.8 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<h2>Access Admin</h2>\n\n<p>Now, to make your account as admin, run the following commands in rails console:</p>\n\n<pre><code>RAILS_ENV=development bundle exec rails c\nu = User.last\nu.admin = true\nu.save</code></pre>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/a/aa5478bc48ef8fef622e09e7948abb8ad8218000.png" class="lightbox" title="admin_console.png"><img src="//cdn.example.com/optimized/2X/a/aa5478bc48ef8fef622e09e7948abb8ad8218000_1_690x441.png" width="690" height="441"><div class="meta">\n<span class="filename">admin_console.png</span><span class="informations">722x462 31.7 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Once you execute the above commands successfully, check out your Discourse account again:</p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/7/72840ed4dbbc02544471649ee4eaa272fde205ef.png" class="lightbox" title="admin_success.png"><img src="//cdn.example.com/optimized/2X/7/72840ed4dbbc02544471649ee4eaa272fde205ef_1_690x371.png" width="690" height="371"><div class="meta">\n<span class="filename">admin_success.png</span><span class="informations">1919x1032 30.3 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Congratulations! You are now the admin of your own Discourse installation!</p>\n\n<p>Happy hacking!</p>\n\n<p>If anything needs to be improved in this guide, feel free to ask on <a href="https://meta.discourse.org/t/developers-guide-to-install-discourse-on-ubuntu/14727">meta.discourse.org</a>, or even better, submit a <a href="https://github.com/techAPJ/discourse-development-ubuntu">pull request</a>.</p>',
+ "<p>So you want to set up Discourse on Ubuntu to hack on and develop with?</p>\n\n<p>We'll assume that you don't have Ruby/Rails/Postgre/Redis installed on your Ubuntu system. Let's begin!</p>\n\n<p><em>Although this guide assumes that you are using Ubuntu, but the set-up instructions will work fine for any Debian based distribution.</em></p>\n\n<p><em>(If you want to install Discourse for production use, see <a href=\"https://github.com/discourse/discourse/blob/main/docs/INSTALL.md\">our install guide</a>)</em></p>\n\n<h2>Install Discourse Dependencies</h2>\n\n<p>Run <a href=\"https://github.com/techAPJ/install-rails/blob/master/linux\">this script</a> in terminal, to setup Rails development environment:</p>\n\n<pre><code>bash &lt;(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/9/9df737ab44032f2f671ac15513456bc668314591.png\" class=\"lightbox\" title=\"linux_script.png\"><img src=\"//cdn.example.com/optimized/2X/9/9df737ab44032f2f671ac15513456bc668314591_1_690x189.png\" width=\"690\" height=\"189\"><div class=\"meta\">\n<span class=\"filename\">linux_script.png</span><span class=\"informations\">770x211 9.62 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>This will install following new packages on your system:</p>\n\n<ul>\n<li><a href=\"http://git-scm.com/\">Git</a></li>\n<li><a href=\"https://github.com/sstephenson/rbenv\">rbenv</a></li>\n<li><a href=\"https://github.com/sstephenson/ruby-build\">ruby-build</a></li>\n<li>\n<a href=\"https://www.ruby-lang.org/\">Ruby</a> (stable)</li>\n<li><a href=\"http://rubyonrails.org/\">Rails</a></li>\n<li><a href=\"http://www.postgresql.org/\">PostgreSQL</a></li>\n<li><a href=\"https://sqlite.org/\">SQLite</a></li>\n<li><a href=\"http://redis.io/\">Redis</a></li>\n<li><a href=\"http://bundler.io/\">Bundler</a></li>\n<li><a href=\"http://www.imagemagick.org/\">ImageMagick</a></li>\n</ul>\n\n<p>Install Phantomjs:</p>\n\n<p>For 32 bit machine:</p>\n\n<pre><code>cd /usr/local/share\nsudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-i686.tar.bz2\nsudo tar xvf phantomjs-1.9.8-linux-i686.tar.bz2\nsudo rm phantomjs-1.9.8-linux-i686.tar.bz2\nsudo ln -s /usr/local/share/phantomjs-1.9.8-linux-i686/bin/phantomjs /usr/local/bin/phantomjs\ncd</code></pre>\n\n<p>For 64 bit machine:</p>\n\n<pre><code>cd /usr/local/share\nsudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo tar xvf phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo rm phantomjs-1.9.8-linux-x86_64.tar.bz2\nsudo ln -s /usr/local/share/phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs\ncd</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/0/0781669e092e0bdc29f8ec1830193503e884fd56.png\" class=\"lightbox\" title=\"phantomjs.png\"><img src=\"//cdn.example.com/optimized/2X/0/0781669e092e0bdc29f8ec1830193503e884fd56_1_690x121.png\" width=\"690\" height=\"121\"><div class=\"meta\">\n<span class=\"filename\">phantomjs.png</span><span class=\"informations\">969x171 10.1 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p><em>In case you have any of this package pre-installed and don't want to run entire script, see the <a href=\"https://github.com/techAPJ/install-rails/blob/master/linux\">script</a> and pick the packages you don't have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.</em></p>\n\n<p>Now that we have installed Discourse dependencies, let's move on to install Discourse itself.</p>\n\n<h2>Clone Discourse</h2>\n\n<p>Clone the Discourse repository in <code>~/discourse</code> folder:</p>\n\n<pre><code>git clone https://github.com/discourse/discourse.git ~/discourse</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/2/23578e144aa4c37d7e577d570d34789add1078f1.png\" class=\"lightbox\" title=\"git_clone.png\"><img src=\"//cdn.example.com/optimized/2X/2/23578e144aa4c37d7e577d570d34789add1078f1_1_690x97.png\" width=\"690\" height=\"97\"><div class=\"meta\">\n<span class=\"filename\">git_clone.png</span><span class=\"informations\">967x137 7.73 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<h2>Setup Database</h2>\n\n<p>Open psql prompt as postgre user</p>\n\n<pre><code>sudo -u postgres psql postgres</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/1/1cb9e5198b2695904204c2b1434427b610468610.png\" class=\"lightbox\" title=\"pg.png\"><img src=\"//cdn.example.com/optimized/2X/1/1cb9e5198b2695904204c2b1434427b610468610_1_690x177.png\" width=\"690\" height=\"177\"><div class=\"meta\">\n<span class=\"filename\">pg.png</span><span class=\"informations\">725x187 5.79 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Create role <strong>with the same name as your ubuntu system username</strong> with <em>discourse</em> as password:</p>\n\n<pre><code>CREATE ROLE discourse WITH LOGIN ENCRYPTED PASSWORD 'discourse' CREATEDB SUPERUSER;</code></pre>\n\n<p>In the above command, I named the role as <strong>discourse</strong>, this means that my ubuntu system username is <strong>discourse</strong>. (<em>It is necessary for role name to be same as system username, otherwise migrations will not run</em>)</p>\n\n<p>Check that you have successfully created <strong>discourse</strong> role:</p>\n\n<pre><code>\\du</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/6/60439a04daa4efc8756a9528873cffb61c327bee.png\" class=\"lightbox\" title=\"pg_user.png\"><img src=\"//cdn.example.com/optimized/2X/6/60439a04daa4efc8756a9528873cffb61c327bee_1_690x176.png\" width=\"690\" height=\"176\"><div class=\"meta\">\n<span class=\"filename\">pg_user.png</span><span class=\"informations\">725x185 7.5 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Create <strong>discourse_development</strong> and <strong>discourse_test</strong> database:</p>\n\n<pre><code>CREATE DATABASE discourse_development WITH OWNER discourse ENCODING 'UTF8' TEMPLATE template0;\nCREATE DATABASE discourse_test WITH OWNER discourse ENCODING 'UTF8' TEMPLATE template0;</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/1/183b46c7f1ffaa024e7c99884fbcc022da2c91b4.png\" class=\"lightbox\" title=\"pg_db.png\"><img src=\"//cdn.example.com/optimized/2X/1/183b46c7f1ffaa024e7c99884fbcc022da2c91b4_1_690x136.png\" width=\"690\" height=\"136\"><div class=\"meta\">\n<span class=\"filename\">pg_db.png</span><span class=\"informations\">724x143 6.82 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_development</strong> database as <strong>discourse</strong> user:</p>\n\n<pre><code>psql -d discourse_development -U discourse -h localhost</code></pre>\n\n<p>When prompted for password, provide the password which you set at the time of creating role, if you followed the guide as is, the password is <strong>discourse</strong></p>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/0/04f4c1e4b3dd8ea1d183f653a77d35baca8c1201.png\" class=\"lightbox\" title=\"pg_dev.png\"><img src=\"//cdn.example.com/optimized/2X/0/04f4c1e4b3dd8ea1d183f653a77d35baca8c1201_1_690x300.png\" width=\"690\" height=\"300\"><div class=\"meta\">\n<span class=\"filename\">pg_dev.png</span><span class=\"informations\">726x316 13.4 KB</span><span class=\"expand\"></span>\n</div></a></div></p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_test</strong> database as <strong>discourse</strong> user:</p>\n\n<pre><code>psql -d discourse_test -U discourse -h localhost</code></pre>\n\n<p>When prompted for password, provide the password which you set at the time of creating role, if you followed the guide as is, the password is <strong>discourse</strong></p>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/d/d2a25de9f227831bf66107ab2ddc1a7abafca2f4.png\" class=\"lightbox\" title=\"pg_test.png\"><img src=\"//cdn.example.com/optimized/2X/d/d2a25de9f227831bf66107ab2ddc1a7abafca2f4_1_690x302.png\" width=\"690\" height=\"302\"><div class=\"meta\">\n<span class=\"filename\">pg_test.png</span><span class=\"informations\">726x318 12.9 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Exit psql prompt by pressing <kbd>ctrl</kbd><kbd>d</kbd></p>\n\n<p>You have set-up the database successfully!</p>\n\n<h2>Bootstrap Discourse</h2>\n\n<p>Switch to your Discourse folder:</p>\n\n<pre><code>cd ~/discourse</code></pre>\n\n<p>Install the needed gems</p>\n\n<pre><code>bundle install</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/e/e1e8390c232c20f6b532c80927cec07185a8e556.png\" class=\"lightbox\" title=\"bundle.png\"><img src=\"//cdn.example.com/optimized/2X/e/e1e8390c232c20f6b532c80927cec07185a8e556_1_690x236.png\" width=\"690\" height=\"236\"><div class=\"meta\">\n<span class=\"filename\">bundle.png</span><span class=\"informations\">724x248 9.75 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Now that you have successfully configured database connection, run this command:</p>\n\n<pre><code>bundle exec rake db:migrate db:test:prepare db:seed_fu</code></pre>\n\n<p>Now, try running the specs: </p>\n\n<pre><code>bundle exec rake autospec</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/8/8a645e90108980cea7fa06a524ecbf1558e142f1.png\" class=\"lightbox\" title=\"specs.png\"><img src=\"//cdn.example.com/optimized/2X/8/8a645e90108980cea7fa06a524ecbf1558e142f1_1_690x253.png\" width=\"690\" height=\"253\"><div class=\"meta\">\n<span class=\"filename\">specs.png</span><span class=\"informations\">717x263 8.63 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Start rails server:</p>\n\n<pre><code>bundle exec rails server</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/a/a8e7892e23bbfe3e613ebc6062605989de83310c.png\" class=\"lightbox\" title=\"server.png\"><img src=\"//cdn.example.com/optimized/2X/a/a8e7892e23bbfe3e613ebc6062605989de83310c_1_690x218.png\" width=\"690\" height=\"218\"><div class=\"meta\">\n<span class=\"filename\">server.png</span><span class=\"informations\">724x229 10.8 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>You should now be able to connect to discourse app on <a href=\"http://localhost:3000\">http://localhost:3000</a> - try it out!</p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/3/3f2fbcd03c5a30b08c51155130418085da77744e.png\" class=\"lightbox\" title=\"discourse_start.png\"><img src=\"//cdn.example.com/optimized/2X/3/3f2fbcd03c5a30b08c51155130418085da77744e_1_690x188.png\" width=\"690\" height=\"188\"><div class=\"meta\">\n<span class=\"filename\">discourse_start.png</span><span class=\"informations\">1919x525 20.3 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<h2>Configure Mail and Create New Account</h2>\n\n<p>We will use <a href=\"http://mailcatcher.me/\">MailCatcher</a> to serve emails in development environment. Install and run MailCatcher:</p>\n\n<pre><code>gem install mailcatcher\nmailcatcher --http-ip 0.0.0.0</code></pre>\n\n<p>Create new account:</p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/3X/1/d/1d2e710b0865e78868c74d6cc54f96d1e2eb9303.png\" class=\"lightbox\" title=\"create_account.png\"><img src=\"//cdn.example.com/optimized/3X/1/d/1d2e710b0865e78868c74d6cc54f96d1e2eb9303_1_690x384.png\" width=\"690\" height=\"384\"><div class=\"meta\">\n<span class=\"filename\">create_account.png</span><span class=\"informations\">720x401 13.5 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Check confirmation email by going to MailCatcher web interface at <a href=\"http://localhost:1080/\">http://localhost:1080/</a></p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/3X/2/9/292a2cb247b37770cf4506f8745fdc39753e547e.png\" class=\"lightbox\" title=\"mc_sign_up_email.png\"><img src=\"//cdn.example.com/optimized/3X/2/9/292a2cb247b37770cf4506f8745fdc39753e547e_1_690x172.png\" width=\"690\" height=\"172\"><div class=\"meta\">\n<span class=\"filename\">mc_sign_up_email.png</span><span class=\"informations\">1919x480 21.5 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p><em>If you did not receive the email, try running this in console</em>: <code>bundle exec sidekiq -q default</code></p>\n\n<p>Click the confirmation link and your account will be activated!</p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png\" class=\"lightbox\" title=\"disc_normal_acc.png\"><img src=\"//cdn.example.com/optimized/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9_1_690x154.png\" width=\"690\" height=\"154\"><div class=\"meta\">\n<span class=\"filename\">disc_normal_acc.png</span><span class=\"informations\">1919x430 21.8 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<h2>Access Admin</h2>\n\n<p>Now, to make your account as admin, run the following commands in rails console:</p>\n\n<pre><code>RAILS_ENV=development bundle exec rails c\nu = User.last\nu.admin = true\nu.save</code></pre>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/a/aa5478bc48ef8fef622e09e7948abb8ad8218000.png\" class=\"lightbox\" title=\"admin_console.png\"><img src=\"//cdn.example.com/optimized/2X/a/aa5478bc48ef8fef622e09e7948abb8ad8218000_1_690x441.png\" width=\"690\" height=\"441\"><div class=\"meta\">\n<span class=\"filename\">admin_console.png</span><span class=\"informations\">722x462 31.7 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Once you execute the above commands successfully, check out your Discourse account again:</p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/7/72840ed4dbbc02544471649ee4eaa272fde205ef.png\" class=\"lightbox\" title=\"admin_success.png\"><img src=\"//cdn.example.com/optimized/2X/7/72840ed4dbbc02544471649ee4eaa272fde205ef_1_690x371.png\" width=\"690\" height=\"371\"><div class=\"meta\">\n<span class=\"filename\">admin_success.png</span><span class=\"informations\">1919x1032 30.3 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Congratulations! You are now the admin of your own Discourse installation!</p>\n\n<p>Happy hacking!</p>\n\n<p>If anything needs to be improved in this guide, feel free to ask on <a href=\"https://meta.discourse.org/t/developers-guide-to-install-discourse-on-ubuntu/14727\">meta.discourse.org</a>, or even better, submit a <a href=\"https://github.com/techAPJ/discourse-development-ubuntu\">pull request</a>.</p>",
post_number: 1,
post_type: 1,
updated_at: "2015-06-22T17:24:20.607Z",
@@ -250,7 +248,7 @@ export default {
uploaded_avatar_id: 3281,
created_at: "2014-05-19T16:59:51.082Z",
cooked:
- '<p>So you want to set up Discourse on Mac OS X to hack on and develop with?</p>\n\n<p>We\'ll assume that you don\'t have Ruby/Rails/Postgre/Redis installed on your Mac. Let\'s begin!</p>\n\n<p><em>(If you want to install Discourse for production use, see <a href="https://github.com/discourse/discourse/blob/main/docs/INSTALL.md">our install guide</a>)</em></p>\n\n<h2>Install Discourse Dependencies</h2>\n\n<p>Run <a href="https://github.com/techAPJ/install-rails/blob/master/mac">this script</a> in terminal, to setup Rails development environment:</p>\n\n<pre><code>bash &lt;(curl -s https://raw.githubusercontent.com/techAPJ/install-rails/master/mac)</code></pre>\n\n<p>This script will install following new packages on your system:</p>\n\n<ul>\n<li><a href="http://git-scm.com/">Git</a></li>\n<li><a href="https://github.com/sstephenson/rbenv">rbenv</a></li>\n<li><a href="https://github.com/sstephenson/ruby-build">ruby-build</a></li>\n<li>\n<a href="https://www.ruby-lang.org/">Ruby</a> (latest stable)</li>\n<li><a href="http://rubyonrails.org/">Rails</a></li>\n<li><a href="http://www.postgresql.org/">PostgreSQL</a></li>\n<li><a href="http://redis.io/">Redis</a></li>\n<li><a href="http://bundler.io/">Bundler</a></li>\n<li><a href="http://www.imagemagick.org/">ImageMagick</a></li>\n<li><a href="http://phantomjs.org/">PhantomJS</a></li>\n</ul>\n\n<p><em>In case you have any of this package pre-installed and don\'t want to run entire script, see the <a href="https://github.com/techAPJ/install-rails/blob/master/mac">script</a> and pick the packages you don\'t have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.</em></p>\n\n<p>Now that we have installed Discourse dependencies, let\'s move on to install Discourse itself.</p>\n\n<h2>Clone Discourse</h2>\n\n<p>Clone the Discourse repository in <code>~/discourse</code> folder:</p>\n\n<pre><code>git clone https://github.com/discourse/discourse.git ~/discourse</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/e/ed047a1077c7d3af966434d093fbf9ddd3db51d9.png" width="571" height="142"> </p>\n\n<p><code>~</code> indicates home folder, so Discourse source code will be available in your home folder.</p>\n\n<h2>Setup Database</h2>\n\n<p>Open psql prompt:</p>\n\n<pre><code>psql postgres</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/0/0a31b7a439991beedf32a974abd423cd7a774b76.png" width="574" height="148"> </p>\n\n<p>Create <strong>discourse_development</strong> and <strong>discourse_test</strong> database with your <em><a href="http://forums.macrumors.com/showthread.php?t=898855">account short name</a></em> specified as role:</p>\n\n<pre><code>CREATE DATABASE discourse_development WITH OWNER techapj ENCODING \'UTF8\' TEMPLATE template0;\nCREATE DATABASE discourse_test WITH OWNER techapj ENCODING \'UTF8\' TEMPLATE template0;</code></pre>\n\n<p>Note that in above commands I specified the role as <em>techapj</em>, this means that my <a href="http://forums.macrumors.com/showthread.php?t=898855">short name</a> is <em>techapj</em>, <strong>replace this with your own <a href="http://forums.macrumors.com/showthread.php?t=898855">short name</a>.</strong></p>\n\n<p><img src="//cdn.example.com/original/2X/9/9e976ace87a952fe60879c522234082fd7166eaf.png" width="573" height="235"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_development</strong> database as <em>your short name</em> user:</p>\n\n<pre><code>psql -d discourse_development -U techapj -h localhost</code></pre>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/9/9bfda41f4f5b020735cd641a4922e0696ad148a0.png" width="571" height="208"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_test</strong> database as <em>your short name</em> user:</p>\n\n<pre><code>psql -d discourse_test -U techapj -h localhost</code></pre>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/3/319b2a9f4b63cf8daf1ce3a4060f2465b6717a7f.png" width="571" height="205"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>You have set-up the database successfully!</p>\n\n<h2>Bootstrap Discourse</h2>\n\n<p>Switch to your Discourse folder:</p>\n\n<pre><code>cd ~/discourse</code></pre>\n\n<p>Install the needed gems</p>\n\n<pre><code>bundle install</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/e/eaabecd382ed7241e7f30c9bd20239140b5fd384.png" width="572" height="366"> </p>\n\n<p>Now that you have successfully installed gems, run this command:</p>\n\n<pre><code>bundle exec rake db:migrate db:test:prepare db:seed_fu</code></pre>\n\n<p>Try running the specs: </p>\n\n<pre><code>bundle exec rake autospec</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/4/4b1414710dd77e46e0add0e78168d392f5a81e2c.png" width="574" height="429"> </p>\n\n<p>All the tests should pass.</p>\n\n<p>Start rails server:</p>\n\n<pre><code>bundle exec rails server</code></pre>\n\n<p><img src="//cdn.example.com/original/2X/0/00584d579d543960d53a36512a2ba4f649204ad4.png" width="575" height="279"> </p>\n\n<p>You should now be able to connect with your Discourse app on <a href="http://localhost:3000">http://localhost:3000</a> - try it out!</p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/6/6325a4d6da2ec891eb8a58dede2b501447050287.png" class="lightbox" title="Screen Shot 2014-05-19 at 13.04.01.png"><img src="//cdn.example.com/optimized/2X/6/6325a4d6da2ec891eb8a58dede2b501447050287_1_690x253.png" width="690" height="253"><div class="meta">\n<span class="filename">Screen Shot 2014-05-19 at 13.04.01.png</span><span class="informations">1255x461 98.7 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<h2>Create New Admin</h2>\n\n<p>To create a new admin, run the following commands in rails console:</p>\n\n<pre><code>RAILS_ENV=development bundle exec rake admin:create</code></pre>\n\n<p>Just enter your input as suggested, you can create an admin account. </p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png" class="lightbox" title="fccdb29463e82f23.png"><img src="//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png" width="690" height="154"><div class="meta">\n<span class="filename">fccdb29463e82f23.png</span><span class="informations">1919x430</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p><div class="lightbox-wrapper"><a href="//cdn.example.com/original/2X/9/982a9ffe0223aebb8df7fd9efbd07dbedef78c0a.png" class="lightbox" title="Screen Shot 2014-05-19 at 13.20.02.png"><img src="//cdn.example.com/optimized/2X/9/982a9ffe0223aebb8df7fd9efbd07dbedef78c0a_1_690x415.png" width="690" height="415"><div class="meta">\n<span class="filename">Screen Shot 2014-05-19 at 13.20.02.png</span><span class="informations">1256x756 124 KB</span><span class="expand"></span>\n</div></a></div> </p>\n\n<p>Happy hacking!</p>',
+ "<p>So you want to set up Discourse on Mac OS X to hack on and develop with?</p>\n\n<p>We'll assume that you don't have Ruby/Rails/Postgre/Redis installed on your Mac. Let's begin!</p>\n\n<p><em>(If you want to install Discourse for production use, see <a href=\"https://github.com/discourse/discourse/blob/main/docs/INSTALL.md\">our install guide</a>)</em></p>\n\n<h2>Install Discourse Dependencies</h2>\n\n<p>Run <a href=\"https://github.com/techAPJ/install-rails/blob/master/mac\">this script</a> in terminal, to setup Rails development environment:</p>\n\n<pre><code>bash &lt;(curl -s https://raw.githubusercontent.com/techAPJ/install-rails/master/mac)</code></pre>\n\n<p>This script will install following new packages on your system:</p>\n\n<ul>\n<li><a href=\"http://git-scm.com/\">Git</a></li>\n<li><a href=\"https://github.com/sstephenson/rbenv\">rbenv</a></li>\n<li><a href=\"https://github.com/sstephenson/ruby-build\">ruby-build</a></li>\n<li>\n<a href=\"https://www.ruby-lang.org/\">Ruby</a> (latest stable)</li>\n<li><a href=\"http://rubyonrails.org/\">Rails</a></li>\n<li><a href=\"http://www.postgresql.org/\">PostgreSQL</a></li>\n<li><a href=\"http://redis.io/\">Redis</a></li>\n<li><a href=\"http://bundler.io/\">Bundler</a></li>\n<li><a href=\"http://www.imagemagick.org/\">ImageMagick</a></li>\n<li><a href=\"http://phantomjs.org/\">PhantomJS</a></li>\n</ul>\n\n<p><em>In case you have any of this package pre-installed and don't want to run entire script, see the <a href=\"https://github.com/techAPJ/install-rails/blob/master/mac\">script</a> and pick the packages you don't have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.</em></p>\n\n<p>Now that we have installed Discourse dependencies, let's move on to install Discourse itself.</p>\n\n<h2>Clone Discourse</h2>\n\n<p>Clone the Discourse repository in <code>~/discourse</code> folder:</p>\n\n<pre><code>git clone https://github.com/discourse/discourse.git ~/discourse</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/e/ed047a1077c7d3af966434d093fbf9ddd3db51d9.png\" width=\"571\" height=\"142\"> </p>\n\n<p><code>~</code> indicates home folder, so Discourse source code will be available in your home folder.</p>\n\n<h2>Setup Database</h2>\n\n<p>Open psql prompt:</p>\n\n<pre><code>psql postgres</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/0/0a31b7a439991beedf32a974abd423cd7a774b76.png\" width=\"574\" height=\"148\"> </p>\n\n<p>Create <strong>discourse_development</strong> and <strong>discourse_test</strong> database with your <em><a href=\"http://forums.macrumors.com/showthread.php?t=898855\">account short name</a></em> specified as role:</p>\n\n<pre><code>CREATE DATABASE discourse_development WITH OWNER techapj ENCODING 'UTF8' TEMPLATE template0;\nCREATE DATABASE discourse_test WITH OWNER techapj ENCODING 'UTF8' TEMPLATE template0;</code></pre>\n\n<p>Note that in above commands I specified the role as <em>techapj</em>, this means that my <a href=\"http://forums.macrumors.com/showthread.php?t=898855\">short name</a> is <em>techapj</em>, <strong>replace this with your own <a href=\"http://forums.macrumors.com/showthread.php?t=898855\">short name</a>.</strong></p>\n\n<p><img src=\"//cdn.example.com/original/2X/9/9e976ace87a952fe60879c522234082fd7166eaf.png\" width=\"573\" height=\"235\"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_development</strong> database as <em>your short name</em> user:</p>\n\n<pre><code>psql -d discourse_development -U techapj -h localhost</code></pre>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/9/9bfda41f4f5b020735cd641a4922e0696ad148a0.png\" width=\"571\" height=\"208\"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>Now access psql prompt in <strong>discourse_test</strong> database as <em>your short name</em> user:</p>\n\n<pre><code>psql -d discourse_test -U techapj -h localhost</code></pre>\n\n<p>Run following commands, separately:</p>\n\n<pre><code>CREATE EXTENSION pg_trgm;\nCREATE EXTENSION hstore;</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/3/319b2a9f4b63cf8daf1ce3a4060f2465b6717a7f.png\" width=\"571\" height=\"205\"> </p>\n\n<p>Exit psql prompt by pressing <kbd>control</kbd><kbd>d</kbd></p>\n\n<p>You have set-up the database successfully!</p>\n\n<h2>Bootstrap Discourse</h2>\n\n<p>Switch to your Discourse folder:</p>\n\n<pre><code>cd ~/discourse</code></pre>\n\n<p>Install the needed gems</p>\n\n<pre><code>bundle install</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/e/eaabecd382ed7241e7f30c9bd20239140b5fd384.png\" width=\"572\" height=\"366\"> </p>\n\n<p>Now that you have successfully installed gems, run this command:</p>\n\n<pre><code>bundle exec rake db:migrate db:test:prepare db:seed_fu</code></pre>\n\n<p>Try running the specs: </p>\n\n<pre><code>bundle exec rake autospec</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/4/4b1414710dd77e46e0add0e78168d392f5a81e2c.png\" width=\"574\" height=\"429\"> </p>\n\n<p>All the tests should pass.</p>\n\n<p>Start rails server:</p>\n\n<pre><code>bundle exec rails server</code></pre>\n\n<p><img src=\"//cdn.example.com/original/2X/0/00584d579d543960d53a36512a2ba4f649204ad4.png\" width=\"575\" height=\"279\"> </p>\n\n<p>You should now be able to connect with your Discourse app on <a href=\"http://localhost:3000\">http://localhost:3000</a> - try it out!</p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/6/6325a4d6da2ec891eb8a58dede2b501447050287.png\" class=\"lightbox\" title=\"Screen Shot 2014-05-19 at 13.04.01.png\"><img src=\"//cdn.example.com/optimized/2X/6/6325a4d6da2ec891eb8a58dede2b501447050287_1_690x253.png\" width=\"690\" height=\"253\"><div class=\"meta\">\n<span class=\"filename\">Screen Shot 2014-05-19 at 13.04.01.png</span><span class=\"informations\">1255x461 98.7 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<h2>Create New Admin</h2>\n\n<p>To create a new admin, run the following commands in rails console:</p>\n\n<pre><code>RAILS_ENV=development bundle exec rake admin:create</code></pre>\n\n<p>Just enter your input as suggested, you can create an admin account. </p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png\" class=\"lightbox\" title=\"fccdb29463e82f23.png\"><img src=\"//cdn.example.com/original/2X/8/8fc06df9b084b4535bcafaaef675799d6ad3e5c9.png\" width=\"690\" height=\"154\"><div class=\"meta\">\n<span class=\"filename\">fccdb29463e82f23.png</span><span class=\"informations\">1919x430</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p><div class=\"lightbox-wrapper\"><a href=\"//cdn.example.com/original/2X/9/982a9ffe0223aebb8df7fd9efbd07dbedef78c0a.png\" class=\"lightbox\" title=\"Screen Shot 2014-05-19 at 13.20.02.png\"><img src=\"//cdn.example.com/optimized/2X/9/982a9ffe0223aebb8df7fd9efbd07dbedef78c0a_1_690x415.png\" width=\"690\" height=\"415\"><div class=\"meta\">\n<span class=\"filename\">Screen Shot 2014-05-19 at 13.20.02.png</span><span class=\"informations\">1256x756 124 KB</span><span class=\"expand\"></span>\n</div></a></div> </p>\n\n<p>Happy hacking!</p>",
post_number: 1,
post_type: 1,
updated_at: "2015-04-26T06:51:23.549Z",
@@ -340,7 +338,7 @@ export default {
uploaded_avatar_id: null,
created_at: "2014-01-24T15:08:06.111Z",
cooked:
- '<p>Continuing the discussion from <a href="https://meta.discourse.org/t/log-of-setting-up-docker-in-virtualbox/12111/7">Log of setting up Docker in Virtualbox</a>:</p>\n\n<aside class="quote" data-post="7" data-topic="12111" data-full="true"><div class="title">\n<div class="quote-controls"></div>\n<img alt="" width="20" height="20" src="//discourse-cdn.global.ssl.fastly.net/meta/user_avatar/meta.discourse.org/riking/40/40212_1.png" class="avatar">riking:</div>\n<blockquote><p>I\'m actually loving having the VM set up - whenever I need to test something, the server was savestated with it running, so all I need to do is go to <code>/admin/docker</code>, refresh once, hit upgrade, and test it out.</p></blockquote></aside>\n\n<p>What is the preferred development environment these days? I have Vagrant up and running as recommended in <a href="http://blog.discourse.org/2013/04/discourse-as-your-first-rails-app/" rel="nofollow">Discourse as Your First Rails App</a> and <a href="https://github.com/discourse/discourse/blob/main/docs/VAGRANT.md" rel="nofollow">Discourse Vagrant Developer Guide</a>, but much of the recent discussion has been about <a href="https://github.com/discourse/discourse_docker" rel="nofollow">Discourse Docker</a> (which I freely admit I haven\'t really looked at for lack of time).</p>\n\n<p>For development purposes, should I carry on using Vagrant for the time being? Or should I be setting up a VM with Ubuntu and then installing Docker and Discourse Docker?</p>\n\n<p>(As a related side issue, my current production environment was built by following the <a href="https://github.com/discourse/discourse/blob/main/docs/INSTALL-ubuntu.md" rel="nofollow">Discourse Install Guide</a>. Would it be prudent to switch that over to Docker at some point as well? Meaning, is version 1.0 likely to recommend Docker instead of a raw installation? This question deserves a topic of its own in some other category, but it seems best to see what people have to say about development environments before launching a second, better-informed discussion about production environments.)</p>\n\n<p>So, for development, Vagrant or Docker?</p>',
+ "<p>Continuing the discussion from <a href=\"https://meta.discourse.org/t/log-of-setting-up-docker-in-virtualbox/12111/7\">Log of setting up Docker in Virtualbox</a>:</p>\n\n<aside class=\"quote\" data-post=\"7\" data-topic=\"12111\" data-full=\"true\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"20\" height=\"20\" src=\"//discourse-cdn.global.ssl.fastly.net/meta/user_avatar/meta.discourse.org/riking/40/40212_1.png\" class=\"avatar\">riking:</div>\n<blockquote><p>I'm actually loving having the VM set up - whenever I need to test something, the server was savestated with it running, so all I need to do is go to <code>/admin/docker</code>, refresh once, hit upgrade, and test it out.</p></blockquote></aside>\n\n<p>What is the preferred development environment these days? I have Vagrant up and running as recommended in <a href=\"http://blog.discourse.org/2013/04/discourse-as-your-first-rails-app/\" rel=\"nofollow\">Discourse as Your First Rails App</a> and <a href=\"https://github.com/discourse/discourse/blob/main/docs/VAGRANT.md\" rel=\"nofollow\">Discourse Vagrant Developer Guide</a>, but much of the recent discussion has been about <a href=\"https://github.com/discourse/discourse_docker\" rel=\"nofollow\">Discourse Docker</a> (which I freely admit I haven't really looked at for lack of time).</p>\n\n<p>For development purposes, should I carry on using Vagrant for the time being? Or should I be setting up a VM with Ubuntu and then installing Docker and Discourse Docker?</p>\n\n<p>(As a related side issue, my current production environment was built by following the <a href=\"https://github.com/discourse/discourse/blob/main/docs/INSTALL-ubuntu.md\" rel=\"nofollow\">Discourse Install Guide</a>. Would it be prudent to switch that over to Docker at some point as well? Meaning, is version 1.0 likely to recommend Docker instead of a raw installation? This question deserves a topic of its own in some other category, but it seems best to see what people have to say about development environments before launching a second, better-informed discussion about production environments.)</p>\n\n<p>So, for development, Vagrant or Docker?</p>",
post_number: 1,
post_type: 1,
updated_at: "2014-01-24T15:08:06.111Z",
diff --git a/app/assets/javascripts/discourse/tests/fixtures/topic.js b/app/assets/javascripts/discourse/tests/fixtures/topic.js
index e0ce9c068e1..441e162c2c3 100644
--- a/app/assets/javascripts/discourse/tests/fixtures/topic.js
+++ b/app/assets/javascripts/discourse/tests/fixtures/topic.js
@@ -3,40 +3,7 @@ export default {
post_stream: {
posts: [
{
- id: 133,
- name: null,
- username: "bianca",
- avatar_template: "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
- created_at: "2020-07-05T09:28:36.371Z",
- cooked:
- "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum. Nunc euismod, metus non vulputate malesuada, ligula metus pharetra tortor, vel sodales arcu lacus sed mauris. Nam semper, orci vitae fringilla placerat, dui tellus convallis felis, ultricies laoreet sapien mi et metus. Mauris facilisis, mi fermentum rhoncus feugiat, dolor est vehicula leo, id porta leo ex non enim. In a ligula vel tellus commodo scelerisque non in ex. Pellentesque semper leo quam, nec varius est viverra eget. Donec vehicula sem et massa faucibus tempus.</p>",
- post_number: 1,
- post_type: 1,
- updated_at: "2020-07-05T09:28:36.371Z",
- 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: 130,
- topic_slug: "lorem-ipsum-dolor-sit-amet",
- display_username: null,
- primary_group_name: null,
- flair_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,
- read: true,
- user_title: "Tester",
- title_is_group: false,
+ admin: true,
actions_summary: [
{
id: 3,
@@ -55,63 +22,112 @@ export default {
can_act: true,
},
],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- trust_level: 0,
+ avatar_template: "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
+ can_delete: false,
+ can_edit: true,
+ can_recover: false,
+ can_view_edit_history: true,
+ can_wiki: true,
+ cooked: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum. Nunc euismod, metus non vulputate malesuada, ligula metus pharetra tortor, vel sodales arcu lacus sed mauris. Nam semper, orci vitae fringilla placerat, dui tellus convallis felis, ultricies laoreet sapien mi et metus. Mauris facilisis, mi fermentum rhoncus feugiat, dolor est vehicula leo, id porta leo ex non enim. In a ligula vel tellus commodo scelerisque non in ex. Pellentesque semper leo quam, nec varius est viverra eget. Donec vehicula sem et massa faucibus tempus.</p>",
+ created_at: "2020-07-05T09:28:36.371Z",
deleted_at: null,
- user_deleted: false,
+ display_username: null,
edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
+ flair_bg_color: null,
+ flair_color: null,
+ flair_name: null,
+ flair_url: null,
+ hidden: false,
+ id: 133,
+ incoming_link_count: 0,
+ moderator: false,
+ name: null,
+ post_number: 1,
+ post_type: 1,
+ primary_group_name: null,
+ quote_count: 0,
+ read: true,
+ readers_count: 0,
+ reads: 1,
+ reply_count: 0,
+ reply_to_post_number: null,
reviewable_id: 0,
reviewable_score_count: 0,
reviewable_score_pending_count: 0,
+ score: 0,
+ staff: true,
+ title_is_group: false,
+ topic_id: 130,
+ topic_slug: "lorem-ipsum-dolor-sit-amet",
+ trust_level: 0,
+ updated_at: "2020-07-05T09:28:36.371Z",
+ user_deleted: false,
+ user_id: 1,
+ user_title: "Tester",
+ username: "bianca",
+ version: 1,
+ wiki: false,
+ yours: true,
},
],
stream: [133],
},
- timeline_lookup: [[1, 0]],
- related_messages: [],
- suggested_topics: [],
- id: 130,
- title: "Lorem ipsum dolor sit amet",
- fancy_title: "Lorem ipsum dolor sit amet",
- posts_count: 1,
- created_at: "2020-07-05T09:28:36.260Z",
- views: 1,
- reply_count: 0,
- like_count: 0,
- last_posted_at: "2020-07-05T09:28:36.371Z",
- visible: true,
- closed: false,
- archived: false,
- has_summary: false,
archetype: "private_message",
- slug: "lorem-ipsum-dolor-sit-amet",
+ archived: false,
+ bookmarked: false,
+ bookmarks: [],
+ bumped: true,
+ bumped_at: "2020-12-22T05:50:15.898Z",
category_id: null,
- word_count: 86,
+ chunk_size: 20,
+ closed: false,
+ created_at: "2020-07-05T09:28:36.260Z",
+ current_post_number: 1,
deleted_at: null,
- user_id: 1,
- featured_link: null,
- pinned_globally: false,
- pinned_at: null,
- pinned_until: null,
- image_url: null,
+ deleted_by: null,
draft: null,
draft_key: "topic_130",
draft_sequence: 0,
- posted: true,
- unpinned: null,
- pinned: false,
- current_post_number: 1,
+ excerpt: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum",
+ fancy_title: "Lorem ipsum dolor sit amet",
+ featured_link: null,
+ has_deleted: false,
+ has_summary: false,
highest_post_number: 1,
- last_read_post_number: 1,
+ id: 130,
+ image_url: null,
+ last_posted_at: "2020-07-05T09:28:36.371Z",
last_read_post_id: 133,
- deleted_by: null,
- has_deleted: false,
+ last_read_post_number: 1,
+ like_count: 0,
+ liked: false,
+ message_archived: false,
+ message_bus_last_id: 5,
+ participant_count: 1,
+ pinned: false,
+ pinned_at: null,
+ pinned_globally: false,
+ pinned_until: null,
+ pm_with_non_human_user: false,
+ posted: true,
+ posts_count: 1,
+ related_messages: [],
+ reply_count: 0,
+ requested_group_name: null,
+ show_read_indicator: false,
+ slug: "lorem-ipsum-dolor-sit-amet",
+ suggested_topics: [],
+ tags_disable_ads: false,
+ thumbnails: null,
+ timeline_lookup: [[1, 0]],
+ title: "Lorem ipsum dolor sit amet",
+ topic_timer: null,
+ unpinned: null,
+ unseen: false,
+ user_id: 1,
+ views: 1,
+ visible: true,
+ word_count: 86,
actions_summary: [
{
id: 4,
@@ -132,18 +148,6 @@ export default {
can_act: true,
},
],
- chunk_size: 20,
- bookmarked: false,
- bookmarks: [],
- message_archived: false,
- topic_timer: null,
- message_bus_last_id: 5,
- participant_count: 1,
- pm_with_non_human_user: false,
- show_read_indicator: false,
- requested_group_name: null,
- thumbnails: null,
- tags_disable_ads: false,
details: {
notification_level: 3,
notifications_reason_id: 1,
@@ -373,7 +377,7 @@ export default {
uploaded_avatar_id: 40181,
created_at: "2013-02-05T21:32:47.649Z",
cooked:
- '<p>The application strings <a href="https://github.com/discourse/discourse/blob/main/config/locales/en.yml" rel="nofollow">are externalized</a>, so localization should be entirely possible with enough translation effort.</p><p>Link for unknown-test: <a href="/c/category-does-not-exist/99999" data-for-test="category-404">link</a></p>',
+ "<p>The application strings <a href=\"https://github.com/discourse/discourse/blob/main/config/locales/en.yml\" rel=\"nofollow\">are externalized</a>, so localization should be entirely possible with enough translation effort.</p><p>Link for unknown-test: <a href=\"/c/category-does-not-exist/99999\" data-for-test=\"category-404\">link</a></p>",
post_number: 2,
post_type: 1,
updated_at: "2013-02-06T10:15:27.965Z",
@@ -468,7 +472,7 @@ export default {
uploaded_avatar_id: 5297,
created_at: "2013-02-06T02:26:24.922Z",
cooked:
- '<p>Yep, all strings are going through a lookup table.*</p>\n\n<p><a href="https://github.com/discourse/discourse/blob/main/config/locales">master/config/locales</a></p>\n\n<p>So you could replace that lookup table with the "de" one to get German.</p>\n\n<p><sub>* we didn\'t get all the strings into the lookup table for launch, but the vast, vast majority of them are and the ones that are not, we will fix as we go!</sub></p>',
+ "<p>Yep, all strings are going through a lookup table.*</p>\n\n<p><a href=\"https://github.com/discourse/discourse/blob/main/config/locales\">master/config/locales</a></p>\n\n<p>So you could replace that lookup table with the \"de\" one to get German.</p>\n\n<p><sub>* we didn't get all the strings into the lookup table for launch, but the vast, vast majority of them are and the ones that are not, we will fix as we go!</sub></p>",
post_number: 3,
post_type: 1,
updated_at: "2014-02-24T05:23:39.211Z",
@@ -572,7 +576,7 @@ export default {
uploaded_avatar_id: 8306,
created_at: "2013-02-07T12:55:33.129Z",
cooked:
- '<p>Is it a coincidence that the strings file is 1337 lines long? <img src="/images/emoji/twitter/smiley.png" title=":smiley:" class="emoji" alt="smiley" width="64" height="64"></p>',
+ "<p>Is it a coincidence that the strings file is 1337 lines long? <img src=\"/images/emoji/twitter/smiley.png\" title=\":smiley:\" class=\"emoji\" alt=\"smiley\" width=\"64\" height=\"64\"></p>",
post_number: 4,
post_type: 1,
updated_at: "2013-02-07T12:55:33.129Z",
@@ -667,9 +671,9 @@ export default {
avatar_template: "/images/avatar.png",
uploaded_avatar_id: 5253,
created_at: "2013-02-07T14:02:07.869Z",
- mentioned_users: [{id: 19, username: "eviltrout"}],
+ mentioned_users: [{ id: 19, username: "eviltrout" }],
cooked:
- '<p><aside class="quote" data-post="3" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/codinghorror/40/5297.png" class="avatar">codinghorror said:</div>\n<blockquote><p>So you could replace that lookup table with the "de" one to get German.</p></blockquote></aside></p>\n\n<p>The problem I see here is that this file is likely two grow and change massively over the next couple months, and tracking these changes in order to keep a localized file up to date is going to be a <em>bitch</em>. </p>\n\n<p>I wonder where there is a tool that can compare two yml structures and point out which nodes are missing? That would help keep track of new strings.</p>\n\n<p>Re keeping track of <em>changed</em> strings, <a class="mention" href="/u/eviltrout">@eviltrout</a> I found this very interesting: <a href="http://stackoverflow.com/questions/4232922/why-do-people-use-plain-english-as-translation-placeholders" rel="nofollow">http://stackoverflow.com/questions/4232922/why-do-people-use-plain-english-as-translation-placeholders</a> if plain English placeholders were used, any change in strings would lead to a <em>new</em> node in the yml file, making keeping the translation up to date easier. Maybe worth thinking about in the future.</p>',
+ "<p><aside class=\"quote\" data-post=\"3\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/codinghorror/40/5297.png\" class=\"avatar\">codinghorror said:</div>\n<blockquote><p>So you could replace that lookup table with the \"de\" one to get German.</p></blockquote></aside></p>\n\n<p>The problem I see here is that this file is likely two grow and change massively over the next couple months, and tracking these changes in order to keep a localized file up to date is going to be a <em>bitch</em>. </p>\n\n<p>I wonder where there is a tool that can compare two yml structures and point out which nodes are missing? That would help keep track of new strings.</p>\n\n<p>Re keeping track of <em>changed</em> strings, <a class=\"mention\" href=\"/u/eviltrout\">@eviltrout</a> I found this very interesting: <a href=\"http://stackoverflow.com/questions/4232922/why-do-people-use-plain-english-as-translation-placeholders\" rel=\"nofollow\">http://stackoverflow.com/questions/4232922/why-do-people-use-plain-english-as-translation-placeholders</a> if plain English placeholders were used, any change in strings would lead to a <em>new</em> node in the yml file, making keeping the translation up to date easier. Maybe worth thinking about in the future.</p>",
post_number: 5,
post_type: 1,
updated_at: "2013-02-07T14:05:42.328Z",
@@ -766,7 +770,7 @@ export default {
uploaded_avatar_id: 5243,
created_at: "2013-02-07T14:05:39.910Z",
cooked:
- '<p>Yes, I really like the concept of fuzzy matching for localization, perhaps you can chase up <a href="https://github.com/SlexAxton">alex sexton</a> he was meaning to upload a localization tool for this kind of stuff. </p>\n\n<p>Also, I am a big fan of <a href="https://github.com/SlexAxton/messageformat.js">ICU message format</a>, but it is not the "Rails way (tm)". </p>',
+ "<p>Yes, I really like the concept of fuzzy matching for localization, perhaps you can chase up <a href=\"https://github.com/SlexAxton\">alex sexton</a> he was meaning to upload a localization tool for this kind of stuff. </p>\n\n<p>Also, I am a big fan of <a href=\"https://github.com/SlexAxton/messageformat.js\">ICU message format</a>, but it is not the \"Rails way (tm)\". </p>",
post_number: 6,
post_type: 1,
updated_at: "2013-02-07T14:05:39.910Z",
@@ -874,7 +878,7 @@ export default {
uploaded_avatar_id: 5253,
created_at: "2013-02-07T14:08:17.493Z",
cooked:
- '<aside class="quote" data-post="5" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/sam/40/5243.png" class="avatar">pekka said:</div>\n<blockquote><p>The problem I see here</p></blockquote></aside><p>Looks interesting, I\'ll take a peek.</p>\n\n<p>As said on dev, the best tool I can see in terms of giving translators a proper interface <em>and</em> quality control would be something like <a href="http://translate.wordpress.org/projects/bbpress/dev" rel="nofollow">GlotPress</a>. It\'s based on the PO messages format (is that somehow related to ICU?) but looks pretty great.</p>\n\n<p><aside class="quote" data-post="6" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/sam/40/5243.png" class="avatar">sam said:</div>\n<blockquote><p>fuzzy matching for localization</p></blockquote></aside></p>\n\n<p>I\'m not familiar with the term in this context, you mean keeping the English version in the code base (instead of a generic code like <code>message_error_nametooshort</code> ?)</p>',
+ "<aside class=\"quote\" data-post=\"5\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/sam/40/5243.png\" class=\"avatar\">pekka said:</div>\n<blockquote><p>The problem I see here</p></blockquote></aside><p>Looks interesting, I'll take a peek.</p>\n\n<p>As said on dev, the best tool I can see in terms of giving translators a proper interface <em>and</em> quality control would be something like <a href=\"http://translate.wordpress.org/projects/bbpress/dev\" rel=\"nofollow\">GlotPress</a>. It's based on the PO messages format (is that somehow related to ICU?) but looks pretty great.</p>\n\n<p><aside class=\"quote\" data-post=\"6\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/sam/40/5243.png\" class=\"avatar\">sam said:</div>\n<blockquote><p>fuzzy matching for localization</p></blockquote></aside></p>\n\n<p>I'm not familiar with the term in this context, you mean keeping the English version in the code base (instead of a generic code like <code>message_error_nametooshort</code> ?)</p>",
post_number: 7,
post_type: 1,
updated_at: "2013-02-07T14:12:02.965Z",
@@ -1071,7 +1075,7 @@ export default {
uploaded_avatar_id: 5253,
created_at: "2013-02-07T14:14:12.666Z",
cooked:
- '<aside class="quote no-group" data-post="3" data-topic="62">\n<div class="title">\n<div class="quote-controls"></div>\n<img alt="" width="20" height="20" src="/user_avatar/meta.discourse.org/sam/40/5243.png" class="avatar"><a href="/t/a-new-topic-with-a-link-to-another-topic/62/3">A new topic with a link to another topic</a>\n</div>\n<blockquote>\n<p>Thanks for posting this</p>\n</blockquote>\n</aside>\n<p>repost after a reload thank you!</p>',
+ "<aside class=\"quote no-group\" data-post=\"3\" data-topic=\"62\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/sam/40/5243.png\" class=\"avatar\"><a href=\"/t/a-new-topic-with-a-link-to-another-topic/62/3\">A new topic with a link to another topic</a>\n</div>\n<blockquote>\n<p>Thanks for posting this</p>\n</blockquote>\n</aside>\n<p>repost after a reload thank you!</p>",
post_number: 9,
post_type: 1,
updated_at: "2013-02-07T14:18:09.569Z",
@@ -1342,7 +1346,7 @@ export default {
uploaded_avatar_id: 5253,
created_at: "2013-02-07T14:33:38.280Z",
cooked:
- '<p><aside class="quote" data-post="11" data-topic="280" data-full="true"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/sam/40/5243.png" class="avatar">sam said:</div>\n<blockquote><p>Yeah, totally, also we could build tools for dev that make introducing string less annoying and make it possible to garbage collect old unused strings, I hate trudging through that file.</p></blockquote></aside></p>\n\n<p>As said, I\'d look into whether WP\'s tools can\'t be reused for this with some tweaking. They seem to be able to scan a code base for new strings, and make them available automatically to translators.</p>\n\n<p>They\'re PHP based which isn\'t ideal, but it looks like they\'ve done a crapload of work to take the hassle out of translations.</p>',
+ "<p><aside class=\"quote\" data-post=\"11\" data-topic=\"280\" data-full=\"true\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/sam/40/5243.png\" class=\"avatar\">sam said:</div>\n<blockquote><p>Yeah, totally, also we could build tools for dev that make introducing string less annoying and make it possible to garbage collect old unused strings, I hate trudging through that file.</p></blockquote></aside></p>\n\n<p>As said, I'd look into whether WP's tools can't be reused for this with some tweaking. They seem to be able to scan a code base for new strings, and make them available automatically to translators.</p>\n\n<p>They're PHP based which isn't ideal, but it looks like they've done a crapload of work to take the hassle out of translations.</p>",
post_number: 12,
post_type: 1,
updated_at: "2013-02-07T14:34:39.910Z",
@@ -1516,7 +1520,7 @@ export default {
uploaded_avatar_id: 8400,
created_at: "2013-02-07T19:37:06.194Z",
cooked:
- '<p><aside class="quote" data-post="12" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/pekka/40/5253.png" class="avatar">pekka said:</div>\n<blockquote><p>As said, I\'d look into whether WP\'s tools can\'t be reused for this with some tweaking. They seem to be able to scan a code base for new strings, and make them available automatically to translators.</p></blockquote></aside></p>\n\n<p>I\'ve had pretty decent luck using Localeapp to localize Rails applications:</p>\n\n<p><a href="http://www.localeapp.com/" class="onebox" target="_blank" rel="nofollow">http://www.localeapp.com/</a></p>\n\n<p>The developer workflow took me about an hour to really get used to, and there were a few minor glitches. But the non-technical translators had very few problems. One limitation: It insists on rewriting all those yaml files full of strings.</p>\n\n<p>Anyway, it\'s worth a look, and it\'s free for open source, if I recall correctly. Certainly easier than doing a whole bunch of toolsmithing from scratch.</p>',
+ "<p><aside class=\"quote\" data-post=\"12\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/pekka/40/5253.png\" class=\"avatar\">pekka said:</div>\n<blockquote><p>As said, I'd look into whether WP's tools can't be reused for this with some tweaking. They seem to be able to scan a code base for new strings, and make them available automatically to translators.</p></blockquote></aside></p>\n\n<p>I've had pretty decent luck using Localeapp to localize Rails applications:</p>\n\n<p><a href=\"http://www.localeapp.com/\" class=\"onebox\" target=\"_blank\" rel=\"nofollow\">http://www.localeapp.com/</a></p>\n\n<p>The developer workflow took me about an hour to really get used to, and there were a few minor glitches. But the non-technical translators had very few problems. One limitation: It insists on rewriting all those yaml files full of strings.</p>\n\n<p>Anyway, it's worth a look, and it's free for open source, if I recall correctly. Certainly easier than doing a whole bunch of toolsmithing from scratch.</p>",
post_number: 14,
post_type: 1,
updated_at: "2013-02-07T19:37:06.194Z",
@@ -1612,7 +1616,7 @@ export default {
uploaded_avatar_id: 5253,
created_at: "2013-02-07T19:52:13.748Z",
cooked:
- '<p><aside class="quote" data-post="14" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/emk/40/8400.png" class="avatar">emk said:</div>\n<blockquote><p>I\'ve had pretty decent luck using Localeapp to localize Rails applications</p></blockquote></aside></p>\n\n<p>Ohhh. Looking sexy. <em>droool</em></p>',
+ "<p><aside class=\"quote\" data-post=\"14\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/emk/40/8400.png\" class=\"avatar\">emk said:</div>\n<blockquote><p>I've had pretty decent luck using Localeapp to localize Rails applications</p></blockquote></aside></p>\n\n<p>Ohhh. Looking sexy. <em>droool</em></p>",
post_number: 15,
post_type: 1,
updated_at: "2013-02-07T19:52:13.748Z",
@@ -1699,7 +1703,7 @@ export default {
uploaded_avatar_id: 8400,
created_at: "2013-02-07T20:52:22.454Z",
cooked:
- '<p><aside class="quote" data-post="15" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/pekka/40/5253.png" class="avatar">pekka said:</div>\n<blockquote><p>Ohhh. Looking sexy. droool</p></blockquote></aside></p>\n\n<p>Yeah, it\'s pretty. <img src="/images/emoji/twitter/smile.png" title=":smile:" class="emoji" alt="smile" width="64" height="64"> But there were still some rough edges as of a few months ago.</p>\n\n<p>Whether or not those rough edges are a deal-breaker will probably depends on whether or not localization is already a source of acute pain. If you\'re already hurting, Localeapp is a pretty useful tool, especially when it comes to enlisting non-technical translators.</p>\n\n<p>But it does require changing how you work with text, and adding one new tool to the mix. So for projects that just don\'t want to know about non-English languages, it\'s not yet seamless the way Unicode is these days.</p>\n\n<p>(Sweet forum software, by the way. I was just testing out Egyptian hieroglyphics on the test server, because they\'re well off the Basic Multilingual Plane, and tend to flush Unicode bugs. Everything worked flawlessly.)</p>',
+ "<p><aside class=\"quote\" data-post=\"15\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/pekka/40/5253.png\" class=\"avatar\">pekka said:</div>\n<blockquote><p>Ohhh. Looking sexy. droool</p></blockquote></aside></p>\n\n<p>Yeah, it's pretty. <img src=\"/images/emoji/twitter/smile.png\" title=\":smile:\" class=\"emoji\" alt=\"smile\" width=\"64\" height=\"64\"> But there were still some rough edges as of a few months ago.</p>\n\n<p>Whether or not those rough edges are a deal-breaker will probably depends on whether or not localization is already a source of acute pain. If you're already hurting, Localeapp is a pretty useful tool, especially when it comes to enlisting non-technical translators.</p>\n\n<p>But it does require changing how you work with text, and adding one new tool to the mix. So for projects that just don't want to know about non-English languages, it's not yet seamless the way Unicode is these days.</p>\n\n<p>(Sweet forum software, by the way. I was just testing out Egyptian hieroglyphics on the test server, because they're well off the Basic Multilingual Plane, and tend to flush Unicode bugs. Everything worked flawlessly.)</p>",
post_number: 16,
post_type: 1,
updated_at: "2013-02-07T20:52:22.454Z",
@@ -1786,7 +1790,7 @@ export default {
uploaded_avatar_id: 5253,
created_at: "2013-02-07T21:04:15.405Z",
cooked:
- '<p><aside class="quote" data-post="16" data-topic="280"><div class="title">\n<div class="quote-controls"></div>\n<img width="20" height="20" src="/user_avatar/meta.discourse.org/emk/40/8400.png" class="avatar">emk said:</div>\n<blockquote><p>But it does require changing how you work with text, and adding one new tool to the mix. So for projects that just don\'t want to know about non-English languages, it\'s not yet seamless the way Unicode is these days.</p></blockquote></aside></p>\n\n<p>Interesting, thanks for the insight. I don\'t think localization is seriously on their table right now, there\'s likely to be many other things on the table before it... but it will become an issue sooner or later.</p>',
+ "<p><aside class=\"quote\" data-post=\"16\" data-topic=\"280\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/emk/40/8400.png\" class=\"avatar\">emk said:</div>\n<blockquote><p>But it does require changing how you work with text, and adding one new tool to the mix. So for projects that just don't want to know about non-English languages, it's not yet seamless the way Unicode is these days.</p></blockquote></aside></p>\n\n<p>Interesting, thanks for the insight. I don't think localization is seriously on their table right now, there's likely to be many other things on the table before it... but it will become an issue sooner or later.</p>",
post_number: 17,
post_type: 1,
updated_at: "2013-02-07T21:04:15.405Z",
@@ -2057,7 +2061,7 @@ export default {
uploaded_avatar_id: 6552,
created_at: "2013-02-07T21:22:46.376Z",
cooked:
- '<p>If you use gettext format you could leverage <a href="https://translations.launchpad.net/" rel="nofollow">Launchpad</a> translations and the community behind it.</p>',
+ "<p>If you use gettext format you could leverage <a href=\"https://translations.launchpad.net/\" rel=\"nofollow\">Launchpad</a> translations and the community behind it.</p>",
post_number: 20,
post_type: 1,
updated_at: "2013-02-07T21:22:46.376Z",
@@ -3046,7 +3050,7 @@ export default {
{
id: 27346,
title:
- 'Reply+{messagekey}@... optionally in header "from" in addition to "reply-to"',
+ "Reply+{messagekey}@... optionally in header \"from\" in addition to \"reply-to\"",
fancy_title:
"Reply+{messagekey}@&hellip; optionally in header &ldquo;from&rdquo; in addition to &ldquo;reply-to&rdquo;",
slug: "reply-messagekey-optionally-in-header-from-in-addition-to-reply-to",
@@ -3258,7 +3262,7 @@ export default {
avatar_template: "/letter_avatar_proxy/v4/letter/b/3be4f8/{size}.png",
created_at: "2020-07-05T09:28:36.371Z",
cooked:
- '<p><span data-date="2021-09-30" data-time="13:00:00" class="discourse-local-date" data-timezone="America/Lima" data-email-preview="2021-09-30T18:00:00Z UTC">2021-09-30T18:00:00Z</span></p>',
+ "<p><span data-date=\"2021-09-30\" data-time=\"13:00:00\" class=\"discourse-local-date\" data-timezone=\"America/Lima\" data-email-preview=\"2021-09-30T18:00:00Z UTC\">2021-09-30T18:00:00Z</span></p>",
post_number: 1,
post_type: 1,
updated_at: "2020-07-05T09:28:36.371Z",
@@ -3449,7 +3453,7 @@ export default {
uploaded_avatar_id: 40071,
created_at: "2015-05-14T20:18:17.954Z",
cooked:
- '<p>Normally, actions such as Liking are rate-limited, and when you hit the limit, you get a message telling you you\'ve hit the limit. However, in 1.3.0beta9, it seems those popups are no longer appearing.</p>\n\n<p>Edit: Possibly linked to <a href="https://meta.discourse.org/t/post-reply-on-different-topic-no-longer-works/28825?u=raceprouk">this issue</a>?</p>',
+ "<p>Normally, actions such as Liking are rate-limited, and when you hit the limit, you get a message telling you you've hit the limit. However, in 1.3.0beta9, it seems those popups are no longer appearing.</p>\n\n<p>Edit: Possibly linked to <a href=\"https://meta.discourse.org/t/post-reply-on-different-topic-no-longer-works/28825?u=raceprouk\">this issue</a>?</p>",
post_number: 1,
post_type: 1,
updated_at: "2015-05-14T20:21:42.825Z",
@@ -3614,7 +3618,7 @@ export default {
uploaded_avatar_id: 5297,
created_at: "2015-05-14T21:15:41.612Z",
cooked:
- '<p>Yeah maybe another Ember 1.10 regression for <a class="mention" href="/u/eviltrout">@eviltrout</a> ?</p>',
+ "<p>Yeah maybe another Ember 1.10 regression for <a class=\"mention\" href=\"/u/eviltrout\">@eviltrout</a> ?</p>",
post_number: 4,
post_type: 1,
updated_at: "2015-05-14T21:15:41.612Z",
@@ -3666,7 +3670,7 @@ export default {
uploaded_avatar_id: 33015,
created_at: "2015-05-14T21:23:09.562Z",
cooked:
- '<aside class="quote" data-post="3" data-topic="28830" data-full="true"><div class="title">\n<div class="quote-controls"></div>\n<img alt="" width="20" height="20" src="/user_avatar/meta.discourse.org/riking/40/40212.png" class="avatar">riking:</div>\n<blockquote><p>I\'m going to guess that the bootbox library got broken somehow?</p></blockquote></aside>\n\n<p>You mean the popup box library, guessing by the name? Still shows up when you want to cancel a post, so it\'s not <em>all</em> popups it seems.</p>',
+ "<aside class=\"quote\" data-post=\"3\" data-topic=\"28830\" data-full=\"true\"><div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"20\" height=\"20\" src=\"/user_avatar/meta.discourse.org/riking/40/40212.png\" class=\"avatar\">riking:</div>\n<blockquote><p>I'm going to guess that the bootbox library got broken somehow?</p></blockquote></aside>\n\n<p>You mean the popup box library, guessing by the name? Still shows up when you want to cancel a post, so it's not <em>all</em> popups it seems.</p>",
post_number: 5,
post_type: 1,
updated_at: "2015-05-14T21:23:09.562Z",
@@ -4919,7 +4923,7 @@ export default {
uploaded_avatar_id: 9,
created_at: "2015-08-13T14:49:11.840Z",
cooked:
- '<p>This is the first post. <a class="mention-group" href="/g/discourse">@discourse</a></p>',
+ "<p>This is the first post. <a class=\"mention-group\" href=\"/g/discourse\">@discourse</a></p>",
post_number: 1,
post_type: 1,
updated_at: "2015-08-13T14:49:11.840Z",
@@ -5615,7 +5619,7 @@ export default {
avatar_template: "/images/avatar.png",
created_at: "2020-07-24T17:50:17.274Z",
cooked:
- '<aside class="onebox allowlistedgeneric" data-onebox-src="https://example.com/57350945"><header class="source"><a href="https://example.com/57350945" target="_blank" rel="noopener">XYZ News Site</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/388;"><img src="/assets/logo.png" class="thumbnail d-lazyload" width="690" height="388"></div> <h3><a href="https://example.com/57350945" target="_blank" rel="noopener">News Headline</a></h3> <p>Article summary</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>',
+ "<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://example.com/57350945\"><header class=\"source\"><a href=\"https://example.com/57350945\" target=\"_blank\" rel=\"noopener\">XYZ News Site</a> </header> <article class=\"onebox-body\"> <div class=\"aspect-image\" style=\"--aspect-ratio:690/388;\"><img src=\"/assets/logo.png\" class=\"thumbnail d-lazyload\" width=\"690\" height=\"388\"></div> <h3><a href=\"https://example.com/57350945\" target=\"_blank\" rel=\"noopener\">News Headline</a></h3> <p>Article summary</p> </article> <div class=\"onebox-metadata\"> </div> <div style=\"clear: both\"></div> </aside>",
post_number: 3,
post_type: 1,
updated_at: "2020-07-24T17:50:17.274Z",
@@ -5960,7 +5964,7 @@ export default {
avatar_template: "/images/avatar.png",
created_at: "2020-07-24T17:50:17.274Z",
cooked:
- '<aside class="onebox allowlistedgeneric" data-onebox-src="https://example.com/57350945"><header class="source"><a href="https://example.com/57350945" target="_blank" rel="noopener">XYZ News Site</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/388;"><img src="/assets/logo.png" class="thumbnail d-lazyload" width="690" height="388"></div> <h3><a href="https://example.com/57350945" target="_blank" rel="noopener">News Headline</a></h3> <p>Article summary</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>',
+ "<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://example.com/57350945\"><header class=\"source\"><a href=\"https://example.com/57350945\" target=\"_blank\" rel=\"noopener\">XYZ News Site</a> </header> <article class=\"onebox-body\"> <div class=\"aspect-image\" style=\"--aspect-ratio:690/388;\"><img src=\"/assets/logo.png\" class=\"thumbnail d-lazyload\" width=\"690\" height=\"388\"></div> <h3><a href=\"https://example.com/57350945\" target=\"_blank\" rel=\"noopener\">News Headline</a></h3> <p>Article summary</p> </article> <div class=\"onebox-metadata\"> </div> <div style=\"clear: both\"></div> </aside>",
post_number: 3,
post_type: 1,
updated_at: "2020-07-24T17:50:17.274Z",
@@ -6556,7 +6560,7 @@ export default {
uploaded_avatar_id: 40181,
created_at: "2013-02-05T21:32:47.649Z",
cooked:
- '<aside class="quote no-group" data-username="james_john" data-post="2" data-topic="54079"><div class="title" style="cursor: pointer;"><div class="quote-controls"><span class="svg-icon-title" title="expand/collapse"><svg class="fa d-icon d-icon-chevron-down svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#chevron-down"></use></svg></span><a href="/t/hello-world-i-am-posting-an-image/158/1" title="go to the quoted post" class="back"><svg class="fa d-icon d-icon-arrow-up svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#arrow-up"></use></svg></a></div> <img alt="" width="20" height="20" src="/letter_avatar_proxy/v4/letter/j/3be4f8/90.png" class="avatar"> james_john:</div><blockquote><p>This is a short topic.</p></blockquote></aside><p>there is a quote above</p>',
+ "<aside class=\"quote no-group\" data-username=\"james_john\" data-post=\"2\" data-topic=\"54079\"><div class=\"title\" style=\"cursor: pointer;\"><div class=\"quote-controls\"><span class=\"svg-icon-title\" title=\"expand/collapse\"><svg class=\"fa d-icon d-icon-chevron-down svg-icon svg-string\" xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#chevron-down\"></use></svg></span><a href=\"/t/hello-world-i-am-posting-an-image/158/1\" title=\"go to the quoted post\" class=\"back\"><svg class=\"fa d-icon d-icon-arrow-up svg-icon svg-string\" xmlns=\"http://www.w3.org/2000/svg\"><use href=\"#arrow-up\"></use></svg></a></div> <img alt=\"\" width=\"20\" height=\"20\" src=\"/letter_avatar_proxy/v4/letter/j/3be4f8/90.png\" class=\"avatar\"> james_john:</div><blockquote><p>This is a short topic.</p></blockquote></aside><p>there is a quote above</p>",
post_number: 4,
post_type: 1,
updated_at: "2013-02-06T10:15:27.965Z",
@@ -6741,202 +6745,202 @@ export default {
pending_posts: [],
post_stream: {
posts: [
- {
- id: 18,
- username: "eviltrout",
- avatar_template: "/images/avatar.png",
- name: "Evil Trout",
- uploaded_avatar_id: 9,
- created_at: "2015-08-13T14:49:11.840Z",
- cooked:
- '<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n<th>Price</th>\n<th>Drivetrain</th>\n<th>Engine</th>\n<th>Power</th>\n<th>Type</th>\n<th>Seats</th>\n<th>Wheels</th>\n<th>Mileage</th>\n<th>Induction</th>\n<th>Intake</th>\n<th>Ranking</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>1998</td>\n<td>50k</td>\n<td>RWD</td>\n<td>I6</td>\n<td>400HP</td>\n<td>Coupe</td>\n<td>4</td>\n<td>Enkei PF01</td>\n<td>100,000</td>\n<td>Twin Turbo</td>\n<td>Yes</td>\n<td>1</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>Skyline</td>\n<td>1999</td>\n<td>100k</td>\n<td>4WD</td>\n<td>I6</td>\n<td>350HP</td>\n<td>Coupe</td>\n<td>4</td>\n<td>TE37</td>\n<td>80,000</td>\n<td>Single Turbo</td>\n<td>No</td>\n<td>2</td>\n</tr>\n<tr>\n<td>Honda</td>\n<td>S2000</td>\n<td>2001</td>\n<td>30k</td>\n<td>RWD</td>\n<td>I4</td>\n<td>230HP</td>\n<td>Roadster</td>\n<td>2</td>\n<td>RPF1</td>\n<td>110,000</td>\n<td>Naturally Aspirated</td>\n<td>No</td>\n<td>3</td>\n</tr>\n</tbody>\n</table>\n',
- post_number: 1,
- post_type: 1,
- updated_at: "2015-08-13T14:49:11.840Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- score: 0,
- yours: true,
- topic_id: 9,
- topic_slug: "this-is-a-test-topic",
- display_username: "",
- primary_group_name: null,
- version: 1,
- can_edit: true,
- can_delete: false,
- can_recover: true,
- read: true,
- user_title: null,
- actions_summary: [
- { id: 3, can_act: true },
- { id: 4, can_act: true },
- { id: 5, hidden: true, can_act: true },
- { id: 7, can_act: true },
- { id: 8, can_act: true },
- ],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- hidden_reason_id: null,
- trust_level: 4,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- },
- {
- id: 19,
- username: "eviltrout",
- avatar_template: "/images/avatar.png",
- name: "Evil Trout",
- uploaded_avatar_id: 9,
- created_at: "2015-08-13T14:49:18.231Z",
- cooked:
- '<p>These are my favourite JDM cars:</p>\n<div class="md-table">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>1998</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>Skyline</td>\n<td>1999</td>\n</tr>\n<tr>\n<td>Honda</td>\n<td>S2000</td>\n<td>2001</td>\n</tr>\n</tbody>\n</table>\n</div><p>These are my favourite Euro cars:</p>\n<div class="md-table">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Porsche</td>\n<td>964</td>\n<td>1998</td>\n</tr>\n<tr>\n<td>BMW</td>\n<td>M3</td>\n<td>2005</td>\n</tr>\n<tr>\n<td>Alfa Romeo</td>\n<td>Giulia</td>\n<td>2018</td>\n</tr>\n</tbody>\n</table>\n</div>',
- post_number: 2,
- post_type: 1,
- updated_at: "2015-08-13T14:49:18.231Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- score: 0,
- yours: true,
- topic_id: 9,
- topic_slug: "this-is-a-test-topic",
- display_username: "",
- primary_group_name: null,
- version: 1,
- can_edit: true,
- can_delete: true,
- can_recover: true,
- read: true,
- user_title: null,
- actions_summary: [
- { id: 3, can_act: true },
- { id: 4, can_act: true },
- { id: 5, hidden: true, can_act: true },
- { id: 7, can_act: true },
- { id: 8, can_act: true },
- ],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- hidden_reason_id: null,
- trust_level: 4,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- },
- {
- id: 20,
- username: "eviltrout",
- avatar_template: "/images/avatar.png",
- name: "Evil Trout",
- uploaded_avatar_id: 9,
- created_at: "2015-08-13T14:49:23.927Z",
- cooked:
- '<div class="md-table">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Price</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>$50,000</td>\n</tr>\n<tr>\n<td></td>\n<td>Celica</td>\n<td>$20,000</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>GTR</td>\n<td>$80,000</td>\n</tr>\n</tbody>\n</table>\n</div>',
- post_number: 3,
- post_type: 1,
- updated_at: "2015-08-13T14:49:23.927Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- score: 0,
- yours: true,
- topic_id: 9,
- topic_slug: "this-is-a-test-topic",
- display_username: "",
- primary_group_name: null,
- version: 1,
- can_edit: true,
- can_delete: true,
- can_recover: true,
- read: true,
- user_title: null,
- actions_summary: [
- { id: 3, can_act: true },
- { id: 4, can_act: true },
- { id: 5, hidden: true, can_act: true },
- { id: 7, can_act: true },
- { id: 8, can_act: true },
- ],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- hidden_reason_id: null,
- trust_level: 4,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- },
- {
- id: 21,
- username: "eviltrout",
- avatar_template: "/images/avatar.png",
- name: "Evil Trout",
- uploaded_avatar_id: 9,
- created_at: "2015-08-13T14:49:23.927Z",
- cooked:
- '<div class="video-placeholder-container" data-video-src="/uploads/default/original/1X/55508bc98a00f615dbe9bd4c84a253ba4238b021.mp4"></div>',
- post_number: 4,
- post_type: 1,
- updated_at: "2015-08-13T14:49:23.927Z",
- reply_count: 0,
- reply_to_post_number: null,
- quote_count: 0,
- incoming_link_count: 0,
- reads: 1,
- score: 0,
- yours: true,
- topic_id: 9,
- topic_slug: "this-is-a-test-topic",
- display_username: "",
- primary_group_name: null,
- version: 1,
- can_edit: true,
- can_delete: true,
- can_recover: true,
- read: true,
- user_title: null,
- actions_summary: [
- { id: 3, can_act: true },
- { id: 4, can_act: true },
- { id: 5, hidden: true, can_act: true },
- { id: 7, can_act: true },
- { id: 8, can_act: true },
- ],
- moderator: false,
- admin: true,
- staff: true,
- user_id: 1,
- hidden: false,
- hidden_reason_id: null,
- trust_level: 4,
- deleted_at: null,
- user_deleted: false,
- edit_reason: null,
- can_view_edit_history: true,
- wiki: false,
- },
+ {
+ id: 18,
+ username: "eviltrout",
+ avatar_template: "/images/avatar.png",
+ name: "Evil Trout",
+ uploaded_avatar_id: 9,
+ created_at: "2015-08-13T14:49:11.840Z",
+ cooked:
+ "<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n<th>Price</th>\n<th>Drivetrain</th>\n<th>Engine</th>\n<th>Power</th>\n<th>Type</th>\n<th>Seats</th>\n<th>Wheels</th>\n<th>Mileage</th>\n<th>Induction</th>\n<th>Intake</th>\n<th>Ranking</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>1998</td>\n<td>50k</td>\n<td>RWD</td>\n<td>I6</td>\n<td>400HP</td>\n<td>Coupe</td>\n<td>4</td>\n<td>Enkei PF01</td>\n<td>100,000</td>\n<td>Twin Turbo</td>\n<td>Yes</td>\n<td>1</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>Skyline</td>\n<td>1999</td>\n<td>100k</td>\n<td>4WD</td>\n<td>I6</td>\n<td>350HP</td>\n<td>Coupe</td>\n<td>4</td>\n<td>TE37</td>\n<td>80,000</td>\n<td>Single Turbo</td>\n<td>No</td>\n<td>2</td>\n</tr>\n<tr>\n<td>Honda</td>\n<td>S2000</td>\n<td>2001</td>\n<td>30k</td>\n<td>RWD</td>\n<td>I4</td>\n<td>230HP</td>\n<td>Roadster</td>\n<td>2</td>\n<td>RPF1</td>\n<td>110,000</td>\n<td>Naturally Aspirated</td>\n<td>No</td>\n<td>3</td>\n</tr>\n</tbody>\n</table>\n",
+ post_number: 1,
+ post_type: 1,
+ updated_at: "2015-08-13T14:49:11.840Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ score: 0,
+ yours: true,
+ topic_id: 9,
+ topic_slug: "this-is-a-test-topic",
+ display_username: "",
+ primary_group_name: null,
+ version: 1,
+ can_edit: true,
+ can_delete: false,
+ can_recover: true,
+ read: true,
+ user_title: null,
+ actions_summary: [
+ { id: 3, can_act: true },
+ { id: 4, can_act: true },
+ { id: 5, hidden: true, can_act: true },
+ { id: 7, can_act: true },
+ { id: 8, can_act: true },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ hidden_reason_id: null,
+ trust_level: 4,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ },
+ {
+ id: 19,
+ username: "eviltrout",
+ avatar_template: "/images/avatar.png",
+ name: "Evil Trout",
+ uploaded_avatar_id: 9,
+ created_at: "2015-08-13T14:49:18.231Z",
+ cooked:
+ "<p>These are my favourite JDM cars:</p>\n<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>1998</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>Skyline</td>\n<td>1999</td>\n</tr>\n<tr>\n<td>Honda</td>\n<td>S2000</td>\n<td>2001</td>\n</tr>\n</tbody>\n</table>\n</div><p>These are my favourite Euro cars:</p>\n<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Year</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Porsche</td>\n<td>964</td>\n<td>1998</td>\n</tr>\n<tr>\n<td>BMW</td>\n<td>M3</td>\n<td>2005</td>\n</tr>\n<tr>\n<td>Alfa Romeo</td>\n<td>Giulia</td>\n<td>2018</td>\n</tr>\n</tbody>\n</table>\n</div>",
+ post_number: 2,
+ post_type: 1,
+ updated_at: "2015-08-13T14:49:18.231Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ score: 0,
+ yours: true,
+ topic_id: 9,
+ topic_slug: "this-is-a-test-topic",
+ display_username: "",
+ primary_group_name: null,
+ version: 1,
+ can_edit: true,
+ can_delete: true,
+ can_recover: true,
+ read: true,
+ user_title: null,
+ actions_summary: [
+ { id: 3, can_act: true },
+ { id: 4, can_act: true },
+ { id: 5, hidden: true, can_act: true },
+ { id: 7, can_act: true },
+ { id: 8, can_act: true },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ hidden_reason_id: null,
+ trust_level: 4,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ },
+ {
+ id: 20,
+ username: "eviltrout",
+ avatar_template: "/images/avatar.png",
+ name: "Evil Trout",
+ uploaded_avatar_id: 9,
+ created_at: "2015-08-13T14:49:23.927Z",
+ cooked:
+ "<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th>Make</th>\n<th>Model</th>\n<th>Price</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Toyota</td>\n<td>Supra</td>\n<td>$50,000</td>\n</tr>\n<tr>\n<td></td>\n<td>Celica</td>\n<td>$20,000</td>\n</tr>\n<tr>\n<td>Nissan</td>\n<td>GTR</td>\n<td>$80,000</td>\n</tr>\n</tbody>\n</table>\n</div>",
+ post_number: 3,
+ post_type: 1,
+ updated_at: "2015-08-13T14:49:23.927Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ score: 0,
+ yours: true,
+ topic_id: 9,
+ topic_slug: "this-is-a-test-topic",
+ display_username: "",
+ primary_group_name: null,
+ version: 1,
+ can_edit: true,
+ can_delete: true,
+ can_recover: true,
+ read: true,
+ user_title: null,
+ actions_summary: [
+ { id: 3, can_act: true },
+ { id: 4, can_act: true },
+ { id: 5, hidden: true, can_act: true },
+ { id: 7, can_act: true },
+ { id: 8, can_act: true },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ hidden_reason_id: null,
+ trust_level: 4,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ },
+ {
+ id: 21,
+ username: "eviltrout",
+ avatar_template: "/images/avatar.png",
+ name: "Evil Trout",
+ uploaded_avatar_id: 9,
+ created_at: "2015-08-13T14:49:23.927Z",
+ cooked:
+ "<div class=\"video-placeholder-container\" data-video-src=\"/uploads/default/original/1X/55508bc98a00f615dbe9bd4c84a253ba4238b021.mp4\"></div>",
+ post_number: 4,
+ post_type: 1,
+ updated_at: "2015-08-13T14:49:23.927Z",
+ reply_count: 0,
+ reply_to_post_number: null,
+ quote_count: 0,
+ incoming_link_count: 0,
+ reads: 1,
+ score: 0,
+ yours: true,
+ topic_id: 9,
+ topic_slug: "this-is-a-test-topic",
+ display_username: "",
+ primary_group_name: null,
+ version: 1,
+ can_edit: true,
+ can_delete: true,
+ can_recover: true,
+ read: true,
+ user_title: null,
+ actions_summary: [
+ { id: 3, can_act: true },
+ { id: 4, can_act: true },
+ { id: 5, hidden: true, can_act: true },
+ { id: 7, can_act: true },
+ { id: 8, can_act: true },
+ ],
+ moderator: false,
+ admin: true,
+ staff: true,
+ user_id: 1,
+ hidden: false,
+ hidden_reason_id: null,
+ trust_level: 4,
+ deleted_at: null,
+ user_deleted: false,
+ edit_reason: null,
+ can_view_edit_history: true,
+ wiki: false,
+ },
],
stream: [398, 419],
gaps: { before: {}, after: { 398: [419] } },
diff --git a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js
index 94a483a7bd7..0060daa4d90 100644
--- a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js
+++ b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js
@@ -414,18 +414,18 @@ export function applyDefaultHandlers(pretender) {
pretender.get("/search", (request) => {
if (
- request.queryParams.q === "discourse" ||
- request.queryParams.q === "discourse order:latest" ||
- request.queryParams.q === "discourse order:likes"
+ request.queryParams.q === "consectetur" ||
+ request.queryParams.q === "consectetur order:latest" ||
+ request.queryParams.q === "consectetur order:likes"
) {
return response(fixturesByUrl["/search.json"]);
- } else if (request.queryParams.q === "discourse visited") {
+ } else if (request.queryParams.q === "consectetur visited") {
const obj = JSON.parse(JSON.stringify(fixturesByUrl["/search.json"]));
obj.topics.firstObject.last_read_post_number = 1;
return response(obj);
} else if (
- request.queryParams.q === "discourse in:personal" ||
- request.queryParams.q === "discourse in:messages"
+ request.queryParams.q === "consectetur in:personal" ||
+ request.queryParams.q === "consectetur in:messages"
) {
const obj = JSON.parse(JSON.stringify(fixturesByUrl["/search.json"]));
obj.topics.firstObject.archetype = "private_message";