Compare commits

...

11 commits

Author SHA1 Message Date
5a9e874d52 Remove survey link from NeoPass announcement, schedule it to vanish
Survey time is done! We'll keep this message up for a few days for
people to get to see the thank-you, then it'll stay up through May 5,
then vanish.
2024-05-02 13:28:37 -07:00
3f0936f25c Add "About NeoPass" link to footer
I'm gonna take down the survey message at some point, so it'll be good
to have the link live elsewhere, too!
2024-05-02 13:20:45 -07:00
32c3ec4f14 Update Yarn version & packages
New install, new life!
2024-05-02 13:19:39 -07:00
c74d9fa735 Don't crash in development if the Rails master key is missing
Oops, right, this meta tag that runs on all pages currently crashes if
we can't read the credentials file!

Instead, let's just allow this value to be `nil` if not present.
2024-05-02 13:13:54 -07:00
c751173c52 Fix public_data:commit's symlinking on some platforms
Huh, curious, I think what I'm seeing is: on my development machine,
`File.exist?` returns true for symlinks, but, on our production
machine, `File.exist?` returns false for symlinks.

I imagine this is a difference in the implementation of the underlying
system calls? Curious!

This new check should work more reliably across platforms. I considered
checking both `exists?` and `symlink?`, but decided that, in the
unexpected case that `latest.sql.gz` exists but is an actual file
instead of a symlink like we expect, it's probably best to avoid
overwriting it anyway, and a crash on the `symlink` attempt is a
reasonable way to do that.
2024-05-02 13:10:30 -07:00
7c09b76b5e Require fewer db privileges to run public_data:commit
In newer versions of MySQL, `mysqldump`'s default behavior requires
accessing some privileged `INFORMATION_SCHEMA` tables, which requires
the global `PROCESS` permission.

Rather than require that, we can just skip this step, by adding the
`--no-tablespaces` argument. This was the guidance I found when looking
up this issue! https://dba.stackexchange.com/a/274460/289961
2024-05-02 13:06:27 -07:00
0943e2dbba Fix broken default value in schema for item description
Idk how we got into this state, or if it's environment-dependent or
MySQL-version-dependent or what, but setting up the dev environment on
my macOS machine is complaining that `TEXT` columns can't have default
values.

Well, in that case, let's just have it be a non-nullable field, and add
a note to our code that missing fields *can* cause item saving to fail!
(This was always true, but I'm just extra-noting it because it's
becoming *more* true.)
2024-05-02 13:00:10 -07:00
73c2d4327a Oops, don't have old Rubies in the PATH when deploying!
Ahh right, this `lineinfile` trick has a gotcha: if we ever change the
Ruby version, it injects the line into the file as a *new* line,
instead of updating or removing the existing one.

When poking at the content of `/etc/profile` to remove old versions of
the line, I noticed that `/etc/profile.d` is a thing! We can drop a
file into there and manage it more directly, instead. Let's do that!
2024-05-02 12:47:02 -07:00
12764c44fc Attempt to fix scheduled public data export cron
This hasn't actually been running, and I'm finally looking into why!
I tested this by running `sudo -u impress COMMAND_GOES_HERE`, and found
that there were two errors: both the lack of `production.env` that I
had noticed and expected, but also that Ruby 3.3.0 wasn't in the `PATH`
value.

To fix this, I now pull in both `/etc/profile` and `~/.bash_profile`,
much like what happens automatically when we log into a shell as
`impress`, to get the environment set up! I haven't actually validated
that this Works, but I guess we'll see! I *could* change the cron
timing to some immediate time to try to watch it happen, but I'm not
invested enough right now, there's other things to do!
2024-05-02 12:21:14 -07:00
3d0c506370 Update some cached gems for macOS
I'm back to working on my Mac laptop again! Running `bundle install`
updated some gems' cached built versions for this OS, so, ta da!
2024-05-02 12:19:08 -07:00
460235e7cf Fix some eslint errors
Huh, I guess my desktop workstation doesn't have this commit hook set
up. Now that I'm using my Mac again, it's catching some things I
missed!
2024-05-02 12:18:51 -07:00
20 changed files with 1398 additions and 1236 deletions

