Merge pull request #3472 from nextcloud/enable-avatars-always
Always enable avatars
This commit is contained in:
commit
c5dffc465c
|
@ -23,9 +23,7 @@
|
||||||
var EDIT_COMMENT_TEMPLATE =
|
var EDIT_COMMENT_TEMPLATE =
|
||||||
'<div class="newCommentRow comment" data-id="{{id}}">' +
|
'<div class="newCommentRow comment" data-id="{{id}}">' +
|
||||||
' <div class="authorRow">' +
|
' <div class="authorRow">' +
|
||||||
' {{#if avatarEnabled}}' +
|
|
||||||
' <div class="avatar" data-username="{{actorId}}"></div>' +
|
' <div class="avatar" data-username="{{actorId}}"></div>' +
|
||||||
' {{/if}}' +
|
|
||||||
' <div class="author">{{actorDisplayName}}</div>' +
|
' <div class="author">{{actorDisplayName}}</div>' +
|
||||||
'{{#if isEditMode}}' +
|
'{{#if isEditMode}}' +
|
||||||
' <a href="#" class="action delete icon icon-delete has-tooltip" title="{{deleteTooltip}}"></a>' +
|
' <a href="#" class="action delete icon icon-delete has-tooltip" title="{{deleteTooltip}}"></a>' +
|
||||||
|
@ -44,9 +42,7 @@
|
||||||
var COMMENT_TEMPLATE =
|
var COMMENT_TEMPLATE =
|
||||||
'<li class="comment{{#if isUnread}} unread{{/if}}{{#if isLong}} collapsed{{/if}}" data-id="{{id}}">' +
|
'<li class="comment{{#if isUnread}} unread{{/if}}{{#if isLong}} collapsed{{/if}}" data-id="{{id}}">' +
|
||||||
' <div class="authorRow">' +
|
' <div class="authorRow">' +
|
||||||
' {{#if avatarEnabled}}' +
|
|
||||||
' <div class="avatar" {{#if actorId}}data-username="{{actorId}}"{{/if}}> </div>' +
|
' <div class="avatar" {{#if actorId}}data-username="{{actorId}}"{{/if}}> </div>' +
|
||||||
' {{/if}}' +
|
|
||||||
' <div class="author">{{actorDisplayName}}</div>' +
|
' <div class="author">{{actorDisplayName}}</div>' +
|
||||||
'{{#if isUserAuthor}}' +
|
'{{#if isUserAuthor}}' +
|
||||||
' <a href="#" class="action edit icon icon-rename has-tooltip" title="{{editTooltip}}"></a>' +
|
' <a href="#" class="action edit icon icon-rename has-tooltip" title="{{editTooltip}}"></a>' +
|
||||||
|
@ -85,8 +81,6 @@
|
||||||
this.collection.on('sync', this._onEndRequest, this);
|
this.collection.on('sync', this._onEndRequest, this);
|
||||||
this.collection.on('add', this._onAddModel, this);
|
this.collection.on('add', this._onAddModel, this);
|
||||||
|
|
||||||
this._avatarsEnabled = !!OC.config.enable_avatars;
|
|
||||||
|
|
||||||
this._commentMaxThreshold = this._commentMaxLength * 0.9;
|
this._commentMaxThreshold = this._commentMaxLength * 0.9;
|
||||||
|
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
|
@ -99,7 +93,6 @@
|
||||||
}
|
}
|
||||||
var currentUser = OC.getCurrentUser();
|
var currentUser = OC.getCurrentUser();
|
||||||
return this._template(_.extend({
|
return this._template(_.extend({
|
||||||
avatarEnabled: this._avatarsEnabled,
|
|
||||||
actorId: currentUser.uid,
|
actorId: currentUser.uid,
|
||||||
actorDisplayName: currentUser.displayName
|
actorDisplayName: currentUser.displayName
|
||||||
}, params));
|
}, params));
|
||||||
|
@ -111,7 +104,6 @@
|
||||||
}
|
}
|
||||||
var currentUser = OC.getCurrentUser();
|
var currentUser = OC.getCurrentUser();
|
||||||
return this._editCommentTemplate(_.extend({
|
return this._editCommentTemplate(_.extend({
|
||||||
avatarEnabled: this._avatarsEnabled,
|
|
||||||
actorId: currentUser.uid,
|
actorId: currentUser.uid,
|
||||||
actorDisplayName: currentUser.displayName,
|
actorDisplayName: currentUser.displayName,
|
||||||
newMessagePlaceholder: t('comments', 'New comment …'),
|
newMessagePlaceholder: t('comments', 'New comment …'),
|
||||||
|
@ -127,7 +119,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
params = _.extend({
|
params = _.extend({
|
||||||
avatarEnabled: this._avatarsEnabled,
|
|
||||||
editTooltip: t('comments', 'Edit comment'),
|
editTooltip: t('comments', 'Edit comment'),
|
||||||
isUserAuthor: OC.getCurrentUser().uid === params.actorId,
|
isUserAuthor: OC.getCurrentUser().uid === params.actorId,
|
||||||
isLong: this._isLong(params.message)
|
isLong: this._isLong(params.message)
|
||||||
|
@ -169,9 +160,7 @@
|
||||||
this.$el.find('.comments').before(this.editCommentTemplate({}));
|
this.$el.find('.comments').before(this.editCommentTemplate({}));
|
||||||
this.$el.find('.has-tooltip').tooltip();
|
this.$el.find('.has-tooltip').tooltip();
|
||||||
this.$container = this.$el.find('ul.comments');
|
this.$container = this.$el.find('ul.comments');
|
||||||
if (this._avatarsEnabled) {
|
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 32);
|
||||||
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 32);
|
|
||||||
}
|
|
||||||
this.delegateEvents();
|
this.delegateEvents();
|
||||||
this.$el.find('.message').on('keydown input change', this._onTypeComment);
|
this.$el.find('.message').on('keydown input change', this._onTypeComment);
|
||||||
|
|
||||||
|
@ -239,12 +228,10 @@
|
||||||
|
|
||||||
_postRenderItem: function($el) {
|
_postRenderItem: function($el) {
|
||||||
$el.find('.has-tooltip').tooltip();
|
$el.find('.has-tooltip').tooltip();
|
||||||
if(this._avatarsEnabled) {
|
$el.find('.avatar').each(function() {
|
||||||
$el.find('.avatar').each(function() {
|
var $this = $(this);
|
||||||
var $this = $(this);
|
$this.avatar($this.attr('data-username'), 32);
|
||||||
$this.avatar($this.attr('data-username'), 32);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,13 +244,10 @@
|
||||||
for(var i in mentions) {
|
for(var i in mentions) {
|
||||||
var mention = '@' + mentions[i].mentionId;
|
var mention = '@' + mentions[i].mentionId;
|
||||||
|
|
||||||
var avatar = '';
|
var avatar = '<div class="avatar" '
|
||||||
if(this._avatarsEnabled) {
|
+ 'data-user="' + _.escape(mentions[i].mentionId) + '"'
|
||||||
avatar = '<div class="avatar" '
|
+' data-user-display-name="'
|
||||||
+ 'data-user="' + _.escape(mentions[i].mentionId) + '"'
|
+ _.escape(mentions[i].mentionDisplayName) + '"></div>';
|
||||||
+' data-user-display-name="'
|
|
||||||
+ _.escape(mentions[i].mentionDisplayName) + '"></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// escape possible regex characters in the name
|
// escape possible regex characters in the name
|
||||||
mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
|
|
@ -43,7 +43,6 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
clock = sinon.useFakeTimers(Date.UTC(2016, 1, 3, 10, 5, 9));
|
clock = sinon.useFakeTimers(Date.UTC(2016, 1, 3, 10, 5, 9));
|
||||||
fetchStub = sinon.stub(OCA.Comments.CommentCollection.prototype, 'fetchNext');
|
fetchStub = sinon.stub(OCA.Comments.CommentCollection.prototype, 'fetchNext');
|
||||||
view = new OCA.Comments.CommentsTabView();
|
view = new OCA.Comments.CommentsTabView();
|
||||||
view._avatarsEnabled = false;
|
|
||||||
fileInfoModel = new OCA.Files.FileInfoModel({
|
fileInfoModel = new OCA.Files.FileInfoModel({
|
||||||
id: 5,
|
id: 5,
|
||||||
name: 'One.txt',
|
name: 'One.txt',
|
||||||
|
@ -146,7 +145,6 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders mentioned user id to avatar and displayname', function() {
|
it('renders mentioned user id to avatar and displayname', function() {
|
||||||
view._avatarsEnabled = true;
|
|
||||||
view.collection.set(testComments);
|
view.collection.set(testComments);
|
||||||
|
|
||||||
var $comment = view.$el.find('.comment[data-id=3] .message');
|
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');
|
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() {
|
describe('more comments', function() {
|
||||||
var hasMoreResultsStub;
|
var hasMoreResultsStub;
|
||||||
|
@ -316,11 +302,13 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
describe('editing comments', function() {
|
describe('editing comments', function() {
|
||||||
var saveStub;
|
var saveStub;
|
||||||
var fetchStub;
|
var fetchStub;
|
||||||
|
var avatarStub;
|
||||||
var currentUserStub;
|
var currentUserStub;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
saveStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'save');
|
saveStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'save');
|
||||||
fetchStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'fetch');
|
fetchStub = sinon.stub(OCA.Comments.CommentModel.prototype, 'fetch');
|
||||||
|
avatarStub = sinon.stub($.fn, 'avatar');
|
||||||
currentUserStub = sinon.stub(OC, 'getCurrentUser');
|
currentUserStub = sinon.stub(OC, 'getCurrentUser');
|
||||||
currentUserStub.returns({
|
currentUserStub.returns({
|
||||||
uid: 'testuser',
|
uid: 'testuser',
|
||||||
|
@ -348,6 +336,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
saveStub.restore();
|
saveStub.restore();
|
||||||
fetchStub.restore();
|
fetchStub.restore();
|
||||||
|
avatarStub.restore();
|
||||||
currentUserStub.restore();
|
currentUserStub.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(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);
|
$('.avatardiv').avatar($('#sharingUserId').val(), 128, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,15 +180,6 @@ $CONFIG = array(
|
||||||
*/
|
*/
|
||||||
'knowledgebaseenabled' => true,
|
'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
|
* ``true`` allows users to change their display names (on their Personal
|
||||||
* pages), and ``false`` prevents them from changing their display names.
|
* pages), and ``false`` prevents them from changing their display names.
|
||||||
|
|
|
@ -33,9 +33,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
* @deprecated here for legacy reasons - will always return true
|
||||||
*/
|
*/
|
||||||
areAvatarsEnabled: function() {
|
areAvatarsEnabled: function() {
|
||||||
return oc_config.enable_avatars === true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
|
|
||||||
var TEMPLATE =
|
var TEMPLATE =
|
||||||
'<span class="reshare">' +
|
'<span class="reshare">' +
|
||||||
' {{#if avatarEnabled}}' +
|
|
||||||
' <div class="avatar" data-userName="{{reshareOwner}}"></div>' +
|
' <div class="avatar" data-userName="{{reshareOwner}}"></div>' +
|
||||||
' {{/if}}' +
|
|
||||||
' {{sharedByText}}' +
|
' {{sharedByText}}' +
|
||||||
'</span><br/>'
|
'</span><br/>'
|
||||||
;
|
;
|
||||||
|
@ -93,17 +91,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$el.html(reshareTemplate({
|
this.$el.html(reshareTemplate({
|
||||||
avatarEnabled: this.configModel.areAvatarsEnabled(),
|
|
||||||
reshareOwner: this.model.getReshareOwner(),
|
reshareOwner: this.model.getReshareOwner(),
|
||||||
sharedByText: sharedByText
|
sharedByText: sharedByText
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(this.configModel.areAvatarsEnabled()) {
|
this.$el.find('.avatar').each(function() {
|
||||||
this.$el.find('.avatar').each(function() {
|
var $this = $(this);
|
||||||
var $this = $(this);
|
$this.avatar($this.data('username'), 32);
|
||||||
$this.avatar($this.data('username'), 32);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
'<ul id="shareWithList" class="shareWithList">' +
|
'<ul id="shareWithList" class="shareWithList">' +
|
||||||
'{{#each sharees}}' +
|
'{{#each sharees}}' +
|
||||||
'<li data-share-id="{{shareId}}" data-share-type="{{shareType}}" data-share-with="{{shareWith}}">' +
|
'<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>' +
|
'<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="has-tooltip username" title="{{shareWithTitle}}">{{shareWithDisplayName}}</span>' +
|
||||||
'<span class="sharingOptionsGroup">' +
|
'<span class="sharingOptionsGroup">' +
|
||||||
'{{#if editPermissionPossible}}' +
|
'{{#if editPermissionPossible}}' +
|
||||||
|
@ -41,9 +39,7 @@
|
||||||
'{{/each}}' +
|
'{{/each}}' +
|
||||||
'{{#each linkReshares}}' +
|
'{{#each linkReshares}}' +
|
||||||
'<li data-share-id="{{shareId}}" data-share-type="{{shareType}}">' +
|
'<li data-share-id="{{shareId}}" data-share-type="{{shareType}}">' +
|
||||||
'{{#if avatarEnabled}}' +
|
|
||||||
'<div class="avatar" data-username="{{shareInitiator}}"></div>' +
|
'<div class="avatar" data-username="{{shareInitiator}}"></div>' +
|
||||||
'{{/if}}' +
|
|
||||||
'<span class="has-tooltip username" title="{{shareInitiator}}">' + t('core', '{{shareInitiatorDisplayName}} shared via link') + '</span>' +
|
'<span class="has-tooltip username" title="{{shareInitiator}}">' + t('core', '{{shareInitiatorDisplayName}} shared via link') + '</span>' +
|
||||||
|
|
||||||
'<span class="sharingOptionsGroup">' +
|
'<span class="sharingOptionsGroup">' +
|
||||||
|
@ -193,7 +189,6 @@
|
||||||
|
|
||||||
getShareProperties: function() {
|
getShareProperties: function() {
|
||||||
return {
|
return {
|
||||||
avatarEnabled: this.configModel.areAvatarsEnabled(),
|
|
||||||
unshareLabel: t('core', 'Unshare'),
|
unshareLabel: t('core', 'Unshare'),
|
||||||
canShareLabel: t('core', 'can reshare'),
|
canShareLabel: t('core', 'can reshare'),
|
||||||
canEditLabel: t('core', 'can edit'),
|
canEditLabel: t('core', 'can edit'),
|
||||||
|
@ -247,7 +242,6 @@
|
||||||
getLinkReshares: function() {
|
getLinkReshares: function() {
|
||||||
var universal = {
|
var universal = {
|
||||||
unshareLabel: t('core', 'Unshare'),
|
unshareLabel: t('core', 'Unshare'),
|
||||||
avatarEnabled: this.configModel.areAvatarsEnabled(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!this.model.hasUserShares()) {
|
if(!this.model.hasUserShares()) {
|
||||||
|
@ -281,18 +275,16 @@
|
||||||
linkReshares: this.getLinkReshares()
|
linkReshares: this.getLinkReshares()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (this.configModel.areAvatarsEnabled()) {
|
this.$('.avatar').each(function () {
|
||||||
this.$('.avatar').each(function () {
|
var $this = $(this);
|
||||||
var $this = $(this);
|
if ($this.hasClass('imageplaceholderseed')) {
|
||||||
if ($this.hasClass('imageplaceholderseed')) {
|
$this.css({width: 32, height: 32});
|
||||||
$this.css({width: 32, height: 32});
|
$this.imageplaceholder($this.data('seed'));
|
||||||
$this.imageplaceholder($this.data('seed'));
|
} else {
|
||||||
} else {
|
// user, size, ie8fix, hidedefault, callback, displayname
|
||||||
// user, size, ie8fix, hidedefault, callback, displayname
|
$this.avatar($this.data('username'), 32, undefined, undefined, undefined, $this.data('displayname'));
|
||||||
$this.avatar($this.data('username'), 32, undefined, undefined, undefined, $this.data('displayname'));
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$('.has-tooltip').tooltip({
|
this.$('.has-tooltip').tooltip({
|
||||||
placement: 'bottom'
|
placement: 'bottom'
|
||||||
|
|
|
@ -24,7 +24,6 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
var $container;
|
var $container;
|
||||||
var oldAppConfig;
|
var oldAppConfig;
|
||||||
var autocompleteStub;
|
var autocompleteStub;
|
||||||
var oldEnableAvatars;
|
|
||||||
var avatarStub;
|
var avatarStub;
|
||||||
var placeholderStub;
|
var placeholderStub;
|
||||||
var oldCurrentUser;
|
var oldCurrentUser;
|
||||||
|
@ -103,8 +102,6 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
return $el;
|
return $el;
|
||||||
});
|
});
|
||||||
|
|
||||||
oldEnableAvatars = oc_config.enable_avatars;
|
|
||||||
oc_config.enable_avatars = false;
|
|
||||||
avatarStub = sinon.stub($.fn, 'avatar');
|
avatarStub = sinon.stub($.fn, 'avatar');
|
||||||
placeholderStub = sinon.stub($.fn, 'imageplaceholder');
|
placeholderStub = sinon.stub($.fn, 'imageplaceholder');
|
||||||
|
|
||||||
|
@ -123,7 +120,6 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
autocompleteStub.restore();
|
autocompleteStub.restore();
|
||||||
avatarStub.restore();
|
avatarStub.restore();
|
||||||
placeholderStub.restore();
|
placeholderStub.restore();
|
||||||
oc_config.enable_avatars = oldEnableAvatars;
|
|
||||||
});
|
});
|
||||||
describe('Share with link', function() {
|
describe('Share with link', function() {
|
||||||
// TODO: test ajax calls
|
// TODO: test ajax calls
|
||||||
|
@ -440,18 +436,13 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
|
|
||||||
describe('avatars enabled', function() {
|
describe('avatars enabled', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
oc_config.enable_avatars = true;
|
|
||||||
avatarStub.reset();
|
avatarStub.reset();
|
||||||
dialog.render();
|
dialog.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
|
||||||
oc_config.enable_avatars = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('test correct function calls', function() {
|
it('test correct function calls', function() {
|
||||||
expect(avatarStub.calledTwice).toEqual(true);
|
expect(avatarStub.calledTwice).toEqual(true);
|
||||||
expect(placeholderStub.calledTwice).toEqual(true);
|
expect(placeholderStub.callCount).toEqual(4);
|
||||||
expect(dialog.$('.shareWithList').children().length).toEqual(3);
|
expect(dialog.$('.shareWithList').children().length).toEqual(3);
|
||||||
expect(dialog.$('.avatar').length).toEqual(4);
|
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);
|
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() {
|
describe('remote sharing', function() {
|
||||||
it('shows remote share info when allowed', function() {
|
it('shows remote share info when allowed', function() {
|
||||||
|
|
|
@ -73,7 +73,6 @@
|
||||||
</form>
|
</form>
|
||||||
<div id="settings">
|
<div id="settings">
|
||||||
<div id="expand" tabindex="6" role="link" class="menutoggle">
|
<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'); } ?>">
|
<div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>">
|
||||||
<?php if ($_['userAvatarSet']): ?>
|
<?php if ($_['userAvatarSet']): ?>
|
||||||
<img alt="" width="32" height="32"
|
<img alt="" width="32" height="32"
|
||||||
|
@ -82,7 +81,6 @@
|
||||||
>
|
>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
<span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span>
|
<span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span>
|
||||||
<div class="icon-caret"></div>
|
<div class="icon-caret"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -204,7 +204,7 @@ class JSConfigHelper {
|
||||||
'session_keepalive' => $this->config->getSystemValue('session_keepalive', true),
|
'session_keepalive' => $this->config->getSystemValue('session_keepalive', true),
|
||||||
'version' => implode('.', \OCP\Util::getVersion()),
|
'version' => implode('.', \OCP\Util::getVersion()),
|
||||||
'versionstring' => \OC_Util::getVersionString(),
|
'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),
|
'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
|
||||||
'modRewriteWorking' => (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
|
'modRewriteWorking' => (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -100,7 +100,6 @@ class TemplateLayout extends \OC_Template {
|
||||||
$this->assign('user_displayname', $userDisplayName);
|
$this->assign('user_displayname', $userDisplayName);
|
||||||
$this->assign('user_uid', \OC_User::getUser());
|
$this->assign('user_uid', \OC_User::getUser());
|
||||||
$this->assign('appsmanagement_active', $appsMgmtActive);
|
$this->assign('appsmanagement_active', $appsMgmtActive);
|
||||||
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
|
|
||||||
|
|
||||||
if (\OC_User::getUser() === false) {
|
if (\OC_User::getUser() === false) {
|
||||||
$this->assign('userAvatarSet', false);
|
$this->assign('userAvatarSet', false);
|
||||||
|
|
|
@ -121,10 +121,8 @@ class OC_Template extends \OC\Template\Base {
|
||||||
OC_Util::addStyle("styles",null,true);
|
OC_Util::addStyle("styles",null,true);
|
||||||
|
|
||||||
// avatars
|
// avatars
|
||||||
if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) {
|
\OC_Util::addScript('jquery.avatar', null, true);
|
||||||
\OC_Util::addScript('jquery.avatar', null, true);
|
\OC_Util::addScript('placeholder', null, true);
|
||||||
\OC_Util::addScript('placeholder', null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_Util::addVendorScript('select2/select2');
|
OC_Util::addVendorScript('select2/select2');
|
||||||
OC_Util::addVendorStyle('select2/select2', null, true);
|
OC_Util::addVendorStyle('select2/select2', null, true);
|
||||||
|
|
|
@ -188,12 +188,10 @@ class UsersController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
$avatarAvailable = false;
|
$avatarAvailable = false;
|
||||||
if ($this->config->getSystemValue('enable_avatars', true) === true) {
|
try {
|
||||||
try {
|
$avatarAvailable = $this->avatarManager->getAvatar($user->getUID())->exists();
|
||||||
$avatarAvailable = $this->avatarManager->getAvatar($user->getUID())->exists();
|
} catch (\Exception $e) {
|
||||||
} catch (\Exception $e) {
|
//No avatar yet
|
||||||
//No avatar yet
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -334,15 +334,13 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load the big avatar
|
// Load the big avatar
|
||||||
if (oc_config.enable_avatars) {
|
$('#avatarform .avatardiv').avatar(OC.currentUser, 145, true, null, function() {
|
||||||
$('#avatarform .avatardiv').avatar(OC.currentUser, 145, true, null, function() {
|
if($('#displayavatar img').length === 0) {
|
||||||
if($('#displayavatar img').length === 0) {
|
$('#removeavatar').removeClass('inlineblock').addClass('hidden');
|
||||||
$('#removeavatar').removeClass('inlineblock').addClass('hidden');
|
} else {
|
||||||
} else {
|
$('#removeavatar').removeClass('hidden').addClass('inlineblock');
|
||||||
$('#removeavatar').removeClass('hidden').addClass('inlineblock');
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Show token views
|
// Show token views
|
||||||
|
|
|
@ -57,10 +57,8 @@ OC_Util::addStyle( 'settings', 'settings' );
|
||||||
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
|
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
|
||||||
\OC_Util::addVendorStyle('strengthify/strengthify');
|
\OC_Util::addVendorStyle('strengthify/strengthify');
|
||||||
\OC_Util::addScript('files', 'jquery.fileupload');
|
\OC_Util::addScript('files', 'jquery.fileupload');
|
||||||
if ($config->getSystemValue('enable_avatars', true) === true) {
|
\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
|
||||||
\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
|
\OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
|
||||||
\OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
|
|
||||||
}
|
|
||||||
|
|
||||||
\OC::$server->getEventDispatcher()->dispatch('OC\Settings\Personal::loadAdditionalScripts');
|
\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('twitterScope', $userData[\OC\Accounts\AccountManager::PROPERTY_TWITTER]['scope']);
|
||||||
$tmpl->assign('addressScope', $userData[\OC\Accounts\AccountManager::PROPERTY_ADDRESS]['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('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
|
||||||
$tmpl->assign('certs', $certificateManager->listCertificates());
|
$tmpl->assign('certs', $certificateManager->listCertificates());
|
||||||
$tmpl->assign('showCertificates', $enableCertImport);
|
$tmpl->assign('showCertificates', $enableCertImport);
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="personal-settings">
|
<div id="personal-settings">
|
||||||
<?php if ($_['enableAvatars']): ?>
|
|
||||||
<div id="personal-settings-avatar-container">
|
<div id="personal-settings-avatar-container">
|
||||||
<form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>">
|
<form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>">
|
||||||
<h2>
|
<h2>
|
||||||
|
@ -66,7 +65,6 @@
|
||||||
<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
|
<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div id="personal-settings-container">
|
<div id="personal-settings-container">
|
||||||
<div class="personal-settings-setting-box">
|
<div class="personal-settings-setting-box">
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<table id="userlist" class="hascontrols grid" data-groups="<?php p($_['allGroups']);?>">
|
<table id="userlist" class="hascontrols grid" data-groups="<?php p($_['allGroups']);?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ($_['enableAvatars']): ?>
|
|
||||||
<th id="headerAvatar" scope="col"></th>
|
<th id="headerAvatar" scope="col"></th>
|
||||||
<?php endif; ?>
|
|
||||||
<th id="headerName" scope="col"><?php p($l->t('Username'))?></th>
|
<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="headerDisplayName" scope="col"><?php p($l->t( 'Full name' )); ?></th>
|
||||||
<th id="headerPassword" scope="col"><?php p($l->t( 'Password' )); ?></th>
|
<th id="headerPassword" scope="col"><?php p($l->t( 'Password' )); ?></th>
|
||||||
|
@ -22,9 +20,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- the following <tr> is used as a template for the JS part -->
|
<!-- the following <tr> is used as a template for the JS part -->
|
||||||
<tr style="display:none">
|
<tr style="display:none">
|
||||||
<?php if ($_['enableAvatars']): ?>
|
|
||||||
<td class="avatar"><div class="avatardiv"></div></td>
|
<td class="avatar"><div class="avatardiv"></div></td>
|
||||||
<?php endif; ?>
|
|
||||||
<th class="name" scope="row"></th>
|
<th class="name" scope="row"></th>
|
||||||
<td class="displayName"><span></span> <img class="action"
|
<td class="displayName"><span></span> <img class="action"
|
||||||
src="<?php p(image_path('core', 'actions/rename.svg'))?>"
|
src="<?php p(image_path('core', 'actions/rename.svg'))?>"
|
||||||
|
|
|
@ -118,7 +118,6 @@ $tmpl->assign('quota_preset', $quotaPreset);
|
||||||
$tmpl->assign('default_quota', $defaultQuota);
|
$tmpl->assign('default_quota', $defaultQuota);
|
||||||
$tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
|
$tmpl->assign('defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
|
||||||
$tmpl->assign('recoveryAdminEnabled', $recoveryAdminEnabled);
|
$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_storage_location', $config->getAppValue('core', 'umgmt_show_storage_location', 'false'));
|
||||||
$tmpl->assign('show_last_login', $config->getAppValue('core', 'umgmt_show_last_login', 'false'));
|
$tmpl->assign('show_last_login', $config->getAppValue('core', 'umgmt_show_last_login', 'false'));
|
||||||
|
|
|
@ -96,10 +96,6 @@ class UsersControllerTest extends \Test\TestCase {
|
||||||
['bar', $avatarExists],
|
['bar', $avatarExists],
|
||||||
['admin', $avatarNotExists],
|
['admin', $avatarNotExists],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$this->config->method('getSystemValue')
|
|
||||||
->with('enable_avatars', true)
|
|
||||||
->willReturn(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue