-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Prevent false-positive when matching dark themes #24133
Prevent false-positive when matching dark themes #24133
Conversation
Note: I signed a DCO, not a CLA as the bot above indicates. |
@@ -499,9 +499,12 @@ std::optional<bool> IsDarkMode() { | |||
|
|||
result = false; | |||
|
|||
if (gtkThemePortalString.contains( | |||
if (gtkThemePortalString.endsWith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in sync with the xesttings part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to create a helper function in private namespace? IsGtkDarkTheme or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool IsGtkDarkTheme(const QString &theme) {
const auto themeLower = theme.toLower();
return themeLower.contains(qsl("-dark-")) || themeLower.endsWith(qsl("-dark"));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in private namespace
I'm not very familiar with C++ and I'm not sure about this bit.
You can squash all commits to the first one. 👌 |
Squashed! |
I'm curious, why this: if (IsGtkDarkTheme(gtkThemePortalString)) {
result = true;
return result;
} Instead of: if (IsGtkDarkTheme(gtkThemePortalString)) {
return true;
} Also, - std::optional<bool> result;
+ std::optional<bool> result = false; |
We're checking all the APIs and return as soon as at least one of them returns dark mode
The default value of |
@WhyNotHugo what's DCO? |
@WhyNotHugo I see, Developer Certificate of Origin. The point of the CLA is to give the submitted work to the public domain so that if I need to do any relicensing in the future I won't need to contact all the people who sent PRs here. |
Hmm, upon further inspection, there's a lot of inconsistency here:
I had missed the discrepancy between title and body the previous time. Isn't it misleading to call it a DCO if the text is entirely different and has different goals? I'm also a bit confused about the implications here: Telegram is distributed under the GPL, but if all developers have signed this agreement, doesn't that imply that it's fully been released into public domain?
I'm familiar. Using a CLA in this style is quite common for open source projects that later want to turn into a non-open source or non-free project. |
@WhyNotHugo Yes, for example I've maintained a closed source version for Telegram Support volunteers, that was later merged into the current open source version. But still I leave a possibility for something like that to happen again. Sorry, it is what it is. There are no plans to close the source code of any Telegram app (all the apps and the client side libraries for building other apps, like TDLib, are open source and this is not planned to be changed). But still I need the full control of the source code, sorry. |
Perhaps the phrasing could be improved indeed. |
@WhyNotHugo if you don't agree with the CLA, maybe it's better to close the PR? |
Oh, pretty sure I did accept it, I'll do that again. |
Including the document in the repo too would probably be good enough, making it a lot less confusing/ambiguous what people agreed to. Especially since the ACTUAL body of the agreement is hosted externally and all references made by the bot are are not quite accurate. |
So, will you sign? |
Maybe try something similar to this: cla-assistant/cla-assistant#243 (comment) |
@vimpostor Thanks for the hint. It looks like https://cla-assistant.io/telegramdesktop/tdesktop should work. I though the CLA Assitant was down again: Apparently not, it loads the body via an XHR call which takes 26 seconds to load: Given that the page loads in under 2 seconds, it never occurred to me that there was an artificial delay of 26 seconds before someone could read the agreement. There's no clue that one has to wait (and I'm curious why that wait is enforced). For the record, the CLA currently reads:
I do still believe that having the document in-repo would be a simpler and more transparent approach. |
I agree but I guess the advantage of the current approach is that Preston can see directly in the PR if someone signed the CLA. If you put the CLA just in the repo, you would also need to require every contributor to signoff their commit (similar to the Linux Kernel) with |
Given 17fcc72, this is no longer relevant. Thanks @ilya-fedin for implementing that! 🍻 |
References: #17061