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

Load feeds on dashboard with AJAX instead of on page render #13507

Merged
merged 3 commits into from
Jul 7, 2017

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Jul 7, 2017

What does it do?

This changes the way the news and security feeds on the dashboard are rendered. Previously, this happened during rendering of the manager (i.e. before the manager HTML is sent to the browser). Now, it happens asynchronously when the manager page has been rendered by ExtJS.

Why is it needed?

The RSS feeds can be quite slow, especially in remote places. They also depend on an internet connection to work, which isn't always available. When the feeds are slow to load, the entire dashboard is slow to load, which is bad.

There are also other issues with the current RSS reader implementation, for example, #13209 where the entire manager is blank if the underlying RSS class can't find OpenSSL. By moving it into a separate PHP process, such issues will no longer break the entire manager just like that. I've not changed how that implementation works for now, other than putting the calls into a different place so it's more resilient.

Related issue(s)/PR(s)

I can't find a specific issue requesting this to be loaded this over AJAX, but #13209 and #2797 are somewhat related.


$enabled = $this->modx->getOption('feed_modx_' . $feed . '_enabled', null, true);
if (!$enabled) {
return $this->failure();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really a failure ? Seems perfectly legit to have those disabled.

Or maybe is that because the request should have never occurred ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah... i should have reviewed the whole diff first!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this shouldn't actually trigger. Was tempted to take it out, and happy to do so if you think that's better ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

No, i'm fine with it (we can never assume only core components would use it).
I was just concerned about the "failure" semantic...


public function loadFeed($url)
{
$this->modx->loadClass('xmlrss.modRSSParser','',false,true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not getService ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No particular reason. Mostly just copied the old code from the widgets into the processor, and that used it like this... getService is probably cleaner though.

@rtripault rtripault added this to the v2.6.0 milestone Jul 7, 2017
@Mark-H
Copy link
Collaborator Author

Mark-H commented Jul 7, 2017

Updated it to use getService instead :)

@rtripault rtripault self-assigned this Jul 7, 2017
@rtripault rtripault merged commit 6e52883 into modxcms:2.x Jul 7, 2017
rtripault added a commit that referenced this pull request Jul 7, 2017
…g AJAX [#13507]

* upstream/pr/13507:
  Use $modx->getService instead of loadClass and direct instantiation of the RSS parser
  Remove sleep() call from testing the loading spinner
  Load the dashboard feeds (news/security) over AJAX to prevent remote delays from slowing down the manager
@rtripault
Copy link
Contributor

Working nicely, many thanks!

@Mark-H Mark-H deleted the feature-ajax-load-feeds branch July 7, 2017 11:50
@gpsietzema
Copy link
Contributor

#modxbughunt #1point to @rtripault

#modxbughunt #3points to @Mark-H

@christianseel
Copy link
Contributor

@Mark-H This might raise potential privacy issues as described here:
#13500 / #13498

Sending the requests via Ajax includes data like the referrer, which can be used to identify the MODX (manager) location.
/cc @mindeffects

@Mark-H
Copy link
Collaborator Author

Mark-H commented Jul 7, 2017

The AJAX request is only local to MODX; it still loads the feed server-side (just in a separate process) just like before.

@christianseel
Copy link
Contributor

Ah gotcha! That of course if perfect! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants