mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Merge 8ff8b47f35 into 9808cf25c1
This commit is contained in:
commit
eafd54a1be
@ -82,6 +82,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.cp-disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.cp-usergrid-user-avatar {
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
@ -1317,10 +1317,10 @@ const factory = (Sortify, UserObject, ProxyManager,
|
||||
var list = {};
|
||||
var types = query.types;
|
||||
var where = query.where;
|
||||
var filter = query.filter || {};
|
||||
var filter = query.filter || {};
|
||||
var isFiltered = function (type, data) {
|
||||
var filtered;
|
||||
var fType = filter.fileType || [];
|
||||
var fType = filter.fileType || [];
|
||||
if (type === 'file' && fType.length) {
|
||||
if (!data.fileType) { return true; }
|
||||
filtered = !fType.some(function (t) {
|
||||
@ -1351,6 +1351,22 @@ const factory = (Sortify, UserObject, ProxyManager,
|
||||
cb(list);
|
||||
};
|
||||
|
||||
// Get all teams where a given pad is stored
|
||||
Store.getPadTeams = function (userId, data, cb) {
|
||||
var channel = data && data.channel;
|
||||
if (!channel) { return void cb({error: 'EINVAL'}); }
|
||||
|
||||
var teamIds = [];
|
||||
getAllStores().forEach(function (s) {
|
||||
if (!s.id) { return; } // Skip our own drive, we only want teams here
|
||||
var chans = s.manager.findChannel(channel, true);
|
||||
if (chans && chans.length) {
|
||||
teamIds.push(s.id);
|
||||
}
|
||||
});
|
||||
cb(teamIds);
|
||||
};
|
||||
|
||||
// Get the first pad we can find in any of our drives and return its file data
|
||||
// NOTE: This is currently only used for template: this won't search inside shared folders
|
||||
Store.getPadData = function (clientId, id, cb) {
|
||||
|
||||
@ -45,6 +45,7 @@ const factory = AStore => {
|
||||
LIST_ALL_TAGS: Store.listAllTags,
|
||||
GET_TEMPLATES: Store.getTemplates,
|
||||
GET_SECURE_FILES_LIST: Store.getSecureFilesList,
|
||||
GET_PAD_TEAMS: Store.getPadTeams,
|
||||
GET_PAD_DATA: Store.getPadData,
|
||||
GET_PAD_DATA_FROM_CHANNEL: Store.getPadDataFromChannel,
|
||||
GET_STRONGER_HASH: Store.getStrongerHash,
|
||||
|
||||
@ -184,7 +184,7 @@ define([
|
||||
|
||||
el = h('div.cp-usergrid-user'+(data.selected?'.cp-selected':'')+(config.large?'.large':''), {
|
||||
'data-ed': data.edPublic,
|
||||
'data-teamid': data.teamId,
|
||||
'data-teamid': data.id,
|
||||
'data-curve': data.curvePublic || '',
|
||||
'data-name': name.toLowerCase(),
|
||||
'data-order': i,
|
||||
|
||||
@ -1246,6 +1246,11 @@ define([
|
||||
cb(void 0, list);
|
||||
});
|
||||
};
|
||||
common.getPadTeams = function (query, cb) {
|
||||
postMessage("GET_PAD_TEAMS", query, function (teams) {
|
||||
cb(teams);
|
||||
});
|
||||
};
|
||||
// Get a template href from its id
|
||||
common.getPadData = function (id, cb) {
|
||||
postMessage("GET_PAD_DATA", id, function (data) {
|
||||
|
||||
@ -82,13 +82,32 @@ define([
|
||||
}
|
||||
|
||||
if (Object.keys(teams).length) {
|
||||
var teamsList = UIElements.getUserGrid(Messages.share_linkTeam, {
|
||||
common: common,
|
||||
noFilter: true,
|
||||
large: true,
|
||||
data: teams
|
||||
}, refreshButtons);
|
||||
$div.append(teamsList.div);
|
||||
common.getPadTeams({channel: config.channel}, function (err, teamIds) {
|
||||
if (err) { console.error(err); }
|
||||
teamIds = teamIds || [];
|
||||
|
||||
var teamsList = UIElements.getUserGrid(Messages.share_linkTeam, {
|
||||
common: common,
|
||||
noFilter: true,
|
||||
large: true,
|
||||
data: teams
|
||||
}, refreshButtons);
|
||||
|
||||
teamsList.icons.forEach(function (icon) {
|
||||
var inTeam = teamIds.some(function (id) {
|
||||
return String(id) === icon.getAttribute('data-teamid');
|
||||
});
|
||||
if (inTeam) {
|
||||
$(icon).addClass('cp-disabled');
|
||||
$(icon).on('click', function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$div.append(teamsList.div);
|
||||
});
|
||||
}
|
||||
|
||||
var shareButton = {
|
||||
|
||||
@ -1533,6 +1533,10 @@ define([
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
sframeChan.on('Q_GET_PAD_TEAMS', function (types, cb) {
|
||||
Cryptpad.getPadTeams(types, cb);
|
||||
});
|
||||
};
|
||||
addCommonRpc(sframeChan, isSafe);
|
||||
|
||||
|
||||
@ -689,6 +689,12 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
funcs.getPadTeams = function (query, cb) {
|
||||
ctx.sframeChan.query('Q_GET_PAD_TEAMS', query, function (err, data) {
|
||||
cb(err || data?.error, data);
|
||||
});
|
||||
};
|
||||
|
||||
funcs.getCache = function () {
|
||||
return ctx.cache;
|
||||
};
|
||||
|
||||
2
www/common/worker.bundle.min.js
vendored
2
www/common/worker.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user