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

Add banlist action to channel context menus #1858

Merged
merged 1 commit into from
Dec 21, 2017

Conversation

AlMcKinlay
Copy link
Member

No description provided.

@@ -133,6 +133,14 @@ $(function() {
data: target.data("id"),
});
}
if (target.hasClass("channel") && utils.hasUserModeInChannel($(`#chan-${target.data("id")}`))) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not 100% on when to show this item.

On the one hand, on all the irc servers I use, any user can view the banlist, so should we show it for everyone? On the otherhand, I thought that only people with some sort of privileges in the channel would have a reason to view it, so we should probably only show it for them.

Open to suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I see no reason to limit this to user modes, just display it to everyone.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice to not show it for regular people as makes the functionality more accessible where people now might not be aware of it being possible unless they run a channel. It might result in some soapboxing in some channels if people are made more aware of the banlist.

Technically there is no reason not to show it indeed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, my reasoning is 2-fold:

  1. It makes the context list busier when there's probably no reason for you to be calling the banlist if you aren't at least voiced
  2. Making it more accessible for users can lead to them unnecessarily calling it, and could lead to issues as explained by @creesch

If people think we should just show it for everything, that's fine. @astorije , what do you think with your UX hat on?

Copy link
Member

Choose a reason for hiding this comment

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

I can see both sides of the argument, but I am in favor of displaying it for normal users. I'll try to list my reasons here (don't see that as patronizing, I'm just too tired to gather thoughts properly and listing helps me compartimentalize :D).

  • Users can still send the /banlist command, so it's not like we're completely blocking the feature (though we could, but I don't think we should), we're just hiding it.
  • Adding a UI element for it helps with discoverability, which is nice.
  • The context menu becoming busier is a valid point, but at the moment we only have 1 real entry in there (2 if you count the entry that clicks on the target :) ) so I don't see that as an issue for now. We can for sure re-think that when it becomes a problem, and there are paradigms for that, such as grouping entries, or re-evaluate what we display in there.
  • You rightfully mention that this is primarily useful for "power users" or actually "voiced or op'ed users", which is a good reason why this shouldn't be in the main UI (i.e. constantly on the page, like Join a channel from the UI #1836 adds). But this is in a context menu, which is a good place where to put advanced features without burying them completely, I think.
  • Though it's clearly useful for voiced/op users, I can see how it's useful for regular users. Just like the question someone asked today "why would someone connect to the same network multiple times" (which is even less obvious IMO ahah), I'm sure there are plenty use cases for not being voiced on a channel you actively contribute/operate, or checking banlists on channels you don't operate, etc. In fact, I was working in a (private) team where no one was ever op or voiced to leave everyone on the same hierarchy level. Workflows 🤷‍♂️
  • Re: soapboxing (thanks, I learned a new word :D), I get what you're saying, but I don't think it's our business at least in this case. If we were a SaaS solution or something proprietary like that, I'd probably have a different point of view.

So yeah, I'd just display it :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Alrighty, you've convinced me, I'll enable it for everyone.

Should I remove the changes I made to the op function, or should I put that in a different PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have removed the changes to the op function and put them in #1864

@@ -48,6 +49,15 @@ function isOpInChannel(channel) {
return isOP;
Copy link
Member Author

Choose a reason for hiding this comment

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

As a side note, this only works for "op", doesn't work for "halfop" "owner", "admin" or anything else. So literally it tells you if a user is op, if the user is more privileged than op, it'll return false.

Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that is difficult is that afaik only op and voice are documented in IRC RFC documents. Things like halfop, owner and admin are IRCd specific implementations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, but we currently have some support for them, so we should probably deal with them in this somehow.

@@ -48,6 +49,15 @@ function isOpInChannel(channel) {
return isOP;
}

// Given a channel element will determine if the lounge user has a user mode other than norml
function hasUserModeInChannel(channel) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We could probably find a nice way to combine these functions (allow the user to pass in a minimum privilege to check for.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, I probably made the isOp function a it narrow in scope as I had a very specific target in mind. Maybe make it possible to pass an array of possible modes to check for so the result can just be passedArray.contains(userMode)

Copy link
Member Author

Choose a reason for hiding this comment

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

That could be a nice way to do it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, I've updated it to this, defaulting to all of the roles (other than normal). Let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup looks good to me, much more versatile.

output += templates.contextmenu_item({
class: "list",
action: "banlist",
text: "Show banlist",
Copy link
Member

Choose a reason for hiding this comment

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

Add a space in banlist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@AlMcKinlay AlMcKinlay force-pushed the yamanickill/context-menu-banlist branch 4 times, most recently from 2ea6dc1 to 7c33797 Compare December 19, 2017 16:43
output += templates.contextmenu_item({
class: "list",
action: "banlist",
text: "Show ban list",
Copy link
Member

Choose a reason for hiding this comment

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

Could you do "List banned users"? That is a bit more explanatory to me and fits better with the "List all channels" wording we did for #1802.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, done

package.json Outdated
@@ -22,7 +22,7 @@
"build": "webpack",
"watch": "webpack --watch",
"test": "npm-run-all --aggregate-output --parallel --continue-on-error test:* lint:*",
"test:mocha": "mocha --colors",
"test:mocha": "mocha --colors --require babel-polyfill --require babel-register",
Copy link
Member

Choose a reason for hiding this comment

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

Argh, running into that was bound to happen as we have more tests.
We can't do exactly that because that's babeling everything including server tests, and that means we could easily ship something incompatible with Node 4 or 6 on the server...

... But! I've been working on solving this and I'm almost there: #1726. There is one more dependency I rely on that needs releasing (the PR I opened to fix their repo is merged, they just need to release) but after that I'll be all set. That means that our client tests will run with the same config than our font-end builds, while the server tests remain unaffected.
I'm pretty excited about it because it brings a few good things, and opens the door to full-feature browser testing. Also I know it is not 100% ideal yet, but we can always improve from there.

(Also if they don't release before your PR is ready, we can find a workaround to not block your PR on it!)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's a valid reason.

But ... Surely the easiest solution is just having 2 different run configurations for client and server tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

(this is now out of this pr and in #1864)

Copy link
Member

Choose a reason for hiding this comment

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

But ... Surely the easiest solution is just having 2 different run configurations for client and server tests?

That is pretty much what #1726 does, with test configuration running behind the (almost) same Webpack config than our client builds.

@AlMcKinlay AlMcKinlay force-pushed the yamanickill/context-menu-banlist branch from 7c33797 to 5084037 Compare December 20, 2017 09:53
@xPaw xPaw added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Dec 20, 2017
@xPaw xPaw added this to the 2.7.0 milestone Dec 20, 2017
Copy link
Member

@astorije astorije left a comment

Choose a reason for hiding this comment

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

Nice!

@astorije astorije merged commit 31f1c2b into master Dec 21, 2017
@astorije astorije deleted the yamanickill/context-menu-banlist branch December 21, 2017 01:13
@astorije astorije changed the title Add banlist context menu item if user isn't normal user Add banlist action to the context menu Dec 21, 2017
@astorije astorije changed the title Add banlist action to the context menu Add banlist action to channels' context menu Dec 21, 2017
@astorije astorije changed the title Add banlist action to channels' context menu Add banlist action to channel context menus Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants