mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 08:12:46 +08:00
This reverts commit 5a93ce421d
.
This commit is contained in:
parent
5a93ce421d
commit
8abc4a0fd6
|
@ -173,9 +173,6 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
selectedRange().startOffset > 0
|
selectedRange().startOffset > 0
|
||||||
? false
|
? false
|
||||||
: _selectedText === toMarkdown(cooked.innerHTML),
|
: _selectedText === toMarkdown(cooked.innerHTML),
|
||||||
displayName:
|
|
||||||
this.siteSettings.display_name_on_posts &&
|
|
||||||
!this.siteSettings.prioritize_username_in_ux,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (
|
for (
|
||||||
|
|
|
@ -6,12 +6,8 @@ export function buildQuote(post, contents, opts = {}) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = opts.displayName
|
|
||||||
? opts.name || post.name
|
|
||||||
: opts.username || post.username;
|
|
||||||
|
|
||||||
const params = [
|
const params = [
|
||||||
name,
|
opts.username || post.username,
|
||||||
`post:${opts.post || post.post_number}`,
|
`post:${opts.post || post.post_number}`,
|
||||||
`topic:${opts.topic || post.topic_id}`,
|
`topic:${opts.topic || post.topic_id}`,
|
||||||
];
|
];
|
||||||
|
|
|
@ -74,7 +74,6 @@ export function transformBasicPost(post) {
|
||||||
actionsSummary: null,
|
actionsSummary: null,
|
||||||
read: post.read,
|
read: post.read,
|
||||||
replyToUsername: null,
|
replyToUsername: null,
|
||||||
replyToName: null,
|
|
||||||
replyToAvatarTemplate: null,
|
replyToAvatarTemplate: null,
|
||||||
reply_to_post_number: post.reply_to_post_number,
|
reply_to_post_number: post.reply_to_post_number,
|
||||||
cooked_hidden: !!post.cooked_hidden,
|
cooked_hidden: !!post.cooked_hidden,
|
||||||
|
@ -228,7 +227,6 @@ export default function transformPost(
|
||||||
const replyToUser = post.get("reply_to_user");
|
const replyToUser = post.get("reply_to_user");
|
||||||
if (replyToUser) {
|
if (replyToUser) {
|
||||||
postAtts.replyToUsername = replyToUser.username;
|
postAtts.replyToUsername = replyToUser.username;
|
||||||
postAtts.replyToName = replyToUser.name;
|
|
||||||
postAtts.replyToAvatarTemplate = replyToUser.avatar_template;
|
postAtts.replyToAvatarTemplate = replyToUser.avatar_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import deprecated from "discourse-common/lib/deprecated";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { propertyNotEqual } from "discourse/lib/computed";
|
import { propertyNotEqual } from "discourse/lib/computed";
|
||||||
import { throwAjaxError } from "discourse/lib/ajax-error";
|
import { throwAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { prioritizeNameInUx } from "discourse/lib/settings";
|
|
||||||
|
|
||||||
let _customizations = [];
|
let _customizations = [];
|
||||||
export function registerCustomizationCallback(cb) {
|
export function registerCustomizationCallback(cb) {
|
||||||
|
@ -357,10 +356,6 @@ const Composer = RestModel.extend({
|
||||||
|
|
||||||
if (topic && post) {
|
if (topic && post) {
|
||||||
const postNumber = post.post_number;
|
const postNumber = post.post_number;
|
||||||
const name =
|
|
||||||
this.siteSettings.display_name_on_posts && prioritizeNameInUx(post.name)
|
|
||||||
? post.name
|
|
||||||
: post.username;
|
|
||||||
|
|
||||||
options.postLink = {
|
options.postLink = {
|
||||||
href: `${topic.url}/${postNumber}`,
|
href: `${topic.url}/${postNumber}`,
|
||||||
|
@ -369,7 +364,7 @@ const Composer = RestModel.extend({
|
||||||
|
|
||||||
options.userLink = {
|
options.userLink = {
|
||||||
href: `${topic.url}/${postNumber}`,
|
href: `${topic.url}/${postNumber}`,
|
||||||
anchor: name,
|
anchor: post.username,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,21 +134,16 @@ createWidget("reply-to-tab", {
|
||||||
|
|
||||||
html(attrs, state) {
|
html(attrs, state) {
|
||||||
const icon = state.loading ? h("div.spinner.small") : iconNode("share");
|
const icon = state.loading ? h("div.spinner.small") : iconNode("share");
|
||||||
const name =
|
|
||||||
this.siteSettings.display_name_on_posts &&
|
|
||||||
prioritizeNameInUx(attrs.replyToName)
|
|
||||||
? attrs.replyToName
|
|
||||||
: attrs.replyToUsername;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
icon,
|
icon,
|
||||||
" ",
|
" ",
|
||||||
avatarImg("small", {
|
avatarImg("small", {
|
||||||
template: attrs.replyToAvatarTemplate,
|
template: attrs.replyToAvatarTemplate,
|
||||||
username: name,
|
username: attrs.replyToUsername,
|
||||||
}),
|
}),
|
||||||
" ",
|
" ",
|
||||||
h("span", formatUsername(name)),
|
h("span", formatUsername(attrs.replyToUsername)),
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
selectText,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||||
|
@ -19,11 +18,7 @@ import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
||||||
|
|
||||||
acceptance("Composer Actions", function (needs) {
|
acceptance("Composer Actions", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({
|
needs.settings({ enable_whispers: true });
|
||||||
prioritize_username_in_ux: true,
|
|
||||||
display_name_on_post: false,
|
|
||||||
enable_whispers: true,
|
|
||||||
});
|
|
||||||
needs.site({ can_tag_topics: true });
|
needs.site({ can_tag_topics: true });
|
||||||
|
|
||||||
test("creating new topic and then reply_as_private_message keeps attributes", async function (assert) {
|
test("creating new topic and then reply_as_private_message keeps attributes", async function (assert) {
|
||||||
|
@ -556,59 +551,3 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
||||||
sinon.restore();
|
sinon.restore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptance("Prioritize Username", function (needs) {
|
|
||||||
needs.user();
|
|
||||||
needs.settings({
|
|
||||||
prioritize_username_in_ux: true,
|
|
||||||
display_name_on_post: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Reply to post use username", async function (assert) {
|
|
||||||
await visit("/t/internationalization-localization/280");
|
|
||||||
await click("article#post_3 button.reply");
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
queryAll(".action-title .user-link").text().trim(),
|
|
||||||
"codinghorror"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Quotes use username", async function (assert) {
|
|
||||||
await visit("/t/internationalization-localization/280");
|
|
||||||
await selectText("#post_3 p");
|
|
||||||
await click(".insert-quote");
|
|
||||||
assert.strictEqual(
|
|
||||||
queryAll(".d-editor-input").val().trim(),
|
|
||||||
'[quote="codinghorror, post:3, topic:280"]\nYep, all strings are going through a lookup table.*\n[/quote]'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
acceptance("Prioritize Full Name", function (needs) {
|
|
||||||
needs.user();
|
|
||||||
needs.settings({
|
|
||||||
prioritize_username_in_ux: false,
|
|
||||||
display_name_on_post: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Reply to post use full name", async function (assert) {
|
|
||||||
await visit("/t/internationalization-localization/280");
|
|
||||||
await click("article#post_3 button.reply");
|
|
||||||
|
|
||||||
assert.strictEqual(
|
|
||||||
queryAll(".action-title .user-link").text().trim(),
|
|
||||||
"Jeff Atwood"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Quotes use full name", async function (assert) {
|
|
||||||
await visit("/t/internationalization-localization/280");
|
|
||||||
await selectText("#post_3 p");
|
|
||||||
await click(".insert-quote");
|
|
||||||
assert.strictEqual(
|
|
||||||
queryAll(".d-editor-input").val().trim(),
|
|
||||||
'[quote="Jeff Atwood, post:3, topic:280"]\nYep, all strings are going through a lookup table.*\n[/quote]'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -13,11 +13,10 @@ import { test } from "qunit";
|
||||||
acceptance("Topic - Quote button - logged in", function (needs) {
|
acceptance("Topic - Quote button - logged in", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({
|
needs.settings({
|
||||||
display_name_on_posts: false,
|
|
||||||
prioritize_username_in_ux: true,
|
|
||||||
share_quote_visibility: "anonymous",
|
share_quote_visibility: "anonymous",
|
||||||
share_quote_buttons: "twitter|email",
|
share_quote_buttons: "twitter|email",
|
||||||
});
|
});
|
||||||
|
|
||||||
chromeTest(
|
chromeTest(
|
||||||
"Does not show the quote share buttons by default",
|
"Does not show the quote share buttons by default",
|
||||||
async function (assert) {
|
async function (assert) {
|
||||||
|
|
|
@ -241,8 +241,6 @@ acceptance("Topic", function (needs) {
|
||||||
acceptance("Topic featured links", function (needs) {
|
acceptance("Topic featured links", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({
|
needs.settings({
|
||||||
display_name_on_posts: false,
|
|
||||||
prioritize_username_in_ux: true,
|
|
||||||
topic_featured_link_enabled: true,
|
topic_featured_link_enabled: true,
|
||||||
max_topic_title_length: 80,
|
max_topic_title_length: 80,
|
||||||
exclude_rel_nofollow_domains: "example.com",
|
exclude_rel_nofollow_domains: "example.com",
|
||||||
|
|
|
@ -256,7 +256,6 @@ class PostSerializer < BasicPostSerializer
|
||||||
def reply_to_user
|
def reply_to_user
|
||||||
{
|
{
|
||||||
username: object.reply_to_user.username,
|
username: object.reply_to_user.username,
|
||||||
name: object.reply_to_user.name,
|
|
||||||
avatar_template: object.reply_to_user.avatar_template
|
avatar_template: object.reply_to_user.avatar_template
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user