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

improve user feedback when interacting with moderation #52

Merged
merged 9 commits into from
Jun 10, 2020

Conversation

cblgh
Copy link
Member

@cblgh cblgh commented Jun 4, 2020

this pr adds

  • /actions - list historic actions by you or your currently applied moderators
  • /roles - shows the admins/mods you have applied atm
  • new virtual message type: chat/moderation see Sort hidden users to bottom of user pane, prefix their names with minus sign cabal-cli#192 for how it is used cc @nikolaiwarner
  • adds support for displaying realtime moderation actions by other moderators/admins, see cabal-cli pr above for what that looks like
  • fixes a bug with setFlag, also reverts _setFlag to return a stream instead of promise
  • fixes ordering of virtual messages (they weren't being sorted properly before)
  • adds better user feedback for various moderation actions

@cblgh cblgh marked this pull request as draft June 4, 2020 18:42
Comment on lines 676 to 693
const promises = [this.moderation.getAdmins(), this.moderation.getMods()]
// get all moderation actions issued by our current mods & admins
Promise.all(promises).then(results => {
const keys = results[0].concat(results[1])
keys.forEach(key => {
const write = (row, enc, next) => {
if (!row) return
const name = this.users[key].name || key.slice(0, 8)
const target = this.users[row.content.id].name || row.content.id.slice(0, 8)
const action = row.type.split("/")[1]
const reason = row.content.reason
const role = row.content.flags[0]
const text = `${name} ${action === "remove" ? "removed" : "added"} ${target} as ${role} ${reason ? "reason: " + reason : ''}`
this.addStatusMessage({ text, timestamp: row.timestamp })
next()
}
const end = (next) => { next() }
pump(this.core.moderation.listModerationBy(key), to.obj(write, end))
Copy link
Member Author

@cblgh cblgh Jun 4, 2020

Choose a reason for hiding this comment

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

i might just skip this logic fwiw; what it does is it prints out all moderation actions that occured for all yr mods/admins on first startup of cabal

@cblgh
Copy link
Member Author

cblgh commented Jun 10, 2020

sorry about the wacky indentation, was trying a new thing in vim. looks like all that was being changed in my editor was purely visual; i'll run standard before releasing

@cblgh cblgh marked this pull request as ready for review June 10, 2020 07:28
@cblgh cblgh merged commit b58edfe into master Jun 10, 2020
@ghost ghost mentioned this pull request Jun 13, 2020
36 tasks
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.

1 participant