Skip to content

Avatars in share dialog #13866

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

Merged
merged 6 commits into from
Feb 17, 2015
Merged

Avatars in share dialog #13866

merged 6 commits into from
Feb 17, 2015

Conversation

rullzer
Copy link
Contributor

@rullzer rullzer commented Feb 3, 2015

As mentioned in #5506 and better illustrated in #3224 this PR add user avatars to the share dialog. Not int the auto complete list but of the users we have shared with. To add it to the autocompletelist probably requires some rework.

If a user does not have an avatar the placeholder image is shown so that formatting stays consistent.

@schiessle
Copy link
Contributor

Looks great. Let's merge this after the 8.0 release.

I wonder why you also added a avatar for the group shares. Up to now you can't set a avatar for a group.

If you share a file from user1 to user2 and then open the share drop-down for user2 on the shared file you see something like "Shared with you by user user1", would be nice to have the avatar there too.

@rullzer
Copy link
Contributor Author

rullzer commented Feb 6, 2015

@schiesbn I added the avatar also for the groups to make sure that the layout stayed the same. It can be trivially removed again of course. But in my opinion it looks better if they all indent the same amount.

I'll look into the extra avatar. Should not be to hard.

@DeepDiver1975 DeepDiver1975 added this to the 8.1-next milestone Feb 6, 2015
@schiessle
Copy link
Contributor

@rullzer makes sense, but then we also need a avatar for remote shares (aka server-to-server shares). With ownCloud 8 you will be able to share a file/folder to a user on another ownCloud server by adding something like <user>@<owncloud_server_url> to the share dialog. This share will be listed along the normal user and group shares.

snapshot1

Or you add a just some additional spacing for group and remote shares. I leave this decision to you, I think both is acceptable. Maybe @jancborchardt also has a opinion on this 😉

@rullzer
Copy link
Contributor Author

rullzer commented Feb 6, 2015

@schiesbn ah true I did not really play with remote shares that much. But indeed then that is required there as well. Shich would be rather easy to add. Lets see what @jancborchardt has to say. And then I can add it.

Of course the remote avatar would then just be the same as for the groups. Unless we have a fancy way to retrieve remote avatars.

@schiessle
Copy link
Contributor

Of course the remote avatar would then just be the same as for the groups. Unless we have a fancy way to retrieve remote avatars.

I think this would be OK as a first step. Of course it would be really cool if we could also get the avatar from the remote server.

@rullzer
Copy link
Contributor Author

rullzer commented Feb 6, 2015

We now also have remote avatars. Altough I could not fully test them since I do not have 2 ownlcoud 8 setups (yet).

@schiessle
Copy link
Contributor

We now also have remote avatars. Altough I could not fully test them since I do not have 2 ownlcoud 8 setups (yet).

Great! You should also be able to create a remote share from user1 to user2 with both on the same server. It doesn't make sense but it is useful for testing purpose.

@schiessle
Copy link
Contributor

If I have a server-to-server share in the list I get following syntax error in the JavaScript console (remote user us "schiesbn@vm/server1"):

Error: Syntax error, unrecognized expression: #avatar-remote-schiesbn-vm/server1

@rullzer
Copy link
Contributor Author

rullzer commented Feb 9, 2015

Aah mmm seems more filtering is needed. I'll have a look at it.

@jancborchardt
Copy link
Member

@rullzer nice! Just some remarks:

  • The avatars are quite small. As the row needs to have a certain height anyway, you can increase the size to 32*32px
  • Groups shouldn’t have an avatar, they don’t have that anywhere else either
  • But the names of groups and remote shares need to be indented as you mention above so that the text is properly aligned. So when there’s no avatar, shift them to the right via CSS.

Thanks! :)

@rullzer
Copy link
Contributor Author

rullzer commented Feb 10, 2015

@jancborchardt

  • I increased the avatar size. Looks better indeed.
  • Removed group avatars
  • Indented group shares

Currently we still have the placeholder for remote shares. Should that stay or go?

@jancborchardt
Copy link
Member

If the placeholder is the actual avatar of the user, then yes. If the remote user has an actual avatar, we should show that.

If showing the actual avatar of the remote user is not possible, then we should not show a placeholder on one end.

Thanks! :) (Also, please squash the commits into one again so it’s nicer after we merge it.)

@rullzer
Copy link
Contributor Author

rullzer commented Feb 10, 2015

@jancborchardt done.

It is currently not possible to get remote avatars. So that will be something for a future PR.

@jancborchardt
Copy link
Member

Looks great! 👍 @schiesbn can you also review it again?

@rullzer can you check out the errors from Jenkins and Scrutinizer?

@rullzer
Copy link
Contributor Author

rullzer commented Feb 11, 2015

So the problem with he build-bot are the unit tests. For some reason they fail... I have no clue why since as far as I know I do not touch the code responsible for the unit tests. I'll look into it in more depth soon.

@schiessle
Copy link
Contributor

Tested, looks great!

The failing tests are a problem wit our build-bot. I created a new dummy-pr to get a final test. Once it passes I will merge your PR.

@rullzer
Copy link
Contributor Author

rullzer commented Feb 12, 2015

@schiesbn well the unit test do also not pass locally. So I did break something.

@PVince81 as requested

