Skip to content

[TWEAK] Edit FlavorText and Rules#2661

Open
CrimeMoot wants to merge 2 commits intoAdventureTimeSS14:masterfrom
CrimeMoot:fix_meme
Open

[TWEAK] Edit FlavorText and Rules#2661
CrimeMoot wants to merge 2 commits intoAdventureTimeSS14:masterfrom
CrimeMoot:fix_meme

Conversation

@CrimeMoot
Copy link
Copy Markdown
Contributor

Описание PR

Убрано OOC описание, добавлены Правила в самом редакторе. Без их подтверждение, редактировать своё описание нельзя - придётся ознакомиться.

Техническая информация

  • Изменения были протестированы на локальном сервере, и всё работает отлично.
  • PR закончен и требует просмотра изменений.

Чейнджлог

🆑 CrimeMoot

  • add: Правила публикации и изменения описания персонажа
  • remove: Редактирование и отображение описания OOC, в том числе и при осмотре кого-то.
  • tweak: Без подтверждения того, что вы ознакомились с правилами описания персонажа, вы не сможете редактировать само описание.

@github-actions github-actions bot added Status: Needs Review size/M Changes: UI Изменение интерфейса Changes: Localization Изменение локализации labels Mar 27, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Walkthrough

Данное изменение удаляет функциональность OOC Notes из системы описания персонажей и добавляет новую систему правил описания. Удалены поле OOCNotes из CharacterFlavorComponent, UI элементы для OOC Notes из окна CharacterFlavorWindow и из редактора профиля. Добавлены новые UI компоненты FlavorTextRulesControl и FlavorTextRulesPopup с логикой принятия правил, которая блокирует редактирование других полей до принятия. Добавлены локализованные строки на английском и русском языках, а также прототип правил описания персонажа.

Possibly related PRs

Suggested reviewers

  • Schrodinger71
  • jungarikjan
  • Unlumy
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Название охватывает основное изменение PR (редактирование FlavorText и добавление Rules), но является довольно общим и не специфичным для ключевого требования о необходимости подтверждения правил.
Description check ✅ Passed Описание на русском языке связано с изменениями: удаление OOC описания, добавление правил и блокировка редактирования без подтверждения правил, что соответствует содержимому PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CrimeMoot
Copy link
Copy Markdown
Contributor Author

Интеграцию в БД не убирал, но по сути она не используется больше. Ибо боюсь сломать что.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs (1)

18-18: ⚠️ Potential issue | 🟡 Minor

Дублирующийся импорт.

Content.Client.Corvax.Sponsors уже импортирован в строке 5. Дубликат следует удалить.

-using Content.Client.Corvax.Sponsors;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs` at line 18, Remove the
duplicate using directive "using Content.Client.Corvax.Sponsors;" from
HumanoidProfileEditor.xaml.cs — keep only the single import declared earlier
(the one at the top of the file) so there are no repeated using statements;
simply delete the redundant line referencing Content.Client.Corvax.Sponsors.
🧹 Nitpick comments (2)
Content.Client/FlavorText/FlavorText.xaml.cs (1)

53-56: Рассмотрите вынесение значения таймера в константу.

Значение Timer = 5f является магическим числом. Для улучшения читаемости и упрощения изменений в будущем можно вынести его в константу.

♻️ Предлагаемое исправление
+    private const float RulesAcceptTimerSeconds = 5f;
+
     private void OpenRulesPopup()
     {
         if (_rulesPopup != null)
             return;

         _rulesPopup = new FlavorTextRulesPopup
         {
-            Timer = 5f
+            Timer = RulesAcceptTimerSeconds
         };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Content.Client/FlavorText/FlavorText.xaml.cs` around lines 53 - 56, Вынесите
"магическое" число таймера в константу: объявите приватную константу (например
private const float RulesPopupTimer = 5f) в классе и используйте её при
инициализации _rulesPopup вместо прямого литерала Timer = 5f; измените ссылку на
константу в конструкторе/инициализаторе и убедитесь, что имя константы понятно
(ссылаясь на FlavorTextRulesPopup, _rulesPopup и свойство Timer).
Content.Client/ADT/FlavorText/Rules/FlavorTextRulesControl.xaml.cs (1)

30-30: Возвращаемое значение TryAddMarkup не проверяется.

Метод TryAddMarkup возвращает boolfalse при ошибке парсинга (см. Content.Client/Guidebook/DocumentParsingManager.cs:54-88). Игнорирование этого значения может привести к тихому отказу без уведомления пользователя.

