From 084eb359015c013016401aea2e6920556e55f5cb Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Sat, 26 Jun 2021 18:46:13 +0300 Subject: [PATCH] fix(tl-ref): added notice about history, removed source info for current schema since current schema is sourced both from tdlib and tdesktop, checking last one in history would be wrong. --- tl-reference/gatsby-node.js | 12 +++++++ tl-reference/src/pages/history.tsx | 5 +++ tl-reference/src/pages/index.tsx | 55 ++++-------------------------- 3 files changed, 23 insertions(+), 49 deletions(-) diff --git a/tl-reference/gatsby-node.js b/tl-reference/gatsby-node.js index ecb1b59f..311eda1c 100644 --- a/tl-reference/gatsby-node.js +++ b/tl-reference/gatsby-node.js @@ -8,6 +8,18 @@ const TL_NODE_TYPE = 'TlObject' exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => { const { createNode } = actions + createNode({ + id: createNodeId(`CurrentTlSchema`), + parent: null, + children: [], + layer: rawSchema.apiLayer, + internal: { + type: 'CurrentTlSchema', + content: JSON.stringify({ layer: rawSchema.apiLayer }), + contentDigest: createContentDigest({ layer: rawSchema.apiLayer }), + }, + }) + function createForNs(ns, prefix = '') { ns.classes.forEach((cls) => { createNode({ diff --git a/tl-reference/src/pages/history.tsx b/tl-reference/src/pages/history.tsx index f06bb91c..109292d7 100644 --- a/tl-reference/src/pages/history.tsx +++ b/tl-reference/src/pages/history.tsx @@ -47,6 +47,11 @@ export default function HistoryPage({ data }: { data: GraphqlResult }) { {' '} repository, and older schemas (<14) are fetched directly from Telegram's website. +
+
+ Note that schemas for MTCute are merged from Telegram Desktop + and TDLib repositories, and thus may not be exactly the same as + in history.
diff --git a/tl-reference/src/pages/index.tsx b/tl-reference/src/pages/index.tsx index 5ac30b73..0285d3de 100644 --- a/tl-reference/src/pages/index.tsx +++ b/tl-reference/src/pages/index.tsx @@ -22,18 +22,8 @@ interface Data { nodes: { arguments: { description: string | null }[] }[] } - updated: { - nodes: [ - { - layer: number - rev: number - source: { - date: string - commit: string - file: string - } - } - ] + currentTlSchema: { + layer: string } historySchemas: { totalCount: number } @@ -60,8 +50,6 @@ export default function IndexPage({ data }: { data: Data }) { countMissingDescriptionArguments(data.argWithoutDesc, true) countMissingDescriptionArguments(data.argWithDesc, false) - const currentLayer = data.updated.nodes[0] - return ( - layer {currentLayer.layer} - {currentLayer.rev > 0 ? ` rev. ${currentLayer.rev}` : ''} / - updated {currentLayer.source.date} /{' '} - - view source - + layer {data.currentTlSchema.layer} @@ -233,16 +211,7 @@ export default function IndexPage({ data }: { data: Data }) { component="ul" >
  • - Generated from layer {data.updated.nodes[0].layer}{' '} - (last updated {data.updated.nodes[0].source.date}, - commit{' '} - - {data.updated.nodes[0].source.commit.substr(0, 7)} - - ) + Generated from layer {data.currentTlSchema.layer}{' '}
  • Current schema contains{' '} @@ -344,20 +313,8 @@ export const query = graphql` totalCount } - updated: allHistoryJson( - sort: { fields: source___date, order: DESC } - filter: { layer: { ne: null } } - limit: 1 - ) { - nodes { - layer - rev - source { - date(formatString: "DD-MM-YYYY") - commit - file - } - } + currentTlSchema { + layer } clsWithDesc: allTlObject(filter: { description: { ne: null } }) {