Revert "DEV: Prioritize full name when setting active (#15820)" (#15869)

This reverts commit 5a93ce421d.
This commit is contained in:
janzenisaac 2022-02-08 13:25:19 -06:00 committed by GitHub
parent 5a93ce421d
commit 8abc4a0fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 90 deletions

View File

@ -173,9 +173,6 @@ export default Component.extend(KeyEnterEscape, {
selectedRange().startOffset > 0
? false
: _selectedText === toMarkdown(cooked.innerHTML),
displayName:
this.siteSettings.display_name_on_posts &&
!this.siteSettings.prioritize_username_in_ux,
};
for (

View File

@ -6,12 +6,8 @@ export function buildQuote(post, contents, opts = {}) {
return "";
}
const name = opts.displayName
? opts.name || post.name
: opts.username || post.username;
const params = [
name,
opts.username || post.username,
`post:${opts.post || post.post_number}`,
`topic:${opts.topic || post.topic_id}`,
];

View File

@ -74,7 +74,6 @@ export function transformBasicPost(post) {
actionsSummary: null,
read: post.read,
replyToUsername: null,
replyToName: null,
replyToAvatarTemplate: null,
reply_to_post_number: post.reply_to_post_number,
cooked_hidden: !!post.cooked_hidden,
@ -228,7 +227,6 @@ export default function transformPost(
const replyToUser = post.get("reply_to_user");
if (replyToUser) {
postAtts.replyToUsername = replyToUser.username;
postAtts.replyToName = replyToUser.name;
postAtts.replyToAvatarTemplate = replyToUser.avatar_template;
}

View File

@ -23,7 +23,6 @@ import deprecated from "discourse-common/lib/deprecated";
import { isEmpty } from "@ember/utils";
import { propertyNotEqual } from "discourse/lib/computed";
import { throwAjaxError } from "discourse/lib/ajax-error";
import { prioritizeNameInUx } from "discourse/lib/settings";
let _customizations = [];
export function registerCustomizationCallback(cb) {
@ -357,10 +356,6 @@ const Composer = RestModel.extend({
if (topic && post) {
const postNumber = post.post_number;
const name =
this.siteSettings.display_name_on_posts && prioritizeNameInUx(post.name)
? post.name
: post.username;
options.postLink = {
href: `${topic.url}/${postNumber}`,
@ -369,7 +364,7 @@ const Composer = RestModel.extend({
options.userLink = {
href: `${topic.url}/${postNumber}`,
anchor: name,
anchor: post.username,
};
}

View File

@ -134,21 +134,16 @@ createWidget("reply-to-tab", {
html(attrs, state) {
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 [
icon,
" ",
avatarImg("small", {
template: attrs.replyToAvatarTemplate,
username: name,
username: attrs.replyToUsername,
}),
" ",
h("span", formatUsername(name)),
h("span", formatUsername(attrs.replyToUsername)),
];
},

View File

@ -4,7 +4,6 @@ import {
exists,
query,
queryAll,
selectText,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
@ -19,11 +18,7 @@ import { toggleCheckDraftPopup } from "discourse/controllers/composer";
acceptance("Composer Actions", function (needs) {
needs.user();
needs.settings({
prioritize_username_in_ux: true,
display_name_on_post: false,
enable_whispers: true,
});
needs.settings({ enable_whispers: true });
needs.site({ can_tag_topics: true });
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();
});
});
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]'
);
});
});

View File

@ -13,11 +13,10 @@ import { test } from "qunit";
acceptance("Topic - Quote button - logged in", function (needs) {
needs.user();
needs.settings({
display_name_on_posts: false,
prioritize_username_in_ux: true,
share_quote_visibility: "anonymous",
share_quote_buttons: "twitter|email",
});
chromeTest(
"Does not show the quote share buttons by default",
async function (assert) {

View File

@ -241,8 +241,6 @@ acceptance("Topic", function (needs) {
acceptance("Topic featured links", function (needs) {
needs.user();
needs.settings({
display_name_on_posts: false,
prioritize_username_in_ux: true,
topic_featured_link_enabled: true,
max_topic_title_length: 80,
exclude_rel_nofollow_domains: "example.com",

View File

@ -256,7 +256,6 @@ class PostSerializer < BasicPostSerializer
def reply_to_user
{
username: object.reply_to_user.username,
name: object.reply_to_user.name,
avatar_template: object.reply_to_user.avatar_template
}
end