-
Notifications
You must be signed in to change notification settings - Fork 800
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
Fix #2243 #2245
Fix #2243 #2245
Conversation
6ac6443
to
28fab94
Compare
src/gui/tray/UserModel.cpp
Outdated
@@ -486,6 +486,11 @@ bool User::serverHasTalk() const | |||
return _account->hasTalk(); | |||
} | |||
|
|||
AccountApp *User::talkApp() const | |||
{ | |||
return _account->findApp(QLatin1String("spreed")); |
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.
You're merely moving code around here, but good opportunity to use QStringLiteral
instead of QLatin1String
here.
src/gui/tray/UserModel.cpp
Outdated
if(talkApp){ | ||
QDesktopServices::openUrl(talkApp->url()); | ||
} else { | ||
qCInfo(lcActivity) << "The Talk app was not found on the server."; |
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.
nitpick: I'd go for warning instead of info. It's not really supposed to happen, if we got in that else something was wrong in the caller.
src/gui/tray/UserModel.cpp
Outdated
if (!(url.contains("http://") || url.contains("https://"))) { | ||
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed"; | ||
auto talkApp = _users[_currentUserId]->talkApp(); | ||
if(talkApp){ |
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.
Missing space after if and before opening curly brace, should be: if (talkApp) {
src/gui/tray/UserModel.cpp
Outdated
@@ -655,7 +647,8 @@ Q_INVOKABLE void UserModel::openCurrentAccountTalk() | |||
if(talkApp){ | |||
QDesktopServices::openUrl(talkApp->url()); | |||
} else { | |||
qCInfo(lcActivity) << "The Talk app was not found on the server."; | |||
qCInfo(lcActivity) << "The Talk app is not enabled on " << | |||
_users[_currentUserId]->server(); |
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.
I'd say use currentUser()
instead of _users[_currentUserId]
.
src/gui/tray/UserModel.cpp
Outdated
QString url = _users[_currentUserId]->server(false) + "/apps/spreed"; | ||
if (!(url.contains("http://") || url.contains("https://"))) { | ||
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed"; | ||
auto talkApp = _users[_currentUserId]->talkApp(); |
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.
I'd say use currentUser()
instead of _users[_currentUserId]
. We're duplicating that logic everywhere inside UserModel
otherwise.
28fab94
to
69707a0
Compare
src/gui/tray/UserModel.cpp
Outdated
if (talkApp) { | ||
QDesktopServices::openUrl(talkApp->url()); | ||
} else { | ||
qCWarning(lcActivity) << "The Talk app is not enabled on " << |
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.
Somehow didn't notice it the previous time but you don't need the space before the closing double quote. They're added for you automatically, also you can probably have this on a single line.
src/gui/tray/UserModel.cpp
Outdated
QString url = _users[_currentUserId]->server(false) + "/apps/spreed"; | ||
if (!(url.contains("http://") || url.contains("https://"))) { | ||
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed"; | ||
auto talkApp = currentUser()->talkApp(); |
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.
nitpick: const auto
?
I live by aggressively using const ;-)
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.
"aggressively using const" would be a great tattoo or sticker.
src/gui/tray/UserModel.cpp
Outdated
@@ -871,9 +863,10 @@ void UserAppsModel::buildAppList() | |||
} | |||
|
|||
if (UserModel::instance()->appList().count() > 0) { | |||
auto talkApp = UserModel::instance()->currentUser()->talkApp(); |
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.
nitpick: const auto
69707a0
to
2179b45
Compare
/rebase |
Signed-off-by: Camila <hello@camila.codes>
- Remove repeated hard coded "spreed" string. Signed-off-by: Camila <hello@camila.codes>
#2243