Skip to content
Snippets Groups Projects
Commit e9b1f936 authored by Gabriel Engel's avatar Gabriel Engel
Browse files

Merge pull request #572 from RocketChat/room-not-found

Room not found
parents 287a4423 d71c76b9
No related branches found
No related tags found
No related merge requests found
......@@ -88,20 +88,21 @@ Meteor.startup ->
room = ChatRoom.findOne query, { reactive: false }
openedRooms[typeName].rid = room._id
msgStream.on openedRooms[typeName].rid, (msg) ->
ChatMessage.upsert { _id: msg._id }, msg
# If room was renamed then close current room and send user to the new one
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
deleteMsgStream.on openedRooms[typeName].rid, (msg) ->
ChatMessage.remove _id: msg._id
if room?
openedRooms[typeName].rid = room._id
msgStream.on openedRooms[typeName].rid, (msg) ->
ChatMessage.upsert { _id: msg._id }, msg
# If room was renamed then close current room and send user to the new one
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
deleteMsgStream.on openedRooms[typeName].rid, (msg) ->
ChatMessage.remove _id: msg._id
Dep.changed()
......
......@@ -21,7 +21,8 @@ openRoom = (type, name) ->
room = ChatRoom.findOne(query)
if not room?
FlowRouter.go 'home'
Session.set 'roomNotFound', {type: type, name: name}
BlazeLayout.render 'main', {center: 'roomNotFound'}
return
mainNode = document.querySelector('.main-content')
......
......@@ -103,3 +103,10 @@ FlowRouter.route '/privacy-policy',
action: ->
Session.set 'cmsPage', 'Layout_Privacy_Policy'
BlazeLayout.render 'cmsPage'
FlowRouter.route '/room-not-found/:type/:name',
name: 'room-not-found'
action: (params) ->
Session.set 'roomNotFound', {type: params.type, name: params.name}
BlazeLayout.render 'main', {center: 'roomNotFound'}
......@@ -2018,6 +2018,29 @@ a.github-fork {
}
}
.room-not-found {
display: flex;
display: -webkit-flex;
flex-direction: column;
-webkit-flex-direction: column;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
font-size: 30px;
color: orange;
div {
line-height: 40px;
text-align: center;
}
i {
font-size: 100px;
padding-bottom: 30px;
}
}
.upload-progress {
position: absolute;
top: 60px;
......
Template.roomNotFound.helpers
data: ->
return Session.get 'roomNotFound'
\ No newline at end of file
<template name="roomNotFound">
<section class="page-container page-list">
<head class="fixed-title">
{{> burger}}
<h2>
<span class="room-title">{{_ "Room_not_found"}}</span>
</h2>
</head>
<div class="content room-not-found">
<i class="icon-attention"></i>
<div>
{{#with data}}
{{#if $eq type 'c'}}
{{{_ 'No_channel_with_name_%s_was_found' name}}}
{{/if}}
{{#if $eq type 'p'}}
{{{_ 'No_group_with_name_%s_was_found' name}}}
{{/if}}
{{#if $eq type 'd'}}
{{{_ 'No_user_with_username_%s_was_found' name}}}
{{/if}}
{{/with}}
</div>
</div>
</section>
</template>
\ No newline at end of file
......@@ -154,6 +154,9 @@
"No_favorites_yet" : "You haven't added any favorites yet.",
"No_groups_yet" : "You have no private groups yet.",
"No_permission_to_view_room" : "You don't have permission to view this room",
"No_channel_with_name_%s_was_found": "No channel with name <strong>\"%s\"</strong> was found!",
"No_group_with_name_%s_was_found": "No private group with name <strong>\"%s\"</strong> was found!",
"No_user_with_username_%s_was_found": "No user with username <strong>\"%s\"</strong> was found!",
"Not_allowed" : "Not allowed",
"Not_found_or_not_allowed" : "Not Found or Not Allowed",
"Nothing_found" : "Nothing found",
......@@ -193,6 +196,7 @@
"Room" : "Room",
"Room_name_changed" : "Room name changed to: <em>__room_name__</em> by <em>__user_by__</em>",
"Room_name_changed_successfully" : "Room name changed successfully",
"Room_not_found": "Room not found",
"room_user_count": "%s users",
"Save" : "Save",
"Save_changes" : "Save changes",
......
......@@ -102,6 +102,9 @@
"No_favorites_yet" : "Nenhum favorito ainda.",
"No_groups_yet" : "Nenhum grupo privado ainda.",
"No_permission_to_view_room" : "Sem permissões para ver a sala",
"No_channel_with_name_%s_was_found": "Nenhum canal com nome <strong>\"%s\"</strong> foi encontrado!",
"No_group_with_name_%s_was_found": "Nenhum grupo privado com nome <strong>\"%s\"</strong> foi encontrado!",
"No_user_with_username_%s_was_found": "Nenhum usuário com nome de usuário <strong>\"%s\"</strong> foi encontrado!",
"Not_allowed" : "Não permitido",
"Not_found_or_not_allowed" : "Não encontrado ou não permitido",
"Nothing_found" : "Nada encontrado",
......@@ -126,6 +129,7 @@
"Room" : "Sala",
"Room_name_changed" : "Nome da sala alterado para: <em>__room_name__</em> por <em>__user_by__</em>",
"Room_name_changed_successfully" : "Nome da sala alterado com sucesso",
"Room_not_found": "Sala não encontrada",
"Save" : "Salvar",
"Search" : "Pesquisar",
"Search_settings" : "Pesquisar configurações",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment