41780[FEATURE] Introduce AvatarProvider
Commit message
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
- typo3/sysext/backend/Classes/Backend/Avatar/Avatar.php16+84 −46
- typo3/sysext/backend/Classes/Backend/Avatar/AvatarProviderInterface.phpnew+31 −0
- typo3/sysext/backend/Classes/Backend/Avatar/Image.php4new+80 −0
- typo3/sysext/backend/Classes/Backend/Avatar/ImageProvider.php2new+83 −0
- typo3/sysext/backend/ext_localconf.php3+4 −0
- typo3/sysext/core/Documentation/Changelog/master/Feature-68429-IntroducedAvatarProviderAPI.rst34new+61 −0
- typo3/sysext/setup/Classes/Controller/SetupModuleController.php10+20 −13
Review log 63
Show 38 earlier messages
-
Nicole Hummel uploaded patch set 1 07/21/15, 15:01
-
Christian Kuhn commented on patch set 1 CR +1 V +1 07/21/15, 17:11
Nice. works as expected, verified with demo extension :>) -
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? -
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? -
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. -
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:92IMO if we go for the hook $image should be passed as reference so a hook can define the final outcome/output.Avatar.php:104I would prefer to keep this protected. And not part of the API -
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. -
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. -
Nicole Hummel commented on patch set 1 07/21/15, 22:37
Avatar.php:104ReplyAny reason for this? This is only a database request which can be reused within the core. -
Nicole Hummel uploaded patch set 2 07/21/15, 22:37
-
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:94Decided to stop the hook processing if an avatar was found. -
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. -
Nicole Hummel commented on patch set 2 07/22/15, 06:59
For which purpose do we need an interface here? -
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 -
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. -
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. -
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. -
Frans Saris uploaded patch set 3 08/11/15, 19:37
-
Markus Klein updated the commit message in patch set 4 08/11/15, 20:53
-
Markus Klein commented on patch set 4 08/11/15, 20:57
Avatar.php:81/>Avatar.php:107@return voidext_conf_template.txt:19should be off by default?ext_localconf.php:37do we want sorting by numbers here, or with before/after syntax? -
Frans Saris commented on patch set 4 08/11/15, 21:14
Avatar.php:81Replyhtml5 doesn't have the closing / right?ext_conf_template.txt:19ReplyNo, think we should enable it by default but provide a way to disable it.ext_localconf.php:37ReplyThink this is okay, just like the loginProviders. -
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. -
Markus Klein commented on patch set 4 08/11/15, 21:54
Avatar.php:81Replyhtml5 makes that optional, which is the biggest bullshit on earth. ;-) -
Markus Klein commented on patch set 4 08/11/15, 21:54
ext_localconf.php:37Replywe had to use sorting for login providers because the orderingservice API wasn't there yet ;-) -
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. -
Frans Saris uploaded patch set 5 08/12/15, 15:13
-
Frans Saris commented on patch set 4 08/12/15, 15:14
Avatar.php:81ReplyDoneAvatar.php:107ReplyDone -
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 -
Frans Saris uploaded patch set 6 08/12/15, 20:48
-
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, thanksImageProvider.php:50pass properties in constructorImage.php:22this is a value object. please remove the setters and provide a constructor to set the valuesSetupModuleController.php:613(int) or hsc here pleaseSetupModuleController.php:614hsc on fieldname here please -
Frans Saris commented on patch set 6 08/13/15, 06:30
ImageProvider.php:50ReplyDoneImage.php:22ReplyDoneSetupModuleController.php:613ReplyDoneSetupModuleController.php:614ReplyDone -
Frans Saris uploaded patch set 7 08/13/15, 06:32
-
Markus Klein commented on patch set 7 08/13/15, 07:08
Avatar.php:76$backenUser can't be NULL for getImage -
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 -
Markus Klein uploaded patch set 8 08/13/15, 07:23
-
Markus Klein uploaded patch set 9 08/13/15, 07:26
-
Markus Klein voted on patch set 9 CR +1 V +1 08/13/15, 07:27
-
Markus Klein uploaded patch set 10 08/13/15, 07:35
-
Markus Klein voted on patch set 10 CR +1 V +1 08/13/15, 07:36
-
Ralf Merz voted on patch set 10 CR +1 08/13/15, 07:51
-
Helmut Hummel commented on patch set 10 08/13/15, 08:17
looks good to me nowImageProvider.php:27hm, every avatar provider, provides an image, right? Maybe name it UserImageProvider? -
Stefan Neufeind commented on patch set 10 CR +1 08/13/15, 12:21
ImageProvider.php:27ReplyBut we have it under namespace "Avatar". The other class is also Avatar\Image. That should be self-explanatory in the context/namespace I guess? -
Frans Saris commented on patch set 10 CR -1 V -1 08/13/15, 13:36
Working on itImageProvider.php:27ReplyDiscussed this with Benni and we keep ImageProvider but drop the directory AvatarProvider. -
Frans Saris uploaded patch set 11 08/13/15, 13:54
-
Markus Klein voted on patch set 11 CR +1 V +1 08/13/15, 14:00
-
Andreas Kienast commented on patch set 11 08/13/15, 14:07
Avatar.php:113imo we can drop the !isset() and move the empty() on top instead, as empty internally calls isset -
Frans Saris commented on patch set 11 08/13/15, 14:09
Avatar.php:113ReplyDone -
Frans Saris uploaded patch set 12 08/13/15, 14:10
-
Markus Klein voted on patch set 12 CR +1 V +1 08/13/15, 14:12
-
Stefan Neufeind voted on patch set 12 CR +1 08/13/15, 14:41
-
Andreas Kienast voted on patch set 12 CR +2 V +2 08/13/15, 14:57
-
Andreas Kienast merged patch set 12 08/13/15, 14:58
-
Nicole Hummel commented on patch set 13 08/13/15, 16:11
Post -1Image.php:25Shouldn't the class where the image tag is generated care about paths?Feature-68429-IntroducedAvatarProviderAPI.rst:8anFeature-68429-IntroducedAvatarProviderAPI.rst:8anFeature-68429-IntroducedAvatarProviderAPI.rst:8isFeature-68429-IntroducedAvatarProviderAPI.rst:9to handle the images defined in the user settingsFeature-68429-IntroducedAvatarProviderAPI.rst:12Avatar is missingFeature-68429-IntroducedAvatarProviderAPI.rst:12Avatar is missingFeature-68429-IntroducedAvatarProviderAPI.rst:15anFeature-68429-IntroducedAvatarProviderAPI.rst:18anFeature-68429-IntroducedAvatarProviderAPI.rst:29Avatar is missingFeature-68429-IntroducedAvatarProviderAPI.rst:30This is used to get the order in which the providers are executed.Feature-68429-IntroducedAvatarProviderAPI.rst:39missing ';'Feature-68429-IntroducedAvatarProviderAPI.rst:51-fromFeature-68429-IntroducedAvatarProviderAPI.rst:54Avatar is missingFeature-68429-IntroducedAvatarProviderAPI.rst:54to be an instance ofFeature-68429-IntroducedAvatarProviderAPI.rst:57hasFeature-68429-IntroducedAvatarProviderAPI.rst:59See comment above. The image shouldn't care about any subdirectorySetupModuleController.php:620Shouldn't this be hcs'd too? -
Frans Saris commented on patch set 13 08/13/15, 19:03
Will push a followup tomorrowFeature-68429-IntroducedAvatarProviderAPI.rst:8ReplyMost of this "grammar" is copied from https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Documentation/Changelog/7.3/Feature-66669-BeLoginFormAPI.rst Should that be adjusted to? -
Nicole Hummel commented on patch set 13 08/14/15, 05:50
Avatar.php:121Not sure if it is helpful to throw an error here as the whole backend isn't accessible anymore then.Avatar.php:124see above -
Frans Saris commented on patch set 13 08/14/15, 06:02
Avatar.php:121ReplyTrue 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 -
Frans Saris commented on patch set 13 08/14/15, 06:38
Image.php:25ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:8ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:8ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:8ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:9ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:12changed to "for given ``be_users`` record"Feature-68429-IntroducedAvatarProviderAPI.rst:12ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:12ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:15ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:18ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:29ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:30ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:39ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:51ReplyChanged to "The record from ``be_users`` database table."Feature-68429-IntroducedAvatarProviderAPI.rst:54ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:54ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:57ReplyDoneFeature-68429-IntroducedAvatarProviderAPI.rst:59ReplyDoneSetupModuleController.php:528see hereSetupModuleController.php:620Replyno, it is set a little bit above and can hold things like class="foo" -
Nicole Hummel commented on patch set 13 08/14/15, 06:54
SetupModuleController.php:528ReplyAs far as I can see $class comes from user generated content ($config) -
Frans Saris commented on patch set 13 08/14/15, 06:57
SetupModuleController.php:528ReplyNot user generated content but configuration. But that is out of scope for (not touched by) this patch.SetupModuleController.php:560also used here -
Helmut Hummel commented on patch set 10 08/14/15, 07:45
ImageProvider.php:27Replythen I disagree with Benni here ;)ImageProvider.php:27ReplyYes, 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. -
Helmut Hummel commented on patch set 13 08/14/15, 07:47
ImageProvider.php:25I 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 -
Helmut Hummel commented on patch set 13 08/14/15, 07:48
uh, this is merged already ^^ please include my comments in the followup :) -
Frans Saris commented on patch set 13 08/14/15, 08:00
ImageProvider.php:25Replybut UserSettingsProvider also is a little strange because it doesn't provide UserSettings. Maybe we should move this discussion to Slack.