Merge lp:~mzanetti/telegram-app/avatar-spinner into lp:telegram-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Michał Karnicki
Approved revision: 162
Merged at revision: 159
Proposed branch: lp:~mzanetti/telegram-app/avatar-spinner
Merge into: lp:telegram-app
Diff against target: 30 lines (+6/-0)
1 file modified
telegram/app/qml/ClickableContactImage.qml (+6/-0)
To merge this branch: bzr merge lp:~mzanetti/telegram-app/avatar-spinner
Reviewer Review Type Date Requested Status
Michał Karnicki (community) Approve
Review via email: mp+287868@code.launchpad.net

Commit message

don't start the spinner if we don't have anything to fetch

Description of the change

This is a "fix" for the issue that victor found in QA today.

The issue was that when clicking the avatar of some contact details page (or the settings page), the app tries to load the big image from the network and displays a spinner for that. Now the problem was, that this was triggered even when there is no profile picture, in which case the spinner just keeps on spinning forever. In the account settings page, this even suggests that it would try to open content hub for importing a picture and keeps the user waiting forever.

We could probably improve this and actually open the content hub, however, this component is used also when you view another contact's details in which case we can't set the image so it's not 100% straight forward. This patch at least doesn't start the spinner if we don't have anything to fetch from the network and doesn't keep the user waiting.

Importing a new avatar is, after all, done from the toolbar icon for that.

To post a comment you must log in.
Revision history for this message
Michał Karnicki (karni) wrote :

Thank you :D

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'telegram/app/qml/ClickableContactImage.qml'
2--- telegram/app/qml/ClickableContactImage.qml 2015-09-22 09:57:07 +0000
3+++ telegram/app/qml/ClickableContactImage.qml 2016-03-03 00:56:34 +0000
4@@ -8,6 +8,7 @@
5 height: 62
6
7 property FileLocation photoBigLocation: isChat ? chat.photo.photoBig : user.photo.photoBig
8+ property FileLocation photoSmallLocation: isChat ? chat.photo.photoSmall : user.photo.photoSmall
9
10 signal clicked(string path)
11
12@@ -32,6 +33,10 @@
13 cursorShape: Qt.PointingHandCursor
14 visible: user.id != telegram.cutegramId
15 onClicked: {
16+ if (smallFilePath.length == 0) {
17+ return;
18+ }
19+
20 if(filePath.length == 0) {
21 loadingPhoto = true
22 telegram.getFile(photoBigLocation)
23@@ -42,6 +47,7 @@
24
25 property bool loadingPhoto: false
26 property string filePath: photoBigLocation.download.location
27+ property string smallFilePath: photoSmallLocation.download.location
28
29 onFilePathChanged: {
30 if(!loadingPhoto)

Subscribers

People subscribed via source and target branches

to status/vote changes: