Skip to content

Commit e93b10a

Browse files
Merge branch 'master' into rate-limit
2 parents 4e50477 + b179ad3 commit e93b10a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3267
-161
lines changed

Diff for: .meteor/packages

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ todda00:friendly-slugs
8888
underscorestring:underscore.string
8989
yasaricli:slugify
9090
yasinuslu:blaze-meta
91+
rocketchat:theme
9192
rocketchat:authorization
9293
perak:codemirror
9394
standard-minifiers

Diff for: .meteor/versions

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ rocketchat:[email protected]
143143
144144
145145
146+
146147
147148
148149

Diff for: client/lib/avatar.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if not username?
55
return
66

7-
return Meteor._relativeToSiteRootUrl "/avatar/#{username}.jpg?_dc=#{random}"
7+
return Meteor.absoluteUrl "avatar/#{username}.jpg?_dc=#{random}"
88

99
Blaze.registerHelper 'avatarUrlFromUsername', getAvatarUrlFromUsername
1010

Diff for: client/stylesheets/global/_variables.less

-40
This file was deleted.

Diff for: client/views/account/accountPreferences.coffee

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Template.accountPreferences.onCreated ->
3939
data.useEmojis = $('input[name=useEmojis]:checked').val()
4040
data.convertAsciiEmoji = $('input[name=convertAsciiEmoji]:checked').val()
4141
data.saveMobileBandwidth = $('input[name=saveMobileBandwidth]:checked').val()
42+
data.compactView = $('input[name=compactView]:checked').val()
4243
data.autoImageLoad = $('input[name=autoImageLoad]:checked').val()
4344

4445
Meteor.call 'saveUserPreferences', data, (error, results) ->

Diff for: client/views/account/accountPreferences.html

