DEV: Resolve user_option deprecations (#20192)

This commit is contained in:
David Taylor 2023-02-09 16:05:42 +00:00 committed by GitHub
parent a8b145547e
commit db42917563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 12 deletions

View File

@ -13,7 +13,7 @@ export default class UserStatusMessage extends Component {
} }
const timezone = this.currentUser const timezone = this.currentUser
? this.currentUser.timezone ? this.currentUser.user_option?.timezone
: moment.tz.guess(); : moment.tz.guess();
return until(this.status.ends_at, timezone, this.currentUser?.locale); return until(this.status.ends_at, timezone, this.currentUser?.locale);

View File

@ -434,8 +434,6 @@ export default Controller.extend({
}, },
resetSeenUserTips() { resetSeenUserTips() {
this.model.set("skip_new_user_tips", false);
this.model.set("seen_popups", null);
this.model.set("user_option.skip_new_user_tips", false); this.model.set("user_option.skip_new_user_tips", false);
this.model.set("user_option.seen_popups", null); this.model.set("user_option.seen_popups", null);
return this.model.save(["skip_new_user_tips", "seen_popups"]); return this.model.save(["skip_new_user_tips", "seen_popups"]);

View File

@ -1179,7 +1179,7 @@ const User = RestModel.extend({
showUserTip(options) { showUserTip(options) {
const userTips = Site.currentProp("user_tips"); const userTips = Site.currentProp("user_tips");
if (!userTips || this.skip_new_user_tips) { if (!userTips || this.user_option?.skip_new_user_tips) {
return; return;
} }
@ -1191,7 +1191,7 @@ const User = RestModel.extend({
return; return;
} }
const seenUserTips = this.seen_popups || []; const seenUserTips = this.user_option?.seen_popups || [];
if ( if (
seenUserTips.includes(-1) || seenUserTips.includes(-1) ||
seenUserTips.includes(userTips[options.id]) seenUserTips.includes(userTips[options.id])
@ -1208,7 +1208,7 @@ const User = RestModel.extend({
hideUserTipForever(userTipId) { hideUserTipForever(userTipId) {
const userTips = Site.currentProp("user_tips"); const userTips = Site.currentProp("user_tips");
if (!userTips || this.skip_new_user_tips) { if (!userTips || this.user_option?.skip_new_user_tips) {
return; return;
} }
@ -1228,7 +1228,7 @@ const User = RestModel.extend({
} }
// Update list of seen user tips. // Update list of seen user tips.
let seenUserTips = this.seen_popups || []; let seenUserTips = this.user_option?.seen_popups || [];
if (userTipId) { if (userTipId) {
if (seenUserTips.includes(userTips[userTipId])) { if (seenUserTips.includes(userTips[userTipId])) {
return; return;

View File

@ -23,7 +23,7 @@ acceptance("Topic - Bulk Actions - Mobile", function (needs) {
}); });
test("bulk select - modal", async function (assert) { test("bulk select - modal", async function (assert) {
updateCurrentUser({ moderator: true, enable_defer: true }); updateCurrentUser({ moderator: true, user_option: { enable_defer: true } });
await visit("/latest"); await visit("/latest");
await click("button.bulk-select"); await click("button.bulk-select");

View File

@ -14,7 +14,7 @@ acceptance("User Card - Show Local Time", function (needs) {
needs.settings({ display_local_time_in_user_card: true }); needs.settings({ display_local_time_in_user_card: true });
test("user card local time - does not update timezone for another user", async function (assert) { test("user card local time - does not update timezone for another user", async function (assert) {
User.current().timezone = "Australia/Brisbane"; User.current().user_option.timezone = "Australia/Brisbane";
await visit("/t/internationalization-localization/280"); await visit("/t/internationalization-localization/280");
await click('a[data-user-card="charlie"]'); await click('a[data-user-card="charlie"]');

View File

@ -482,7 +482,7 @@ acceptance("User Status - new user menu", function (needs) {
needs.user({ needs.user({
id: userId, id: userId,
timezone: userTimezone, "user_option.timezone": userTimezone,
redesigned_user_menu_enabled: true, redesigned_user_menu_enabled: true,
}); });

View File

@ -3118,8 +3118,8 @@ export default {
text_size: "normal", text_size: "normal",
text_size_seq: 0, text_size_seq: 0,
title_count_mode: "notifications", title_count_mode: "notifications",
timezone: "Asia/Tokyo",
}, },
timezone: "Asia/Tokyo",
}, },
}, },
"/u/%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%B3/summary.json": { "/u/%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%B3/summary.json": {

View File

@ -85,7 +85,7 @@ module(
}); });
test("notification reason text - user mailing list mode", async function (assert) { test("notification reason text - user mailing list mode", async function (assert) {
this.currentUser.set("mailing_list_mode", true); this.currentUser.set("user_option.mailing_list_mode", true);
this.set("topic", buildTopic.call(this, { level: 2 })); this.set("topic", buildTopic.call(this, { level: 2 }));
await render(hbs` await render(hbs`