Commit bfcc9613 authored by Christophe Benz's avatar Christophe Benz
Browse files

Rename source properties

parent 60d88d73
......@@ -32,16 +32,16 @@ pages:
title: Challenges of the hackathon
newItemButtonTitle: Add a new challenge
source:
provider: gitlab
baseUrl: https://framagit.org
type: gitlab
url: https://framagit.org
group: agdic-hackathon/challenges
- slug: tools
appBarTitle: Tools
title: Tools of the hackathon
source:
provider: discourse
baseUrl: https://forum.datafin.fr
category: defis
type: discourse
url: https://forum.datafin.fr
category: defis # ID or slug
- slug: data
appBarTitle: Data
title: Data of the hackathon
......@@ -30,7 +30,7 @@ export function discourseTopicToCardData(source, topic) {
imageUrl: topic.image_url,
html: topic.excerpt,
// title already exist in `topic`
url: `${source.baseUrl}/t/${topic.slug}`
url: `${source.url}/t/${topic.slug}`
}
}
......@@ -58,7 +58,7 @@ export function gitlabProjectToCardData(project) {
export async function fetchZoneCards(source, zone = {}) {
let results
switch (source.provider) {
switch (source.type) {
case "discourse":
if (source.category) {
const topicsResults = await fetchDiscourseCategoryTopics.bind(this)(source, zone)
......@@ -72,7 +72,7 @@ export async function fetchZoneCards(source, zone = {}) {
)
} else {
throw new ConfigError({
message: `Missing "category" or "topic" property in ${source.provider} not supported`,
message: `Missing "category" or "topic" property in ${source.type} not supported`,
info: { source, zone }
})
}
......@@ -84,7 +84,7 @@ export async function fetchZoneCards(source, zone = {}) {
}
default:
throw new ConfigError({
message: `Provider ${source.provider} not supported`,
message: `Provider ${source.type} not supported`,
info: { source, zone }
})
}
......@@ -92,7 +92,7 @@ export async function fetchZoneCards(source, zone = {}) {
}
export async function fetchDiscourseCategoryTopics(source, zone) {
const { baseUrl, category } = source
const { url: baseUrl, category } = source
const { limit = null } = zone
const url = `${baseUrl}/c/${category}.json`
let result = null
......@@ -138,7 +138,7 @@ export async function fetchDiscourseCategoryTopics(source, zone) {
}
export async function fetchDiscourseTopic(source) {
const { baseUrl, topic, id } = source
const { url: baseUrl, topic, id } = source
const url = `${baseUrl}/t/${topic}/${id}.json`
const info = { url, source }
let response
......@@ -164,7 +164,7 @@ export async function fetchDiscourseTopic(source) {
}
export async function fetchGitLabGroupProjects(source, zone) {
const { baseUrl, group } = source
const { url: baseUrl, group } = source
const {
limit = -1, // means no limit in GitLab API
orderBy = "name"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment