Skip to content

Commit

Permalink
Refactor user preference into admin setting
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelavald committed Jul 25, 2017
1 parent 95c6aa0 commit 8722ed9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@
"Clear_all_unreads_question": "Clear all unreads?",
"Click_here": "Click here",
"Click_here_for_more_info": "Click here for more info",
"Click_Direct_Message": "Click to Create Direct Message",
"Click_Direct_Message_Description": "Skip opening profile tab, instead go straight to conversation",
"UI_Click_Direct_Message": "Click to Create Direct Message",
"UI_Click_Direct_Message_Description": "Skip opening profile tab, instead go straight to conversation",
"Client_ID": "Client ID",
"Client_Secret": "Client Secret",
"Clients_will_refresh_in_a_few_seconds": "Clients will refresh in a few seconds",
Expand Down
4 changes: 4 additions & 0 deletions packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,10 @@ RocketChat.settings.addGroup('Layout', function() {
type: 'boolean',
'public': true
});
this.add('UI_Click_Direct_Message', false, {
type: 'boolean',
'public': true
});
});
});

Expand Down
9 changes: 0 additions & 9 deletions packages/rocketchat-ui-account/client/accountPreferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ <h1>{{_ "Messages"}}</h1>
<label><input type="radio" name="mergeChannels" value="-1" checked="{{checked 'mergeChannels' undefined true}}" /> {{_ "Default"}}</label>
</div>
</div>
<div class="input-line double-col" id="clickToDirectMessage">
<label>{{_ "Click_Direct_Message"}}</label>
<div>
<label><input type="radio" name="clickToDirectMessage" value="1" checked="{{checked 'clickToDirectMessage' true}}"/> {{_ "True"}}</label>
<label><input type="radio" name="clickToDirectMessage" value="0" checked="{{checked 'clickToDirectMessage' false true}}"/> {{_ "False"}}</label>
</div>
<div class="info">{{_ "Click_Direct_Message_Description"}}</div>

</div>
<div class="input-line double-col" id="sendOnEnter">
<label>{{_ "Enter_Behaviour"}}</label>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Template.accountPreferences.onCreated(function() {
data.hideFlexTab = $('#hideFlexTab').find('input:checked').val();
data.hideAvatars = $('#hideAvatars').find('input:checked').val();
data.mergeChannels = $('#mergeChannels').find('input:checked').val();
data.clickToDirectMessage = $('#clickToDirectMessage').find('input:checked').val();
data.sendOnEnter = $('#sendOnEnter').find('select').val();
data.unreadRoomsMode = $('input[name=unreadRoomsMode]:checked').val();
data.autoImageLoad = $('input[name=autoImageLoad]:checked').val();
Expand Down
3 changes: 1 addition & 2 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ Template.room.events({
if (!Meteor.userId() || !this._arguments) {
return;
}
const clickToDirectMessage = Meteor.user() && Meteor.user().settings && Meteor.user().settings.preferences && Meteor.user().settings.preferences.clickToDirectMessage;
if (clickToDirectMessage) {
if (RocketChat.settings.get('UI_Click_Direct_Message')) {
return Meteor.call('createDirectMessage', this._arguments[1].u.username, (error, result) => {
if (error) {
if (error.isClientSafe) {
Expand Down
1 change: 0 additions & 1 deletion server/methods/saveUserPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Meteor.methods({
preferences.hideUsernames = settings.hideUsernames === '1';
preferences.hideRoles = settings.hideRoles === '1';
preferences.hideAvatars = settings.hideAvatars === '1';
preferences.clickToDirectMessage = settings.clickToDirectMessage === '1';
preferences.hideFlexTab = settings.hideFlexTab === '1';
preferences.highlights = settings.highlights;
preferences.sendOnEnter = settings.sendOnEnter;
Expand Down

0 comments on commit 8722ed9

Please sign in to comment.