View file

@ -101,7 +101,8 @@ module ApplicationHelper
def impress_2020_meta_tags
origin = Rails.configuration.impress_2020_origin
support_secret = Rails.application.credentials.impress_2020.support_secret
support_secret = Rails.application.credentials.dig(
:impress_2020, :support_secret)
capture do
concat tag("meta", name: "impress-2020-origin", content: origin)

View file

@ -1,4 +1,9 @@
module OutfitsHelper
LAST_DAY_OF_NEOPASS_ANNOUNCEMENT = Date.parse("2024-05-05")
def show_neopass_announcement?
Date.today <= LAST_DAY_OF_NEOPASS_ANNOUNCEMENT
end
def destination_tag(value)
hidden_field_tag 'destination', value, :id => nil
end

View file

@ -14,7 +14,6 @@ import { ApolloProvider } from "@apollo/client";
import { BrowserRouter } from "react-router-dom";
import { css, Global } from "@emotion/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import produce from "immer";
import apolloClient from "./apolloClient";

View file

@ -31,7 +31,6 @@ import getVisibleLayers from "../components/getVisibleLayers";
import { OutfitLayers } from "../components/OutfitPreview";
import SupportOnly from "./support/SupportOnly";
import { useAltStylesForSpecies } from "../loaders/alt-styles";
import useSupport from "./support/useSupport";
import { useLocalStorage } from "../util";
// From https://twemoji.twitter.com/, thank you!
@ -81,7 +80,6 @@ function PosePicker({
"DTIPosePickerIsInSupportMode",
false,
);
const { isSupportUser } = useSupport();
const toast = useToast();
const loading = posesQuery.loading || altStylesQuery.isLoading;
@ -280,30 +278,31 @@ function PosePicker({
);
}
function PosePickerButton({ pose, altStyle, isOpen, loading, ...props }, ref) {
const theme = useTheme();
const PosePickerButton = React.forwardRef(
({ pose, altStyle, isOpen, loading, ...props }, ref) => {
const theme = useTheme();
const icon = altStyle != null ? twemojiSunglasses : getIcon(pose);
const label = altStyle != null ? altStyle.seriesName : getLabel(pose);
const icon = altStyle != null ? twemojiSunglasses : getIcon(pose);
const label = altStyle != null ? altStyle.seriesName : getLabel(pose);
return (
<ClassNames>
{({ css, cx }) => (
<Button
variant="unstyled"
textShadow={`${theme.colors.blackAlpha["700"]} 0 1px 2px`}
d="flex"
alignItems="center"
justifyContent="center"
_focus={{ borderColor: "gray.50" }}
_hover={{ borderColor: "gray.50" }}
outline="initial"
fontSize="sm"
fontWeight="normal"
minWidth="12ch"
disabled={loading}
className={cx(
css`
return (
<ClassNames>
{({ css, cx }) => (
<Button
variant="unstyled"
textShadow={`${theme.colors.blackAlpha["700"]} 0 1px 2px`}
d="flex"
alignItems="center"
justifyContent="center"
_focus={{ borderColor: "gray.50" }}
_hover={{ borderColor: "gray.50" }}
outline="initial"
fontSize="sm"
fontWeight="normal"
minWidth="12ch"
disabled={loading}
className={cx(
css`
border: 1px solid transparent !important;
color: ${theme.colors.gray["100"]};
cursor: ${loading ? "wait" : "pointer"} !important;
@ -331,22 +330,22 @@ function PosePickerButton({ pose, altStyle, isOpen, loading, ...props }, ref) {
border-width: 2px !important;
}
`,
isOpen && "is-open",
)}
{...props}
ref={ref}
>
<EmojiImage src={icon} alt="Style" />
<Box width=".5em" />
{label}
<Box width=".5em" />
<ChevronDownIcon />
</Button>
)}
</ClassNames>
);
}
PosePickerButton = React.forwardRef(PosePickerButton);
isOpen && "is-open",
)}
{...props}
ref={ref}
>
<EmojiImage src={icon} alt="Style" />
<Box width=".5em" />
{label}
<Box width=".5em" />
<ChevronDownIcon />
</Button>
)}
</ClassNames>
);
},
);
function PosePickerTable({ poseInfos, onChange, initialFocusRef }) {
return (

View file

@ -1,5 +1,3 @@
import * as React from "react";
import { getSupportSecret } from "../../impress-2020-config";
/**

View file

@ -700,7 +700,7 @@ function getZonesAndItems(itemsById, wornItemIds, closetedItemIds) {
// used. Then, loop over them again, appending the ID number if count > 1.
const labelCounts = new Map();
for (const itemZoneGroup of zonesAndItems) {
const { zoneId, zoneLabel } = itemZoneGroup;
const { zoneLabel } = itemZoneGroup;
const count = labelCounts.get(zoneLabel) ?? 0;
labelCounts.set(zoneLabel, count + 1);

View file

@ -429,6 +429,8 @@ class Item < ApplicationRecord
species_support_strs = info['species_support'] || []
self.species_support_ids = species_support_strs.map(&:to_i)
# NOTE: If some of these fields are missing, it could cause saving the item
# to fail, because many of these columns are non-nullable.
self.name = info['name']
self.description = info['description']
self.thumbnail_url = info['thumbnail_url']

View file

@ -68,6 +68,7 @@
%li.terms{"data-updated-recently": terms_updated_recently }
= link_to t('.footer.terms', date: terms_updated_timestamp),
terms_path
%li= link_to t('.footer.about_neopass'), about_neopass_path
%div
#{t('.footer.contact')}:

View file

@ -4,41 +4,26 @@
%p#pet-not-found.alert= t 'pets.load.not_found'
%section.neopass-announcement
= image_tag "about/neopass-survey.png", width: 70, height: 70,
srcset: {"about/neopass-survey@2x.png": "2x"},
class: "neopass-thumbnail"
.neopass-content
%p
%strong
💭 Can you help us and TNT decide what to build next with NeoPass?
- if show_neopass_announcement?
%section.neopass-announcement
= image_tag "about/neopass-survey.png", width: 70, height: 70,
srcset: {"about/neopass-survey@2x.png": "2x"},
class: "neopass-thumbnail"
.neopass-content
%p
%strong
💭 Thank you for sending us your NeoPass feedback!
%p
- if user_signed_in?
- if current_user.uses_neopass?
= link_to "Login with NeoPass", about_neopass_path
is ready—and you're already on it, thank you! 🥰
- else
= link_to "Login with NeoPass", about_neopass_path
is ready! You can connect via the
#{link_to "Settings page", edit_auth_user_path}.
- else
= link_to "Login with NeoPass", about_neopass_path
is ready! If you're new to Dress to Impress, try logging in right now!!
🎉
%p
We're working with TNT now to build new integrations, based on what you
told us! We're glad
= link_to "log in with NeoPass", about_neopass_path
is working well, and we're excited to do the next part! More info soon!
%p
Now that we've built the foundation, TNT are looking for our help deciding what integration to build
next.
= link_to "Would you fill out this survey for us, please?",
"https://docs.google.com/forms/d/e/1FAIpQLSdyi7bZB3-gyztdOVSmikRrfts6KM5mK2r37D0SBla3JO3GbQ/viewform"
We've got some ideas, and we're looking for more! Even if you don't use
NeoPass yet, your input would be <em>super</em> useful.
%p
Thanks again to everyone for helping us out! We're grateful, as always 💖
%br
%em —Matchu
%p
Thanks again to everyone for helping us out! We're grateful, as always 💖
%br
%em —Matchu
#outfit-forms
- localized_cache :action_suffix => 'outfit_forms_intro' do

View file

@ -31,11 +31,9 @@ en-MEEP:
login: Meep in
footer:
blog: Bleep
source_code: Source Meep
terms: Terms of Use (meeped Sep 2022)
contact: Meeptact
suggestions: Suggesteeps
email: Questions, comments, meepits
copyright: Images © 1999%{year} World of Neopets, Inc. All Rights Reserved.
Used With Permission. Meep.

View file

@ -31,11 +31,10 @@ en:
login: Log in
footer:
blog: Blog
source_code: Source Code
terms: Terms of Use (updated %{date})
about_neopass: About NeoPass
contact: Contact
suggestions: Suggestions
email: Questions, comments, bugs
copyright: Images © 1999%{year} World of Neopets, Inc. All Rights Reserved.
Used With Permission

View file

@ -24,10 +24,8 @@ pt:
logout: Sair
login: Entrar
footer:
blog: Blog
source_code: Código Fonte
contact: Contato
suggestions: Sugestões
email: Perguntas, comentários, erros
copyright: Images © 1999%{year} World of Neopets, Inc. All Rights Reserved. Used With Permission
items:

View file

@ -0,0 +1,8 @@
class FixDefaultValueForItemsDescription < ActiveRecord::Migration[7.1]
def change
# Idk why, but this column's default value is specified in our schema as
# an empty string, but setting up the dev environment on my macOS machine
# is saying on latest MariaDB that this isn't allowed.
change_column_default :items, :description, from: "", to: nil
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_04_21_033509) do
ActiveRecord::Schema[7.1].define(version: 2024_05_02_195157) do
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.integer "species_id", null: false
t.integer "color_id", null: false
@ -132,7 +132,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_21_033509) do
t.column "modeling_status_hint", "enum('done','glitchy')"
t.boolean "is_manually_nc", default: false, null: false
t.string "name", null: false
t.text "description", size: :medium, default: "", null: false
t.text "description", size: :medium, null: false
t.string "rarity", default: "", null: false
t.index ["modeling_status_hint", "created_at", "id"], name: "items_modeling_status_hint_and_created_at_and_id"
t.index ["modeling_status_hint", "created_at"], name: "items_modeling_status_hint_and_created_at"
@ -149,7 +149,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_21_033509) do
end
create_table "modeling_logs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.datetime "created_at", precision: nil, default: -> { "current_timestamp()" }, null: false
t.datetime "created_at", precision: nil, default: -> { "CURRENT_TIMESTAMP" }, null: false
t.text "log_json", size: :long, null: false
t.string "pet_name", limit: 128, null: false
end

View file

@ -178,9 +178,9 @@
when: not ruby_dir.stat.exists
- name: Add Ruby 3.3.0 to the global PATH, for developer convenience
lineinfile:
dest: /etc/profile
line: 'PATH="/opt/ruby-3.3.0/bin:$PATH" # Added by impress deploy setup script'
copy:
dest: /etc/profile.d/ruby_path.sh
content: PATH="/opt/ruby-3.3.0/bin:$PATH"
- name: Install system dependencies for impress's Ruby gems
apt:
@ -444,7 +444,7 @@
weekday: "0" # Sunday
hour: "1" # 1:15am
minute: "15" # 1:15am
job: "cd /srv/impress/current && bin/rails public_data:commit[scheduled]"
job: "bash -c 'source /etc/profile && source ~/.bash_profile && cd /srv/impress/current && bin/rails public_data:commit[scheduled]'"
handlers:
- name: Reload nginx

View file

@ -30,6 +30,9 @@ namespace :public_data do
# Don't lock the database to do it!
args << "--single-transaction"
# Skip dumping tablespaces, so this requires fewer privileges.
args << "--no-tablespaces"
# Dump the public data tables from the primary database.
args << config.fetch(:database)
args += %w(species colors zones) # manual constants
@ -53,7 +56,7 @@ namespace :public_data do
# Link this latest dump as `latest.sql.gz`.
latest_path = Rails.configuration.public_data_root / "latest.sql.gz"
File.unlink(latest_path) if File.exist?(latest_path)
File.unlink(latest_path) if File.symlink?(latest_path)
File.symlink(dest_path, latest_path)
puts "Linked dump to #{latest_path}"

View file

@ -48,5 +48,6 @@
"dev": "yarn build:dev --watch",
"lint": "eslint app/javascript",
"prepare": "husky install"
}
},
"packageManager": "yarn@4.2.1"
}

Binary file not shown.

Binary file not shown.

2451
yarn.lock

File diff suppressed because it is too large Load diff