Skip to content

Commit

Permalink
Merge branch 'notification-page' of github.com:sagemathinc/cocalc int…
Browse files Browse the repository at this point in the history
…o notification-page
  • Loading branch information
williamstein committed Apr 23, 2019
2 parents 73d0b92 + 56fdc48 commit c92a2fc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/smc-util/client.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,7 @@ class exports.Connection extends EventEmitter
project_id : required
path : required
target : required # account_id (for now)
source : required # account_id
priority : undefined # optional integer; larger number is higher; 0 is default.
description: undefined # optional string context eg. part of the message
cb : undefined
Expand Down
8 changes: 3 additions & 5 deletions src/smc-util/db-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,6 @@ schema.system_notifications = {
schema.mentions = {
primary_key: ["time", "project_id", "path", "target"],
db_standby: "unsafe",
anonymous: false,
fields: {
time: {
type: "timestamp",
Expand Down Expand Up @@ -1803,9 +1802,7 @@ schema.mentions = {
},
users: {
type: "map",
desc:
"{account_id1: {read: boolean, action2:timestamp2}, account_id2: {...}}",
date: "all"
desc: "{account_id1: {read: boolean, saved: boolean}, account_id2: {...}}"
}
},

Expand Down Expand Up @@ -1835,14 +1832,15 @@ schema.mentions = {
},
project_id: "project_write",
path: true,
source: "account_id",
source: true,
target: true,
priority: true,
description: true,
users: true
},
required_fields: {
project_id: true,
source: true,
path: true,
target: true
}
Expand Down
4 changes: 1 addition & 3 deletions src/smc-util/sync/table/synctable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ export class SyncTable extends EventEmitter {

// For sanity!
changes = this.do_coerce_types(changes);

// Ensure that each key is allowed to be set.
if (this.client_query.set == null) {
throw Error(`users may not set ${this.table}`);
Expand All @@ -351,7 +350,6 @@ export class SyncTable extends EventEmitter {
throw Error(`users may not set ${this.table}.${k}`);
}
});

// Determine the primary key's value
let key: string | undefined = this.obj_to_key(changes);
if (key == null) {
Expand Down Expand Up @@ -418,6 +416,7 @@ export class SyncTable extends EventEmitter {
throw Error("merge must be one of 'deep', 'shallow', 'none'");
}
}

if (new_val.equals(cur)) {
// nothing actually changed, so nothing further to do.
return new_val;
Expand Down Expand Up @@ -1085,7 +1084,6 @@ export class SyncTable extends EventEmitter {
}
}
}

return Map(
changes.map((value, field) => {
if (typeof field !== "string") {
Expand Down
4 changes: 4 additions & 0 deletions src/smc-webapp/chat/actions.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ class ChatActions extends Actions

submit_user_mentions: (project_id, path) =>
CONTEXT_SIZE = 80
account_store = @redux.getStore('account')
if account_store == undefined
return
@store.get('unsent_user_mentions').map((mention) =>
end_of_mention_index = mention.get('plainTextIndex') + mention.get('display').length
end_of_context_index = end_of_mention_index + CONTEXT_SIZE
Expand All @@ -172,6 +175,7 @@ class ChatActions extends Actions
target: mention.get('id')
priority: 2
description: description
source: account_store.get_account_id()
})
)
@setState(unsent_user_mentions: immutable.List())
Expand Down
2 changes: 1 addition & 1 deletion src/smc-webapp/notifications/mentions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class MentionsActions extends Actions<MentionsState> {
if (table == undefined) {
return;
}
await table.set({ mentions: obj });
await table.set(obj);
} catch (error) {
const err = error;
console.warn("WARNING: mentions error -- ", err);
Expand Down

0 comments on commit c92a2fc

Please sign in to comment.