do not remove convo when removing only message

use the user pubkey if group update notification with an unknown user
make GroupNotification a function component
pull/1387/head
Audric Ackermann 5 years ago
parent 95101bfd3c
commit dfbcf3ac9b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -2339,19 +2339,11 @@
this.messageCollection.reset([]); this.messageCollection.reset([]);
// let's try to keep the RSS conversation open just empty... // destroy message keeps the active timestamp set so the
if (this.isRss()) { // conversation still appears on the conversation list but is empty
this.set({ this.set({
lastMessage: null, lastMessage: null,
}); });
} else {
// this will remove the conversation from conversation lists...
this.set({
lastMessage: null,
timestamp: null,
active_at: null,
});
}
await this.commit(); await this.commit();
}, },

@ -173,7 +173,7 @@
if (!conversation) { if (!conversation) {
return number; return number;
} }
return conversation.getProfileName(); return conversation.getDisplayName();
}, },
getLokiNameForNumber(number) { getLokiNameForNumber(number) {
const conversation = ConversationController.get(number); const conversation = ConversationController.get(number);

@ -32,9 +32,6 @@ const {
EmbeddedContact, EmbeddedContact,
} = require('../../ts/components/conversation/EmbeddedContact'); } = require('../../ts/components/conversation/EmbeddedContact');
const { Emojify } = require('../../ts/components/conversation/Emojify'); const { Emojify } = require('../../ts/components/conversation/Emojify');
const {
GroupNotification,
} = require('../../ts/components/conversation/GroupNotification');
const { Lightbox } = require('../../ts/components/Lightbox'); const { Lightbox } = require('../../ts/components/Lightbox');
const { LightboxGallery } = require('../../ts/components/LightboxGallery'); const { LightboxGallery } = require('../../ts/components/LightboxGallery');
const { MemberList } = require('../../ts/components/conversation/MemberList'); const { MemberList } = require('../../ts/components/conversation/MemberList');
@ -261,7 +258,6 @@ exports.setup = (options = {}) => {
SettingsView, SettingsView,
EmbeddedContact, EmbeddedContact,
Emojify, Emojify,
GroupNotification,
Lightbox, Lightbox,
LightboxGallery, LightboxGallery,
MemberList, MemberList,

@ -2,8 +2,6 @@ import React from 'react';
import { compact, flatten } from 'lodash'; import { compact, flatten } from 'lodash';
import { Intl } from '../Intl'; import { Intl } from '../Intl';
import { LocalizerType } from '../../types/Util';
import { missingCaseError } from '../../util/missingCaseError'; import { missingCaseError } from '../../util/missingCaseError';
interface Contact { interface Contact {
@ -23,10 +21,11 @@ interface Props {
changes: Array<Change>; changes: Array<Change>;
} }
// This class is used to display group updates in the conversation view. // This component is used to display group updates in the conversation view.
// This is a not a "notification" as the name suggests, but a message inside the conversation // This is a not a "notification" as the name suggests, but a message inside the conversation
export class GroupNotification extends React.Component<Props> { export const GroupNotification = (props: Props) => {
public renderChange(change: Change) {
function renderChange(change: Change) {
const { isMe, contacts, type, newName } = change; const { isMe, contacts, type, newName } = change;
const { i18n } = window; const { i18n } = window;
@ -94,17 +93,16 @@ export class GroupNotification extends React.Component<Props> {
} }
} }
public render() {
const { changes } = this.props; const { changes } = props;
return (
return ( <div className="module-group-notification">
<div className="module-group-notification"> {(changes || []).map((change, index) => (
{(changes || []).map((change, index) => ( <div key={index} className="module-group-notification__change">
<div key={index} className="module-group-notification__change"> {renderChange(change)}
{this.renderChange(change)} </div>
</div> ))}
))} </div>
</div> );
);
}
} }

@ -134,6 +134,7 @@ export class SessionConversation extends React.Component<Props, State> {
// this.getMessages.bind(this), // this.getMessages.bind(this),
// 1000 // one second // 1000 // one second
// ); // );
this.getMessages = this.getMessages.bind(this);
// Keyboard navigation // Keyboard navigation
this.onKeyDown = this.onKeyDown.bind(this); this.onKeyDown = this.onKeyDown.bind(this);

Loading…
Cancel
Save