mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
remove more XXX notes, add stricter team invite link content validation
This commit is contained in:
parent
897b0bb5b6
commit
ae7e5e0636
@ -3616,7 +3616,7 @@ define([
|
||||
});
|
||||
|
||||
var displayName = UI.getDisplayName(data.name);
|
||||
common.displayAvatar($(avatar), data.avatar, displayName); // XXX
|
||||
common.displayAvatar($(avatar), data.avatar, displayName);
|
||||
return h('span.cp-mentions', {
|
||||
'data-curve': data.curvePublic,
|
||||
'data-notifications': data.notifications,
|
||||
|
||||
@ -348,7 +348,7 @@ define([
|
||||
if (!val) {
|
||||
$('<img>', {
|
||||
src: '/customize/images/avatar.png',
|
||||
title: Messages.profile_avatar, // XXX
|
||||
title: Messages.profile_defaultAlt,
|
||||
alt: Messages.profile_defaultAlt,
|
||||
}).appendTo($span);
|
||||
return;
|
||||
@ -391,7 +391,7 @@ define([
|
||||
}, function () {
|
||||
sframeChan.query("Q_PROFILE_AVATAR_ADD", data.url, function (err, err2) {
|
||||
if (err || err2) { return void UI.log(err || err2); }
|
||||
displayAvatar(data.url); // XXX add "Profile picture"
|
||||
displayAvatar(data.url);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -1099,8 +1099,8 @@ define([
|
||||
if (!val) {
|
||||
var $img = $('<img>', {
|
||||
src: '/customize/images/avatar.png',
|
||||
title: Messages.profile_avatar, // XXX
|
||||
alt: 'Avatar'
|
||||
title: Messages.profile_defaultAlt,
|
||||
alt: Messages.profile_defaultAlt,
|
||||
});
|
||||
var mt = h('media-tag', $img[0]);
|
||||
$avatar.append(mt);
|
||||
@ -1323,16 +1323,23 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
var isValidInvitationLinkContent = function (json) {
|
||||
if (!json) { return false; }
|
||||
if (json.error || !Object.keys(json).length) { return false; }
|
||||
if (!json.author) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
nThen(function (waitFor) {
|
||||
// Get preview content.
|
||||
sframeChan.query('Q_ANON_GET_PREVIEW_CONTENT', { seeds: seeds }, waitFor(function (err, json) {
|
||||
if (json && (json.error || !Object.keys(json).length)) { // XXX team invite links are triggering this every time for me?
|
||||
if (!isValidInvitationLinkContent(json)) {
|
||||
$(errorBlock).text(Messages.team_inviteInvalidLinkError).show();
|
||||
waitFor.abort();
|
||||
$div.empty();
|
||||
return;
|
||||
}
|
||||
// XXX nothing guarantees that author, teamName, or message exist in json
|
||||
// FIXME nothing guarantees that teamName or author.displayName exist in json
|
||||
$div.empty();
|
||||
$div.append(h('div.cp-teams-invite-from', [
|
||||
Messages.team_inviteFrom,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user