Skip to content

Always generate avatar - #6876

Merged
MorrisJobke merged 6 commits into
masterfrom
always_img_avatar
Dec 8, 2017
Merged

Always generate avatar#6876
MorrisJobke merged 6 commits into
masterfrom
always_img_avatar

Conversation

@rullzer

@rullzerrullzer commented Oct 19, 2017

Copy link
Copy Markdown
Member

@LukasReschke as discussed

Even if no avatar is set we should just generate the image. This to not
duplicate the code on all the clients. And only server images from the
avatar endpoint.

Todo:

  • Save avatar
  • Move this to the actual avatar code instead of the Controller

Future work:

  • use imgsrc so the browser fetches the right size on hdpi stuff
  • extend caching

@rullzerrullzer added this to the Nextcloud 13 milestone Oct 19, 2017
@codecov

codecovBot commented Oct 20, 2017

Copy link
Copy Markdown

Codecov Report

Merging #6876 into master will increase coverage by 0.03%.
The diff coverage is 81.19%.

@@ Coverage Diff @@## master #6876 +/- ##
============================================
+ Coverage 50.85% 50.89% +0.03% - Complexity 24539 24557 +18 
============================================
Files 1584 1584 Lines 93798 93891 +93 Branches 1358 1358 ============================================
+ Hits 47704 47788 +84 - Misses 46094 46103 +9
Impacted FilesCoverage ΔComplexity Δ
core/Controller/AvatarController.php81.16% <100%> (+2.64%)31 <0> (-1)⬇️
lib/private/Avatar.php78.08% <80.7%> (+1.77%)43 <18> (+19)⬆️
apps/files_trashbin/lib/Trashbin.php72.53% <0%> (+0.24%)136% <0%> (ø)⬇️
core/js/js.js63.55% <0%> (+0.56%)0% <0%> (ø)⬇️

@rullzer

Copy link
Copy Markdown
MemberAuthor

Ah mmm so upating the JS is a tiny bit tricky as there is also some code to handle unknown users etc.

@rullzer

Copy link
Copy Markdown
MemberAuthor

So @tobiasKaminsky this is what you wanted right?

@jancborchardt please checkout this branch and try to share etc. To see if there are no weird avatar hickups now.

@tobiasKaminsky

Copy link
Copy Markdown
Member

@rullzer this is great. So we can drop avatar generation once NC 12 has end of life :-)

LukasReschke
LukasReschke previously requested changes Nov 3, 2017
/**
* @NoAdminRequired
* @NoCSRFRequired
* @NoSameSiteCookieRequired

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you remove this? This is for example required when Collabora is embedding avatars since it runs under a different origin :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Good question

Comment threadlib/private/Avatar.php Outdated

$hsl = $this->rgbToHsl($rgb[0], $rgb[1], $rgb[2]);

// Classic formulla to check the brigtness for our eye

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/formulla/formula/

Comment threadlib/private/Avatar.php Outdated
* @param double $h Heu in range [0, 1]
* @param double $s Saturation in range [0, 1]
* @param double $l Lightness in range [0, 1]
* @return int[] Array containging r g b in the range [0, 255]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/containging/containing/

Comment threadlib/private/Avatar.php Outdated
}

/**
* @param double $h Heu in range [0, 1]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/Heu/Hue/ maybe?

throw new NotFoundException;
}

private function generateAvatar($userDisplayName, $size) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PHPDoc on the parameters would be awesome 😄

@rullzerrullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 29, 2017
Even if no avatar is set we should just generate the image. This to not
duplicate the code on all the clients. And only server images from the
avtar endpoint.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I made the font use semibold weight and made it a bit better centered, because it was slightly off.

@MorrisJobke

Copy link
Copy Markdown
Member

bildschirmfoto 2017-12-08 um 16 24 04

The only thing that may be a bit different is, that we now always have an avatar in the top right - cc @nextcloud/designers

@skjnldsv

Copy link
Copy Markdown
Member

I'm OK with that. This is also pretty nice for the top right menu list drop-down positioning issue we have here and there :)

@MariusBluem

Copy link
Copy Markdown
Member

I like always having the avatar at the top 👍

@MorrisJobke

Copy link
Copy Markdown
Member

Discussed with @LukasReschke on IRC and good to get in.

@MorrisJobke
MorrisJobke merged commit ed7beb9 into masterDec 8, 2017
@MorrisJobke
MorrisJobke deleted the always_img_avatar branch December 8, 2017 22:58
@MorrisJobke

Copy link
Copy Markdown
Member

@rullzer Seems to break the integration tests for sharing :/ See @danxuliu's comment in #6715 (comment)

@IvansssIvansss mentioned this pull request Dec 11, 2017
28 tasks
@rullzer

Copy link
Copy Markdown
MemberAuthor

I know. I have a patch for that already

@MorrisJobke

Copy link
Copy Markdown
Member

I know. I have a patch for that already

#7342

@jancborchardt

Copy link
Copy Markdown
Member

Hm, in the past @karlitschek and I discussed this with avatar placeholder in top right and we didn’t really like it as it’s very present and colorful. However it kind of nudges you to set a proper image, so I guess it’s fine after all. :)

@jancborchardt

Copy link
Copy Markdown
Member

Actually this causes a confusion with new users or installations. Cause in the top right the avatar is shown and not the settings icon, it is not immediately obvious where the settings are:

#7535

(When you are used to the UI and added a picture, you also know where the settings are.)

@MariusBluem

Copy link
Copy Markdown
Member

I disagree with you @jancborchardt ... this behaviour is known by the users from so many services ... not only by Nextcloud.

To make it crystal clear we could show some arrows with descriptions in the firstrunwizard :)

@jancborchardt

Copy link
Copy Markdown
Member

To make it crystal clear we could show some arrows with descriptions in the firstrunwizard :)

If it's known, we don't need a pointer for such an obvious menu in the first run wizard. ;)

@MorrisJobke

Copy link
Copy Markdown
Member

Actually this causes a confusion with new users or installations. Cause in the top right the avatar is shown and not the settings icon, it is not immediately obvious where the settings are:

I guess the main problem is, that we don't have an indicator for menus. On github they put for example a little arrow beside the avatar to indicate the menu:

bildschirmfoto 2017-12-16 um 12 32 18

@MariusBluem

Copy link
Copy Markdown
Member

Dropbox:
c3d27750-4e64-44d5-a824-f1ec369ab2b5

Microsoft:
dfcc7cd6-ef3d-4890-8162-c26912e8ee1f

No indicator ;)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@rullzer@tobiasKaminsky@MorrisJobke@skjnldsv@MariusBluem@jancborchardt@LukasReschke