Fix drive event always sent when fetching new pad metadata
This commit is contained in:
@@ -3384,9 +3384,17 @@ define([
|
|||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
|
// If the selected element is not visible, scroll to make it visible, otherwise scroll to
|
||||||
|
// the previous scroll position
|
||||||
var $sel = findSelectedElements();
|
var $sel = findSelectedElements();
|
||||||
if ($sel.length) {
|
if ($sel.length) {
|
||||||
|
var _top = $sel[0].getBoundingClientRect().top;
|
||||||
|
var _topContent = $content[0].getBoundingClientRect().top;
|
||||||
|
if ((_topContent + s + $content.height() - 20) < _top) {
|
||||||
$sel[0].scrollIntoView();
|
$sel[0].scrollIntoView();
|
||||||
|
} else {
|
||||||
|
$content.scrollTop(s);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$content.scrollTop(s);
|
$content.scrollTop(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1589,13 +1589,19 @@ define([
|
|||||||
// Update owners and expire time in the drive
|
// Update owners and expire time in the drive
|
||||||
getAllStores().forEach(function (s) {
|
getAllStores().forEach(function (s) {
|
||||||
var allData = s.manager.findChannel(data.channel);
|
var allData = s.manager.findChannel(data.channel);
|
||||||
|
var changed = false;
|
||||||
allData.forEach(function (obj) {
|
allData.forEach(function (obj) {
|
||||||
|
if (Sortify(obj.data.owners) !== Sortify(metadata.owners)) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
obj.data.owners = metadata.owners;
|
obj.data.owners = metadata.owners;
|
||||||
obj.data.atime = +new Date();
|
obj.data.atime = +new Date();
|
||||||
if (metadata.expire) {
|
if (metadata.expire) {
|
||||||
obj.data.expire = +metadata.expire;
|
obj.data.expire = +metadata.expire;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// If we had to change the "owners" field, redraw the drive UI
|
||||||
|
if (!changed) { return; }
|
||||||
var send = s.sendEvent || sendDriveEvent;
|
var send = s.sendEvent || sendDriveEvent;
|
||||||
send('DRIVE_CHANGE', {
|
send('DRIVE_CHANGE', {
|
||||||
path: ['drive', UserObject.FILES_DATA]
|
path: ['drive', UserObject.FILES_DATA]
|
||||||
|
|||||||
Reference in New Issue
Block a user