Review main Merged

41780[FEATURE] Introduce AvatarProvider

Nicole Hummel CR +2 V +2 Hard +363 −59 updated 08/14/15, 08:00

Commit message

To make providing a avatar image for BE users more flexible a proper API
is needed to be able to register different AvatarProviders.

Review

  • Code review CR +2
    • Andreas Kienast +2
    • Stefan Neufeind +1
    • Markus Klein +1
  • Verified V +2
    • Andreas Kienast +2
    • Markus Klein +1

Issues 1

Files 7

Review log 63

Show 38 earlier messages
  1. Nicole Hummel uploaded patch set 1 07/21/15, 15:01

  2. Christian Kuhn commented on patch set 1 CR +1 V +1 07/21/15, 17:11

    Nice. works as expected, verified with demo extension :>)
  3. Christian Kuhn commented on patch set 1 07/21/15, 17:21

    ah ... maybe a .rst file for the hook to explain this could be useful for eg. gravatar? maybe even link to the forge issue for an example implementation?
  4. Benjamin Kott commented on patch set 1 07/21/15, 18:26

    Would it not be more nice to have the Gravatar feature in the core as fallback if no image is set?
  5. Benjamin Kott commented on patch set 1 07/21/15, 18:27

    Maybe it would also make sense to have some kind of "Providers" for the Avatar Image instead of a hook.
  6. Frans Saris commented on patch set 1 07/21/15, 20:36

    My first thought was also a registry so you can define a priority to the registered providers. But maybe a hook could also be enough.

    Avatar.php:92

    IMO if we go for the hook $image should be passed as reference so a hook can define the final outcome/output.

    Avatar.php:104

    I would prefer to keep this protected. And not part of the API
  7. Christian Kuhn commented on patch set 1 07/21/15, 20:50

    imho, the hook is not that bad: gravatar for instance *always* delivers something as far as i know, so a "provider" interface is not that easy (compare with default image in gravatar to find out if something was provided to lookt out for a chain??). otoh, i'd support a clean api instead over a simple hook, but also the hook seems to solve the issue for now. for the default installation: if the core provides a gravatar default solution, this must be solved in a way that it is turned on/off and only enabled as optional feature: there are lots of systems quite curious about "talking home", especially in intranet or other encapsulated environments ... see jira as comparison: they have an internal solution, too and only optionally enable gravatar / other things that need external http requests.
  8. Christian Kuhn commented on patch set 1 CR 0 V 0 07/21/15, 20:55

    asked markus for another opinion. will remove +1 for now to have a chance on fetching more optional solutions and giving people some time to react.
  9. Nicole Hummel commented on patch set 1 07/21/15, 22:37

    Avatar.php:104 Reply

    Any reason for this? This is only a database request which can be reused within the core.
  10. Nicole Hummel uploaded patch set 2 07/21/15, 22:37

  11. Nicole Hummel commented on patch set 2 07/21/15, 22:40

    I chose hook over any other implementation as this is quite straight without any overhead.

    Avatar.php:94

    Decided to stop the hook processing if an avatar was found.
  12. Frans Saris commented on patch set 2 CR -1 07/22/15, 06:51

    Currently my preference goes to a provider approuch. Then you can set a priority and can provide a nice API to let extension developers register there own Avatar providers. For instance images from there login service from a Social media provider. The hook could also work, but also then we should provide an Interface and we must pass the $image as param so the hooks can decide the outcome.
  13. Nicole Hummel commented on patch set 2 07/22/15, 06:59

    For which purpose do we need an interface here?
  14. Frans Saris commented on patch set 2 07/22/15, 07:02

    So we have a clean way to use/check the hook. This is a "requirement" for every new introduced hook IMO
  15. Markus Klein commented on patch set 2 CR -1 07/22/15, 07:43

    I would generally suggest to switch that concept around. Create providers, which can provide an avatar. The backend should only query that avatar provider API then. The current avatar implementation is then only one of the providers.
  16. Markus Klein commented on patch set 2 07/22/15, 07:47

    An interface is also preferred of course. The question is, does it make sense to have more than 1 provider? So maybe the provider registry (aka array) should only accept a single provider at all.
  17. Frans Saris commented on patch set 2 V -1 08/09/15, 10:27

    Working on it. Give it some more thought and think we need to go for a provider registry. 1. So we can provide gravatar support by the core without using hooks 2. We need to be strict about what is provided by a processor so we are flexible in using the provided image.
  18. Frans Saris uploaded patch set 3 08/11/15, 19:37

  19. Markus Klein updated the commit message in patch set 4 08/11/15, 20:53

  20. Markus Klein commented on patch set 4 08/11/15, 20:57

    Avatar.php:81

    />

    Avatar.php:107

    @return void

    ext_conf_template.txt:19

    should be off by default?

    ext_localconf.php:37

    do we want sorting by numbers here, or with before/after syntax?
  21. Frans Saris commented on patch set 4 08/11/15, 21:14

    Avatar.php:81 Reply

    html5 doesn't have the closing / right?

    ext_conf_template.txt:19 Reply

    No, think we should enable it by default but provide a way to disable it.

    ext_localconf.php:37 Reply

    Think this is okay, just like the loginProviders.
  22. Nicole Hummel commented on patch set 4 08/11/15, 21:16

    I still don't get why we need such a complicated API for a simple thing. And I don't understand neither why the core has to support Gravatar profile images out of the box. This is a perfectly fine usecase for an extension.
  23. Markus Klein commented on patch set 4 08/11/15, 21:54

    Avatar.php:81 Reply

    html5 makes that optional, which is the biggest bullshit on earth. ;-)
  24. Markus Klein commented on patch set 4 08/11/15, 21:54

    ext_localconf.php:37 Reply

    we had to use sorting for login providers because the orderingservice API wasn't there yet ;-)
  25. Markus Klein commented on patch set 4 08/11/15, 21:57

    I actually agree with Nicole, we don't need any third party "that's how I want to look"-service in core. I don't know a single company who uses gravatar or something like that in the professional environment. The API itself seems fine to me though.
  26. Frans Saris uploaded patch set 5 08/12/15, 15:13

  27. Frans Saris commented on patch set 4 08/12/15, 15:14

    Avatar.php:81 Reply

    Done

    Avatar.php:107 Reply

    Done
  28. Frans Saris commented on patch set 5 08/12/15, 20:02

    Added a test extension to http://forge.typo3.org/issues/68429 so you can test the provider
  29. Frans Saris uploaded patch set 6 08/12/15, 20:48

  30. Helmut Hummel commented on patch set 6 CR -1 08/12/15, 21:07

    some minor comments. in general this looks a bit over done, but still nice API in the end, thanks

    ImageProvider.php:50

    pass properties in constructor

    Image.php:22

    this is a value object. please remove the setters and provide a constructor to set the values

    SetupModuleController.php:613

    (int) or hsc here please

    SetupModuleController.php:614

    hsc on fieldname here please
  31. Frans Saris commented on patch set 6 08/13/15, 06:30

    ImageProvider.php:50 Reply

    Done

    Image.php:22 Reply

    Done

    SetupModuleController.php:613 Reply

    Done

    SetupModuleController.php:614 Reply

    Done
  32. Frans Saris uploaded patch set 7 08/13/15, 06:32

  33. Markus Klein commented on patch set 7 08/13/15, 07:08

    Avatar.php:76

    $backenUser can't be NULL for getImage
  34. Markus Klein commented on patch set 7 CR -1 08/13/15, 07:17

    found a few issues and will add the DependencyOrderingService. working on it
  35. Markus Klein uploaded patch set 8 08/13/15, 07:23

  36. Markus Klein uploaded patch set 9 08/13/15, 07:26

  37. Markus Klein voted on patch set 9 CR +1 V +1 08/13/15, 07:27

  38. Markus Klein uploaded patch set 10 08/13/15, 07:35

  1. Markus Klein voted on patch set 10 CR +1 V +1 08/13/15, 07:36

  2. Ralf Merz voted on patch set 10 CR +1 08/13/15, 07:51

  3. Helmut Hummel commented on patch set 10 08/13/15, 08:17

    looks good to me now

    ImageProvider.php:27

    hm, every avatar provider, provides an image, right? Maybe name it UserImageProvider?
  4. Stefan Neufeind commented on patch set 10 CR +1 08/13/15, 12:21

    ImageProvider.php:27 Reply

    But we have it under namespace "Avatar". The other class is also Avatar\Image. That should be self-explanatory in the context/namespace I guess?
  5. Frans Saris commented on patch set 10 CR -1 V -1 08/13/15, 13:36

    Working on it

    ImageProvider.php:27 Reply

    Discussed this with Benni and we keep ImageProvider but drop the directory AvatarProvider.
  6. Frans Saris uploaded patch set 11 08/13/15, 13:54

  7. Markus Klein voted on patch set 11 CR +1 V +1 08/13/15, 14:00

  8. Andreas Kienast commented on patch set 11 08/13/15, 14:07

    Avatar.php:113

    imo we can drop the !isset() and move the empty() on top instead, as empty internally calls isset
  9. Frans Saris commented on patch set 11 08/13/15, 14:09

    Avatar.php:113 Reply

    Done
  10. Frans Saris uploaded patch set 12 08/13/15, 14:10

  11. Markus Klein voted on patch set 12 CR +1 V +1 08/13/15, 14:12

  12. Stefan Neufeind voted on patch set 12 CR +1 08/13/15, 14:41

  13. Andreas Kienast voted on patch set 12 CR +2 V +2 08/13/15, 14:57

  14. Andreas Kienast merged patch set 12 08/13/15, 14:58

  15. Nicole Hummel commented on patch set 13 08/13/15, 16:11

    Post -1

    Image.php:25

    Shouldn't the class where the image tag is generated care about paths?

    Feature-68429-IntroducedAvatarProviderAPI.rst:8

    an

    Feature-68429-IntroducedAvatarProviderAPI.rst:8

    an

    Feature-68429-IntroducedAvatarProviderAPI.rst:8

    is

    Feature-68429-IntroducedAvatarProviderAPI.rst:9

    to handle the images defined in the user settings

    Feature-68429-IntroducedAvatarProviderAPI.rst:12

    Avatar is missing

    Feature-68429-IntroducedAvatarProviderAPI.rst:12

    Avatar is missing

    Feature-68429-IntroducedAvatarProviderAPI.rst:15

    an

    Feature-68429-IntroducedAvatarProviderAPI.rst:18

    an

    Feature-68429-IntroducedAvatarProviderAPI.rst:29

    Avatar is missing

    Feature-68429-IntroducedAvatarProviderAPI.rst:30

    This is used to get the order in which the providers are executed.

    Feature-68429-IntroducedAvatarProviderAPI.rst:39

    missing ';'

    Feature-68429-IntroducedAvatarProviderAPI.rst:51

    -from

    Feature-68429-IntroducedAvatarProviderAPI.rst:54

    Avatar is missing

    Feature-68429-IntroducedAvatarProviderAPI.rst:54

    to be an instance of

    Feature-68429-IntroducedAvatarProviderAPI.rst:57

    has

    Feature-68429-IntroducedAvatarProviderAPI.rst:59

    See comment above. The image shouldn't care about any subdirectory

    SetupModuleController.php:620

    Shouldn't this be hcs'd too?
  16. Frans Saris commented on patch set 13 08/13/15, 19:03

    Will push a followup tomorrow

    Feature-68429-IntroducedAvatarProviderAPI.rst:8 Reply

  17. Nicole Hummel commented on patch set 13 08/14/15, 05:50

    Avatar.php:121

    Not sure if it is helpful to throw an error here as the whole backend isn't accessible anymore then.

    Avatar.php:124

    see above
  18. Frans Saris commented on patch set 13 08/14/15, 06:02

    Avatar.php:121 Reply

    True that the backend isn't accessible anymore. But this never should happen in a normal situation, only when configuration changes and that is in dev environment. See also implementation of LoginProviders
  19. Frans Saris commented on patch set 13 08/14/15, 06:38

    Image.php:25 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:8 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:8 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:8 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:9 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:12

    changed to "for given ``be_users`` record"

    Feature-68429-IntroducedAvatarProviderAPI.rst:12 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:12 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:15 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:18 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:29 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:30 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:39 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:51 Reply

    Changed to "The record from ``be_users`` database table."

    Feature-68429-IntroducedAvatarProviderAPI.rst:54 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:54 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:57 Reply

    Done

    Feature-68429-IntroducedAvatarProviderAPI.rst:59 Reply

    Done

    SetupModuleController.php:528

    see here

    SetupModuleController.php:620 Reply

    no, it is set a little bit above and can hold things like class="foo"
  20. Nicole Hummel commented on patch set 13 08/14/15, 06:54

    SetupModuleController.php:528 Reply

    As far as I can see $class comes from user generated content ($config)
  21. Frans Saris commented on patch set 13 08/14/15, 06:57

    SetupModuleController.php:528 Reply

    Not user generated content but configuration. But that is out of scope for (not touched by) this patch.

    SetupModuleController.php:560

    also used here
  22. Helmut Hummel commented on patch set 10 08/14/15, 07:45

    ImageProvider.php:27 Reply

    then I disagree with Benni here ;)

    ImageProvider.php:27 Reply

    Yes, especially because every avatar provider returns an image, it would make sense to be possible to identify from the name what the differences are if we do not want to end up with 10 ImageProvider classes which only differ in namespace.
  23. Helmut Hummel commented on patch set 13 08/14/15, 07:47

    ImageProvider.php:25

    I would even go one sept further and even name it: "UserSettingsProvider" as it is self-explanatory that it returns an image (is in Avatar namespace), but it is not clear, where this image is taken from the name
  24. Helmut Hummel commented on patch set 13 08/14/15, 07:48

    uh, this is merged already ^^ please include my comments in the followup :)
  25. Frans Saris commented on patch set 13 08/14/15, 08:00

    ImageProvider.php:25 Reply

    but UserSettingsProvider also is a little strange because it doesn't provide UserSettings. Maybe we should move this discussion to Slack.