diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 8387e527f4a8474245639e9402e1efd3726e9597..f60968616a2a756d00f68e48c89cb743999be57c 100644 Binary files a/apps/comments/js/commentstabview.js and b/apps/comments/js/commentstabview.js differ diff --git a/apps/comments/tests/js/commentstabviewSpec.js b/apps/comments/tests/js/commentstabviewSpec.js index 9e4bf4f05331d81eeb2bd4135cc15b194e52d341..0bbfaa1f295f742f1e78555590e47c7830092936 100644 --- a/apps/comments/tests/js/commentstabviewSpec.js +++ b/apps/comments/tests/js/commentstabviewSpec.js @@ -43,7 +43,6 @@ describe('OCA.Comments.CommentsTabView tests', function() { clock = sinon.useFakeTimers(Date.UTC(2016, 1, 3, 10, 5, 9)); fetchStub = sinon.stub(OCA.Comments.CommentCollection.prototype, 'fetchNext'); view = new OCA.Comments.CommentsTabView(); - view._avatarsEnabled = false; fileInfoModel = new OCA.Files.FileInfoModel({ id: 5, name: 'One.txt', @@ -146,7 +145,6 @@ describe('OCA.Comments.CommentsTabView tests', function() { }); it('renders mentioned user id to avatar and displayname', function() { - view._avatarsEnabled = true; view.collection.set(testComments); var $comment = view.$el.find('.comment[data-id=3] .message'); @@ -158,18 +156,6 @@ describe('OCA.Comments.CommentsTabView tests', function() { expect($comment.find('strong:last-child').text()).toEqual('Lord Banquo'); }); - it('renders mentioned user id to displayname, avatars disabled', function() { - view.collection.set(testComments); - - var $comment = view.$el.find('.comment[data-id=3] .message'); - expect($comment.length).toEqual(1); - expect($comment.find('.avatar[data-user=macbeth]').length).toEqual(0); - expect($comment.find('strong:first-child').text()).toEqual('Thane of Cawdor'); - - expect($comment.find('.avatar[data-user=banquo]').length).toEqual(0); - expect($comment.find('strong:last-child').text()).toEqual('Lord Banquo'); - }); - }); describe('more comments', function() { var hasMoreResultsStub; @@ -316,11 +302,13 @@ describe('OCA.Comments.CommentsTabView tests', function() { describe('editing comments', function() { var saveStub; var fetchStub; + var avatarStub; var currentUserStub; beforeEach(function() { saveStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'save'); fetchStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'fetch'); + avatarStub = sinon.stub($.fn, 'avatar'); currentUserStub = sinon.stub(OC, 'getCurrentUser'); currentUserStub.returns({ uid: 'testuser', @@ -348,6 +336,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { afterEach(function() { saveStub.restore(); fetchStub.restore(); + avatarStub.restore(); currentUserStub.restore(); }); diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js index f9f6959c9525b1e58db2cbf222b4d530096841e0..64051844d037a47f26eae539e1b759bf9864e270 100644 --- a/apps/files_sharing/js/files_drop.js +++ b/apps/files_sharing/js/files_drop.js @@ -117,7 +117,7 @@ }; $(document).ready(function() { - if($('#upload-only-interface').val() === "1" && oc_config.enable_avatars) { + if($('#upload-only-interface').val() === "1") { $('.avatardiv').avatar($('#sharingUserId').val(), 128, true); } diff --git a/config/config.sample.php b/config/config.sample.php index 228233452eb5891fbce49405b4c879b88738ac7a..2a1387cecd0a41a177996a730225b6628308fe4b 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -180,15 +180,6 @@ $CONFIG = array( */ 'knowledgebaseenabled' => true, -/** - * ``true`` enables avatars, or user profile photos. These appear on the User - * page, on user's Personal pages and are used by some apps (contacts, mail, - * etc). ``false`` disables them. - * - * Defaults to ``true`` - */ -'enable_avatars' => true, - /** * ``true`` allows users to change their display names (on their Personal * pages), and ``false`` prevents them from changing their display names. diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index 7c92853f682f45c9ec7d0a933cab5d0d638b78f1..98388cbd508cf6cf4e3c3ec807e3ed86b5e878f3 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -33,9 +33,10 @@ /** * @returns {boolean} + * @deprecated here for legacy reasons - will always return true */ areAvatarsEnabled: function() { - return oc_config.enable_avatars === true; + return true; }, /** diff --git a/core/js/sharedialogresharerinfoview.js b/core/js/sharedialogresharerinfoview.js index 9a9d95cfb60c9a573d5ec81008e371bfe9dc3f4f..a82b495bdcccb1f025969f05a0024d11151a5da3 100644 --- a/core/js/sharedialogresharerinfoview.js +++ b/core/js/sharedialogresharerinfoview.js @@ -17,9 +17,7 @@ var TEMPLATE = '<span class="reshare">' + - ' {{#if avatarEnabled}}' + ' <div class="avatar" data-userName="{{reshareOwner}}"></div>' + - ' {{/if}}' + ' {{sharedByText}}' + '</span><br/>' ; @@ -93,17 +91,14 @@ } this.$el.html(reshareTemplate({ - avatarEnabled: this.configModel.areAvatarsEnabled(), reshareOwner: this.model.getReshareOwner(), sharedByText: sharedByText })); - if(this.configModel.areAvatarsEnabled()) { - this.$el.find('.avatar').each(function() { - var $this = $(this); - $this.avatar($this.data('username'), 32); - }); - } + this.$el.find('.avatar').each(function() { + var $this = $(this); + $this.avatar($this.data('username'), 32); + }); return this; }, diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 4647dedd7220b6e3466f20e7e43e9e2b8702c28c..47dc62d14fe0fd1e575f7d7df8ba8e9a0e5d513b 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -21,9 +21,7 @@ '<ul id="shareWithList" class="shareWithList">' + '{{#each sharees}}' + '<li data-share-id="{{shareId}}" data-share-type="{{shareType}}" data-share-with="{{shareWith}}">' + - '{{#if avatarEnabled}}' + '<div class="avatar {{#if modSeed}}imageplaceholderseed{{/if}}" data-username="{{shareWith}}" data-displayname="{{shareWithDisplayName}}" {{#if modSeed}}data-seed="{{shareWith}} {{shareType}}"{{/if}}></div>' + - '{{/if}}' + '<span class="has-tooltip username" title="{{shareWithTitle}}">{{shareWithDisplayName}}</span>' + '<span class="sharingOptionsGroup">' + '{{#if editPermissionPossible}}' + @@ -41,9 +39,7 @@ '{{/each}}' + '{{#each linkReshares}}' + '<li data-share-id="{{shareId}}" data-share-type="{{shareType}}">' + - '{{#if avatarEnabled}}' + '<div class="avatar" data-username="{{shareInitiator}}"></div>' + - '{{/if}}' + '<span class="has-tooltip username" title="{{shareInitiator}}">' + t('core', '{{shareInitiatorDisplayName}} shared via link') + '</span>' + '<span class="sharingOptionsGroup">' + @@ -193,7 +189,6 @@ getShareProperties: function() { return { - avatarEnabled: this.configModel.areAvatarsEnabled(), unshareLabel: t('core', 'Unshare'), canShareLabel: t('core', 'can reshare'), canEditLabel: t('core', 'can edit'), @@ -247,7 +242,6 @@ getLinkReshares: function() { var universal = { unshareLabel: t('core', 'Unshare'), - avatarEnabled: this.configModel.areAvatarsEnabled(), }; if(!this.model.hasUserShares()) { @@ -281,18 +275,16 @@ linkReshares: this.getLinkReshares() })); - if (this.configModel.areAvatarsEnabled()) { - this.$('.avatar').each(function () { - var $this = $(this); - if ($this.hasClass('imageplaceholderseed')) { - $this.css({width: 32, height: 32}); - $this.imageplaceholder($this.data('seed')); - } else { - // user, size, ie8fix, hidedefault, callback, displayname - $this.avatar($this.data('username'), 32, undefined, undefined, undefined, $this.data('displayname')); - } - }); - } + this.$('.avatar').each(function () { + var $this = $(this); + if ($this.hasClass('imageplaceholderseed')) { + $this.css({width: 32, height: 32}); + $this.imageplaceholder($this.data('seed')); + } else { + // user, size, ie8fix, hidedefault, callback, displayname + $this.avatar($this.data('username'), 32, undefined, undefined, undefined, $this.data('displayname')); + } + }); this.$('.has-tooltip').tooltip({ placement: 'bottom' diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index cbb74714ff7e38043e0cfcfce21f3d039c8e4eb8..307adea85ffd5d409d79b27ee96aee347c3ef4a4 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -24,7 +24,6 @@ describe('OC.Share.ShareDialogView', function() { var $container; var oldAppConfig; var autocompleteStub; - var oldEnableAvatars; var avatarStub; var placeholderStub; var oldCurrentUser; @@ -103,8 +102,6 @@ describe('OC.Share.ShareDialogView', function() { return $el; }); - oldEnableAvatars = oc_config.enable_avatars; - oc_config.enable_avatars = false; avatarStub = sinon.stub($.fn, 'avatar'); placeholderStub = sinon.stub($.fn, 'imageplaceholder'); @@ -123,7 +120,6 @@ describe('OC.Share.ShareDialogView', function() { autocompleteStub.restore(); avatarStub.restore(); placeholderStub.restore(); - oc_config.enable_avatars = oldEnableAvatars; }); describe('Share with link', function() { // TODO: test ajax calls @@ -440,18 +436,13 @@ describe('OC.Share.ShareDialogView', function() { describe('avatars enabled', function() { beforeEach(function() { - oc_config.enable_avatars = true; avatarStub.reset(); dialog.render(); }); - afterEach(function() { - oc_config.enable_avatars = false; - }); - it('test correct function calls', function() { expect(avatarStub.calledTwice).toEqual(true); - expect(placeholderStub.calledTwice).toEqual(true); + expect(placeholderStub.callCount).toEqual(4); expect(dialog.$('.shareWithList').children().length).toEqual(3); expect(dialog.$('.avatar').length).toEqual(4); }); @@ -481,18 +472,6 @@ describe('OC.Share.ShareDialogView', function() { expect(args[0]).toEqual('foo@bar.com/baz ' + OC.Share.SHARE_TYPE_REMOTE); }); }); - - describe('avatars disabled', function() { - beforeEach(function() { - dialog.render(); - }); - - it('no avatar classes', function() { - expect($('.avatar').length).toEqual(0); - expect(avatarStub.callCount).toEqual(0); - expect(placeholderStub.callCount).toEqual(0); - }); - }); }); describe('remote sharing', function() { it('shows remote share info when allowed', function() { diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 4842a94897dcb1b6e19f784d56d4beebbe7cd284..e9a9b042e07f04c12275667bacd814a425f08f87 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -73,7 +73,6 @@ </form> <div id="settings"> <div id="expand" tabindex="6" role="link" class="menutoggle"> - <?php if ($_['enableAvatars']): ?> <div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>"> <?php if ($_['userAvatarSet']): ?> <img alt="" width="32" height="32" @@ -82,7 +81,6 @@ > <?php endif; ?> </div> - <?php endif; ?> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> <div class="icon-caret"></div> </div> diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index f17c6a16194158dffa8c3b80310732733d39ab8d..1c241989fd2b373d9e76c7d4094a276393b3019d 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -204,7 +204,7 @@ class JSConfigHelper { 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => \OC_Util::getVersionString(), - 'enable_avatars' => $this->config->getSystemValue('enable_avatars', true) === true, + 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), 'modRewriteWorking' => (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), ]), diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 19fc94621859e6796dfe567e3b6202e279966ed2..f1621363237a59ed506ab6086aa9393002090413 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -100,7 +100,6 @@ class TemplateLayout extends \OC_Template { $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', \OC_User::getUser()); $this->assign('appsmanagement_active', $appsMgmtActive); - $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true); if (\OC_User::getUser() === false) { $this->assign('userAvatarSet', false); diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index a07bf214f343846dc305768975baa86b7b893f68..09e3d130f49617da77528ec48e4ffdb64c6690e4 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -121,10 +121,8 @@ class OC_Template extends \OC\Template\Base { OC_Util::addStyle("styles",null,true); // avatars - if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) { - \OC_Util::addScript('jquery.avatar', null, true); - \OC_Util::addScript('placeholder', null, true); - } + \OC_Util::addScript('jquery.avatar', null, true); + \OC_Util::addScript('placeholder', null, true); OC_Util::addVendorScript('select2/select2'); OC_Util::addVendorStyle('select2/select2', null, true); diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 43a3843249911bd33ce986294cc388ce5c49f688..719b6eb68f6526cc2e6c3106231ad9313b2d98d5 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -188,12 +188,10 @@ class UsersController extends Controller { } $avatarAvailable = false; - if ($this->config->getSystemValue('enable_avatars', true) === true) { - try { - $avatarAvailable = $this->avatarManager->getAvatar($user->getUID())->exists(); - } catch (\Exception $e) { - //No avatar yet - } + try { + $avatarAvailable = $this->avatarManager->getAvatar($user->getUID())->exists(); + } catch (\Exception $e) { + //No avatar yet } return [ diff --git a/settings/js/personal.js b/settings/js/personal.js index f9a4517633a39946f3b4355507119e191c53a2d4..89491b96657b2e52af9e8c089d5f903328e32684 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -334,15 +334,13 @@ $(document).ready(function () { }); // Load the big avatar - if (oc_config.enable_avatars) { - $('#avatarform .avatardiv').avatar(OC.currentUser, 145, true, null, function() { - if($('#displayavatar img').length === 0) { - $('#removeavatar').removeClass('inlineblock').addClass('hidden'); - } else { - $('#removeavatar').removeClass('hidden').addClass('inlineblock'); - } - }); - } + $('#avatarform .avatardiv').avatar(OC.currentUser, 145, true, null, function() { + if($('#displayavatar img').length === 0) { + $('#removeavatar').removeClass('inlineblock').addClass('hidden'); + } else { + $('#removeavatar').removeClass('hidden').addClass('inlineblock'); + } + }); // Show token views diff --git a/settings/personal.php b/settings/personal.php index a79e9764a6be19ad8a6adc40e735e46830532165..a1fcd10e0adb1107541b80f4eaa223fc114888b9 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -57,10 +57,8 @@ OC_Util::addStyle( 'settings', 'settings' ); \OC_Util::addVendorScript('strengthify/jquery.strengthify'); \OC_Util::addVendorStyle('strengthify/strengthify'); \OC_Util::addScript('files', 'jquery.fileupload'); -if ($config->getSystemValue('enable_avatars', true) === true) { - \OC_Util::addVendorScript('jcrop/js/jquery.Jcrop'); - \OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop'); -} +\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop'); +\OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop'); \OC::$server->getEventDispatcher()->dispatch('OC\Settings\Personal::loadAdditionalScripts'); @@ -182,7 +180,6 @@ $tmpl->assign('websiteScope', $userData[\OC\Accounts\AccountManager::PROPERTY_WE $tmpl->assign('twitterScope', $userData[\OC\Accounts\AccountManager::PROPERTY_TWITTER]['scope']); $tmpl->assign('addressScope', $userData[\OC\Accounts\AccountManager::PROPERTY_ADDRESS]['scope']); -$tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true) === true); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); $tmpl->assign('certs', $certificateManager->listCertificates()); $tmpl->assign('showCertificates', $enableCertImport); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 65ce3751b9809fe629f8b495fbac69d000fca6c2..ecbf1ff5c5f3b22cc94300dde4d09cfe6187470a 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -35,7 +35,6 @@ </div> <div id="personal-settings"> -<?php if ($_['enableAvatars']): ?> <div id="personal-settings-avatar-container"> <form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>"> <h2> @@ -66,7 +65,6 @@ <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>"> </form> </div> -<?php endif; ?> <div id="personal-settings-container"> <div class="personal-settings-setting-box"> diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php index bab68e5a765b9a3d333319e04de8a1948f52f039..4cf395ff62d0b3b6f5b36ad163b1649a26f79cde 100644 --- a/settings/templates/users/part.userlist.php +++ b/settings/templates/users/part.userlist.php @@ -1,9 +1,7 @@ <table id="userlist" class="hascontrols grid" data-groups="<?php p($_['allGroups']);?>"> <thead> <tr> - <?php if ($_['enableAvatars']): ?> <th id="headerAvatar" scope="col"></th> - <?php endif; ?> <th id="headerName" scope="col"><?php p($l->t('Username'))?></th> <th id="headerDisplayName" scope="col"><?php p($l->t( 'Full name' )); ?></th> <th id="headerPassword" scope="col"><?php p($l->t( 'Password' )); ?></th> @@ -22,9 +20,7 @@ <tbody> <!-- the following <tr> is used as a template for the JS part --> <tr style="display:none"> - <?php if ($_['enableAvatars']): ?> <td class="avatar"><div class="avatardiv"></div></td> - <?php endif; ?> <th class="name" scope="row"></th> <td class="displayName"><span></span> <img class="action" src="<?php p(image_path('core', 'actions/rename.svg'))?>" diff --git a/settings/users.php b/settings/users.php index 5f31d35ff97b99511080a10edacb4a38103abebd..1b0f4f7b8e83751ff722bb4ff9947148cf1f6205 100644 --- a/settings/users.php +++ b/settings/users.php @@ -118,7 +118,6 @@ $tmpl->assign('quota_preset', $quotaPreset); $tmpl->assign('default_quota', $defaultQuota); $tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined); $tmpl->assign('recoveryAdminEnabled', $recoveryAdminEnabled); -$tmpl->assign('enableAvatars', \OC::$server->getConfig()->getSystemValue('enable_avatars', true) === true); $tmpl->assign('show_storage_location', $config->getAppValue('core', 'umgmt_show_storage_location', 'false')); $tmpl->assign('show_last_login', $config->getAppValue('core', 'umgmt_show_last_login', 'false')); diff --git a/tests/Settings/Controller/UsersControllerTest.php b/tests/Settings/Controller/UsersControllerTest.php index 36ca09175241b4825f2080e644bfbbd3bed4af7e..4f10fed1a2fa818bb337e9d807522efb24380cb1 100644 --- a/tests/Settings/Controller/UsersControllerTest.php +++ b/tests/Settings/Controller/UsersControllerTest.php @@ -96,10 +96,6 @@ class UsersControllerTest extends \Test\TestCase { ['bar', $avatarExists], ['admin', $avatarNotExists], ])); - - $this->config->method('getSystemValue') - ->with('enable_avatars', true) - ->willReturn(true); } /**