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

Channel archiving #74

Merged
merged 14 commits into from
Mar 6, 2021
Merged

Channel archiving #74

merged 14 commits into from
Mar 6, 2021

Conversation

cblgh
Copy link
Member

@cblgh cblgh commented Feb 22, 2021

This PR adds implements support for channel archiving, enabling people to hide channels from being listed. This can be useful for abuse mitigation as well as handling mistakenly created channels, or cleaning up unused ones.

The system is centered around the subjective moderation system. This means that:

  1. the local user can always archive/restore channels (you are always an admin from your own perspective)
  2. the local user's moderators and admins will have their archiving actions be applied to the local user's view
  3. if rando mcrando archives a channel, it will have no effect for the local user (unless the above applies)
  4. people can still join & talk in archived channels, they will just be hidden from channel listings

Currently implemented commands:

/archives, /archived
    view the list of currently archived channels
/archive <channel name>
    archive <channel name>
/unarchive, /restore <channel name>
    restore <channel name> from the archives

This closes #68 and is related to #16. It is also dependent on merging cabal-club/cabal-core#103.

Copy link
Contributor

@lykkin lykkin left a comment

Choose a reason for hiding this comment

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

👁️ 👄 👁️

src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Outdated Show resolved Hide resolved
src/cabal-details.js Show resolved Hide resolved
@cblgh cblgh force-pushed the channel-archiving branch 2 times, most recently from b5f7c7e to fc6ff85 Compare February 28, 2021 21:44
@cblgh
Copy link
Member Author

cblgh commented Mar 6, 2021

dunno why the tests are failing, cabal-core's pass

from cabal-client's ci error above

> [email protected] test /home/travis/build/cabal-club/cabal-client
> tape test/*.js

TAP version 13
# create a cabal
ok 1 cabal created ok
ok 2 should be equivalent
ok 3 should be equivalent
/home/travis/build/cabal-club/cabal-client/node_modules/leveldown/leveldown.js:119
    throw new Error('cannot call iterator() before open()')
    ^

Error: cannot call iterator() before open()
    at LevelDOWN._iterator (/home/travis/build/cabal-club/cabal-client/node_modules/leveldown/leveldown.js:119:11)
    at LevelDOWN.AbstractLevelDOWN.iterator (/home/travis/build/cabal-club/cabal-client/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:280:15)
    at SubDown._iterator (/home/travis/build/cabal-club/cabal-client/node_modules/subleveldown/leveldown.js:181:47)
    at SubDown.AbstractLevelDOWN.iterator (/home/travis/build/cabal-club/cabal-client/node_modules/abstract-leveldown/abstract-leveldown.js:280:15)
    at new Iterator (/home/travis/build/cabal-club/cabal-client/node_modules/encoding-down/index.js:116:19)
    at DB._iterator (/home/travis/build/cabal-club/cabal-client/node_modules/encoding-down/index.js:102:10)
    at DB.AbstractLevelDOWN.iterator (/home/travis/build/cabal-club/cabal-client/node_modules/abstract-leveldown/abstract-leveldown.js:280:15)
    at LevelUP.readStream.LevelUP.createReadStream (/home/travis/build/cabal-club/cabal-client/node_modules/levelup/lib/levelup.js:318:37)
    at LevelUP.keyStream.LevelUP.createKeyStream (/home/travis/build/cabal-club/cabal-client/node_modules/levelup/lib/levelup.js:323:15)
    at /home/travis/build/cabal-club/cabal-client/node_modules/cabal-core/views/channels.js:44:15

edit: kira helped me debug ^__^ massively refactored CabalDetails._initialize to account for race conditions & only call done when all the callbacks are actually done. Moved the callbacks into their own file in src/initialization-callbacks.js.

@cblgh cblgh merged commit 7a704c9 into master Mar 6, 2021
@cblgh
Copy link
Member Author

cblgh commented Mar 6, 2021

published [email protected]

@cblgh cblgh mentioned this pull request Mar 14, 2021
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.

Allow mods to archive channels
2 participants