Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] "Idle Time Limit" using milliseconds instead of seconds #9824

Merged
merged 17 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b308a7f
Changed Idle Time Limit from milliseconds to seconds to make it more …
kaiiiiiiiii Feb 21, 2018
13cfcdb
Database Migration to convert Idle Time Limit from milliseconds to se…
kaiiiiiiiii Feb 21, 2018
c66cd34
Added a new line at the end of the migration file
kaiiiiiiiii Feb 21, 2018
9b56f3c
Add Idle Time Limit description
kaiiiiiiiii Feb 22, 2018
9ba12a2
Changed migration version number from 108 to 109 to resolve merge con…
kaiiiiiiiii Mar 27, 2018
74f316f
Rerun tests
kaiiiiiiiii Mar 27, 2018
eebdba1
Rerun tests
kaiiiiiiiii Mar 27, 2018
5b6d98f
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
kaiiiiiiiii Mar 27, 2018
4711c45
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
geekgonecrazy Mar 28, 2018
f6327c6
Changed migration version number, as there has been a merge conflict …
kaiiiiiiiii Apr 1, 2018
a984c49
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
kaiiiiiiiii Apr 1, 2018
7c4ff3c
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
geekgonecrazy Apr 3, 2018
e47193e
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
kaiiiiiiiii Apr 9, 2018
7937395
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
kaiiiiiiiii Apr 10, 2018
7e63a7d
Change migrasion version to 112
sampaiodiego Apr 17, 2018
701d497
Merge branch 'develop' into change_idle_time_limit_from_milliseconds_…
sampaiodiego Apr 17, 2018
6679f82
Update the idle timeout test description to 300
graywolf336 Apr 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/startup/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ Meteor.startup(function() {
}
};

const defaultIdleTimeLimit = 300000;
const defaultIdleTimeLimit = 300;

Meteor.subscribe('userData', function() {
const user = Meteor.user();
const userLanguage = user && user.language ? user.language : window.defaultUserLanguage();

if (!userHasPreferences(user)) {
UserPresence.awayTime = defaultIdleTimeLimit;
UserPresence.awayTime = defaultIdleTimeLimit * 1000;
UserPresence.start();
} else {
UserPresence.awayTime = user.settings.preferences.idleTimeLimit || defaultIdleTimeLimit;
UserPresence.awayTime = (user.settings.preferences.idleTimeLimit || defaultIdleTimeLimit) * 1000;

if (user.settings.preferences.hasOwnProperty('enableAutoAway')) {
user.settings.preferences.enableAutoAway && UserPresence.start();
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@
"IssueLinks_LinkTemplate": "Template for issue links",
"IssueLinks_LinkTemplate_Description": "Template for issue links; %s will be replaced by the issue number.",
"It_works": "It works",
"Idle_Time_Limit": "Idle Time Limit",
"Idle_Time_Limit": "Idle Time Limit (Sec.)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a Idle_Time_Limit_Description property and describe what it does?

"italics": "italics",
"Jitsi_Chrome_Extension": "Chrome Extension Id",
"Jitsi_Enable_Channels": "Enable in Channels",
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ RocketChat.settings.addGroup('Accounts', function() {
'public': true,
i18nLabel: 'Enable_Auto_Away'
});
this.add('Accounts_Default_User_Preferences_idleTimeoutLimit', 300000, {
this.add('Accounts_Default_User_Preferences_idleTimeoutLimit', 300, {
type: 'int',
'public': true,
i18nLabel: 'Idle_Time_Limit'
Expand Down
26 changes: 26 additions & 0 deletions server/startup/migrations/v108.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
RocketChat.Migrations.add({
version: 108,
up() {
if (RocketChat && RocketChat.models) {

if (RocketChat.models.Settings) {
const setting = RocketChat.models.Settings.findOne({ _id: 'Accounts_Default_User_Preferences_idleTimeoutLimit' });
if (setting && setting.value) {
RocketChat.models.Settings.update(
{ _id: 'Accounts_Default_User_Preferences_idleTimeoutLimit' },
{ $set: { value: setting.value / 1000 } }
);
}
}

if (RocketChat.models.Users) {
RocketChat.models.Users.find({ 'settings.preferences.idleTimeLimit': { $exists: 1 } }).forEach(function(user) {
RocketChat.models.Users.update(
{ _id: user._id },
{ $set: { 'settings.preferences.idleTimeLimit': user.settings.preferences.idleTimeLimit / 1000 } }
);
});
}
}
}
});
2 changes: 1 addition & 1 deletion tests/end-to-end/ui/11-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ describe('[Administration]', () => {
admin.accountsIdleTimeoutLimit.isVisible().should.be.true;
});
it('the idle timeout limit field value should be 0', () => {
admin.accountsIdleTimeoutLimit.getValue().should.equal('300000');
admin.accountsIdleTimeoutLimit.getValue().should.equal('300');
});

it('it should show the notifications durations field', () => {
Expand Down