Little fixes and improvements to comments

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

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

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

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

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

Loading…
Cancel
Save