Deprecate oc_current_user, fix usage and move currentUser to the bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
a3800a6810
commit
278c281cc9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -354,7 +354,7 @@
|
|||
});
|
||||
|
||||
var username = $el.find('.avatar').data('username');
|
||||
if (username !== oc_current_user) {
|
||||
if (username !== OC.getCurrentUser().uid) {
|
||||
$el.find('.authorRow .avatar, .authorRow .author').contactsMenu(
|
||||
username, 0, $el.find('.authorRow'));
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
owner = $('#owner').val(),
|
||||
ownerDisplayName = $('#ownerDisplayName').val();
|
||||
if (usedSpacePercent > 98) {
|
||||
if (owner !== oc_current_user) {
|
||||
if (owner !== OC.getCurrentUser().uid) {
|
||||
OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!',
|
||||
{owner: ownerDisplayName}), {type: 'error'}
|
||||
);
|
||||
|
@ -167,7 +167,7 @@
|
|||
return;
|
||||
}
|
||||
if (usedSpacePercent > 90) {
|
||||
if (owner !== oc_current_user) {
|
||||
if (owner !== OC.getCurrentUser().uid) {
|
||||
OC.Notification.show(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)',
|
||||
{
|
||||
usedSpacePercent: usedSpacePercent,
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,3 @@
|
|||
var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user');
|
||||
var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
|
||||
|
||||
/** @namespace OCP */
|
||||
|
@ -16,13 +15,6 @@ Object.assign(window.OC, {
|
|||
*/
|
||||
_capabilities: window.oc_capabilities || null,
|
||||
|
||||
/**
|
||||
* Currently logged in user or null if none
|
||||
*
|
||||
* @type String
|
||||
* @deprecated use {@link OC.getCurrentUser} instead
|
||||
*/
|
||||
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
|
||||
theme: window.oc_defaults || {},
|
||||
requestToken: oc_requesttoken,
|
||||
|
||||
|
@ -92,23 +84,6 @@ Object.assign(window.OC, {
|
|||
return OC._capabilities;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the currently logged in user or null if there is no logged in
|
||||
* user (public page mode)
|
||||
*
|
||||
* @return {OC.CurrentUser} user spec
|
||||
* @since 9.0.0
|
||||
*/
|
||||
getCurrentUser: function() {
|
||||
if (_.isUndefined(this._currentUserDisplayName)) {
|
||||
this._currentUserDisplayName = document.getElementsByTagName('head')[0].getAttribute('data-user-displayname');
|
||||
}
|
||||
return {
|
||||
uid: this.currentUser,
|
||||
displayName: this._currentUserDisplayName
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* get the absolute path to an image file
|
||||
* if no extension is given for the image, it will automatically decide
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
shareWith = 'circle-' + shareIndex;
|
||||
}
|
||||
|
||||
if (sharedBy !== oc_current_user) {
|
||||
if (sharedBy !== OC.getCurrentUser().uid) {
|
||||
var empty = shareWithTitle === '';
|
||||
if (!empty) {
|
||||
shareWithTitle += ' (';
|
||||
|
@ -154,8 +154,8 @@
|
|||
shareId: this.model.get('shares')[shareIndex].id,
|
||||
modSeed: shareWithAvatar || (shareType !== OC.Share.SHARE_TYPE_USER && shareType !== OC.Share.SHARE_TYPE_CIRCLE && shareType !== OC.Share.SHARE_TYPE_ROOM),
|
||||
owner: fileOwnerUid,
|
||||
isShareWithCurrentUser: (shareType === OC.Share.SHARE_TYPE_USER && shareWith === oc_current_user),
|
||||
canUpdateShareSettings: (sharedBy === oc_current_user || fileOwnerUid === oc_current_user),
|
||||
isShareWithCurrentUser: (shareType === OC.Share.SHARE_TYPE_USER && shareWith === OC.getCurrentUser().uid),
|
||||
canUpdateShareSettings: (sharedBy === OC.getCurrentUser().uid || fileOwnerUid === OC.getCurrentUser().uid),
|
||||
isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE,
|
||||
isRemoteGroupShare: shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP,
|
||||
isNoteAvailable: shareType !== OC.Share.SHARE_TYPE_REMOTE && shareType !== OC.Share.SHARE_TYPE_REMOTE_GROUP,
|
||||
|
|
|
@ -98,7 +98,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'file'
|
||||
}]);
|
||||
listView.render();
|
||||
|
@ -113,7 +113,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'file'
|
||||
}]);
|
||||
listView.render();
|
||||
|
@ -128,7 +128,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
@ -144,7 +144,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user _.@-\'',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
@ -160,7 +160,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
@ -176,7 +176,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user _.@-\'',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
@ -193,7 +193,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
listView.render();
|
||||
|
@ -210,7 +210,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
@ -228,7 +228,7 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
|||
share_type: OC.Share.SHARE_TYPE_USER,
|
||||
share_with: 'user1',
|
||||
share_with_displayname: 'User One',
|
||||
uid_owner: oc_current_user,
|
||||
uid_owner: OC.getCurrentUser().uid,
|
||||
itemType: 'folder'
|
||||
}]);
|
||||
shareModel.set('itemType', 'folder');
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const rawUid = document
|
||||
.getElementsByTagName('head')[0]
|
||||
.getAttribute('data-user')
|
||||
const displayname = document
|
||||
.getElementsByTagName('head')[0]
|
||||
.getAttribute('data-user-displayname')
|
||||
|
||||
export const currentUser = rawUid !== undefined ? rawUid : false
|
||||
|
||||
export const getCurrentUser = () => {
|
||||
return {
|
||||
uid: currentUser,
|
||||
displayname,
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ import {
|
|||
TAG_FAVORITE,
|
||||
} from './constants'
|
||||
import ContactsMenu from './contactsmenu'
|
||||
import {currentUser, getCurrentUser} from './currentuser'
|
||||
import Dialogs from './dialogs'
|
||||
import EventSource from './eventsource'
|
||||
import {get, set} from './get_set'
|
||||
|
@ -90,8 +91,22 @@ export default {
|
|||
Backbone,
|
||||
ContactsMenu,
|
||||
config: Config,
|
||||
/**
|
||||
* Currently logged in user or null if none
|
||||
*
|
||||
* @type String
|
||||
* @deprecated use {@link OC.getCurrentUser} instead
|
||||
*/
|
||||
currentUser,
|
||||
dialogs: Dialogs,
|
||||
EventSource,
|
||||
/**
|
||||
* Returns the currently logged in user or null if there is no logged in
|
||||
* user (public page mode)
|
||||
*
|
||||
* @since 9.0.0
|
||||
*/
|
||||
getCurrentUser,
|
||||
isUserAdmin,
|
||||
L10N,
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ window['moment'] = moment
|
|||
window['OC'] = OC
|
||||
setDeprecatedProp('oc_appswebroots', OC.appswebroots, 'use OC.appswebroots instead')
|
||||
setDeprecatedProp('oc_config', OC.config, 'use OC.config instead')
|
||||
setDeprecatedProp('oc_current_user', OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead')
|
||||
setDeprecatedProp('oc_debug', OC.debug, 'use OC.debug instead')
|
||||
setDeprecatedProp('oc_isadmin', OC.isUserAdmin(), 'use OC.isUserAdmin() instead')
|
||||
setDeprecatedProp('oc_webroot', OC.webroot, 'use OC.getRootPath() instead')
|
||||
|
|
2900
settings/js/vue-1.js
2900
settings/js/vue-1.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
3125
settings/js/vue-2.js
3125
settings/js/vue-2.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
3267
settings/js/vue-3.js
3267
settings/js/vue-3.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -108,5 +108,5 @@ o.a.use(Gt.a);var te={API_FAILURE:function(e,n){try{var r=n.error.response.data.
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
o.a.use(i.a),Object(a.sync)(ee,Vt),r.nc=btoa(OC.requestToken),r.p=OC.linkTo("settings","js/"),o.a.prototype.t=t,o.a.prototype.OC=OC,o.a.prototype.OCA=OCA,o.a.prototype.oc_userconfig=oc_userconfig,o.a.prototype.oc_current_user=oc_current_user;var ne=new o.a({router:Vt,store:ee,render:function(t){return t(c)}}).$mount("#content")}]);
|
||||
o.a.use(i.a),Object(a.sync)(ee,Vt),r.nc=btoa(OC.requestToken),r.p=OC.linkTo("settings","js/"),o.a.prototype.t=t,o.a.prototype.OC=OC,o.a.prototype.OCA=OCA,o.a.prototype.oc_userconfig=oc_userconfig;var ne=new o.a({router:Vt,store:ee,render:function(t){return t(c)}}).$mount("#content")}]);
|
||||
//# sourceMappingURL=vue-settings-apps-users-management.js.map
|
File diff suppressed because one or more lines are too long
|
@ -212,7 +212,7 @@ export default {
|
|||
}
|
||||
if (!this.settings.isAdmin) {
|
||||
// we don't want subadmins to edit themselves
|
||||
return this.users.filter(user => user.enabled !== false && user.id !== oc_current_user);
|
||||
return this.users.filter(user => user.enabled !== false && user.id !== OC.getCurrentUser().uid);
|
||||
}
|
||||
return this.users.filter(user => user.enabled !== false);
|
||||
},
|
||||
|
|
|
@ -47,7 +47,6 @@ Vue.prototype.t = t;
|
|||
Vue.prototype.OC = OC;
|
||||
Vue.prototype.OCA = OCA;
|
||||
Vue.prototype.oc_userconfig = oc_userconfig;
|
||||
Vue.prototype.oc_current_user = oc_current_user;
|
||||
|
||||
const app = new Vue({
|
||||
router,
|
||||
|
|
Loading…
Reference in New Issue