PhantomJS 1.9.8 (Linux) OC.Share tests dropdown "sharesChanged" event triggers "sharesChanged" event when adding shares FAILED
        Expected false to equal true.
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:455
        TypeError: 'null' is not an object (evaluating 'handler.getCall(0).args')
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:456
PhantomJS 1.9.8 (Linux) OC.Share tests dropdown "sharesChanged" event triggers "sharesChanged" event when deleting shares FAILED
        Expected false to equal true.
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:469
        TypeError: 'null' is not an object (evaluating 'handler.getCall(0).args')
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:470
PhantomJS 1.9.8 (Linux) OC.Share tests dropdown "sharesChanged" event triggers "sharesChanged" event when toggling link share FAILED
        Expected false to equal true.
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:483
        TypeError: 'null' is not an object (evaluating 'handler.getCall(0).args')
            at /home/roeland/owncloud/core/core/js/tests/specs/shareSpec.js:484

@@ -681,6 +692,9 @@ OC.Share={
html += '</div>';
html += '</li>';
html = $(html).appendTo('#shareWithList');
if (shareType == OC.Share.SHARE_TYPE_USER) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use triple equals ===

@PVince81
Copy link
Contributor

Please do the following:

  • stub the function $.fn.avatar in beforeEach in shareSpec.js
  • add a new unit test to check if the avatar is loaded
    • check if the avatar stub was called with the right arguments
    • check the DOM to see if the avatar element is there

@rullzer
Copy link
Contributor Author

rullzer commented Feb 12, 2015

So the unit tests pass again!
Please review.

expect(avatarStub.calledOnce).toEqual(true);
var args = avatarStub.getCall(0).args;

expect($('#avatar-user1')[0]).toEqual(jasmine.anything());
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually do expect($('#avatar-user1').length).toEqual(1));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah that might look cleaner indeed

@PVince81
Copy link
Contributor

The code looks good, haven't tested yet.

@ghost
Copy link

ghost commented Feb 12, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/9339/

Build result: FAILURE

[...truncated 14 lines...] > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git2703028884527562311.credentials # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse refs/remotes/origin/pr/13866/merge^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/pr/13866/merge^{commit} # timeout=10Checking out Revision 9da1be0b58085f4a766226f38155c7fb1c1e0a3e (refs/remotes/origin/pr/13866/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f 9da1be0b58085f4a766226f38155c7fb1c1e0a3e > git rev-list 8da12e0f9ed71ad6ad9b15060f849e3179231733 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » SLAVEpull-request-analyser-ng-simple » SLAVE completed with result FAILURESetting status of ecb7d44 to FAILURE with url https://ci.owncloud.org/job/pull-request-analyser-ng-simple/9339/ and message: Merged build finished.
Test FAILed.

@PVince81
Copy link
Contributor

@rullzer I just remembered that there is an option in config.php to disable avatars.

Can you add this to your code as well ?
Basically: don't render the avatars if "enable_avatars" is false.
For the unit test you can simulate the config option, see the top of "shareSpec.js", it uses "oc_appconfig.core.someOption = someTestValue"

@rullzer
Copy link
Contributor Author

rullzer commented Feb 13, 2015

@PVince81 I added the checks and extended the unit tests.

@ghost
Copy link

ghost commented Feb 13, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/9390/

Build result: FAILURE

[...truncated 14 lines...] > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git6036363490301203250.credentials # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse refs/remotes/origin/pr/13866/merge^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/pr/13866/merge^{commit} # timeout=10Checking out Revision dccf9b71f33b336b55aa9c1580252dceb7fbd2bc (refs/remotes/origin/pr/13866/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f dccf9b71f33b336b55aa9c1580252dceb7fbd2bc > git rev-list 8da12e0f9ed71ad6ad9b15060f849e3179231733 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » SLAVEpull-request-analyser-ng-simple » SLAVE completed with result FAILURESetting status of 9a6da8e to FAILURE with url https://ci.owncloud.org/job/pull-request-analyser-ng-simple/9390/ and message: Merged build finished.
Test FAILed.

@scrutinizer-notifier
Copy link

The inspection completed: 8 new issues

@schiessle
Copy link
Contributor

Tests successfully passed here: #14144

👍 from my side.

@jancborchardt
Copy link
Member

Ok, so if the commits are squashed one more time into one this looks good to go! :)

@PVince81
Copy link
Contributor

I do wonder whether this needs more vertical spacing:
burger_sharing

@jancborchardt what do you think ?

@rullzer sorry for delaying the merge of this nice PR a bit more 😄

@rullzer
Copy link
Contributor Author

rullzer commented Feb 16, 2015

@PVince81 Hehe no problem. We have some time before 8.1 right :)

Anyway. I'm fine either way. Adding a bit more spacing is not that hard.
However I do not think extra vertical spacing is going to make it look nicer. It is probably better If all he permissions start at the same indentation. I'll try to get screen shots of both. But it will probably be later this week.

@PVince81
Copy link
Contributor

Anyway, I don't want to block this needlessly. The spacing wasn't that nice even before the avatars.

👍

PVince81 pushed a commit that referenced this pull request Feb 17, 2015
@PVince81 PVince81 merged commit e8f16db into owncloud:master Feb 17, 2015
@jancborchardt
Copy link
Member

Yeah, it’s a different issue. It doesn’t need vertical spacing, it needs a proper dropdown for the »create, edit, delete« actions ;)

Great job @rullzer! :)

@rullzer rullzer deleted the avatar_share_dialog branch May 22, 2015 11:50
@lock lock bot locked as resolved and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants