Skip to content

Commit

Permalink
Merge pull request #8190 from RocketChat/scroll
Browse files Browse the repository at this point in the history
[FIX] Scrollbar not using new style
  • Loading branch information
rodrigok authored Sep 20, 2017
2 parents 9fc4540 + 2ea5466 commit 62aad03
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,4 @@ yasinuslu:blaze-meta
deepwell:bootstrap-datepicker2
rocketchat:postcss
[email protected]
keepnox:perfect-scrollbar
1 change: 1 addition & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jparker:[email protected]
[email protected]
kadira:[email protected]
kadira:[email protected]
keepnox:[email protected]
konecty:[email protected]
konecty:[email protected]
konecty:[email protected]_3
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/client/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Meteor.startup(function() {
}
Meteor.setTimeout(function() {
const currentUrl = location.origin + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
if (__meteor_runtime_config__.ROOT_URL !== currentUrl) {
if (__meteor_runtime_config__.ROOT_URL.replace(/\/$/, '') !== currentUrl) {
swal({
type: 'warning',
title: t('Warning'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.message-actions {
position: absolute;
top: 2px;
right: 2px;
right: 0.4rem;

display: none;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


.rooms-list {
position: relative;
overflow-y: scroll;

height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

height: var(--sidebar-item-height);

margin: 0 0 0 8px;
margin: 0 8px;

padding: 0 calc(var(--sidebar-default-padding) - 8px);

Expand Down
8 changes: 8 additions & 0 deletions packages/rocketchat-theme/client/imports/general/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@ button {

vertical-align: -0.15em;
}

.ps-scrollbar-y-rail {
background: transparent !important;
}

.ps-scrollbar-y {
width: 4px !important;
}
4 changes: 4 additions & 0 deletions packages/rocketchat-ui-account/client/accountFlex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Template.accountFlex.events({
}
});

Template.accountFlex.onRendered(function() {
$(this.find('.rooms-list')).perfectScrollbar();
});

Template.accountFlex.helpers({
allowUserProfileChange() {
return RocketChat.settings.get('Accounts_AllowUserProfileChange');
Expand Down
4 changes: 4 additions & 0 deletions packages/rocketchat-ui-admin/client/adminFlex.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const label = function() {
return TAPi18n.__(this.i18nLabel || this._id);
};

Template.adminFlex.onRendered(function() {
$(this.find('.rooms-list')).perfectScrollbar();
});

Template.adminFlex.helpers({
groups() {
const filter = Template.instance().settingsFilter.get();
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,11 @@ Template.message.onViewRendered = function(context) {
if (!templateInstance) {
return;
}

if (currentNode.classList.contains('own') === true) {
return (templateInstance.atBottom = true);
templateInstance.atBottom = true;
}
templateInstance.sendToBottomIfNecessary();
}
});
};
4 changes: 2 additions & 2 deletions packages/rocketchat-ui-message/client/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ Template.messageBox.events({
// fixes https://github.com/RocketChat/Rocket.Chat/issues/3037
// at this point, the input is cleared and ready for autogrow
input.updateAutogrow();
return instance.isMessageFieldEmpty.set(chatMessages[this._id].isEmpty());
instance.isMessageFieldEmpty.set(chatMessages[this._id].isEmpty());
return input.focus();
});
return input.focus();
},
'keyup .js-input-message'(event, instance) {
chatMessages[this._id].keyup(this._id, event, instance);
Expand Down
4 changes: 4 additions & 0 deletions packages/rocketchat-ui-sidenav/client/roomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Template.roomList.helpers({
}
});

Template.roomList.onRendered(function() {
$(this.firstNode.parentElement).perfectScrollbar();
});

Template.roomList.events({
'click .more'(e, t) {
if (t.data.identifier === 'p') {
Expand Down
10 changes: 6 additions & 4 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ Template.room.onDestroyed(function() {
});

Template.room.onRendered(function() {
$(this.find('.messages-box .wrapper')).perfectScrollbar();
const rid = Session.get('openedRoom');
if (!window.chatMessages[rid]) {
window.chatMessages[rid] = new ChatMessages;
Expand All @@ -816,8 +817,10 @@ Template.room.onRendered(function() {
const messageBox = $('.messages-box');

template.isAtBottom = function(scrollThreshold) {
if ((scrollThreshold == null)) { scrollThreshold = 0; }
if ((wrapper.scrollTop + scrollThreshold) >= (wrapper.scrollHeight - wrapper.clientHeight)) {
if (scrollThreshold == null) {
scrollThreshold = 0;
}
if (wrapper.scrollTop + scrollThreshold >= wrapper.scrollHeight - wrapper.clientHeight) {
newMessage.className = 'new-message background-primary-action-color color-content-background-color not';
return true;
}
Expand All @@ -836,8 +839,7 @@ Template.room.onRendered(function() {
};

template.sendToBottomIfNecessary = function() {

if ((template.atBottom === true) && (template.isAtBottom() !== true)) {
if (template.atBottom === true && template.isAtBottom() !== true) {
return template.sendToBottom();
}
};
Expand Down
2 changes: 2 additions & 0 deletions tests/end-to-end/ui/11-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,10 @@ describe('[Administration]', () => {

describe('[General Settings]', () => {
before(() => {
admin.settingsSearch.setValue('general');
admin.generalLink.waitForVisible(5000);
admin.generalLink.click();
admin.settingsSearch.setValue('');
admin.generalSiteUrl.waitForVisible(5000);
});

Expand Down
1 change: 1 addition & 0 deletions tests/pageobjects/administration.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Page from './Page';
class Administration extends Page {
get flexNav() { return browser.element('.flex-nav'); }
get flexNavContent() { return browser.element('.flex-nav'); }
get settingsSearch() { return browser.element('[name=settings-search]'); }
get layoutLink() { return browser.element('.flex-nav [href="/admin/Layout"]'); }
get infoLink() { return browser.element('.flex-nav [href="/admin/info"]'); }
get roomsLink() { return browser.element('.flex-nav [href="/admin/rooms"]'); }
Expand Down

0 comments on commit 62aad03

Please sign in to comment.