Skip to content

Improve the archive command#303

Merged
MattyTheHacker merged 62 commits intomainfrom
archive-upgrade
Apr 20, 2025
Merged

Improve the archive command#303
MattyTheHacker merged 62 commits intomainfrom
archive-upgrade

Conversation

@MattyTheHacker
Copy link
Copy Markdown
Member

No description provided.

@MattyTheHacker MattyTheHacker self-assigned this Aug 6, 2024
@MattyTheHacker MattyTheHacker added enhancement New feature or request refactor Improvements to the codebase that do not directly affect users labels Aug 6, 2024
Copy link
Copy Markdown
Member

@CarrotManMatt CarrotManMatt left a comment

Choose a reason for hiding this comment

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

Please can you provide more information about why all of the fine-grained permissions have been removed? The existing functionality ensures that the channel/category retains the correct committee permissions after archiving.

Comment thread cogs/archive.py
Comment thread cogs/archive.py
@MattyTheHacker
Copy link
Copy Markdown
Member Author

The issue around users being able to see names of channels that are committee only isn't an issue, because the stats command does the same as does statbot

@MattyTheHacker
Copy link
Copy Markdown
Member Author

Also not sure what you mean about the permissions - this method syncs permissions to the archive channel which handles all the permissions automatically for all the channels in that category, doing it one by one in this cog is unnecessary.

@MattyTheHacker MattyTheHacker enabled auto-merge (squash) January 1, 2025 21:31
@CarrotManMatt
Copy link
Copy Markdown
Member

CarrotManMatt commented Jan 1, 2025

The issue around users being able to see names of channels that are committee only isn't an issue, because the stats command does the same as does statbot

Just because other places make some poor security decisions, doesn't mean everywhere should. I think our stats command should eventually be removed/have this viewing bug fixed (eventually™). Can the additional check you added of making sure the term archive isn't within the channel name, just be added to the current permissions checks? Is there any performance/valid usability reason for not doing the check to see if the user can view the autocomplete-suggested channel name?

Copy link
Copy Markdown
Member

@CarrotManMatt CarrotManMatt left a comment

Choose a reason for hiding this comment

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

  • On line 36, autocomplete_get_categories() method should be renamed to autocomplete_get_non_archival_categories()
  • Retrieval of the destination category in the archive-channel command should only be done after the checks for the selected channel are completed, rather than happening at the same time

After completing a more thorough review I do now see why the commands have to be separate, however I still also believe the UX may need some improvement as it's not entirely obvious from the outset as to how these should be used without understanding the implementation.

I'll be happy to approve and merge (after the requested changes in this review of course) without the improvements to the UX, but if you have any ideas they would be appreciated.

Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py
MattyTheHacker and others added 2 commits April 18, 2025 22:03
Co-authored-by: Matt Norton <matt@carrotmanmatt.com>
Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the archiving functionality by refactoring the archive command into two distinct commands—one for archiving categories and one for channels—and by updating autocomplete functions accordingly.

  • Renames and refactors the archive command to archive-category and archive-channel.
  • Introduces new autocomplete functions for non-archival and archival categories, and for non-archived channels.
  • Adds an option to allow archivist access for archived categories.

Comment thread cogs/archive.py Outdated
Comment thread cogs/archive.py
@MattyTheHacker MattyTheHacker merged commit 616f403 into main Apr 20, 2025
9 checks passed
@MattyTheHacker MattyTheHacker deleted the archive-upgrade branch April 20, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Improvements to the codebase that do not directly affect users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make /archive command archive single channel

3 participants