Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions app/sagas/deepLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ const navigate = function* navigate({ params }) {
if (params.path || params.rid) {
let type;
let name;
let jumpToThreadId;
if (params.path) {
[type, name] = params.path.split('/');
const pathSplitted = params.path.split('/');
type = pathSplitted[0];
name = pathSplitted[1];
// Check if has thread at path from params: channel/general/thread/threadId and expect that threadId is the next param
const threadIdIndexOf = pathSplitted.lastIndexOf('thread') + 1;
Comment thread
reinaldonetof marked this conversation as resolved.
Outdated
jumpToThreadId = threadIdIndexOf > 0 && threadIdIndexOf < pathSplitted.length ? pathSplitted[threadIdIndexOf] : null;
}
if (type !== 'invite' || params.rid) {
const room = yield RocketChat.canOpenRoom(params);
Expand All @@ -65,14 +71,14 @@ const navigate = function* navigate({ params }) {
if (focusedRooms.includes(room.rid)) {
// if there's one room on the list or last room is the one
if (focusedRooms.length === 1 || focusedRooms[0] === room.rid) {
yield goRoom({ item, isMasterDetail, jumpToMessageId });
yield goRoom({ item, isMasterDetail, jumpToMessageId, jumpToThreadId });
} else {
popToRoot({ isMasterDetail });
yield goRoom({ item, isMasterDetail, jumpToMessageId });
yield goRoom({ item, isMasterDetail, jumpToMessageId, jumpToThreadId });
}
} else {
popToRoot({ isMasterDetail });
yield goRoom({ item, isMasterDetail, jumpToMessageId });
yield goRoom({ item, isMasterDetail, jumpToMessageId, jumpToThreadId });
}

if (params.isCall) {
Expand Down
8 changes: 8 additions & 0 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class RoomView extends React.Component {
prid
};
this.jumpToMessageId = props.route.params?.jumpToMessageId;
this.jumpToThreadId = props.route.params?.jumpToThreadId;
const roomUserId = props.route.params?.roomUserId ?? RocketChat.getUidDirectMessage(room);
this.state = {
joined: true,
Expand Down Expand Up @@ -208,6 +209,9 @@ class RoomView extends React.Component {
if (this.jumpToMessageId) {
this.jumpToMessage(this.jumpToMessageId);
}
if (this.jumpToThreadId && !this.jumpToMessageId) {
this.navToThread({ tmid: this.jumpToThreadId });
}
if (isIOS && this.rid) {
this.updateUnreadCount();
}
Expand Down Expand Up @@ -253,6 +257,10 @@ class RoomView extends React.Component {
this.jumpToMessage(route?.params?.jumpToMessageId);
}

if (route?.params?.jumpToThreadId !== prevProps.route?.params?.jumpToThreadId) {
this.navToThread({ tmid: route?.params?.jumpToThreadId });
}

if (appState === 'foreground' && appState !== prevProps.appState && this.rid) {
// Fire List.query() just to keep observables working
if (this.list && this.list.current) {
Expand Down