Skip to content

Commit

Permalink
Merge pull request #1449 from oxen-io/clearnet
Browse files Browse the repository at this point in the history
Session v1.4.7
  • Loading branch information
Bilb authored Jan 22, 2021
2 parents 29358eb + b4c71c4 commit 98296ae
Show file tree
Hide file tree
Showing 25 changed files with 64 additions and 189 deletions.
3 changes: 1 addition & 2 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@
window
.getConversationController()
.getConversations()
.filter(convo => convo.isPublic() && !convo.isRss())
.filter(convo => convo.isPublic())
.forEach(convo =>
convo.trigger('ourAvatarChanged', { url, profileKey })
);
Expand Down Expand Up @@ -892,7 +892,6 @@
profileName: displayName,
pubkey: userPubKey,
avatarPath,
isRss: conversation.isRss(),
onStartConversation: () => {
window.inboxStore.dispatch(
window.actionsCreators.openConversationExternal(conversation.id)
Expand Down
1 change: 0 additions & 1 deletion js/models/conversations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export interface ConversationModel

isPublic: () => boolean;
isClosedGroup: () => boolean;
isRss: () => boolean;
isBlocked: () => boolean;
isClosable: () => boolean;
isAdmin: (id: string) => boolean;
Expand Down
31 changes: 5 additions & 26 deletions js/models/conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,10 @@
return !!(this.id && this.id.match(/^publicChat:/));
},
isClosedGroup() {
return (
this.get('type') === Message.GROUP && !this.isPublic() && !this.isRss()
);
return this.get('type') === Message.GROUP && !this.isPublic();
},
isClosable() {
return !this.isRss() || this.get('closable');
},
isRss() {
return !!(this.id && this.id.match(/^rss:/));
return this.get('closable');
},
isBlocked() {
if (!this.id || this.isMe()) {
Expand All @@ -180,7 +175,7 @@
return this.get('is_medium_group');
},
async block() {
if (!this.id || this.isPublic() || this.isRss()) {
if (!this.id || this.isPublic()) {
return;
}

Expand All @@ -192,7 +187,7 @@
await libsession.Utils.SyncMessageUtils.sendBlockedListSyncMessage();
},
async unblock() {
if (!this.id || this.isPublic() || this.isRss()) {
if (!this.id || this.isPublic()) {
return;
}
const promise = this.isPrivate()
Expand Down Expand Up @@ -313,7 +308,7 @@
},

async updateProfileAvatar() {
if (this.isRss() || this.isPublic()) {
if (this.isPublic()) {
return;
}

Expand Down Expand Up @@ -446,7 +441,6 @@
type: this.isPrivate() ? 'direct' : 'group',
isMe: this.isMe(),
isPublic: this.isPublic(),
isRss: this.isRss(),
isClosable: this.isClosable(),
isTyping: typingKeys.length > 0,
lastUpdated: this.get('timestamp'),
Expand All @@ -465,7 +459,6 @@
lastMessage: {
status: this.get('lastMessageStatus'),
text: this.get('lastMessage'),
isRss: this.isRss(),
},
hasNickname: !!this.getNickname(),
isKickedFromGroup: !!this.get('isKickedFromGroup'),
Expand Down Expand Up @@ -940,9 +933,6 @@
if (!this.isPublic()) {
return;
}
if (this.isRss()) {
return;
}
if (!this.get('profileSharing')) {
return;
}
Expand Down Expand Up @@ -1304,17 +1294,6 @@
getNickname() {
return this.get('nickname');
},
getRssSettings() {
if (!this.isRss()) {
return null;
}
return {
RSS_FEED: this.get('rssFeed'),
CONVO_ID: this.id,
title: this.get('name'),
closeable: this.get('closable'),
};
},
// maybe "Backend" instead of "Source"?
async setPublicSource(newServer, newChannelId) {
if (!this.isPublic()) {
Expand Down
1 change: 0 additions & 1 deletion js/models/messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export interface MessageRegularProps {
expirationTimestamp?: number;
convoId: string;
isPublic?: boolean;
isRss?: boolean;
selected: boolean;
isKickedFromGroup: boolean;
// whether or not to show check boxes
Expand Down
1 change: 0 additions & 1 deletion js/models/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@
expirationLength,
expirationTimestamp,
isPublic,
isRss: !!this.get('isRss'),
isKickedFromGroup:
conversation && conversation.get('isKickedFromGroup'),
isAdmin, // if the sender is an admin (not us)
Expand Down
10 changes: 0 additions & 10 deletions js/views/conversation_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,6 @@

this.model.updateLastMessage();

if (this.model.isRss()) {
$('.compose').hide();
$('.conversation-stack').removeClass('conversation-stack-no-border');
$('.conversation-stack').addClass('conversation-stack-border');
} else {
$('.compose').show();
$('.conversation-stack').removeClass('conversation-stack-border');
$('.conversation-stack').addClass('conversation-stack-no-border');
}

// We schedule our catch-up decrypt right after any in-progress fetch of
// messages from the database, then ensure that the loading screen is only
// dismissed when that is complete.
Expand Down
3 changes: 0 additions & 3 deletions js/views/user_details_dialog_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
profileName,
avatarPath,
pubkey,
isRss,
onOk,
onStartConversation,
theme,
Expand All @@ -21,7 +20,6 @@

this.profileName = profileName;
this.pubkey = pubkey;
this.isRss = isRss;
this.avatarPath = avatarPath;
this.onOk = onOk;
this.onStartConversation = onStartConversation;
Expand All @@ -40,7 +38,6 @@
onStartConversation: this.onStartConversation,
profileName: this.profileName,
pubkey: this.pubkey,
isRss: this.isRss,
avatarPath: this.avatarPath,
i18n,
theme: this.theme,
Expand Down
2 changes: 1 addition & 1 deletion libtextsecure/message_receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function MessageReceiver() {
// bind events
lokiPublicChatAPI.on(
'publicMessage',
window.NewReceiver.handleUnencryptedMessage
window.NewReceiver.handlePublicMessage
);
openGroupBound = true;
}
Expand Down
10 changes: 1 addition & 9 deletions ts/components/ConversationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export type ConversationListItemProps = {
avatarPath?: string;
isMe: boolean;
isPublic?: boolean;
isRss?: boolean;
isClosable?: boolean;
primaryDevice?: string;

Expand All @@ -46,7 +45,6 @@ export type ConversationListItemProps = {
lastMessage?: {
status: 'sending' | 'sent' | 'delivered' | 'read' | 'error';
text: string;
isRss: boolean;
};

isBlocked?: boolean;
Expand Down Expand Up @@ -170,13 +168,7 @@ class ConversationListItem extends React.PureComponent<Props> {
if (!lastMessage && !isTyping) {
return null;
}
let text = lastMessage && lastMessage.text ? lastMessage.text : '';

// if coming from Rss feed
if (lastMessage && lastMessage.isRss) {
// strip any HTML
text = text.replace(/<[^>]*>?/gm, '');
}
const text = lastMessage && lastMessage.text ? lastMessage.text : '';

if (isEmpty(text)) {
return null;
Expand Down
17 changes: 7 additions & 10 deletions ts/components/UserDetailsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { DefaultTheme } from 'styled-components';

interface Props {
i18n: any;
isRss: boolean;
profileName: string;
avatarPath: string;
pubkey: string;
Expand All @@ -37,7 +36,7 @@ export class UserDetailsDialog extends React.Component<Props, State> {
}

public render() {
const { i18n, isRss } = this.props;
const { i18n } = this.props;

return (
<SessionModal
Expand All @@ -52,14 +51,12 @@ export class UserDetailsDialog extends React.Component<Props, State> {
<SessionIdEditable editable={false} text={this.props.pubkey} />

<div className="session-modal__button-group__center">
{!isRss && (
<SessionButton
text={i18n('startConversation')}
buttonType={SessionButtonType.Default}
buttonColor={SessionButtonColor.Primary}
onClick={this.onClickStartConversation}
/>
)}
<SessionButton
text={i18n('startConversation')}
buttonType={SessionButtonType.Default}
buttonColor={SessionButtonColor.Primary}
onClick={this.onClickStartConversation}
/>
</div>
</SessionModal>
);
Expand Down
6 changes: 2 additions & 4 deletions ts/components/conversation/ConversationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ interface Props {
isGroup: boolean;
isPrivate: boolean;
isPublic: boolean;
isRss: boolean;
isAdmin: boolean;

// We might not always have the full list of members,
Expand Down Expand Up @@ -120,7 +119,6 @@ class ConversationHeaderInner extends React.Component<Props> {
profileName,
isGroup,
isPublic,
isRss,
members,
subscriberCount,
isMe,
Expand All @@ -138,7 +136,7 @@ class ConversationHeaderInner extends React.Component<Props> {
}

const memberCount: number = (() => {
if (!isGroup || isRss) {
if (!isGroup) {
return 0;
}

Expand Down Expand Up @@ -262,7 +260,7 @@ class ConversationHeaderInner extends React.Component<Props> {
</div>
{!isKickedFromGroup && this.renderExpirationLength()}

{!this.props.isRss && !selectionMode && this.renderAvatar()}
{!selectionMode && this.renderAvatar()}

<ConversationHeaderMenu {...this.getHeaderMenuProps(triggerId)} />
</div>
Expand Down
10 changes: 1 addition & 9 deletions ts/components/conversation/Linkify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const linkify = LinkifyIt();

interface Props {
text: string;
isRss?: boolean;
/** Allows you to customize now non-links are rendered. Simplest is just a <span>. */
renderNonLink?: RenderTextCallbackType;
}
Expand All @@ -24,17 +23,10 @@ export class Linkify extends React.Component<Props> {
};

public render() {
const { text, renderNonLink, isRss } = this.props;
const { text, renderNonLink } = this.props;
const results: Array<any> = [];
let count = 1;

if (isRss && text.indexOf('</') !== -1) {
results.push(<SessionHtmlRenderer key={count++} html={text} tag="div" />);
// should already have links

return results;
}

const matchData = linkify.match(text) || [];
let last = 0;

Expand Down
6 changes: 2 additions & 4 deletions ts/components/conversation/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ class MessageInner extends React.PureComponent<MessageRegularProps, State> {
bodyPending,
direction,
status,
isRss,
conversationType,
convoId,
multiSelectMode,
Expand Down Expand Up @@ -581,7 +580,6 @@ class MessageInner extends React.PureComponent<MessageRegularProps, State> {
>
<MessageBody
text={contents || ''}
isRss={isRss}
i18n={window.i18n}
bodyPending={bodyPending}
isGroup={conversationType === 'group'}
Expand Down Expand Up @@ -916,8 +914,8 @@ class MessageInner extends React.PureComponent<MessageRegularProps, State> {
private handleContextMenu(e: any) {
e.preventDefault();
e.stopPropagation();
const { isRss, multiSelectMode, isKickedFromGroup } = this.props;
const enableContextMenu = !isRss && !multiSelectMode && !isKickedFromGroup;
const { multiSelectMode, isKickedFromGroup } = this.props;
const enableContextMenu = !multiSelectMode && !isKickedFromGroup;

if (enableContextMenu) {
// Don't forget to pass the id and the event and voila!
Expand Down
4 changes: 0 additions & 4 deletions ts/components/conversation/MessageBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { LocalizerType, RenderTextCallbackType } from '../../types/Util';

interface Props {
text: string;
isRss?: boolean;
bodyPending?: boolean;
/** If set, all emoji will be the same size. Otherwise, just one emoji will be large. */
disableJumbomoji?: boolean;
Expand Down Expand Up @@ -106,7 +105,6 @@ export class MessageBody extends React.Component<Props> {
bodyPending,
disableJumbomoji,
disableLinks,
isRss,
i18n,
isGroup,
convoId,
Expand Down Expand Up @@ -141,7 +139,6 @@ export class MessageBody extends React.Component<Props> {
const bodyContents = this.addDownloading(
<Linkify
text={textWithPending}
isRss={isRss}
renderNonLink={({ key, text: nonLinkText }) => {
return renderEmoji({
i18n,
Expand All @@ -159,7 +156,6 @@ export class MessageBody extends React.Component<Props> {
return this.addDownloading(
<Linkify
text={textWithPending}
isRss={isRss}
renderNonLink={({ key, text: nonLinkText }) => {
return renderEmoji({
i18n,
Expand Down
6 changes: 1 addition & 5 deletions ts/components/session/conversation/SessionConversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ export class SessionConversation extends React.Component<Props, State> {
isGroup: !conversation.isPrivate(),
isPrivate: conversation.isPrivate(),
isPublic: conversation.isPublic(),
isRss: conversation.isRss(),
isAdmin: conversation.isAdmin(ourPrimary),
members,
subscriberCount: conversation.get('subscriberCount'),
Expand Down Expand Up @@ -483,9 +482,7 @@ export class SessionConversation extends React.Component<Props, State> {
},

onAvatarClick: (pubkey: any) => {
if (!conversation.isRss()) {
this.toggleRightPanel();
}
this.toggleRightPanel();
},
};

Expand Down Expand Up @@ -548,7 +545,6 @@ export class SessionConversation extends React.Component<Props, State> {
isGroup: !conversation.isPrivate(),
isPublic: conversation.isPublic(),
isAdmin,
isRss: conversation.isRss(),
isBlocked: conversation.isBlocked(),

timerOptions: window.Whisper.ExpirationTimerOptions.map((item: any) => ({
Expand Down
Loading

0 comments on commit 98296ae

Please sign in to comment.