Change channel type; Closes #1037
parent
4b8fac9d97
commit
1977d10e74
@ -0,0 +1,12 @@ |
||||
Meteor.startup -> |
||||
roomNameChangedCallback = (msg) -> |
||||
Tracker.nonreactive -> |
||||
if msg.t is 'r' |
||||
if Session.get('openedRoom') is msg.rid |
||||
type = if FlowRouter.current().route.name is 'channel' then 'c' else 'p' |
||||
RoomManager.close type + FlowRouter.getParam('name') |
||||
FlowRouter.go FlowRouter.current().route.name, name: msg.msg |
||||
|
||||
return msg |
||||
|
||||
RocketChat.callbacks.add 'streamMessage', roomNameChangedCallback, RocketChat.callbacks.priority.HIGH |
@ -0,0 +1,20 @@ |
||||
Meteor.startup -> |
||||
RocketChat.MessageTypes.registerType |
||||
id: 'room_changed_privacy' |
||||
system: true |
||||
message: 'room_changed_privacy' |
||||
data: (message) -> |
||||
return { |
||||
user_by: message.u?.username |
||||
room_type: message.msg |
||||
} |
||||
|
||||
RocketChat.MessageTypes.registerType |
||||
id: 'room_changed_topic' |
||||
system: true |
||||
message: 'room_changed_topic' |
||||
data: (message) -> |
||||
return { |
||||
user_by: message.u?.username |
||||
room_topic: message.msg |
||||
} |
@ -1,11 +1,12 @@ |
||||
Meteor.startup -> |
||||
|
||||
RocketChat.callbacks.add 'enter-room', -> |
||||
RocketChat.callbacks.add 'enter-room', (subscription) -> |
||||
|
||||
if RocketChat.authz.hasAtLeastOnePermission('edit-room', subscription?.rid) |
||||
RocketChat.TabBar.addButton |
||||
id: 'channel-settings' |
||||
i18nTitle: 'Channel_Settings' |
||||
icon: 'octicon octicon-gear' |
||||
template: 'channelSettings' |
||||
order: 0 |
||||
|
||||
, RocketChat.callbacks.priority.MEDIUM, 'enter-room-tabbar-channel-settings' |
@ -0,0 +1,15 @@ |
||||
Meteor.startup -> |
||||
roomSettingsChangedCallback = (msg) -> |
||||
Tracker.nonreactive -> |
||||
if msg.t is 'room_changed_privacy' |
||||
if Session.get('openedRoom') is msg.rid |
||||
type = if FlowRouter.current().route.name is 'channel' then 'c' else 'p' |
||||
RoomManager.close type + FlowRouter.getParam('name') |
||||
|
||||
subscription = ChatSubscription.findOne({ rid: msg.rid }) |
||||
route = if subscription.t is 'c' then 'channel' else 'group' |
||||
FlowRouter.go route, name: subscription.name |
||||
|
||||
return msg |
||||
|
||||
RocketChat.callbacks.add 'streamMessage', roomSettingsChangedCallback, RocketChat.callbacks.priority.HIGH |
@ -0,0 +1,2 @@ |
||||
RocketChat.models.Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser = (type, roomId, message, user, extraData) -> |
||||
return @createWithTypeRoomIdMessageAndUser type, roomId, message, user, extraData |
Loading…
Reference in new issue