+13-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ <h1>{{_ "Messages"}}</h1>
1717
<div>
1818
{{#if desktopNotificationEnabled}}
1919
<label>{{_ "Desktop_Notifications_Enabled"}}</label>
20-
{{else}} {{#if desktopNotificationDisabled}}
21-
<label>{{_ "Desktop_Notifications_Disabled"}}</label>
2220
{{else}}
23-
<label><button class="button enable-notifications"><i class="octicon octicon-comment"></i> <span>{{_ "Enable_Desktop_Notifications"}}</span></button></label>
24-
{{/if}} {{/if}}
21+
{{#if desktopNotificationDisabled}}
22+
<label>{{_ "Desktop_Notifications_Disabled"}}</label>
23+
{{else}}
24+
<label><button class="button enable-notifications"><i class="octicon octicon-comment"></i> <span>{{_ "Enable_Desktop_Notifications"}}</span></button></label>
25+
{{/if}}
26+
{{/if}}
2527
</div>
2628
</div>
2729
<div class="input-line double-col">
@@ -52,6 +54,13 @@ <h1>{{_ "Messages"}}</h1>
5254
<label><input type="radio" name="saveMobileBandwidth" value="0" checked="{{checked 'saveMobileBandwidth' false}}" /> {{_ "False"}}</label>
5355
</div>
5456
</div>
57+
<div class="input-line double-col" id="compactView">
58+
<label>{{_ "Compact_View"}}</label>
59+
<div>
60+
<label><input type="radio" name="compactView" value="1" checked="{{checked 'compactView' true}}" /> {{_ "True"}}</label>
61+
<label><input type="radio" name="compactView" value="0" checked="{{checked 'compactView' false true}}" /> {{_ "False"}}</label>
62+
</div>
63+
</div>
5564
</div>
5665
</div>
5766
<div class="section">

Diff for: client/views/admin/admin.coffee

+12
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Template.admin.events
5050
value = parseInt(_.trim(t.$("[name=#{setting._id}]").val()))
5151
else if setting.type is 'boolean' and t.$("[name=#{setting._id}]:checked").length
5252
value = if t.$("[name=#{setting._id}]:checked").val() is "1" then true else false
53+
else if setting.type is 'color'
54+
value = _.trim(t.$("[name=#{setting._id}]").val())
5355

5456
if value?
5557
updateSettings.push { _id: setting._id, value: value }
@@ -98,3 +100,13 @@ Template.admin.onRendered ->
98100
Tracker.afterFlush ->
99101
SideNav.setFlex "adminFlex"
100102
SideNav.openFlex()
103+
104+
Meteor.setTimeout ->
105+
$('input.minicolors').minicolors({theme: 'rocketchat'})
106+
, 500
107+
108+
Tracker.autorun ->
109+
FlowRouter.watchPathChange()
110+
Meteor.setTimeout ->
111+
$('input.minicolors').minicolors({theme: 'rocketchat'})
112+
, 200

Diff for: client/views/admin/admin.html

+11
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ <h1>{{section}}</h1>
7171
{{/if}}
7272
</div>
7373
{{/if}}
74+
{{#if $eq type 'color'}}
75+
<div class="input-line double-col">
76+
<label>{{label}}</label>
77+
<div>
78+
<input type="text" class="minicolors" name="{{_id}}" value="{{value}}" />
79+
{{#if description}}
80+
<small>{{description}}</small>
81+
{{/if}}
82+
</div>
83+
</div>
84+
{{/if}}
7485
{{/each}}
7586

7687
{{#if section}}

Diff for: client/views/app/message.coffee

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
Template.message.helpers
22
actions: ->
33
return RocketChat.MessageAction.getButtons(this)
4-
4+
55
own: ->
66
return 'own' if this.u?._id is Meteor.userId()
77

8+
chatops: ->
9+
return 'chatops-message' if this.u?.username is RocketChat.settings.get('Chatops_Username')
10+
811
time: ->
912
return moment(this.ts).format('HH:mm')
1013

@@ -28,10 +31,16 @@ Template.message.helpers
2831
when 'rm' then t('Message_removed', { user: this.u.username })
2932
when 'rtc' then RocketChat.callbacks.run 'renderRtcMessage', this
3033
else
34+
if this.u?.username is RocketChat.settings.get('Chatops_Username')
35+
this.html = this.msg
36+
message = RocketChat.callbacks.run 'renderMentions', this
37+
# console.log JSON.stringify message
38+
return this.html
3139
this.html = this.msg
3240
if _.trim(this.html) isnt ''
3341
this.html = _.escapeHTML this.html
3442
message = RocketChat.callbacks.run 'renderMessage', this
43+
# console.log JSON.stringify message
3544
this.html = message.html.replace /\n/gm, '<br/>'
3645
return this.html
3746

@@ -97,11 +106,12 @@ Template.message.onViewRendered = (context) ->
97106
wrapper = ul.parentElement
98107

99108
if context.urls?.length > 0 and Template.oembedBaseWidget? and RocketChat.settings.get 'API_Embed'
100-
for item in context.urls
101-
do (item) ->
102-
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
103-
if urlNode?
104-
$(lastNode.querySelector('.body')).append Blaze.toHTMLWithData Template.oembedBaseWidget, item
109+
if context.u?.username not in RocketChat.settings.get('API_EmbedDisabledFor')?.split(',')
110+
for item in context.urls
111+
do (item) ->
112+
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
113+
if urlNode?
114+
$(lastNode.querySelector('.body')).append Blaze.toHTMLWithData Template.oembedBaseWidget, item
105115

106116
if not lastNode.nextElementSibling?
107117
if lastNode.classList.contains('own') is true

Diff for: client/views/app/message.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template name="message">
2-
<li id="{{_id}}" class="message sequential {{system}} {{t}} {{own}} {{isTemp}}" data-username="{{u.username}}" data-date="{{date}}">
2+
<li id="{{_id}}" class="message sequential {{system}} {{t}} {{own}} {{isTemp}} {{chatops}}" data-username="{{u.username}}" data-date="{{date}}">
33
<a class="thumb user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{> avatar username=u.username}}</a>
44
<a class="user user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{u.username}}</a>
55
<span class="info">

Diff for: client/views/app/room.coffee

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ favoritesEnabled = ->
88
# @TODO bug com o botão para "rolar até o fim" (novas mensagens) quando há uma mensagem com texto que gere rolagem horizontal
99
Template.room.helpers
1010
showFormattingTips: ->
11-
return RocketChat.Markdown or RocketChat.Highlight
11+
return RocketChat.settings.get('Message_ShowFormattingTips') and (RocketChat.Markdown or RocketChat.Highlight)
1212
showMarkdown: ->
1313
return RocketChat.Markdown
1414
showHighlight: ->
@@ -188,11 +188,12 @@ Template.room.helpers
188188
return !! ChatRoom.findOne { _id: @_id, t: 'c' }
189189

190190
canRecordAudio: ->
191-
return navigator.getUserMedia? or navigator.webkitGetUserMedia?
191+
return RocketChat.settings.get('Message_AudioRecorderEnabled') and (navigator.getUserMedia? or navigator.webkitGetUserMedia?)
192192

193-
roomManager: ->
193+
unreadSince: ->
194194
room = ChatRoom.findOne(this._id, { reactive: false })
195-
return RoomManager.openedRooms[room.t + room.name]
195+
if room?
196+
return RoomManager.openedRooms[room.t + room.name]?.unreadSince?.get()
196197

197198
unreadCount: ->
198199
return RoomHistoryManager.getRoom(@_id).unreadNotLoaded.get() + Template.instance().unreadCount.get()
@@ -217,6 +218,9 @@ Template.room.helpers
217218
showToggleFavorite: ->
218219
return true if isSubscribed(this._id) and favoritesEnabled()
219220

221+
compactView: ->
222+
return 'compact' if Meteor.user()?.settings?.preferences?.compactView
223+
220224
Template.room.events
221225
"touchstart .message": (e, t) ->
222226
message = this._arguments[1]
@@ -304,7 +308,8 @@ Template.room.events
304308
file: item.getAsFile()
305309
name: 'Clipboard'
306310

307-
fileUpload files
311+
if files.length > 0
312+
fileUpload files
308313

309314
'keydown .input-message': (event) ->
310315
Template.instance().chatMessages.keydown(@_id, event, Template.instance())
@@ -387,8 +392,9 @@ Template.room.events
387392
FlowRouter.go 'channel', {name: channel}
388393
return
389394

390-
RocketChat.TabBar.openFlex()
395+
RocketChat.TabBar.setTemplate 'membersList'
391396
Session.set('showUserInfo', $(e.currentTarget).data('username'))
397+
RocketChat.TabBar.openFlex()
392398

393399
'click .image-to-download': (event) ->
394400
ChatMessage.update {_id: this._arguments[1]._id, 'urls.url': $(event.currentTarget).data('url')}, {$set: {'urls.$.downloadImages': true}}

Diff for: client/views/app/room.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ <h2>
3939
{{/each}}
4040
</div>
4141
{{#if unreadCount}}
42-
{{#if roomManager.unreadSince.get}}
42+
{{#if unreadSince}}
4343
<div class="unread-bar">
4444
{{_ "S_new_messages_since_s" unreadCount formatUnreadSince}}
4545
<a>
@@ -48,7 +48,7 @@ <h2>
4848
</div>
4949
{{/if}}
5050
{{/if}}
51-
<div class="messages-box">
51+
<div class="messages-box {{compactView}}">
5252
<div class="ticks-bar"></div>
5353
<div class="wrapper">
5454
<ul aria-live="polite">
@@ -80,14 +80,14 @@ <h2>
8080
<form class="message-form" method="post" action="/">
8181
<div style="display: flex">
8282
<div class="file">
83-
<i class="icon-attach"></i>
83+
<i class="octicon octicon-cloud-upload file"></i>
8484
<input type="file" accept="image/*">
8585
</div>
8686
<div class="input-message-container">
8787
{{> messagePopupConfig getPupupConfig}}
8888
<textarea dir="auto" name="msg" maxlength="{{maxMessageLength}}" class="input-message autogrow-short" placeholder="{{_ 'Message'}}"></textarea>
89-
<i class="icon-paper-plane" title="{{_ "Send_Message"}}" aria-label="{{_ "Send_Message"}}"></i>
9089
</div>
90+
9191
{{#if canRecordAudio}}
9292
<div class="mic">
9393
<i class="icon-mic" aria-label="{{_ "Record"}}"></i>
@@ -115,6 +115,7 @@ <h2>
115115
{{/if}}
116116
{{/with}}
117117
</div>
118+
118119
{{#if showFormattingTips}}
119120
<div class="formatting-tips" aria-hidden="true" dir="auto">
120121
{{#if showMarkdown}}
@@ -129,6 +130,7 @@ <h2>
129130
{{#if showMarkdown}}
130131
<q><span class="hidden-br"><br></span>&gt;{{_ "quote"}}</q>
131132
{{/if}}
133+
132134
</div>
133135
{{/if}}
134136
<div class="editing-commands" aria-hidden="true" dir="auto">

Diff for: client/views/app/sideNav/chatRoomItem.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<i class="{{roomIcon}} {{userStatus}}"></i>
88
<span class='name'>{{name}}</span>
99
<span class='opt'>
10-
<i class="icon-cancel-circled hide-room" title="{{_ "Hide_room"}}"></i>
10+
<i class="octicon octicon-eye hide-room" title="{{_ "Hide_room"}}"></i>
1111
{{#if canLeave}}
12-
<i class="icon-logout leave-room" title="{{_ "Leave_room"}}"></i>
12+
<i class="octicon octicon-sign-out" title="{{_ "Leave_room"}}"></i>
1313
{{/if}}
1414
</span>
1515
</a>

Diff for: client/views/main.html

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<link rel="apple-touch-icon" sizes="144x144" href="/images/logo/apple-touch-icon-144x144.png?v=3">
3535
<link rel="apple-touch-icon" sizes="152x152" href="/images/logo/apple-touch-icon-152x152.png?v=3">
3636
<link rel="apple-touch-icon" sizes="180x180" href="/images/logo/apple-touch-icon-180x180.png?v=3">
37+
<link rel="stylesheet" type="text/css" href="/theme.css" id="theme">
3738
</head>
3839

3940
<body>

Diff for: i18n/en.i18n.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
"API" : "API",
4646
"API_Analytics" : "Analytics",
4747
"API_Embed" : "Embed",
48+
"API_EmbedDisabledFor": "Disable Embed for Users",
49+
"API_EmbedDisabledFor_Description": "Comma-separated usernames list",
4850
"are_also_typing" : "are also typing",
4951
"are_typing" : "are typing",
5052
"Are_you_sure" : "Are you sure?",
@@ -72,6 +74,7 @@
7274
"close" : "close",
7375
"coming_soon" : "coming soon",
7476
"Commands" : "Commands",
77+
"Compact_View": "Compact View",
7578
"Confirm_password" : "Confirm your password",
7679
"Contact" : "Contact",
7780
"Conversation" : "Conversation",
@@ -180,6 +183,7 @@
180183
"Message_AllowDeleting" : "Allow Message Deleting",
181184
"Message_AllowEditing" : "Allow Message Editing",
182185
"Message_AllowEditing_BlockEditInMinutes" : "Block message editing after (in minutes - 0 to disable)",
186+
"Message_AudioRecorderEnabled": "Audio Recorder Enabled",
183187
"Message_deleting_not_allowed" : "Message deleting not allowed",
184188
"Message_editing_not_allowed" : "Message editing not allowed",
185189
"Message_editing_blocked" : "This message cannot be edited anymore",
@@ -190,6 +194,7 @@
190194
"Message_pinned" : "Message pinned",
191195
"Message_ShowDeletedStatus" : "Show Deleted Status",
192196
"Message_ShowEditedStatus" : "Show Edited Status",
197+
"Message_ShowFormattingTips": "Show Formatting Tips",
193198
"Messages": "Messages",
194199
"Meta" : "Meta",
195200
"Meta_fb_app_id" : "Facebook APP ID",
@@ -300,7 +305,9 @@
300305
"Showing_results" : "<p>Showing <b>%s</b> results</p>",
301306
"Silence" : "Silence",
302307
"since_creation" : "since %s",
303-
"Site_Name" : "Site Name:",
308+
"Site_Name" : "Site Name",
309+
"Site_Url" : "Site URL",
310+
"Site_Url_Description" : "Example: https://chat.domain.com/",
304311
"SAML" : "SAML",
305312
"SMTP" : "SMTP",
306313
"SMTP_Host" : "SMTP Host",

0 commit comments

Comments
 (0)