Browse Source

personal alias n photo in network.send

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
a16d34ce7b
  1. 6
      dist/src/controllers/chats.js
  2. 2
      dist/src/controllers/chats.js.map
  3. 8
      dist/src/models/ts/chat.js
  4. 2
      dist/src/models/ts/chat.js.map
  5. 10
      dist/src/network/send.js
  6. 2
      dist/src/network/send.js.map
  7. 2
      dist/src/utils/setup.js
  8. 2
      dist/src/utils/setup.js.map
  9. 12
      src/network/send.ts

6
dist/src/controllers/chats.js

@ -32,7 +32,7 @@ function updateChat(req, res) {
if (!chat) {
return res_1.failure(res, 'chat not found');
}
const { name, photo_url, meta } = req.body;
const { name, photo_url, meta, my_alias, my_photo_url } = req.body;
const obj = {};
if (name)
obj.name = name;
@ -40,6 +40,10 @@ function updateChat(req, res) {
obj.photoUrl = photo_url;
if (meta && typeof meta === 'string')
obj.meta = meta;
if (my_alias)
obj.myAlias = my_alias;
if (my_photo_url)
obj.myPhotoUrl = my_photo_url;
if (Object.keys(obj).length > 0) {
yield chat.update(obj);
}

2
dist/src/controllers/chats.js.map

File diff suppressed because one or more lines are too long

8
dist/src/models/ts/chat.js

@ -128,6 +128,14 @@ __decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], Chat.prototype, "meta", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], Chat.prototype, "myPhotoUrl", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], Chat.prototype, "myAlias", void 0);
Chat = __decorate([
sequelize_typescript_1.Table({ tableName: 'sphinx_chats', underscored: true })
], Chat);

2
dist/src/models/ts/chat.js.map

@ -1 +1 @@
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../../src/models/ts/chat.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,IAAI,GAAzB,MAAqB,IAAK,SAAQ,4BAAW;CA8F5C,CAAA;AAtFC;IANC,6BAAM,CAAC;QACN,IAAI,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GjB;IADC,6BAAM;;qCACS;AAGhB;IADC,6BAAM;;yCACY;AAOnB;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,KAAK;KACjB,CAAC;;kCACW;AAGb;IADC,6BAAM;;oCACO;AAGd;IADC,6BAAM;;qCACQ;AAGf;IADC,6BAAM;;kCACK;AAGZ;IADC,6BAAM;;wCACW;AAGlB;IADC,6BAAM;;qCACQ;AAlGI,IAAI;IADxB,4BAAK,CAAC,EAAC,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACjC,IAAI,CAoGxB;kBApGoB,IAAI"}

10
dist/src/network/send.js

@ -167,12 +167,20 @@ function checkIfAutoConfirm(data) {
function newmsg(type, chat, sender, message) {
const includeGroupKey = type === constants_1.default.message_types.group_create || type === constants_1.default.message_types.group_invite;
const includeAlias = sender && sender.alias && chat.type === constants_1.default.chat_types.tribe;
let aliasToInclude = sender.alias;
if (includeAlias && chat.myAlias) {
aliasToInclude = chat.myAlias;
}
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type === constants_1.default.chat_types.tribe;
let photoUrlToInclude = sender.photoUrl;
if (includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl;
}
return {
type: type,
chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), (chat.type || chat.type === 0) && { type: chat.type }), chat.members && { members: chat.members }), (includeGroupKey && chat.groupKey) && { groupKey: chat.groupKey }), (includeGroupKey && chat.host) && { host: chat.host }),
message: message,
sender: Object.assign({ pub_key: sender.publicKey, alias: includeAlias ? sender.alias : '', role: sender.role || constants_1.default.chat_roles.reader }, includePhotoUrl && { photo_url: sender.photoUrl })
sender: Object.assign({ pub_key: sender.publicKey, alias: includeAlias ? aliasToInclude : '', role: sender.role || constants_1.default.chat_roles.reader }, includePhotoUrl && { photo_url: photoUrlToInclude })
};
}
exports.newmsg = newmsg;

2
dist/src/network/send.js.map

File diff suppressed because one or more lines are too long

2
dist/src/utils/setup.js

@ -49,6 +49,8 @@ function setVersion() {
}
function migrate() {
return __awaiter(this, void 0, void 0, function* () {
addTableColumn('sphinx_chats', 'my_photo_url');
addTableColumn('sphinx_chats', 'my_alias');
addTableColumn('sphinx_messages', 'sender_pic');
addTableColumn('sphinx_messages', 'network_type', 'INTEGER');
addTableColumn('sphinx_chats', 'meta');

2
dist/src/utils/setup.js.map

File diff suppressed because one or more lines are too long

12
src/network/send.ts

@ -159,7 +159,15 @@ function checkIfAutoConfirm(data){
export function newmsg(type, chat, sender, message){
const includeGroupKey = type===constants.message_types.group_create || type===constants.message_types.group_invite
const includeAlias = sender && sender.alias && chat.type===constants.chat_types.tribe
let aliasToInclude = sender.alias
if(includeAlias && chat.myAlias) {
aliasToInclude = chat.myAlias
}
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto && chat && chat.type===constants.chat_types.tribe
let photoUrlToInclude = sender.photoUrl
if(includePhotoUrl && chat.myPhotoUrl) {
photoUrlToInclude = chat.myPhotoUrl
}
return {
type: type,
chat: {
@ -173,9 +181,9 @@ export function newmsg(type, chat, sender, message){
message: message,
sender: {
pub_key: sender.publicKey,
alias: includeAlias ? sender.alias : '',
alias: includeAlias ? aliasToInclude : '',
role: sender.role || constants.chat_roles.reader,
...includePhotoUrl && {photo_url: sender.photoUrl},
...includePhotoUrl && {photo_url: photoUrlToInclude},
// ...sender.contactKey && {contact_key: sender.contactKey}
}
}

Loading…
Cancel
Save