Little fixes and improvements to comments

pull/1/head
yflory 5 years ago
parent fd348dc4e2
commit 60555f65a7

@ -24,8 +24,9 @@
.avatar_main(40px);
display: flex;
align-items: flex-start;
textarea {
div.cp-textarea {
flex: 1;
min-height: 50px;
height: 50px;
padding: 2px 8px;
}
@ -82,7 +83,7 @@
background-color: white;
padding: 10px 5px 5px;
white-space: pre-wrap;
word-break: break-all;
word-break: break-word;
}
.cp-comment-actions {
display: none;

@ -316,6 +316,7 @@ define([
};
Messages.comments_notification = 'Replies to your comment "{0}" in <b>{1}</b>'; // XXX
Messages.unknownPad = "Unknown pad"; // XXX
handlers['COMMENT_REPLY'] = function (common, data) {
var content = data.content;
var msg = content.msg;
@ -326,16 +327,18 @@ define([
if (msg.content.comment.length > 20) {
comment += '...';
}
var title = Util.fixHTML(msg.content.title);
var title = Util.fixHTML(msg.content.title || Messages.unknownPad);
var href = msg.content.href;
content.getFormatText = function () {
return Messages._getKey('comments_notification', [comment, title]);
};
content.handler = function () {
common.openURL(href);
defaultDismiss(common, data)();
};
if (href) {
content.handler = function () {
common.openURL(href);
defaultDismiss(common, data)();
};
}
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}
@ -348,16 +351,18 @@ define([
// Display the notification
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var title = Util.fixHTML(msg.content.title);
var title = Util.fixHTML(msg.content.title || Messages.unknownPad);
var href = msg.content.href;
content.getFormatText = function () {
return Messages._getKey('mentions_notification', [name, title]);
};
content.handler = function () {
common.openURL(href);
defaultDismiss(common, data)();
};
if (href) {
content.handler = function () {
common.openURL(href);
defaultDismiss(common, data)();
};
}
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}

@ -546,12 +546,12 @@ define([
var title, href;
// Check if the pad is in our drive
if (!res.some(function (obj) {
res.some(function (obj) {
if (!obj.data) { return; }
href = obj.data.href;
href = obj.data.href || obj.data.roHref;
title = obj.data.filename || obj.data.title;
return true;
})) { return void cb(true); }
});
// If we don't have the edit url, ignore this notification
if (!href) { return void cb(true); }
@ -596,16 +596,17 @@ define([
var channel = content.channel;
if (!channel) { return void cb(true); }
var res = ctx.store.manager.findChannel(channel);
console.log(res);
if (!res.length) { return void cb(true); }
var title, href;
// Check if the pad is in our drive
if (!res.some(function (obj) {
res.some(function (obj) {
if (!obj.data) { return; }
href = obj.data.href || obj.data.roHref; // XXX send the href when we mention?
href = obj.data.href || obj.data.roHref;
title = obj.data.filename || obj.data.title;
return true;
})) { return void cb(true); }
});
// Add the title
content.href = href;

@ -195,7 +195,9 @@ define([
// Send notification
var privateData = Env.metadataMgr.getPrivateData();
var userData = Env.metadataMgr.getUserData();
Object.keys(notify).forEach(function (curve) {
if (curve === userData.curvePublic) { return; }
Env.common.mailbox.sendTo("MENTION", {
channel: privateData.channel,
}, {

Loading…
Cancel
Save