summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js2
-rw-r--r--lib/models/note.js2
-rw-r--r--lib/realtime.js30
-rw-r--r--public/css/site.css2
-rw-r--r--public/js/cover.js2
-rw-r--r--public/js/index.js24
-rw-r--r--public/views/body.ejs6
7 files changed, 39 insertions, 29 deletions
diff --git a/app.js b/app.js
index 83b19e23..7b5e6197 100644
--- a/app.js
+++ b/app.js
@@ -641,7 +641,7 @@ process.on('SIGINT', function () {
var checkCleanTimer = setInterval(function () {
if (history.isReady() && realtime.isReady()) {
models.Revision.checkAllNotesRevision(function (err, notes) {
- if (err) throw new Error(err);
+ if (err) return logger.error(err);
if (!notes || notes.length <= 0) {
clearInterval(checkCleanTimer);
return process.exit(0);
diff --git a/lib/models/note.js b/lib/models/note.js
index a6921267..86112973 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -23,7 +23,7 @@ var logger = require("../logger.js");
var ot = require("../ot/index.js");
// permission types
-var permissionTypes = ["freely", "editable", "limited", "private", "protected", "locked"];
+var permissionTypes = ["freely", "editable", "limited", "locked", "protected", "private"];
module.exports = function (sequelize, DataTypes) {
var Note = sequelize.define("Note", {
diff --git a/lib/realtime.js b/lib/realtime.js
index a3c56c41..21390607 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -652,17 +652,25 @@ function operationCallback(socket, operation) {
if (!user) return;
userId = socket.request.user.id;
if (!note.authors[userId]) {
- models.Author.create({
- noteId: noteId,
- userId: userId,
- color: user.color
- }).then(function (author) {
- note.authors[author.userId] = {
- userid: author.userId,
- color: author.color,
- photo: user.photo,
- name: user.name
- };
+ models.Author.findOrCreate({
+ where: {
+ noteId: noteId,
+ userId: userId
+ },
+ defaults: {
+ noteId: noteId,
+ userId: userId,
+ color: user.color
+ }
+ }).spread(function (author, created) {
+ if (author) {
+ note.authors[author.userId] = {
+ userid: author.userId,
+ color: author.color,
+ photo: user.photo,
+ name: user.name
+ };
+ }
}).catch(function (err) {
return logger.error('operation callback failed: ' + err);
});
diff --git a/public/css/site.css b/public/css/site.css
index 3685149b..d88f8429 100644
--- a/public/css/site.css
+++ b/public/css/site.css
@@ -3,7 +3,7 @@ body {
font-smoothing: subpixel-antialiased !important;
-webkit-font-smoothing: subpixel-antialiased !important;
-moz-osx-font-smoothing: auto !important;
- text-shadow: 1px 1px 1.2px rgba(0, 0, 0, 0.004);
+ text-shadow: 0 0 1em transparent, 1px 1px 1.2px rgba(0, 0, 0, 0.004);
/*text-rendering: optimizeLegibility;*/
-webkit-overflow-scrolling: touch;
font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
diff --git a/public/js/cover.js b/public/js/cover.js
index 2f35bd28..a8d8ecfe 100644
--- a/public/js/cover.js
+++ b/public/js/cover.js
@@ -107,9 +107,11 @@ $(".ui-history").click(function () {
function checkHistoryList() {
if ($("#history-list").children().length > 0) {
+ $('.pagination').show();
$(".ui-nohistory").hide();
$(".ui-import-from-browser").hide();
} else if ($("#history-list").children().length == 0) {
+ $('.pagination').hide();
$(".ui-nohistory").slideDown();
getStorageHistory(function (data) {
if (data && data.length > 0 && getLoginState() && historyList.items.length == 0) {
diff --git a/public/js/index.js b/public/js/index.js
index 91dc8f0d..14235bc3 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2289,19 +2289,19 @@ function updatePermission(newPermission) {
break;
case "limited":
label = '<i class="fa fa-id-card"></i> Limited';
- title = "Signed people can edit & guest can't view"
+ title = "Signed people can edit (forbid guest)"
break;
- case "private":
- label = '<i class="fa fa-hand-stop-o"></i> Private';
- title = "Only owner can view & edit";
+ case "locked":
+ label = '<i class="fa fa-lock"></i> Locked';
+ title = "Only owner can edit";
break;
case "protected":
label = '<i class="fa fa-umbrella"></i> Protected';
- title = "Only owner can edit & guest can't view";
+ title = "Only owner can edit (forbid guest)";
break;
- case "locked":
- label = '<i class="fa fa-lock"></i> Locked';
- title = "Only owner can edit";
+ case "private":
+ label = '<i class="fa fa-hand-stop-o"></i> Private';
+ title = "Only owner can view & edit";
break;
}
if (personalInfo.userid && owner && personalInfo.userid == owner) {
@@ -2946,14 +2946,14 @@ function sortOnlineUserList(list) {
else if (usera.idle && !userb.idle)
return 1;
else {
- if (usera.name && usera.name.toLowerCase() < userb.name.toLowerCase()) {
+ if (usera.name && userb.name && usera.name.toLowerCase() < userb.name.toLowerCase()) {
return -1;
- } else if (usera.name && usera.name.toLowerCase() > userb.name.toLowerCase()) {
+ } else if (usera.name && userb.name && usera.name.toLowerCase() > userb.name.toLowerCase()) {
return 1;
} else {
- if (usera.color && usera.color.toLowerCase() < userb.color.toLowerCase())
+ if (usera.color && userb.color && usera.color.toLowerCase() < userb.color.toLowerCase())
return -1;
- else if (usera.color && usera.color.toLowerCase() > userb.color.toLowerCase())
+ else if (usera.color && userb.color && usera.color.toLowerCase() > userb.color.toLowerCase())
return 1;
else
return 0;
diff --git a/public/views/body.ejs b/public/views/body.ejs
index 86469ce9..5ad1733e 100644
--- a/public/views/body.ejs
+++ b/public/views/body.ejs
@@ -17,10 +17,10 @@
<ul class="dropdown-menu" aria-labelledby="permissionLabel">
<li class="ui-permission-freely"<% if(!allowAnonymous) { %> style="display: none;"<% } %>><a><i class="fa fa-leaf fa-fw"></i> Freely - Anyone can edit</a></li>
<li class="ui-permission-editable"><a><i class="fa fa-shield fa-fw"></i> Editable - Signed people can edit</a></li>
- <li class="ui-permission-limited"><a><i class="fa fa-id-card fa-fw"></i> Limited - Signed people can edit &amp; view</a></li>
- <li class="ui-permission-private"><a><i class="fa fa-hand-stop-o fa-fw"></i> Private - Only owner can view &amp; edit</a></li>
- <li class="ui-permission-protected"><a><i class="fa fa-umbrella fa-fw"></i> Protected - Only owner can edit</a></li>
+ <li class="ui-permission-limited"><a><i class="fa fa-id-card fa-fw"></i> Limited - Signed people can edit (forbid guest)</a></li>
<li class="ui-permission-locked"><a><i class="fa fa-lock fa-fw"></i> Locked - Only owner can edit</a></li>
+ <li class="ui-permission-protected"><a><i class="fa fa-umbrella fa-fw"></i> Protected - Only owner can edit (forbid guest)</a></li>
+ <li class="ui-permission-private"><a><i class="fa fa-hand-stop-o fa-fw"></i> Private - Only owner can view &amp; edit</a></li>
<li class="divider"></li>
<li class="ui-delete-note"><a><i class="fa fa-trash-o fa-fw"></i> Delete this note</a></li>
</ul>