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

FEAT(client): Message Thresholding #4808

Merged
merged 2 commits into from
May 31, 2021
Merged

Conversation

Skewjo
Copy link
Contributor

@Skewjo Skewjo commented Feb 28, 2021

Checks

This PR adds a new column named "Threshold" to the "Messages" settings tab to allow users to turn off message notifications when the server is above a certain number of users:
image

src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.ui Outdated Show resolved Hide resolved
src/mumble/Log.ui Outdated Show resolved Hide resolved
@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 1, 2021

Also, I haven't tested this functionality in any way, other than building & opening mumble to make sure the UI looked somewhat correct.

  • Is there a way I can mock a bunch of users on a server?
    • If not, is there a well-known server I can jump into to check it?
  • Do I need to write any unit tests for this functionality?

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Mar 1, 2021

Is there a way I can mock a bunch of users on a server?

You can use something like Botamusique to create a bunch of bots and let them join a locally hosted server

If not, is there a well-known server I can jump into to check it?

If you set the threshold low enough and @Natenom allows it, you could use his server (I'll not give out any server details before he agreed though)

Do I need to write any unit tests for this functionality?

As it stands we barely have any tests in the first place, so I don't see an easy way of adding test cases for this feature. We want to change that eventually but for now: no you don't have to

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 1, 2021

Also, here's what the new elements currently look like:
image

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Mar 1, 2021

I think it'd look better if the threshold column was moved one position to the left so that the Path column remains the last column. That way all checkboxes would stay grouped together ☝️

@Skewjo Skewjo marked this pull request as draft March 1, 2021 20:25
@Kissaki
Copy link
Member

Kissaki commented Mar 7, 2021

Can you please include a description of the (overall) changes and context in the PR description? This may be what is also written in an individual commit message. It should be enough context to get an overview for unfamiliar readers, and will land in the merge commit which again should be easy to digest to know what changed and why.

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 7, 2021

Can you please include a description of the (overall) changes and context in the PR description? This may be what is also written in an individual commit message. It should be enough context to get an overview for unfamiliar readers, and will land in the merge commit which again should be easy to digest to know what changed and why.

Yes, I'm going to clean up the commits after I'm done with my changes. It's just auto-pushing from my fork :/

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 7, 2021

@Krzmbrzl
I, mistakenly, installed a visual studio update before finishing this PR, and now my build process stays stuck at -- Qt5 component found: Widgets | Version: 5.15.2 for an hour or more (I've attempted to rebuild it 3 times now). ¯_(ツ)_/¯
So close, yet so far.
image

@davidebeatrici
Copy link
Member

Prune the build directory.

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Mar 7, 2021

And also try waiting. Start the build and then go have lunch or something. On Windows it can take forever for this to work out.

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 7, 2021

@davidebeatrici, sorry, not sure how to prune the build directory. Is pruning referring to modifying one of the CMakeLists.txt files or a special prune command I can pass to CMake maybe?

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 7, 2021

Ok... I've built it, the threshold settings save, and it works (but not for server connect and disconnect).

@Kissaki
Copy link
Member

Kissaki commented Mar 7, 2021

Try removing the out and src folder, and check them out again. This should remove any intermediate and broken files.

Then generate and make steps again.

@Skewjo Skewjo marked this pull request as ready for review March 7, 2021 22:44
@Skewjo Skewjo changed the title WIP Feat: Message Thresholding #2556 Feat: Message Thresholding #2556 Mar 7, 2021
@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 7, 2021

I'd like to see this polished a bit, but if I don't submit this PR now, I'm never going to finish it. I've checked the functionality for 2 different message types, but not all of them.

  • This functionality does not work for "Server Connected" or "Server Disconnected". (I'm guessing the functionality I'm using to get the current number of users on the server can't run before you're connected (or after you're disconnected). Those should likely be greyed out.
  • I'd like to make the qCheckBox (qcbMessageThreshold) and qSpinBox (qsbMessageThresholdUsers) part of the same UI component, but I believe that would involve changing the layout of the Misc. box from layout class="QVBoxLayout"" to layout class="QGridLayout" but that felt like an overreach.
    • The spinbox should probably be greyed out when the checkbox is unchecked.
  • I'm worried the name of the column ("threshold") is too generic and may get confused with other functionalities.

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Mar 8, 2021

This functionality does not work for "Server Connected" or "Server Disconnected". (I'm guessing the functionality I'm using to get the current number of users on the server can't run before you're connected (or after you're disconnected). Those should likely be greyed out.

It's definitely not possible for the Connected situation. And for the Disconnected one I can imagine the disconnect already having happened when this part of the code is reached.
But then again you don't get spammed by these messages anyways, since you will only get them once each.

I'd like to make the qCheckBox (qcbMessageThreshold) and qSpinBox (qsbMessageThresholdUsers) part of the same UI component, but I believe that would involve changing the layout of the Misc. box from layout class="QVBoxLayout"" to layout class="QGridLayout" but that felt like an overreach.

I think that'd be quite important to do in order to clarify the context. So changing the layout is fine

The spinbox should probably be greyed out when the checkbox is unchecked.

Yes

I'm worried the name of the column ("threshold") is too generic and may get confused with other functionalities.

It is rather cryptic, yes. I am having a hard time finding a better column header though. Maybe Limit might be better (with a tooltip of what exactly is being limited)?

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Mar 8, 2021

Note also that you have merge conflicts.

In order to resolve them, run git pull --rebase https://github.com/mumble-voip/mumble.git master and then resolve the merge conflicts as to https://www.freecodecamp.org/news/how-to-handle-merge-conflicts-in-git/

@Skewjo Skewjo force-pushed the master branch 2 times, most recently from 29e488d to 57ffe53 Compare March 13, 2021 20:42
@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 13, 2021

@Krzmbrzl

Holy guacamole, I think I'm finally done.

  1. Change to grid layout so the 2 buttons and text can be aligned ✅
  2. Make spinbox gray out when option is disabled ✅
  3. Added additional clarifying sentence to "Threshold" tooltip ✅

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

I think "Limit" is probably the better name for this feature.
a) It seems to be more easily understandable
b) It's shorter and thus the column header doesn't require as much space

In that spirit, I think you should rename all variables, setting keys and all UI strings that I might have overlooked to use "limit" instead of "threshold". Unless you disagree with that choice of course ☝️

src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
twi->setWhatsThis(ColStaticSound, tr("Click here to toggle sound notification for %1 events.<br />If checked, "
"Mumble uses a sound file predefined by you to indicate %1 events. Sound "
"files and Text-To-Speech cannot be used at the same time.")
.arg(messageName));
twi->setWhatsThis(ColStaticSoundPath,
tr("Path to sound file used for sound notifications in the case of %1 events.<br />Single "
tr("Path to sound file used for sound notifications in the case of %1 events.<br />Single "
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated change

Copy link
Contributor Author

@Skewjo Skewjo Mar 15, 2021

Choose a reason for hiding this comment

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

You guys don't follow the "boy scout" rule? 😛

Copy link
Member

Choose a reason for hiding this comment

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

It depends. Fixing this is fine, but it should be separated from the main changes. So if you wrap this up in its own FORMAT commit, then that'd be fine :)

src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.ui Outdated Show resolved Hide resolved
src/mumble/Log.ui Show resolved Hide resolved
src/mumble/Log.ui Outdated Show resolved Hide resolved
src/mumble/Log.ui Show resolved Hide resolved
@Skewjo Skewjo force-pushed the master branch 4 times, most recently from 42d35b7 to aad0f6b Compare March 30, 2021 19:00
@@ -223,6 +240,9 @@ void LogConfig::load(const Settings &r) {

#endif
qcbWhisperFriends->setChecked(r.bWhisperFriends);
qcbMessageLimit->setChecked(r.bMessageLimit);
qsbMessageLimitUsers->setDisabled(!r.bMessageLimit);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should resolve the uninitialized box issue.

@Kissaki
Copy link
Member

Kissaki commented Mar 30, 2021

From the column title “Threshold” I would expect it to be a message count or rate threshold, not a user count threshold. What do you think about qualifying it to “User Threshold” or some other terminology, like “User Limit” or “Max Users”?

There also seems to be no connection between the column and the setting below. I’m not sure if they are supposed to be connected or alternatives, but either way if they represent the same functionality they should use the same terminology.

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 30, 2021

Oh sorry, I thought I already changed that column header to be "Limit". Let me look again.

@Skewjo
Copy link
Contributor Author

Skewjo commented Mar 30, 2021

Yep, just needed to change the screenshot.

@Skewjo Skewjo requested a review from Krzmbrzl March 30, 2021 23:07
@Krzmbrzl
Copy link
Member

There also seems to be no connection between the column and the setting below. I’m not sure if they are supposed to be connected or alternatives, but either way if they represent the same functionality they should use the same terminology.

Yep that is a good point. We should probably simply have the checkboxes in the column and below only have the spin box for setting the user count at which limiting starts 🤔

@Skewjo
Copy link
Contributor Author

Skewjo commented Apr 6, 2021

There also seems to be no connection between the column and the setting below. I’m not sure if they are supposed to be connected or alternatives, but either way if they represent the same functionality they should use the same terminology.

Yep that is a good point. We should probably simply have the checkboxes in the column and below only have the spin box for setting the user count at which limiting starts 🤔

That should be easy enough.

@Skewjo
Copy link
Contributor Author

Skewjo commented Apr 9, 2021

Ok @Krzmbrzl, mind giving it another look?

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

Furthermore I think the menu entry for setting the user threshold for the limiting feature should be a simple form. Something like

Notification limit threshold: <spinBox> users

Also sorry for the delay. I didn't get to review this earlier.

src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Log.cpp Outdated Show resolved Hide resolved
src/mumble/Settings.cpp Outdated Show resolved Hide resolved
src/mumble/Settings.h Outdated Show resolved Hide resolved
src/mumble/Settings.cpp Outdated Show resolved Hide resolved
src/mumble/Settings.h Outdated Show resolved Hide resolved
@Skewjo
Copy link
Contributor Author

Skewjo commented May 4, 2021

Ok, @Krzmbrzl, I think we're good now. Sorry for the delay. Got a new job and have limited time to work on this issue.

@Skewjo
Copy link
Contributor Author

Skewjo commented May 30, 2021

Ok @Krzmbrzl, I've got 2 days to finish this thing. Any chance you could take a look at it some time today?

@Krzmbrzl Krzmbrzl added feature-request This issue or PR deals with a new feature client labels May 30, 2021
Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

The changes LGTM.

The only thing I notices was that when you select the Limit option for all messages, all checkboxes are checked as epxteced. However unchecking a single checkbox for a particular message then causes all boxes to go unnchecked again.
This is a general problem of that settings page though and as such unrelated to your changes. Thus that is fine :)

I rebased your PR against the latest master branch and also added the missing translation commit.

I assume you have tested these changes to work as expected?

@Krzmbrzl Krzmbrzl force-pushed the master branch 2 times, most recently from 1199969 to 4f49edc Compare May 30, 2021 16:05
@Krzmbrzl Krzmbrzl changed the title Feat: Message Thresholding #2556 FEAT(client): Message Thresholding May 31, 2021
Skewjo and others added 2 commits May 31, 2021 13:54
As requested in mumble-voip#2556, this commit implements the ability to turn off notifications when the server is hosting a number of clients defined by the user.

Implements mumble-voip#2556
@Krzmbrzl Krzmbrzl merged commit adf3859 into mumble-voip:master May 31, 2021
@Krzmbrzl
Copy link
Member

Thank you very much for your contribution 👍

@Skewjo
Copy link
Contributor Author

Skewjo commented May 31, 2021

You're welcome! Glad to have been able to help. Hoping to make some time to do some documentation PRs some time in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client feature-request This issue or PR deals with a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants