Merge pull request #100 from zamentur/broken_link

[fix] Link broken on security alert (#95)
This commit is contained in:
opi 2015-07-09 09:17:43 +02:00
commit 21be86fc05

View file

@ -422,6 +422,7 @@ app = Sammy('#main', function (sam) {
// Get security feed and display new items
var securityFeed = 'https://yunohost.org/security.rss'
var forumUrl = 'https://forum.yunohost.org';
$.ajax({
url: securityFeed,
@ -435,11 +436,18 @@ app = Sammy('#main', function (sam) {
// Loop through items
$('item', xml).each(function(k, v) {
var link=$('link', v)[0].innerHTML;
if (typeof link == 'string' && link!='' && link.charAt(0)=='/')
link=forumUrl+link;
var description=$('description', v)[0].textContent;
description=description.replace('href="/','href="'+forumUrl+'/');
var item = {
guid: $('guid', v)[0].innerHTML,
title: $('title', v)[0].innerHTML,
url: $('link', v)[0].innerHTML,
desc: $('description', v)[0].textContent
url: link,
desc: description,
date: $('pubDate', v)[0].innerHTML.split(' +')[0],
}
if (viewedItems.indexOf(item.guid) === -1) {
// Show security message to administrator
@ -1767,6 +1775,7 @@ app = Sammy('#main', function (sam) {
};
// Get security feed and display items
var forumUrl = 'https://forum.yunohost.org';
var securityUrl = 'https://forum.yunohost.org/c/security';
var securityFeed = 'https://yunohost.org/security.rss';
@ -1781,14 +1790,19 @@ app = Sammy('#main', function (sam) {
dataType: "xml"
})
.done(function(xml){
// Loop through items
$('item', xml).each(function(k, v) {
var link=$('link', v)[0].innerHTML;
if (typeof link == 'string' && link!='' && link.charAt(0)=='/')
link=forumUrl+link;
var description=$('description', v)[0].textContent;
description=description.replace('href="/','href="'+forumUrl+'/');
var item = {
guid: $('guid', v)[0].innerHTML,
title: $('title', v)[0].innerHTML,
url: $('link', v)[0].innerHTML,
desc: $('description', v)[0].textContent,
url: link,
desc: description,
date: $('pubDate', v)[0].innerHTML.split(' +')[0],
}
data.items.push(item);