Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port] Ru Keycodes / Русские Ключи Радиоканалов #67

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

Spatison
Copy link
Member

Описание PR

Описание.


Медиа

image


Изменения

🆑 Spatison

  • add: Added ru keycodes / Добавлены русские ключи радиоканалов

Copy link
Contributor

coderabbitai bot commented Sep 22, 2024

Walkthrough

The pull request introduces significant changes to the handling of radio channels across various components. Key modifications include the transition from single key codes to lists of key codes for radio channels, allowing for multiple character associations. This change is reflected in the RadioChannelPrototype class and its associated configuration files. Additionally, the handling of key codes in the SharedChatSystem has shifted from a frozen dictionary to a mutable dictionary, enhancing flexibility. The construction of keys in the EncryptionKeySystem has also been updated to accommodate multiple key codes.

Changes

Files Change Summary
Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs Modified message sending logic to use the first key code from a list instead of a single key code.
Content.Shared/Chat/SharedChatSystem.cs Changed _keyCodes from FrozenDictionary to Dictionary for mutability; updated CacheRadios method for dynamic key code handling.
Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs Updated AddChannelsExamine method to construct keys using multiple key codes instead of a single key code.
Content.Shared/Radio/RadioChannelPrototype.cs Changed KeyCode property to KeyCodes, now a list of characters, allowing multiple key codes per radio channel.
Resources/Prototypes/DeltaV/radio_channels.yml Updated keycode definitions for "Justice" and "Prison" channels to use list format for multiple key codes.
Resources/Prototypes/radio_channels.yml Modified keycode entries for various channels to list format, adding corresponding Cyrillic characters for each.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f1cc259 and ea1a240.

Files selected for processing (6)
  • Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs (2 hunks)
  • Content.Shared/Chat/SharedChatSystem.cs (3 hunks)
  • Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs (1 hunks)
  • Content.Shared/Radio/RadioChannelPrototype.cs (1 hunks)
  • Resources/Prototypes/DeltaV/radio_channels.yml (1 hunks)
  • Resources/Prototypes/radio_channels.yml (3 hunks)
Additional comments not posted (16)
Resources/Prototypes/DeltaV/radio_channels.yml (2)

13-15: LGTM!

Similar to the Justice radio channel, the change from a single keycode to a list of keycodes, including the Cyrillic character 'з', is a good enhancement to support Russian keycodes.


4-6: Verify the impact of the keycode change on the codebase.

The change from a single keycode to a list of keycodes is a good enhancement to support multiple character associations, especially the addition of the Cyrillic character 'ю' for Russian-speaking users.

Please ensure that the codebase is updated to handle the list of keycodes instead of a single keycode. You can use the following script to search for potential areas that may need to be updated:

Verification successful

Re-run the search with the corrected keycode pattern.


Keycode changes have been successfully verified across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for potential areas in the codebase that may need to be updated to handle the list of keycodes.

# Test: Search for usage of the `keycode` field. Expect: Occurrences that assume a single keycode value.
rg --type yaml -A 5 $'keycode:'

Length of output: 30


Script:

#!/bin/bash
# Description: Search for all usages of `keycodes` field to ensure the codebase handles it as a list.

# Test: Search for instances where `keycodes` is used. Expect: References to a list of keycodes.
rg --type yaml 'keycodes:'

Length of output: 898

Resources/Prototypes/radio_channels.yml (10)

4-5: LGTM!

The change to convert keycode to a list format for the Common radio channel looks good. It provides flexibility for future additions while preserving the existing keycode.


12-14: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'ц' for the CentCom radio channel looks good. It provides support for Russian users while preserving the existing keycode.


22-24: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'к' for the Command radio channel looks good. It provides support for Russian users while preserving the existing keycode.


31-33: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'и' for the Engineering radio channel looks good. It provides support for Russian users while preserving the existing keycode.


40-42: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'м' for the Medical radio channel looks good. It provides support for Russian users while preserving the existing keycode.


49-51: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'н' for the Science radio channel looks good. It provides support for Russian users while preserving the existing keycode.


58-60: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'о' for the Security radio channel looks good. It provides support for Russian users while preserving the existing keycode.


67-69: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'в' for the Service radio channel looks good. It provides support for Russian users while preserving the existing keycode.


76-78: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'с' for the Supply radio channel looks good. It provides support for Russian users while preserving the existing keycode.


85-87: LGTM!

The change to convert keycode to a list format and add the Cyrillic keycode 'т' for the Syndicate radio channel looks good. It provides support for Russian users while preserving the existing keycode.

Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs (1)

79-79: Verify the assumption and consider the user experience impact.

The change assumes that radioChannelProto.KeyCodes is a non-empty collection. Please ensure this is always the case to avoid potential exceptions.

Also, consider the impact on user experience if multiple key codes are available for a radio channel but only the first one is used in the message. It might lead to inconsistencies or confusion for users expecting to use other key codes.

To verify the assumption, run the following script:

Content.Shared/Chat/SharedChatSystem.cs (2)

60-70: LGTM!

The modifications to the CacheRadios method improve its robustness by:

  • Clearing the _keyCodes dictionary before populating it, ensuring stale entries are removed.
  • Iterating through RadioChannelPrototype instances to populate the dictionary based on the current state of the prototypes.
  • Checking for duplicate keycodes using _keyCodes.ContainsKey to prevent overwriting existing entries.

The changes provide a more dynamic and reliable approach to maintaining the _keyCodes dictionary.


42-42: Ensure the mutable nature of _keyCodes is handled correctly.

The change from FrozenDictionary to Dictionary for _keyCodes allows for mutable operations, which seems to be the intention based on the modifications in the CacheRadios method.

Please ensure that the mutable nature of the dictionary is handled correctly throughout the codebase to avoid unintended modifications.

Run the following script to verify the usage of _keyCodes:

Verification successful

Verified that _keyCodes is only modified within CacheRadios.

No further modifications to _keyCodes were found outside of the CacheRadios method.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `_keyCodes` is not modified outside of `CacheRadios`.

# Test: Search for modifications to `_keyCodes`. Expect: Only in `CacheRadios`.
rg --type cs -A 5 $'_keyCodes\s*='

Length of output: 531

Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs (1)

227-227: LGTM!

The change to the construction of the key variable aligns with the overall shift towards supporting multiple key codes for radio channels. It allows for associating multiple key codes with a channel, providing flexibility in key assignments.

Content.Shared/Radio/RadioChannelPrototype.cs Show resolved Hide resolved
@Remuchi Remuchi merged commit 43f1564 into master Sep 23, 2024
12 checks passed
@Remuchi Remuchi deleted the ru-keycodes branch September 23, 2024 02:57
riddleridou added a commit that referenced this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants