forked from mrsimpson/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming a thread is now possible without losing the capability to navigate. The navigation from thread to parent only survives the renaming half: The updated name is shown after a refresh, but the link is not clickable. Considered good enough for the moment
- Loading branch information
Showing
4 changed files
with
39 additions
and
879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* globals RocketChat */ | ||
|
||
import {FlowRouter} from 'meteor/kadira:flow-router'; | ||
|
||
/** | ||
* in order to provide links to messages which are stable (e. g. survive renaming a room or changing its type) | ||
* we introduce an explicit route. Since this needs to be executable on the client, we provide a method along with it | ||
*/ | ||
FlowRouter.route('/message/:id', { | ||
name: 'message', | ||
action(params) { | ||
Meteor.call('getCurrentRouteLink', params.id, (err, res) => { | ||
if (!err && res) { | ||
FlowRouter.go(res); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
Meteor.methods({ | ||
getCurrentRouteLink(messageId) { | ||
if (Meteor.isServer) { | ||
const message = RocketChat.models.Messages.findOneById(messageId); | ||
|
||
if (message && message.rid) { | ||
const room = RocketChat.models.Rooms.findOneById(message.rid); | ||
return FlowRouter.path(RocketChat.roomTypes.getRouteLink(room.t, room), '', {msg: message._id}); | ||
} else { | ||
throw new Meteor.Error('invalid message'); | ||
} | ||
} | ||
} | ||
}); |
Oops, something went wrong.