♻️ Предлагаемое исправление
-        _parsingMan.TryAddMarkup(RulesContainer, entry.Value);
+        if (!_parsingMan.TryAddMarkup(RulesContainer, entry.Value))
+        {
+            // Markup добавит GuidebookError при ошибке, дополнительная обработка опциональна
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Content.Client/ADT/FlavorText/Rules/FlavorTextRulesControl.xaml.cs` at line
30, Вызов _parsingMan.TryAddMarkup(RulesContainer, entry.Value) игнорирует
возвращаемое bool и может проглотить ошибки парсинга; оберните вызов проверкой
результата и обработайте false — например, записать подробный лог/сообщение об
ошибке с контекстом (какой entry/значение пытались распарсить) и/или показать
пользователю предупреждение/фоллбек, чтобы парсинг не падал молча; реализуйте
это прямо там, где вызывается TryAddMarkup, чтобы при false выполнить
логирование/уведомление и/или альтернативную обработку.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Content.Client/ADT/FlavorText/Rules/FlavorTextRulesPopup.xaml`:
- Around line 10-11: PanelContainer is currently self-closed so BoxContainer is
a sibling and does not inherit the windowPanel style; change PanelContainer from
a self-closing tag to an opening tag and move BoxContainer (and the rest of the
window content) inside it, then add the corresponding closing </PanelContainer>
so that StyleClasses="windowPanel" wraps the BoxContainer content; reference the
PanelContainer and BoxContainer elements and the StyleClasses="windowPanel"
attribute when making this change.

In `@Content.Client/FlavorText/FlavorText.xaml`:
- Line 66: The PlaceHolder="Вставьте сюда ссылку" in FlavorText.xaml is
hardcoded Russian text; add a localization key
flavor-interface-headshot-placeholder to the FTL files (e.g.,
Resources/Locale/ru-RU/... and en-US/...) with the corresponding translations,
then replace the inline PlaceHolder value in FlavorText.xaml with the
localization reference {Loc 'flavor-interface-headshot-placeholder'} so the XAML
uses the localized string instead of hardcoded text.

In `@Resources/Locale/en-US/ADT/preferences/ui/flavor-text.ftl`:
- Line 7: The message flavor-rules-wait currently uses a fixed "seconds" and
fails for singular; update the Fluent string for flavor-rules-wait to use a
plural/select expression based on $time (e.g., a Fluent plural variant with
[one] and [other]) so it emits "1 second" for one and "{ $time } seconds" for
other values; locate flavor-rules-wait in the FTL and replace the simple
interpolation with a pluralized expression using $time.

In `@Resources/Locale/ru-RU/ADT/Preferences/ui/flavor-text.ftl`:
- Line 7: The message key flavor-rules-wait uses a fixed genitive plural
"секунд" which is grammatically wrong for 1–4; update flavor-rules-wait to use a
Fluent plural/select expression over {$time} (or a selector) to provide correct
Russian forms (e.g., "1 секунду", "2/3/4 секунды", "5+ секунд") so the string
chooses the right case based on $time.

---

Outside diff comments:
In `@Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs`:
- Line 18: Remove the duplicate using directive "using
Content.Client.Corvax.Sponsors;" from HumanoidProfileEditor.xaml.cs — keep only
the single import declared earlier (the one at the top of the file) so there are
no repeated using statements; simply delete the redundant line referencing
Content.Client.Corvax.Sponsors.

---

Nitpick comments:
In `@Content.Client/ADT/FlavorText/Rules/FlavorTextRulesControl.xaml.cs`:
- Line 30: Вызов _parsingMan.TryAddMarkup(RulesContainer, entry.Value)
игнорирует возвращаемое bool и может проглотить ошибки парсинга; оберните вызов
проверкой результата и обработайте false — например, записать подробный
лог/сообщение об ошибке с контекстом (какой entry/значение пытались распарсить)
и/или показать пользователю предупреждение/фоллбек, чтобы парсинг не падал
молча; реализуйте это прямо там, где вызывается TryAddMarkup, чтобы при false
выполнить логирование/уведомление и/или альтернативную обработку.

In `@Content.Client/FlavorText/FlavorText.xaml.cs`:
- Around line 53-56: Вынесите "магическое" число таймера в константу: объявите
приватную константу (например private const float RulesPopupTimer = 5f) в классе
и используйте её при инициализации _rulesPopup вместо прямого литерала Timer =
5f; измените ссылку на константу в конструкторе/инициализаторе и убедитесь, что
имя константы понятно (ссылаясь на FlavorTextRulesPopup, _rulesPopup и свойство
Timer).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ae8b3459-84d2-4f59-a082-c4a18bbbac25

📥 Commits

Reviewing files that changed from the base of the PR and between 8fadbc6 and c74ccb0.

📒 Files selected for processing (16)
  • Content.Client/ADT/CharecterFlavor/CharacterFlavorWindow.xaml
  • Content.Client/ADT/CharecterFlavor/CharacterFlavorWindow.xaml.cs
  • Content.Client/ADT/FlavorText/Rules/FlavorTextRulesControl.xaml
  • Content.Client/ADT/FlavorText/Rules/FlavorTextRulesControl.xaml.cs
  • Content.Client/ADT/FlavorText/Rules/FlavorTextRulesPopup.xaml
  • Content.Client/ADT/FlavorText/Rules/FlavorTextRulesPopup.xaml.cs
  • Content.Client/FlavorText/FlavorText.xaml
  • Content.Client/FlavorText/FlavorText.xaml.cs
  • Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
  • Content.Server/Polymorph/Systems/PolymorphSystem.cs
  • Content.Server/Station/Systems/StationSpawningSystem.cs
  • Content.Shared/ADT/CharecterFlavor/CharacterFlavorComponent.cs
  • Resources/Locale/en-US/ADT/preferences/ui/flavor-text.ftl
  • Resources/Locale/ru-RU/ADT/Preferences/ui/flavor-text.ftl
  • Resources/Prototypes/ADT/Guidebook/rules.yml
  • Resources/ServerInfo/ADT/Guidebook/ServerRules/FlavorTextRules.xml
💤 Files with no reviewable changes (4)
  • Content.Client/ADT/CharecterFlavor/CharacterFlavorWindow.xaml.cs
  • Content.Server/Station/Systems/StationSpawningSystem.cs
  • Content.Server/Polymorph/Systems/PolymorphSystem.cs
  • Content.Shared/ADT/CharecterFlavor/CharacterFlavorComponent.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes: Localization Изменение локализации Changes: UI Изменение интерфейса size/M Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant