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

Implement channel archiving #103

Merged
merged 6 commits into from
Mar 6, 2021
Merged

Implement channel archiving #103

merged 6 commits into from
Mar 6, 2021

Conversation

cblgh
Copy link
Member

@cblgh cblgh commented Feb 22, 2021

This PR implements support for archiving of channels, see more background info in cabal-club/cabal-client#68 and cabal-club/cabal-client#16.

Archiving a channel is intended to hide the channel from channel browsers, and support for this will be added in cabal-client once this is finished & after this is merged. Only moderators or admins are allowed to archive channels—the local user is always allowed to archive channels, as they are always regarded as an admin in our subjective moderation system.

Copy link
Member

@hackergrrl hackergrrl left a comment

Choose a reason for hiding this comment

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

Nicely done @cblgh! This looks really good :)

ops.push({
type: 'put',
key: `archive!${channel}!${key}`,
value: `${reason}`
Copy link
Member

@hackergrrl hackergrrl Feb 22, 2021

Choose a reason for hiding this comment

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

For future development, it might be easier to store the sequence number here instead of duplicating the reason field, and then pull up that msg when answering a query. That way, if we want to add any additional data to archiving ops in the future, they too won't need to be duplicated in index storage.

EDIT: Realized that the value isn't being used right now anyways. Maybe let's just write the seq# for now (so it's recorded going forward) and we can always add logic to grab the reason etc in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed this! i saved the key@seq cause i figure that would save a concatenation step during lookup, lmk if that's silly and i'll just save the seq~

views/channel-archiving.js Outdated Show resolved Hide resolved
the second index keeps track of explicitly **unarchived** channels.
rationale: the local user's unarchived channels should take precedence
in the local view over any archiving decisions made by other moderators.

this second index would not be needed if we could query the moderation
view at indexing time, alas that is not meant to be (atm)
@cblgh cblgh merged commit ad4f750 into master Mar 6, 2021
@cblgh
Copy link
Member Author

cblgh commented Mar 6, 2021

published as cabal-core@13.2.0 💖

@ralphtheninja ralphtheninja deleted the channel-archiving branch September 20, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants