diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-02-13 17:49:05 -0600 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-02-13 17:53:33 -0600 |
commit | 200a28255e058843465c63080d917170de293ee6 (patch) | |
tree | 86c8f04fc95b22e8f2e973e16f026ae1d2552ec3 /core | |
parent | 88047aaea732d77bf38730566842fc163c6ba3a1 (diff) | |
download | nextcloud-server-200a28255e058843465c63080d917170de293ee6.tar.gz nextcloud-server-200a28255e058843465c63080d917170de293ee6.zip |
Always enable avatars
* we introduced this setting in the begining because our
avatar support caused some performance issues, but we
fixed them and should only provide one way how Nextcloud
looks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/shareconfigmodel.js | 3 | ||||
-rw-r--r-- | core/js/sharedialogresharerinfoview.js | 13 | ||||
-rw-r--r-- | core/js/sharedialogshareelistview.js | 28 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 23 | ||||
-rw-r--r-- | core/templates/layout.user.php | 2 |
5 files changed, 17 insertions, 52 deletions
diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index 7c92853f682..98388cbd508 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 9a9d95cfb60..a82b495bdcc 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 4647dedd722..47dc62d14fe 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 cbb74714ff7..307adea85ff 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 4842a94897d..e9a9b042e07 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> |