remove more XXX notes, add stricter team invite link content validation

pull/1/head
ansuz 3 years ago
parent 897b0bb5b6
commit ae7e5e0636

@ -3616,7 +3616,7 @@ define([
}); });
var displayName = UI.getDisplayName(data.name); var displayName = UI.getDisplayName(data.name);
common.displayAvatar($(avatar), data.avatar, displayName); // XXX common.displayAvatar($(avatar), data.avatar, displayName);
return h('span.cp-mentions', { return h('span.cp-mentions', {
'data-curve': data.curvePublic, 'data-curve': data.curvePublic,
'data-notifications': data.notifications, 'data-notifications': data.notifications,

@ -348,7 +348,7 @@ define([
if (!val) { if (!val) {
$('<img>', { $('<img>', {
src: '/customize/images/avatar.png', src: '/customize/images/avatar.png',
title: Messages.profile_avatar, // XXX title: Messages.profile_defaultAlt,
alt: Messages.profile_defaultAlt, alt: Messages.profile_defaultAlt,
}).appendTo($span); }).appendTo($span);
return; return;
@ -391,7 +391,7 @@ define([
}, function () { }, function () {
sframeChan.query("Q_PROFILE_AVATAR_ADD", data.url, function (err, err2) { sframeChan.query("Q_PROFILE_AVATAR_ADD", data.url, function (err, err2) {
if (err || err2) { return void UI.log(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) { if (!val) {
var $img = $('<img>', { var $img = $('<img>', {
src: '/customize/images/avatar.png', src: '/customize/images/avatar.png',
title: Messages.profile_avatar, // XXX title: Messages.profile_defaultAlt,
alt: 'Avatar' alt: Messages.profile_defaultAlt,
}); });
var mt = h('media-tag', $img[0]); var mt = h('media-tag', $img[0]);
$avatar.append(mt); $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) { nThen(function (waitFor) {
// Get preview content. // Get preview content.
sframeChan.query('Q_ANON_GET_PREVIEW_CONTENT', { seeds: seeds }, waitFor(function (err, json) { 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(); $(errorBlock).text(Messages.team_inviteInvalidLinkError).show();
waitFor.abort(); waitFor.abort();
$div.empty(); $div.empty();
return; 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.empty();
$div.append(h('div.cp-teams-invite-from', [ $div.append(h('div.cp-teams-invite-from', [
Messages.team_inviteFrom, Messages.team_inviteFrom,

Loading…
Cancel
Save