From 5fb5f1e8b5f2ca957c7ddc62f60d9775b446beeb Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 3 Aug 2021 21:55:52 -0400 Subject: [PATCH 01/10] perf: Remove backup column migration (#2397) * perf: Remove no-longer-used 'backup' columns These were added as part of the move to the v2 editor over a year ago incase any text was not correctly converted. After a year of use no cases of failed conversion have occurred that required the use of this column * Remove migration, will do in 2-step release * perf: Remove no-longer-used 'backup' columns These were added as part of the move to the v2 editor over a year ago incase any text was not correctly converted. After a year of use no cases of failed conversion have occurred that required the use of this column --- .../20210730044247-remove-backup-column.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server/migrations/20210730044247-remove-backup-column.js diff --git a/server/migrations/20210730044247-remove-backup-column.js b/server/migrations/20210730044247-remove-backup-column.js new file mode 100644 index 0000000000..3f2ec872a1 --- /dev/null +++ b/server/migrations/20210730044247-remove-backup-column.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.removeColumn('documents', 'backup'); + await queryInterface.removeColumn('revisions', 'backup'); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.addColumn('documents', 'backup', { + type: Sequelize.TEXT, + allowNull: true, + }); + await queryInterface.addColumn('revisions', 'backup', { + type: Sequelize.TEXT, + allowNull: true, + }); + } +}; \ No newline at end of file From dad21b2186a2f13e4add19c7e24a830b28a5fda4 Mon Sep 17 00:00:00 2001 From: Translate-O-Tron <75237327+outline-translations@users.noreply.github.com> Date: Tue, 3 Aug 2021 19:32:51 -0700 Subject: [PATCH 02/10] New Crowdin updates (#2400) --- shared/i18n/locales/de_DE/translation.json | 96 +++++------ shared/i18n/locales/nl_NL/translation.json | 6 +- shared/i18n/locales/zh_CN/translation.json | 178 ++++++++++----------- 3 files changed, 140 insertions(+), 140 deletions(-) diff --git a/shared/i18n/locales/de_DE/translation.json b/shared/i18n/locales/de_DE/translation.json index 7deb3f211e..8cc853c9dd 100644 --- a/shared/i18n/locales/de_DE/translation.json +++ b/shared/i18n/locales/de_DE/translation.json @@ -34,11 +34,11 @@ "only you": "Nur Du", "person": "Person", "people": "Personen", - "{{ total }} task": "{{ total }} task", - "{{ total }} task_plural": "{{ total }} tasks", - "{{ completed }} task done": "{{ completed }} task done", - "{{ completed }} task done_plural": "{{ completed }} tasks done", - "{{ completed }} of {{ total }} tasks": "{{ completed }} of {{ total }} tasks", + "{{ total }} task": "{{ total }} Aufgabe", + "{{ total }} task_plural": "{{ total }} Aufgaben", + "{{ completed }} task done": "{{ completed }} Aufgabe erledigt", + "{{ completed }} task done_plural": "{{ completed }} Aufgaben erledigt", + "{{ completed }} of {{ total }} tasks": "{{ completed }} von {{ total }} Aufgaben", "Currently editing": "Derzeit in Bearbeitung", "Currently viewing": "Gerade angezeigt", "Viewed {{ timeAgo }} ago": "Angesehen vor {{ timeAgo }}", @@ -50,7 +50,7 @@ "Align left": "Links ausrichten", "Align right": "Rechts ausrichten", "Bulleted list": "Punkteliste", - "Todo list": "Task list", + "Todo list": "Aufgabenliste", "Code block": "Codeblock", "Copied to clipboard": "In die Zwischenablage kopiert", "Code": "Code", @@ -75,7 +75,7 @@ "Divider": "Trennlinie", "Image": "Bild", "Sorry, an error occurred uploading the image": "Beim Hochladen des Bildes ist ein Fehler aufgetreten", - "Write a caption": "Write a caption", + "Write a caption": "Untertitel schreiben", "Info": "Info", "Info notice": "Info-Hinweis", "Link": "Link", @@ -101,20 +101,20 @@ "Tip notice": "Tipp Hinweis", "Warning": "Warnung", "Warning notice": "Warnhinweis", - "Module failed to load": "Module failed to load", - "Loading Failed": "Loading Failed", - "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.": "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.", - "Reload": "Reload", - "Something Unexpected Happened": "Something Unexpected Happened", - "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.": "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.", - "our engineers have been notified": "our engineers have been notified", - "Report a Bug": "Report a Bug", - "Show Detail": "Show Detail", + "Module failed to load": "Modul konnte nicht geladen werden", + "Loading Failed": "Laden fehlgeschlagen", + "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.": "Leider konnte ein Teil der Software nicht geladen werden weil der Inhalt sich inzwischen geändert hat oder eine Abfrage nicht erfolgreich abgeschlossen werden konnte. Bitte neu laden.", + "Reload": "Neu Laden", + "Something Unexpected Happened": "Ein unerwarteter Fehler ist aufgetreten", + "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.": "Entschuldigung, ein nicht behebbarer Fehler ist aufgetreten{{notified}}. Bitte versuchen Sie die Seite neu zu laden, es könnte inzwischen wieder funktionieren.", + "our engineers have been notified": "unsere Entwickler wurden benachrichtigt", + "Report a Bug": "Fehler melden", + "Show Detail": "Details anzeigen", "Icon": "Icon", "Show menu": "Menü anzeigen", "Choose icon": "Icon auswählen", "Loading": "Laden", - "Loading editor": "Loading editor", + "Loading editor": "Editor wird geladen", "Search": "Suche", "Default access": "Standardzugriff", "View and edit": "Anzeigen und bearbeiten", @@ -198,13 +198,13 @@ "Create template": "Vorlage erstellen", "Duplicate": "Duplizieren", "Unpublish": "Nicht veröffentlichen", - "Permanently delete": "Permanently delete", + "Permanently delete": "Unwiderruflich löschen", "Move": "Verschieben", "History": "Verlauf", "Download": "Herunterladen", "Print": "Drucken", "Move {{ documentName }}": "Verschiebe {{ documentName }}", - "Permanently delete {{ documentName }}": "Permanently delete {{ documentName }}", + "Permanently delete {{ documentName }}": "{{ documentName }} endgültig löschen", "Edit group": "Gruppe bearbeiten", "Delete group": "Gruppe löschen", "Group options": "Gruppen-Einstellungen", @@ -222,8 +222,8 @@ "Share options": "Teilen-Einstellungen", "Go to document": "Zum Dokument gehen", "Revoke link": "Link widerrufen", - "Contents": "Contents", - "Headings you add to the document will appear here": "Headings you add to the document will appear here", + "Contents": "Inhalte", + "Headings you add to the document will appear here": "Überschriften, die Sie dem Dokument hinzufügen, werden hier angezeigt", "Table of contents": "Inhaltsverzeichnis", "By {{ author }}": "Von {{ author }}", "Are you sure you want to make {{ userName }} an admin? Admins can modify team and billing information.": "Sind Sie sicher, dass Sie {{ userName }} zu einem Administrator machen möchten? Administratoren können Team- und Rechnungsinformationen ändern.", @@ -237,8 +237,8 @@ "Revoke invite": "Einladung widerrufen", "Activate account": "Konto aktivieren", "Suspend account": "Konto sperren", - "API token created": "API token created", - "Name your token something that will help you to remember it's use in the future, for example \"local development\", \"production\", or \"continuous integration\".": "Name your token something that will help you to remember it's use in the future, for example \"local development\", \"production\", or \"continuous integration\".", + "API token created": "API-Token erstellt", + "Name your token something that will help you to remember it's use in the future, for example \"local development\", \"production\", or \"continuous integration\".": "Nennen Sie Ihren Token so, dass Sie sich leicht daran erinnern können, z. B. \"development\" \"production\" oder \"continuous integration\".", "Documents": "Dokumente", "The document archive is empty at the moment.": "Das Dokumentenarchiv ist momentan leer.", "Search in collection": "Suche in Sammlung", @@ -254,7 +254,7 @@ "Least recently updated": "Am längsten nicht aktualisiert", "A–Z": "A - Z", "Drop documents to import": "Dokumente zum Importieren hier ablegen", - "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.": "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.", + "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.": "Sind Sie sich sicher? Löschung der {{collectionName}} Sammlung ist dauerhaft und nicht wiederrufbar. Die Dokumente selbst werden jedoch dem Papierkorb hinzugefügt.", "Deleting": "Wird gelöscht", "I’m sure – Delete": "Ich bin mir sicher – Löschen", "The collection was updated": "Die Sammlung wurde aktualisiert", @@ -266,9 +266,9 @@ "Public sharing is currently disabled in the team security settings.": "Öffentliches Teilen ist derzeit in den Sicherheitseinstellungen des Teams deaktiviert.", "Saving": "Speichert", "Save": "Speichern", - "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.": "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.", - "Exporting": "Exporting", - "Export Collection": "Export Collection", + "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.": "Der Export der Sammlung {{collectionName}} kann einige Sekunden dauern. Ihre Dokumente werden als ZIP-Datei mit Markdown Textdateien heruntergeladen.", + "Exporting": "Wird exportiert", + "Export Collection": "Sammlung exportieren", "Collections are for grouping your documents. They work best when organized around a topic or internal team — Product or Engineering for example.": "Sammlungen dienen zur Gruppierung von Dokumenten. Sie funktionieren am besten, wenn sie nach einem Thema oder nach internen Teams organisiert sind — z. B. Produkt oder Entwicklung.", "This is the default level of access given to team members, you can give specific users or groups more access once the collection is created.": "Dies ist die Standardstufe des Zugriffs für Teammitglieder. Du kannst bestimmten Nutzern oder Gruppen mehr Zugriff geben, sobald die Sammlung erstellt wurde.", "Creating": "Wird erstellt", @@ -311,17 +311,17 @@ "Add specific access for individual groups and team members": "Speziellen Zugriff für einzelne Gruppen und Teammitglieder hinzufügen", "Add groups to {{ collectionName }}": "Gruppen zu {{ collectionName }} hinzufügen", "Add people to {{ collectionName }}": "Personen zu {{ collectionName }} hinzufügen", - "Document updated by {{userName}}": "Document updated by {{userName}}", - "You have unsaved changes.\nAre you sure you want to discard them?": "You have unsaved changes.\nAre you sure you want to discard them?", - "Images are still uploading.\nAre you sure you want to discard them?": "Images are still uploading.\nAre you sure you want to discard them?", - "You’re editing a template. Highlight some text and use the <2> control to add placeholders that can be filled out when creating new documents from this template.": "You’re editing a template. Highlight some text and use the <2> control to add placeholders that can be filled out when creating new documents from this template.", - "Archived by {{userName}}": "Archived by {{userName}}", - "Deleted by {{userName}}": "Deleted by {{userName}}", - "This template will be permanently deleted in <2> unless restored.": "This template will be permanently deleted in <2> unless restored.", - "This document will be permanently deleted in <2> unless restored.": "This document will be permanently deleted in <2> unless restored.", - "Start your template…": "Start your template…", - "Start with a title…": "Start with a title…", - "…the rest is up to you": "…the rest is up to you", + "Document updated by {{userName}}": "Dokument aktualisiert durch {{userName}}", + "You have unsaved changes.\nAre you sure you want to discard them?": "Sie haben ungespeicherte Änderungen. Sind Sie sicher, dass Sie abbrechen wollen?", + "Images are still uploading.\nAre you sure you want to discard them?": "Bilder werden noch hochgeladen.\nMöchten Sie sie wirklich verwerfen?", + "You’re editing a template. Highlight some text and use the <2> control to add placeholders that can be filled out when creating new documents from this template.": "Sie bearbeiten eine Vorlage. Markieren Sie eine Textstelle und verwenden Sie die <2> -control, um Platzhalter hinzuzufügen, die beim Erstellen neuer Dokumente aus dieser Vorlage ausgefüllt werden können.", + "Archived by {{userName}}": "Archiviert durch {{userName}}", + "Deleted by {{userName}}": "Gelöscht von {{userName}}", + "This template will be permanently deleted in <2> unless restored.": "Diese Vorlage wird dauerhaft in <2> gelöscht, wenn sie nicht wiederhergestellt wird.", + "This document will be permanently deleted in <2> unless restored.": "Dieses Dokument wird dauerhaft in <2> gelöscht, wenn es nicht wiederhergestellt wird.", + "Start your template…": "Vorlage starten…", + "Start with a title…": "Mit dem Titel beginnen…", + "…the rest is up to you": "…der Rest liegt bei Ihnen", "Hide contents": "Inhalt ausblenden", "Show contents": "Inhalt anzeigen", "Edit {{noun}}": "{{noun}} bearbeiten", @@ -347,15 +347,15 @@ "Are you sure about that? Deleting the {{ documentTitle }} document will delete all of its history and any nested documents.": "Bist du dir sicher? Durch Löschen des Dokuments {{ documentTitle }}, werden der gesamte Verlauf und alle Unterdokumente gelöscht.", "If you’d like the option of referencing or restoring the {{noun}} in the future, consider archiving it instead.": "Wenn du {{noun}} in Zukunft noch referenzieren oder wiederherstellen möchtest, solltest du es stattdessen archivieren.", "Archiving": "Wird archiviert", - "Document moved": "Document moved", - "Current location": "Current location", - "Choose a new location": "Choose a new location", - "Search collections & documents": "Search collections & documents", + "Document moved": "Dokument verschoben", + "Current location": "Aktueller Speicherort", + "Choose a new location": "Wähle neuen Speicherort", + "Search collections & documents": "Sammlungen und Dokumente durchsuchen", "Couldn’t create the document, try again?": "Dokument konnte nicht erstellt werden. Erneut versuchen?", - "Document permanently deleted": "Document permanently deleted", - "Are you sure you want to permanently delete the {{ documentTitle }} document? This action is immediate and cannot be undone.": "Are you sure you want to permanently delete the {{ documentTitle }} document? This action is immediate and cannot be undone.", - "Template created, go ahead and customize it": "Template created, go ahead and customize it", - "Creating a template from {{titleWithDefault}} is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.": "Creating a template from {{titleWithDefault}} is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.", + "Document permanently deleted": "Dokument endgültig gelöscht", + "Are you sure you want to permanently delete the {{ documentTitle }} document? This action is immediate and cannot be undone.": "Möchten Sie das Dokument {{ documentTitle }} dauerhaft löschen? Die Löschung erfolgt sofort und kann nicht rückgängig gemacht werden.", + "Template created, go ahead and customize it": "Vorlage erstellt, fortfahren und anpassen", + "Creating a template from {{titleWithDefault}} is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.": "Das Erstellen einer Vorlage durch {{titleWithDefault}} ist eine non-destruktive Aktion – wir erstellen eine Kopie des Dokuments und verwandeln es in eine Vorlage, die als Ausgangspunkt für neue Dokumente verwendet werden kann.", "Search documents": "Dokumente durchsuchen", "No documents found for your filters.": "Keine Dokumente anhand Ihre Filter gefunden.", "You’ve not got any drafts at the moment.": "Sie haben im Moment keine Entwürfe.", @@ -365,8 +365,8 @@ "We were unable to load the document while offline.": "Wir konnten das Dokument nicht offline laden.", "Your account has been suspended": "Ihr Konto wurde gesperrt", "A team admin ({{ suspendedContactEmail }}) has suspended your account. To re-activate your account, please reach out to them directly.": "Ein Administrator ({{ suspendedContactEmail }}) hat dein Konto gesperrt. Um dein Konto zu reaktivieren, wende dich bitte direkt an diesen.", - "Are you sure about that? Deleting the {{groupName}} group will cause its members to lose access to collections and documents that it is associated with.": "Are you sure about that? Deleting the {{groupName}} group will cause its members to lose access to collections and documents that it is associated with.", - "You can edit the name of this group at any time, however doing so too often might confuse your team mates.": "You can edit the name of this group at any time, however doing so too often might confuse your team mates.", + "Are you sure about that? Deleting the {{groupName}} group will cause its members to lose access to collections and documents that it is associated with.": "Sind Sie sicher? Durch das Löschen der {{groupName}} verlieren Ihre Teammitglieder den Zugriff auf Sammlungen und Dokumente die mit der Gruppe verknüpft waren.", + "You can edit the name of this group at any time, however doing so too often might confuse your team mates.": "Sie können den Namen dieser Gruppe jederzeit ändern. Dies kann jedoch Ihre Teammitglieder verwirren.", "{{userName}} was added to the group": "{{userName}} wurde zur Gruppe hinzugefügt", "Add team members below to give them access to the group. Need to add someone who’s not yet on the team yet?": "Fügen Sie unten Teammitglieder hinzu, um ihnen Zugriff auf die Gruppe zu gewähren. Sie müssen jemanden hinzufügen, der noch nicht im Team ist?", "Invite them to {{teamName}}": "Personen zu {{teamName}} einladen", diff --git a/shared/i18n/locales/nl_NL/translation.json b/shared/i18n/locales/nl_NL/translation.json index 9b6a2c65cf..ff3d0cc990 100644 --- a/shared/i18n/locales/nl_NL/translation.json +++ b/shared/i18n/locales/nl_NL/translation.json @@ -1,13 +1,13 @@ { "currently editing": "momenteel aan het bewerken", "currently viewing": "momenteen aan het bekijken", - "previously edited": "previously edited", + "previously edited": "eerder bewerkt", "You": "Jij", "Viewers": "Kijkers", "Sorry, an error occurred saving the collection": "Er is een fout opgetreden bij het opslaan van de collectie", "Add a description": "Voeg een beschrijving toe", - "Collapse": "Collapse", - "Expand": "Expand", + "Collapse": "Inklappen", + "Expand": "Uitklappen", "Submenu": "Submenu", "Trash": "Prullenmand", "Archive": "Archief", diff --git a/shared/i18n/locales/zh_CN/translation.json b/shared/i18n/locales/zh_CN/translation.json index 29cfbdf5c5..35cb93891a 100644 --- a/shared/i18n/locales/zh_CN/translation.json +++ b/shared/i18n/locales/zh_CN/translation.json @@ -34,11 +34,11 @@ "only you": "仅您自己", "person": "人", "people": "用户", - "{{ total }} task": "{{ total }} task", - "{{ total }} task_plural": "{{ total }} tasks", - "{{ completed }} task done": "{{ completed }} task done", - "{{ completed }} task done_plural": "{{ completed }} tasks done", - "{{ completed }} of {{ total }} tasks": "{{ completed }} of {{ total }} tasks", + "{{ total }} task": "一共 {{ total }} 项任务", + "{{ total }} task_plural": "一共 {{ total }} 项任务", + "{{ completed }} task done": "已完成 {{ completed }} 项任务", + "{{ completed }} task done_plural": "已完成 {{ completed }} 项任务", + "{{ completed }} of {{ total }} tasks": "一共 {{ total }} 项任务,已完成 {{ completed }} 项", "Currently editing": "正在编辑", "Currently viewing": "正在浏览", "Viewed {{ timeAgo }} ago": "{{ timeAgo }} 前查看", @@ -50,7 +50,7 @@ "Align left": "左对齐", "Align right": "右对齐", "Bulleted list": "无序列表", - "Todo list": "Task list", + "Todo list": "任务列表", "Code block": "代码块", "Copied to clipboard": "已复制到剪切板", "Code": "代码", @@ -75,7 +75,7 @@ "Divider": "分割线", "Image": "图片", "Sorry, an error occurred uploading the image": "抱歉,上传图片时发生错误", - "Write a caption": "Write a caption", + "Write a caption": "撰写一个标题", "Info": "信息", "Info notice": "提示信息", "Link": "链接", @@ -101,20 +101,20 @@ "Tip notice": "提示信息", "Warning": "警告", "Warning notice": "警告信息", - "Module failed to load": "Module failed to load", - "Loading Failed": "Loading Failed", - "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.": "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.", - "Reload": "Reload", - "Something Unexpected Happened": "Something Unexpected Happened", - "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.": "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.", - "our engineers have been notified": "our engineers have been notified", - "Report a Bug": "Report a Bug", - "Show Detail": "Show Detail", + "Module failed to load": "模块加载失败", + "Loading Failed": "加载失败", + "Sorry, part of the application failed to load. This may be because it was updated since you opened the tab or because of a failed network request. Please try reloading.": "抱歉,应用程序有一部分加载失败。 这可能是因为在您打开标签后已经更新,或者因为网络请求失败。请尝试重新加载。", + "Reload": "重新加载", + "Something Unexpected Happened": "发生了一些意料之外的错误", + "Sorry, an unrecoverable error occurred{{notified}}. Please try reloading the page, it may have been a temporary glitch.": "抱歉,发生了一个无法恢复的错误{{notified}}。请尝试重新加载页面,这可能是一个暂时的小故障。", + "our engineers have been notified": "我们的工程师已经收到通知", + "Report a Bug": "反馈一个问题", + "Show Detail": "显示详情", "Icon": "图标", "Show menu": "显示菜单", "Choose icon": "选择图标", "Loading": "加载中", - "Loading editor": "Loading editor", + "Loading editor": "正在加载编辑器", "Search": "搜索", "Default access": "默认访问", "View and edit": "查看并编辑", @@ -222,8 +222,8 @@ "Share options": "分享选项", "Go to document": "转到文档", "Revoke link": "撤消链接", - "Contents": "Contents", - "Headings you add to the document will appear here": "Headings you add to the document will appear here", + "Contents": "目录", + "Headings you add to the document will appear here": "您添加到文档的标题将显示在此处", "Table of contents": "目录", "By {{ author }}": "创建人 {{ author }}", "Are you sure you want to make {{ userName }} an admin? Admins can modify team and billing information.": "您确定要设置 {{ userName }} 为管理员吗?管理员可以修改团队和帐单信息。", @@ -254,7 +254,7 @@ "Least recently updated": "最近最少更新", "A–Z": "A-Z", "Drop documents to import": "拖放文档以导入", - "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.": "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.", + "Are you sure about that? Deleting the {{collectionName}} collection is permanent and cannot be restored, however documents within will be moved to the trash.": "您确定要这样做吗? 删除 {{collectionName}} 文档集是永久性的,且无法还原。不过,文档集中的文件将被移动到回收站。", "Deleting": "正在删除", "I’m sure – Delete": "确认删除", "The collection was updated": "文档集已更新", @@ -266,9 +266,9 @@ "Public sharing is currently disabled in the team security settings.": "公共共享目前在团队安全设置中被禁用。", "Saving": "保存中", "Save": "保存", - "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.": "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.", - "Exporting": "Exporting", - "Export Collection": "Export Collection", + "Exporting the collection {{collectionName}} may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format.": "导出集合 {{collectionName}} 将会需要几秒钟。您的文档将会以 Markdown 格式放在文件夹中,并压缩成 zip 压缩包以供下载。", + "Exporting": "正在导出……", + "Export Collection": "导出文档集", "Collections are for grouping your documents. They work best when organized around a topic or internal team — Product or Engineering for example.": "文档集用于对文档进行分组。建议使用文档集管理同一主题或固定团队(比如产品团队或研发团队)的文档。", "This is the default level of access given to team members, you can give specific users or groups more access once the collection is created.": "这是授予团队成员的默认访问级别,创建集合后,您可以为特定用户或用户组提供更多访问权限。", "Creating": "正在创建", @@ -311,17 +311,17 @@ "Add specific access for individual groups and team members": "为个别组和团队成员添加特定访问权限", "Add groups to {{ collectionName }}": "将群组加到 {{ collectionName }}", "Add people to {{ collectionName }}": "添加用户到 {{ collectionName }}", - "Document updated by {{userName}}": "Document updated by {{userName}}", - "You have unsaved changes.\nAre you sure you want to discard them?": "You have unsaved changes.\nAre you sure you want to discard them?", - "Images are still uploading.\nAre you sure you want to discard them?": "Images are still uploading.\nAre you sure you want to discard them?", + "Document updated by {{userName}}": "文档已被 {{userName}} 更新", + "You have unsaved changes.\nAre you sure you want to discard them?": "您有尚未保存的修改。\n您确定要丢弃它们吗?", + "Images are still uploading.\nAre you sure you want to discard them?": "图像仍在上传中。\n您确定要丢弃它们吗?", "You’re editing a template. Highlight some text and use the <2> control to add placeholders that can be filled out when creating new documents from this template.": "You’re editing a template. Highlight some text and use the <2> control to add placeholders that can be filled out when creating new documents from this template.", - "Archived by {{userName}}": "Archived by {{userName}}", - "Deleted by {{userName}}": "Deleted by {{userName}}", - "This template will be permanently deleted in <2> unless restored.": "This template will be permanently deleted in <2> unless restored.", - "This document will be permanently deleted in <2> unless restored.": "This document will be permanently deleted in <2> unless restored.", - "Start your template…": "Start your template…", + "Archived by {{userName}}": "已被 {{userName}} 存档", + "Deleted by {{userName}}": "已被 {{userName}} 删除", + "This template will be permanently deleted in <2> unless restored.": "此模板将在 <2> 中永久删除,除非手动恢复。", + "This document will be permanently deleted in <2> unless restored.": "此文档将在 <2> 中永久删除,除非手动恢复。", + "Start your template…": "开始创建模板…", "Start with a title…": "Start with a title…", - "…the rest is up to you": "…the rest is up to you", + "…the rest is up to you": "…其余部分由您决定。", "Hide contents": "隐藏内容", "Show contents": "显示内容", "Edit {{noun}}": "编辑 {{noun}}", @@ -347,14 +347,14 @@ "Are you sure about that? Deleting the {{ documentTitle }} document will delete all of its history and any nested documents.": "删除文档 {{ documentTitle }} 也将会删除该文档所有历史版本和子文档,是否确认删除?", "If you’d like the option of referencing or restoring the {{noun}} in the future, consider archiving it instead.": "如果您将来希望引用或还原{{noun}},请考虑将其存档。", "Archiving": "正在归档", - "Document moved": "Document moved", - "Current location": "Current location", - "Choose a new location": "Choose a new location", - "Search collections & documents": "Search collections & documents", + "Document moved": "文档已被移动", + "Current location": "当前位置", + "Choose a new location": "选择新的位置", + "Search collections & documents": "搜索文档集和文档", "Couldn’t create the document, try again?": "无法创建文档,请重试?", "Document permanently deleted": "文档已被永久删除", "Are you sure you want to permanently delete the {{ documentTitle }} document? This action is immediate and cannot be undone.": "您确定要永久地删除 {{ documentTitle }} 文档吗?此操作即时生效且无法撤消。", - "Template created, go ahead and customize it": "Template created, go ahead and customize it", + "Template created, go ahead and customize it": "模板已创建,继续进行自定义", "Creating a template from {{titleWithDefault}} is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.": "Creating a template from {{titleWithDefault}} is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.", "Search documents": "搜索文档", "No documents found for your filters.": "没有找到相关文档。", @@ -374,27 +374,27 @@ "Add and remove team members in the {{groupName}} group. Adding people to the group will give them access to any collections this group has been added to.": "Add and remove team members in the {{groupName}} group. Adding people to the group will give them access to any collections this group has been added to.", "Listing team members in the {{groupName}} group.": "Listing team members in the {{groupName}} group.", "This group has no members.": "这个群组没有任何成员", - "Add people to {{groupName}}": "Add people to {{groupName}}", + "Add people to {{groupName}}": "添加用户到 {{groupName}}", "Groups are for organizing your team. They work best when centered around a function or a responsibility — Support or Engineering for example.": "Groups are for organizing your team. They work best when centered around a function or a responsibility — Support or Engineering for example.", - "You’ll be able to add people to the group next.": "You’ll be able to add people to the group next.", - "Continue": "Continue", - "Group members": "Group members", + "You’ll be able to add people to the group next.": "接下来,您将能够将人员添加到群组中。", + "Continue": "继续操作", + "Group members": "群组成员", "Recently viewed": "最近浏览", "Created by me": "由我创建", - "Weird, this shouldn’t ever be empty": "Weird, this shouldn’t ever be empty", - "Documents you’ve recently viewed will be here for easy access": "Documents you’ve recently viewed will be here for easy access", - "We sent out your invites!": "We sent out your invites!", - "Sorry, you can only send {{MAX_INVITES}} invites at a time": "Sorry, you can only send {{MAX_INVITES}} invites at a time", - "Invite team members or guests to join your knowledge base. Team members can sign in with {{signinMethods}} or use their email address.": "Invite team members or guests to join your knowledge base. Team members can sign in with {{signinMethods}} or use their email address.", - "Invite team members to join your knowledge base. They will need to sign in with {{signinMethods}}.": "Invite team members to join your knowledge base. They will need to sign in with {{signinMethods}}.", - "As an admin you can also <2>enable email sign-in.": "As an admin you can also <2>enable email sign-in.", - "Want a link to share directly with your team?": "Want a link to share directly with your team?", + "Weird, this shouldn’t ever be empty": "奇怪,这里不应该是空的", + "Documents you’ve recently viewed will be here for easy access": "您最近浏览过的文档将放在此处以方便快速访问", + "We sent out your invites!": "我们发送了您的邀请!", + "Sorry, you can only send {{MAX_INVITES}} invites at a time": "抱歉,您一次只能发送 {{MAX_INVITES}} 个邀请", + "Invite team members or guests to join your knowledge base. Team members can sign in with {{signinMethods}} or use their email address.": "邀请团队成员或访客加入您的知识库。团队成员可以使用 {{signinMethods}} 登录或使用他们的电子邮件地址登录。", + "Invite team members to join your knowledge base. They will need to sign in with {{signinMethods}}.": "邀请团队成员加入您的知识库。他们需要使用 {{signinMethods}} 登录。", + "As an admin you can also <2>enable email sign-in.": "作为管理员,您还可以<2>启用电子邮件登录.", + "Want a link to share directly with your team?": "想要一个链接直接分享到您的团队吗?", "Email": "邮箱", "Full name": "全名", - "Remove invite": "Remove invite", - "Add another": "Add another", - "Inviting": "Inviting", - "Send Invites": "Send Invites", + "Remove invite": "撤消邀请", + "Add another": "再添加一个", + "Inviting": "邀请中……", + "Send Invites": "发送邀请", "Navigation": "导航", "Edit current document": "编辑当前文档", "Move current document": "移动当前文档", @@ -424,19 +424,19 @@ "Blockquote": "块引用", "Horizontal divider": "水平分隔线", "Inline code": "行内代码", - "Back to home": "Back to home", - "Back to website": "Back to website", - "Check your email": "Check your email", - "A magic sign-in link has been sent to the email {{ emailLinkSentTo }}, no password needed.": "A magic sign-in link has been sent to the email {{ emailLinkSentTo }}, no password needed.", - "Back to login": "Back to login", - "Create an account": "Create an account", - "Get started by choosing a sign-in method for your new team below…": "Get started by choosing a sign-in method for your new team below…", - "Login to {{ authProviderName }}": "Login to {{ authProviderName }}", - "You signed in with {{ authProviderName }} last time.": "You signed in with {{ authProviderName }} last time.", - "Already have an account? Go to <1>login.": "Already have an account? Go to <1>login.", - "Sign In": "Sign In", - "Continue with Email": "Continue with Email", - "Continue with {{ authProviderName }}": "Continue with {{ authProviderName }}", + "Back to home": "回到主页", + "Back to website": "返回网站", + "Check your email": "请查看您的电子邮件", + "A magic sign-in link has been sent to the email {{ emailLinkSentTo }}, no password needed.": "魔法登录链接已经发送到电子邮箱 {{ emailLinkSentTo }},不需要密码。", + "Back to login": "回到登录界面", + "Create an account": "创建一个帐户", + "Get started by choosing a sign-in method for your new team below…": "请在下面为您的新团队选择一种登陆方式", + "Login to {{ authProviderName }}": "登录到 {{ authProviderName }}", + "You signed in with {{ authProviderName }} last time.": "您上次登录的方式为 {{ authProviderName }}。", + "Already have an account? Go to <1>login.": "已经有帐户了?前往<1>登录.", + "Sign In": "登录", + "Continue with Email": "使用电子邮件继续", + "Continue with {{ authProviderName }}": "使用 {{ authProviderName }} 继续", "Any collection": "文档集", "Any time": "任何时间", "Past day": "过去一天", @@ -466,14 +466,14 @@ "Active": "活动的", "Everyone": "所有人", "Admins": "管理員", - "Settings saved": "Settings saved", - "Unable to upload new logo": "Unable to upload new logo", + "Settings saved": "设置已保存", + "Unable to upload new logo": "无法上传新logo", "These details affect the way that your Outline appears to everyone on the team.": "These details affect the way that your Outline appears to everyone on the team.", - "Logo": "Logo", - "Crop logo": "Crop logo", + "Logo": "网站标志 (Logo)", + "Crop logo": "裁剪标志", "Upload": "上传", - "Subdomain": "Subdomain", - "Your knowledge base will be accessible at": "Your knowledge base will be accessible at", + "Subdomain": "二级域名", + "Your knowledge base will be accessible at": "您的知识库将在", "New group": "新建群组", "Groups can be used to organize and manage the people on your team.": "可以使用群组来组织和管理您团队中的人。", "All groups": "所有群组", @@ -491,20 +491,20 @@ "Export Requested": "已请求导出", "Requesting Export": "正在请求导出", "Export Data": "导出数据", - "Document published": "Document published", - "Receive a notification whenever a new document is published": "Receive a notification whenever a new document is published", - "Document updated": "Document updated", - "Receive a notification when a document you created is edited": "Receive a notification when a document you created is edited", - "Collection created": "Collection created", - "Receive a notification whenever a new collection is created": "Receive a notification whenever a new collection is created", - "Getting started": "Getting started", + "Document published": "文档已发布", + "Receive a notification whenever a new document is published": "每当发布新文档时收到通知", + "Document updated": "文档已更新", + "Receive a notification when a document you created is edited": "每当您创建的文档被编辑时收到通知", + "Collection created": "已创建文档集", + "Receive a notification whenever a new collection is created": "每当创建新文档集时收到通知", + "Getting started": "新手指南", "Tips on getting started with Outline`s features and functionality": "Tips on getting started with Outline`s features and functionality", - "New features": "New features", - "Receive an email when new features of note are added": "Receive an email when new features of note are added", - "Notifications saved": "Notifications saved", + "New features": "新特性", + "Receive an email when new features of note are added": "当笔记增加新功能时收到电子邮件", + "Notifications saved": "通知配置已保存", "Unsubscription successful. Your notification settings were updated": "Unsubscription successful. Your notification settings were updated", "Manage when and where you receive email notifications from Outline. Your email address can be updated in your SSO provider.": "Manage when and where you receive email notifications from Outline. Your email address can be updated in your SSO provider.", - "Email address": "Email address", + "Email address": "电子邮件地址", "Everyone that has signed into Outline appears here. It’s possible that there are other users who have access through {team.signinMethods} but haven’t signed in yet.": "每个登录到大纲的用户都会出现在这里。可能还有其他尚未登录的用户可以通过 {team.signinMethods} 访问。", "Filter": "筛选", "Profile saved": "配置已保存", @@ -517,8 +517,8 @@ "You may delete your account at any time, note that this is unrecoverable": "您可以随时删除您的帐户,请注意删除后将无法恢复该账号", "Delete account": "删除账户", "Settings that impact the access, security, and content of your knowledge base.": "Settings that impact the access, security, and content of your knowledge base.", - "Allow email authentication": "Allow email authentication", - "When enabled, users can sign-in using their email address": "When enabled, users can sign-in using their email address", + "Allow email authentication": "允许电子邮件身份验证", + "When enabled, users can sign-in using their email address": "启用后,用户可以使用他们的电子邮件地址登录", "When enabled, documents can be shared publicly on the internet by any team member": "When enabled, documents can be shared publicly on the internet by any team member", "Rich service embeds": "Rich service embeds", "Links to supported services are shown as rich embeds within your documents": "Links to supported services are shown as rich embeds within your documents", @@ -540,14 +540,14 @@ "Create a token": "创建令牌", "Zapier": "Zapier", "Zapier is a platform that allows Outline to easily integrate with thousands of other business tools. Head over to Zapier to setup a \"Zap\" and start programmatically interacting with Outline.'": "Zapier is a platform that allows Outline to easily integrate with thousands of other business tools. Head over to Zapier to setup a \"Zap\" and start programmatically interacting with Outline.'", - "Open Zapier": "Open Zapier", + "Open Zapier": "打开 Zapier", "You’ve not starred any documents yet.": "您尚未标记任何文档。", "There are no templates just yet.": "尚无可用模板。", "You can create templates to help your team create consistent and accurate documentation.": "您可以创建模板来帮助您的团队创建风格一致和准确的文档。", "Trash is empty at the moment.": "回收站为空。", - "Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of Outline and all your API tokens will be revoked.": "Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of Outline and all your API tokens will be revoked.", - "Note: Signing back in will cause a new account to be automatically reprovisioned.": "Note: Signing back in will cause a new account to be automatically reprovisioned.", - "Delete My Account": "Delete My Account", + "Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of Outline and all your API tokens will be revoked.": "你确定吗?注销您的帐户将销毁与您的用户相关联的识别数据并且无法撤消。您将立即退出 Outline,并且您的所有 API 令牌都将被撤销。", + "Note: Signing back in will cause a new account to be automatically reprovisioned.": "注意: 重新登录将导致自动重新配置新帐户。", + "Delete My Account": "注销我的帐户", "You joined": "您已加入", "Joined": "已加入", "{{ time }} ago.": "{{ time }} 之前。", From f2f550e1d2cc7b316f3caf3b546a7c76e0f7df7d Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 3 Aug 2021 20:02:11 -0700 Subject: [PATCH 03/10] fix: Policies missing on documents.viewed endpoint --- server/api/documents.js | 12 ++++++++++-- server/api/documents.test.js | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/api/documents.js b/server/api/documents.js index 58b86e6b63..faa9bf25f1 100644 --- a/server/api/documents.js +++ b/server/api/documents.js @@ -310,9 +310,10 @@ router.post("documents.viewed", auth(), pagination(), async (ctx) => { const user = ctx.state.user; const collectionIds = await user.collectionIds(); + const userId = user.id; const views = await View.findAll({ - where: { userId: user.id }, + where: { userId }, order: [[sort, direction]], include: [ { @@ -325,9 +326,16 @@ router.post("documents.viewed", auth(), pagination(), async (ctx) => { { model: Star, as: "starred", - where: { userId: user.id }, + where: { userId }, + separate: true, required: false, }, + { + model: Collection.scope({ + method: ["withMembership", userId], + }), + as: "collection", + }, ], }, ], diff --git a/server/api/documents.test.js b/server/api/documents.test.js index 1f6413a9ec..e43609d625 100644 --- a/server/api/documents.test.js +++ b/server/api/documents.test.js @@ -1349,6 +1349,7 @@ describe("#documents.viewed", () => { expect(res.status).toEqual(200); expect(body.data.length).toEqual(1); expect(body.data[0].id).toEqual(document.id); + expect(body.policies[0].abilities.update).toEqual(true); }); it("should not return recently viewed but deleted documents", async () => { From 28d32af61341eae1b273a0d98b042d644a6ae076 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 3 Aug 2021 23:51:12 -0400 Subject: [PATCH 04/10] perf: Remove unused database indexes according to a month of data in production (#2395) --- .../20210730042450-remove-unused-indexes.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/migrations/20210730042450-remove-unused-indexes.js diff --git a/server/migrations/20210730042450-remove-unused-indexes.js b/server/migrations/20210730042450-remove-unused-indexes.js new file mode 100644 index 0000000000..7b8a869722 --- /dev/null +++ b/server/migrations/20210730042450-remove-unused-indexes.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.removeIndex("documents", "documents_collaborator_ids"); + await queryInterface.removeIndex("documents", "documents_id_deleted_at"); + await queryInterface.removeIndex("users", "users_slack_id"); + await queryInterface.removeIndex("teams", "teams_slack_id"); + await queryInterface.removeIndex("teams", "teams_google_id"); + await queryInterface.removeIndex("collection_users", "collection_users_permission"); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.addIndex("documents", ["collaboratorIds"]); + await queryInterface.addIndex("documents", ["id", "deletedAt"]); + await queryInterface.addIndex("users", ["slackId"]); + await queryInterface.addIndex("teams", ["slackId"]); + await queryInterface.addIndex("teams", ["googleId"]); + await queryInterface.addIndex("collection_users", ["permission"]); + } +}; From bd148f4790ddc600665ef42cdade06440d4306a4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 4 Aug 2021 09:20:51 -0700 Subject: [PATCH 05/10] fix: Paste handler should default to HTML when paste source is Outline editor related #2416 --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 40533762c2..78e4d8e324 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "react-window": "^1.8.6", "reakit": "^1.3.8", "regenerator-runtime": "^0.13.7", - "rich-markdown-editor": "^11.17.0", + "rich-markdown-editor": "^11.17.1", "semver": "^7.3.2", "sequelize": "^6.3.4", "sequelize-cli": "^6.2.0", @@ -212,4 +212,4 @@ "js-yaml": "^3.13.1" }, "version": "0.58.0" -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e3fda7276e..217303ad2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11566,10 +11566,10 @@ retry-as-promised@^3.2.0: dependencies: any-promise "^1.3.0" -rich-markdown-editor@^11.17.0: - version "11.17.0" - resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.17.0.tgz#9a39f5bd6518de1d0dc6c6ffa352fd3f7f664d96" - integrity sha512-zCl9F7eeR3T5O2tiSU9iNGDOKhYBfTMqwWMPSY4ADjHcxELNkF1wOdKb0lqM8ZOfM63DkPEZy/N7cSifReyqvg== +rich-markdown-editor@^11.17.1: + version "11.17.1" + resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.17.1.tgz#ace87dccf7e7c7f6e093d73accb467794d3cee60" + integrity sha512-/V7nPhjASnKVqFRW0CFKCe1+PrRZywVWzjvlpwzAKjpYW8QSWL/fViIkYzWBsynYamCT/A/iLx8ms6KJr6gSjw== dependencies: copy-to-clipboard "^3.0.8" lodash "^4.17.11" From 57a2524fbd1f42c0fd8b1a43f3986806aeaeca60 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 4 Aug 2021 12:21:25 -0400 Subject: [PATCH 06/10] fix: /public directory missing in new docker releases (#2417) closes #2416 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index d6a918c1f0..da24d60ac9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ ENV NODE_ENV production COPY --from=builder $APP_PATH/build ./build COPY --from=builder $APP_PATH/server ./server +COPY --from=builder $APP_PATH/public ./public COPY --from=builder $APP_PATH/.sequelizerc ./.sequelizerc COPY --from=deps-prod $APP_PATH/node_modules ./node_modules COPY --from=builder $APP_PATH/package.json ./package.json From 9db72217aff56cadc72493eff4e1c3048d441d0c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 5 Aug 2021 18:03:55 -0400 Subject: [PATCH 07/10] feat: Include more events in document history sidebar (#2334) closes #2230 --- app/components/Button.js | 6 +- app/components/DocumentHistory.js | 124 +++++++++++ .../DocumentHistory/DocumentHistory.js | 199 ------------------ .../DocumentHistory/components/Revision.js | 87 -------- app/components/DocumentHistory/index.js | 3 - app/components/EventListItem.js | 163 ++++++++++++++ app/components/List/Item.js | 75 +++++-- app/components/LocaleTime.js | 35 ++- app/components/NavLink.js | 26 +++ app/components/NudeButton.js | 1 + app/components/PaginatedEventList.js | 53 +++++ app/components/PaginatedList.js | 45 +++- app/components/PaginatedList.test.js | 2 +- app/components/Tab.js | 21 +- app/components/Time.js | 1 + app/menus/RevisionMenu.js | 14 +- app/models/Event.js | 14 -- app/stores/EventsStore.js | 23 ++ app/stores/RootStore.js | 4 + app/test/setup.js | 3 + app/utils/dates.js | 51 +++++ shared/i18n/locales/en_US/translation.json | 19 +- 22 files changed, 600 insertions(+), 369 deletions(-) create mode 100644 app/components/DocumentHistory.js delete mode 100644 app/components/DocumentHistory/DocumentHistory.js delete mode 100644 app/components/DocumentHistory/components/Revision.js delete mode 100644 app/components/DocumentHistory/index.js create mode 100644 app/components/EventListItem.js create mode 100644 app/components/NavLink.js create mode 100644 app/components/PaginatedEventList.js create mode 100644 app/stores/EventsStore.js create mode 100644 app/utils/dates.js diff --git a/app/components/Button.js b/app/components/Button.js index 6ba2b8b559..fc3b4f64ad 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -66,7 +66,11 @@ const RealButton = styled.button` &:hover { - background: ${darken(0.05, props.theme.buttonNeutralBackground)}; + background: ${ + props.borderOnHover + ? props.theme.buttonNeutralBackground + : darken(0.05, props.theme.buttonNeutralBackground) + }; box-shadow: rgba(0, 0, 0, 0.07) 0px 1px 2px, ${ props.theme.buttonNeutralBorder } 0 0 0 1px inset; diff --git a/app/components/DocumentHistory.js b/app/components/DocumentHistory.js new file mode 100644 index 0000000000..264e9d2351 --- /dev/null +++ b/app/components/DocumentHistory.js @@ -0,0 +1,124 @@ +// @flow +import { observer } from "mobx-react"; +import { CloseIcon } from "outline-icons"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import { useHistory, useRouteMatch } from "react-router-dom"; +import styled from "styled-components"; +import breakpoint from "styled-components-breakpoint"; +import Event from "models/Event"; +import Button from "components/Button"; +import Empty from "components/Empty"; +import Flex from "components/Flex"; +import PaginatedEventList from "components/PaginatedEventList"; +import Scrollable from "components/Scrollable"; +import useStores from "hooks/useStores"; +import { documentUrl } from "utils/routeHelpers"; + +const EMPTY_ARRAY = []; + +function DocumentHistory() { + const { events, documents } = useStores(); + const { t } = useTranslation(); + const match = useRouteMatch(); + const history = useHistory(); + + const document = documents.getByUrl(match.params.documentSlug); + const eventsInDocument = document + ? events.inDocument(document.id) + : EMPTY_ARRAY; + + const onCloseHistory = () => { + history.push(documentUrl(document)); + }; + + const items = React.useMemo(() => { + if ( + eventsInDocument[0] && + document && + eventsInDocument[0].createdAt !== document.updatedAt + ) { + eventsInDocument.unshift( + new Event({ + name: "documents.latest_version", + documentId: document.id, + createdAt: document.updatedAt, + actor: document.updatedBy, + }) + ); + } + + return eventsInDocument; + }, [eventsInDocument, document]); + + return ( + + {document ? ( + +
+ {t("History")} +
+ + {t("Oh weird, there's nothing here")}} + /> + +
+ ) : null} +
+ ); +} + +const Position = styled(Flex)` + position: fixed; + top: 0; + bottom: 0; + width: ${(props) => props.theme.sidebarWidth}px; +`; + +const Sidebar = styled(Flex)` + display: none; + position: relative; + flex-shrink: 0; + background: ${(props) => props.theme.background}; + width: ${(props) => props.theme.sidebarWidth}px; + border-left: 1px solid ${(props) => props.theme.divider}; + z-index: 1; + + ${breakpoint("tablet")` + display: flex; + `}; +`; + +const Title = styled(Flex)` + font-size: 16px; + font-weight: 600; + text-align: center; + align-items: center; + justify-content: flex-start; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 0; + flex-grow: 1; +`; + +const Header = styled(Flex)` + align-items: center; + position: relative; + padding: 12px; + color: ${(props) => props.theme.text}; + flex-shrink: 0; +`; + +export default observer(DocumentHistory); diff --git a/app/components/DocumentHistory/DocumentHistory.js b/app/components/DocumentHistory/DocumentHistory.js deleted file mode 100644 index 68c8576f24..0000000000 --- a/app/components/DocumentHistory/DocumentHistory.js +++ /dev/null @@ -1,199 +0,0 @@ -// @flow -import ArrowKeyNavigation from "boundless-arrow-key-navigation"; -import { action, observable } from "mobx"; -import { inject, observer } from "mobx-react"; -import { CloseIcon } from "outline-icons"; -import * as React from "react"; -import { type Match, Redirect, type RouterHistory } from "react-router-dom"; -import { Waypoint } from "react-waypoint"; -import styled from "styled-components"; - -import breakpoint from "styled-components-breakpoint"; -import { DEFAULT_PAGINATION_LIMIT } from "stores/BaseStore"; -import DocumentsStore from "stores/DocumentsStore"; -import RevisionsStore from "stores/RevisionsStore"; - -import Button from "components/Button"; -import Flex from "components/Flex"; -import PlaceholderList from "components/List/Placeholder"; -import Revision from "./components/Revision"; -import { documentHistoryUrl, documentUrl } from "utils/routeHelpers"; - -type Props = { - match: Match, - documents: DocumentsStore, - revisions: RevisionsStore, - history: RouterHistory, -}; - -@observer -class DocumentHistory extends React.Component { - @observable isLoaded: boolean = false; - @observable isFetching: boolean = false; - @observable offset: number = 0; - @observable allowLoadMore: boolean = true; - @observable redirectTo: ?string; - - async componentDidMount() { - await this.loadMoreResults(); - this.selectFirstRevision(); - } - - fetchResults = async () => { - this.isFetching = true; - - const limit = DEFAULT_PAGINATION_LIMIT; - const results = await this.props.revisions.fetchPage({ - limit, - offset: this.offset, - documentId: this.props.match.params.documentSlug, - }); - - if ( - results && - (results.length === 0 || results.length < DEFAULT_PAGINATION_LIMIT) - ) { - this.allowLoadMore = false; - } else { - this.offset += DEFAULT_PAGINATION_LIMIT; - } - - this.isLoaded = true; - this.isFetching = false; - }; - - selectFirstRevision = () => { - if (this.revisions.length) { - const document = this.props.documents.getByUrl( - this.props.match.params.documentSlug - ); - if (!document) return; - - this.props.history.replace( - documentHistoryUrl(document, this.revisions[0].id) - ); - } - }; - - @action - loadMoreResults = async () => { - // Don't paginate if there aren't more results or we’re in the middle of fetching - if (!this.allowLoadMore || this.isFetching) return; - await this.fetchResults(); - }; - - get revisions() { - const document = this.props.documents.getByUrl( - this.props.match.params.documentSlug - ); - if (!document) return []; - return this.props.revisions.getDocumentRevisions(document.id); - } - - onCloseHistory = () => { - const document = this.props.documents.getByUrl( - this.props.match.params.documentSlug - ); - - this.redirectTo = documentUrl(document); - }; - - render() { - const document = this.props.documents.getByUrl( - this.props.match.params.documentSlug - ); - const showLoading = (!this.isLoaded && this.isFetching) || !document; - - if (this.redirectTo) return ; - - return ( - - -
- History -
- {showLoading ? ( - - - - ) : ( - - {this.revisions.map((revision, index) => ( - - ))} - - )} - {this.allowLoadMore && ( - - )} -
-
- ); - } -} - -const Loading = styled.div` - margin: 0 16px; -`; - -const Wrapper = styled(Flex)` - position: fixed; - top: 0; - right: 0; - z-index: 1; - min-width: ${(props) => props.theme.sidebarWidth}px; - height: 100%; - overflow-y: auto; - overscroll-behavior: none; -`; - -const Sidebar = styled(Flex)` - display: none; - background: ${(props) => props.theme.background}; - min-width: ${(props) => props.theme.sidebarWidth}px; - border-left: 1px solid ${(props) => props.theme.divider}; - z-index: 1; - - ${breakpoint("tablet")` - display: flex; - `}; -`; - -const Title = styled(Flex)` - font-size: 16px; - font-weight: 600; - text-align: center; - align-items: center; - justify-content: flex-start; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - width: 0; - flex-grow: 1; -`; - -const Header = styled(Flex)` - align-items: center; - position: relative; - padding: 12px; - border-bottom: 1px solid ${(props) => props.theme.divider}; - color: ${(props) => props.theme.text}; - flex-shrink: 0; -`; - -export default inject("documents", "revisions")(DocumentHistory); diff --git a/app/components/DocumentHistory/components/Revision.js b/app/components/DocumentHistory/components/Revision.js deleted file mode 100644 index f1469f89b0..0000000000 --- a/app/components/DocumentHistory/components/Revision.js +++ /dev/null @@ -1,87 +0,0 @@ -// @flow -import { format } from "date-fns"; -import * as React from "react"; -import { NavLink } from "react-router-dom"; -import styled, { withTheme } from "styled-components"; - -import Document from "models/Document"; -import Revision from "models/Revision"; -import Avatar from "components/Avatar"; -import Flex from "components/Flex"; -import Time from "components/Time"; -import RevisionMenu from "menus/RevisionMenu"; -import { type Theme } from "types"; - -import { documentHistoryUrl } from "utils/routeHelpers"; - -type Props = { - theme: Theme, - showMenu: boolean, - selected: boolean, - document: Document, - revision: Revision, -}; - -class RevisionListItem extends React.Component { - render() { - const { revision, document, showMenu, selected, theme } = this.props; - - return ( - - - {" "} - {revision.createdBy.name} - - - - - {showMenu && ( - - )} - - ); - } -} - -const StyledAvatar = styled(Avatar)` - border-color: transparent; - margin-right: 4px; -`; - -const StyledRevisionMenu = styled(RevisionMenu)` - position: absolute; - right: 16px; - top: 20px; -`; - -const StyledNavLink = styled(NavLink)` - color: ${(props) => props.theme.text}; - display: block; - padding: 8px 16px; - font-size: 15px; - position: relative; -`; - -const Author = styled(Flex)` - font-weight: 500; - padding: 0; - margin: 0; -`; - -const Meta = styled.p` - font-size: 14px; - opacity: 0.75; - margin: 0 0 2px; - padding: 0; -`; - -export default withTheme(RevisionListItem); diff --git a/app/components/DocumentHistory/index.js b/app/components/DocumentHistory/index.js deleted file mode 100644 index 7d566709c2..0000000000 --- a/app/components/DocumentHistory/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow -import DocumentHistory from "./DocumentHistory"; -export default DocumentHistory; diff --git a/app/components/EventListItem.js b/app/components/EventListItem.js new file mode 100644 index 0000000000..47f2d29663 --- /dev/null +++ b/app/components/EventListItem.js @@ -0,0 +1,163 @@ +// @flow +import { + TrashIcon, + ArchiveIcon, + EditIcon, + PublishIcon, + MoveIcon, + CheckboxIcon, +} from "outline-icons"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import styled from "styled-components"; +import Document from "models/Document"; +import Event from "models/Event"; +import Avatar from "components/Avatar"; +import Item, { Actions } from "components/List/Item"; +import Time from "components/Time"; +import RevisionMenu from "menus/RevisionMenu"; +import { documentHistoryUrl } from "utils/routeHelpers"; + +type Props = {| + document: Document, + event: Event, + latest?: boolean, +|}; + +const EventListItem = ({ event, latest, document }: Props) => { + const { t } = useTranslation(); + const opts = { userName: event.actor.name }; + const isRevision = event.name === "revisions.create"; + let meta, icon, to; + + switch (event.name) { + case "revisions.create": + case "documents.latest_version": { + if (latest) { + icon = ; + meta = t("Latest version"); + to = documentHistoryUrl(document); + break; + } else { + icon = ; + meta = t("{{userName}} edited", opts); + to = documentHistoryUrl(document, event.modelId || ""); + break; + } + } + case "documents.archive": + icon = ; + meta = t("{{userName}} archived", opts); + break; + case "documents.unarchive": + meta = t("{{userName}} restored", opts); + break; + case "documents.delete": + icon = ; + meta = t("{{userName}} deleted", opts); + break; + case "documents.restore": + meta = t("{{userName}} moved from trash", opts); + break; + case "documents.publish": + icon = ; + meta = t("{{userName}} published", opts); + break; + case "documents.move": + icon = ; + meta = t("{{userName}} moved", opts); + break; + default: + console.warn("Unhandled event: ", event.name); + } + + if (!meta) { + return null; + } + + return ( + + } + image={} + subtitle={ + + {icon} + {meta} + + } + actions={ + isRevision ? ( + + ) : undefined + } + /> + ); +}; + +const Subtitle = styled.span` + svg { + margin: -3px; + margin-right: 2px; + } +`; + +const ListItem = styled(Item)` + border: 0; + position: relative; + margin: 8px; + padding: 8px; + border-radius: 8px; + + img { + border-color: transparent; + } + + &::before { + content: ""; + display: block; + position: absolute; + top: -4px; + left: 23px; + width: 2px; + height: calc(100% + 8px); + background: ${(props) => props.theme.textSecondary}; + opacity: 0.25; + } + + &:nth-child(2)::before { + height: 50%; + top: 50%; + } + + &:last-child::before { + height: 50%; + } + + &:first-child:last-child::before { + display: none; + } + + ${Actions} { + opacity: 0.25; + transition: opacity 100ms ease-in-out; + } + + &:hover { + ${Actions} { + opacity: 1; + } + } +`; + +export default EventListItem; diff --git a/app/components/List/Item.js b/app/components/List/Item.js index 29b300f8eb..0dfc5f0b67 100644 --- a/app/components/List/Item.js +++ b/app/components/List/Item.js @@ -1,41 +1,62 @@ // @flow import * as React from "react"; -import styled from "styled-components"; +import styled, { useTheme } from "styled-components"; import Flex from "components/Flex"; +import NavLink from "components/NavLink"; -type Props = { +type Props = {| image?: React.Node, + to?: string, title: React.Node, subtitle?: React.Node, actions?: React.Node, border?: boolean, small?: boolean, -}; +|}; -const ListItem = ({ - image, - title, - subtitle, - actions, - small, - border, -}: Props) => { +const ListItem = ( + { image, title, subtitle, actions, small, border, to, ...rest }: Props, + ref +) => { + const theme = useTheme(); const compact = !subtitle; - return ( - + const content = (selected) => ( + <> {image && {image}} - + {title} - {subtitle && {subtitle}} + {subtitle && ( + + {subtitle} + + )} - {actions && {actions}} + {actions && {actions}} + + ); + + return ( + + {to ? content : content(false)} ); }; -const Wrapper = styled.li` +const Wrapper = styled.div` display: flex; + user-select: none; padding: ${(props) => (props.$border === false ? 0 : "8px 0")}; margin: ${(props) => (props.$border === false ? "8px 0" : 0)}; border-bottom: 1px solid @@ -57,28 +78,36 @@ const Image = styled(Flex)` `; const Heading = styled.p` - font-size: ${(props) => (props.$small ? 15 : 16)}px; + font-size: ${(props) => (props.$small ? 14 : 16)}px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - line-height: 1.2; + line-height: ${(props) => (props.$small ? 1.3 : 1.2)}; margin: 0; `; -const Content = styled(Flex)` +const Content = styled.div` + display: flex; + flex-direction: column; flex-grow: 1; + color: ${(props) => (props.$selected ? props.theme.white : props.theme.text)}; `; const Subtitle = styled.p` margin: 0; font-size: ${(props) => (props.$small ? 13 : 14)}px; - color: ${(props) => props.theme.textTertiary}; + color: ${(props) => + props.$selected ? props.theme.white50 : props.theme.textTertiary}; margin-top: -2px; `; -const Actions = styled.div` +export const Actions = styled(Flex)` align-self: center; + justify-content: center; + margin-right: 4px; + color: ${(props) => + props.$selected ? props.theme.white : props.theme.textSecondary}; `; -export default ListItem; +export default React.forwardRef(ListItem); diff --git a/app/components/LocaleTime.js b/app/components/LocaleTime.js index 107a7c21d4..b01094f5a3 100644 --- a/app/components/LocaleTime.js +++ b/app/components/LocaleTime.js @@ -1,5 +1,5 @@ // @flow -import { format, formatDistanceToNow } from "date-fns"; +import { format as formatDate, formatDistanceToNow } from "date-fns"; import { enUS, de, @@ -57,6 +57,9 @@ type Props = { tooltipDelay?: number, addSuffix?: boolean, shorten?: boolean, + relative?: boolean, + format?: string, + tooltip?: boolean, }; function LocaleTime({ @@ -64,7 +67,10 @@ function LocaleTime({ children, dateTime, shorten, + format, + relative, tooltipDelay, + tooltip, }: Props) { const userLocale = useUserLocale(); const [_, setMinutesMounted] = React.useState(0); // eslint-disable-line no-unused-vars @@ -82,25 +88,34 @@ function LocaleTime({ }; }, []); - let content = formatDistanceToNow(Date.parse(dateTime), { + const locale = userLocale ? locales[userLocale] : undefined; + let relativeContent = formatDistanceToNow(Date.parse(dateTime), { addSuffix, - locale: userLocale ? locales[userLocale] : undefined, + locale, }); if (shorten) { - content = content + relativeContent = relativeContent .replace("about", "") .replace("less than a minute ago", "just now") .replace("minute", "min"); } + const tooltipContent = formatDate( + Date.parse(dateTime), + format || "MMMM do, yyyy h:mm a", + { locale } + ); + + const content = children || relative ? relativeContent : tooltipContent; + + if (!tooltip) { + return content; + } + return ( - - + + ); } diff --git a/app/components/NavLink.js b/app/components/NavLink.js new file mode 100644 index 0000000000..12dbc8f922 --- /dev/null +++ b/app/components/NavLink.js @@ -0,0 +1,26 @@ +// @flow +import * as React from "react"; +import { NavLink, Route, type Match } from "react-router-dom"; + +type Props = { + children?: (match: Match) => React.Node, + exact?: boolean, + to: string, +}; + +export default function NavLinkWithChildrenFunc({ + to, + exact = false, + children, + ...rest +}: Props) { + return ( + + {({ match }) => ( + + {children ? children(match) : null} + + )} + + ); +} diff --git a/app/components/NudeButton.js b/app/components/NudeButton.js index 5e0027b214..193f56a859 100644 --- a/app/components/NudeButton.js +++ b/app/components/NudeButton.js @@ -12,6 +12,7 @@ const Button = styled.button` padding: 0; cursor: pointer; user-select: none; + color: inherit; `; export default React.forwardRef( diff --git a/app/components/PaginatedEventList.js b/app/components/PaginatedEventList.js new file mode 100644 index 0000000000..5414c49c56 --- /dev/null +++ b/app/components/PaginatedEventList.js @@ -0,0 +1,53 @@ +// @flow +import * as React from "react"; +import styled from "styled-components"; +import Document from "models/Document"; +import Event from "models/Event"; +import PaginatedList from "components/PaginatedList"; +import EventListItem from "./EventListItem"; + +type Props = {| + events: Event[], + document: Document, + fetch: (options: ?Object) => Promise, + options?: Object, + heading?: React.Node, + empty?: React.Node, +|}; + +const PaginatedEventList = React.memo(function PaginatedEventList({ + empty, + heading, + events, + fetch, + options, + document, + ...rest +}: Props) { + return ( + ( + + )} + renderHeading={(name) => {name}} + /> + ); +}); + +const Heading = styled("h3")` + font-size: 14px; + padding: 0 12px; +`; + +export default PaginatedEventList; diff --git a/app/components/PaginatedList.js b/app/components/PaginatedList.js index 7deeb9f52c..ca1d70615b 100644 --- a/app/components/PaginatedList.js +++ b/app/components/PaginatedList.js @@ -4,10 +4,12 @@ import { isEqual } from "lodash"; import { observable, action } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; +import { withTranslation, type TFunction } from "react-i18next"; import { Waypoint } from "react-waypoint"; import { DEFAULT_PAGINATION_LIMIT } from "stores/BaseStore"; import DelayedMount from "components/DelayedMount"; import PlaceholderList from "components/List/Placeholder"; +import { dateToHeading } from "utils/dates"; type Props = { fetch?: (options: ?Object) => Promise, @@ -15,7 +17,9 @@ type Props = { heading?: React.Node, empty?: React.Node, items: any[], - renderItem: (any) => React.Node, + renderItem: (any, index: number) => React.Node, + renderHeading?: (name: React.Element | string) => React.Node, + t: TFunction, }; @observer @@ -101,8 +105,9 @@ class PaginatedList extends React.Component { }; render() { - const { items, heading, empty } = this.props; + const { items, heading, empty, renderHeading } = this.props; + let previousHeading = ""; const showLoading = this.isFetching && !this.isFetchingMore && !this.isInitiallyLoaded; const showEmpty = !items.length && !showLoading; @@ -119,7 +124,37 @@ class PaginatedList extends React.Component { mode={ArrowKeyNavigation.mode.VERTICAL} defaultActiveChildIndex={0} > - {items.slice(0, this.renderCount).map(this.props.renderItem)} + {items.slice(0, this.renderCount).map((item, index) => { + const children = this.props.renderItem(item, index); + + // If there is no renderHeading method passed then no date + // headings are rendered + if (!renderHeading) { + return children; + } + + // Our models have standard date fields, updatedAt > createdAt. + // Get what a heading would look like for this item + const currentDate = + item.updatedAt || item.createdAt || previousHeading; + const currentHeading = dateToHeading(currentDate, this.props.t); + + // If the heading is different to any previous heading then we + // should render it, otherwise the item can go under the previous + // heading + if (!previousHeading || currentHeading !== previousHeading) { + previousHeading = currentHeading; + + return ( + + {renderHeading(currentHeading)} + {children} + + ); + } + + return children; + })} {this.allowLoadMore && ( @@ -136,4 +171,6 @@ class PaginatedList extends React.Component { } } -export default PaginatedList; +export const Component = PaginatedList; + +export default withTranslation()(PaginatedList); diff --git a/app/components/PaginatedList.test.js b/app/components/PaginatedList.test.js index 506c9c5474..438f65ac17 100644 --- a/app/components/PaginatedList.test.js +++ b/app/components/PaginatedList.test.js @@ -4,7 +4,7 @@ import { shallow } from "enzyme"; import * as React from "react"; import { DEFAULT_PAGINATION_LIMIT } from "stores/BaseStore"; import { runAllPromises } from "../test/support"; -import PaginatedList from "./PaginatedList"; +import { Component as PaginatedList } from "./PaginatedList"; describe("PaginatedList", () => { const render = () => null; diff --git a/app/components/Tab.js b/app/components/Tab.js index feb1c0df9c..4ad6a4cd60 100644 --- a/app/components/Tab.js +++ b/app/components/Tab.js @@ -1,25 +1,13 @@ // @flow import { m } from "framer-motion"; import * as React from "react"; -import { NavLink, Route } from "react-router-dom"; -import styled, { withTheme } from "styled-components"; -import { type Theme } from "types"; +import styled, { useTheme } from "styled-components"; +import NavLinkWithChildrenFunc from "components/NavLink"; type Props = { - theme: Theme, children: React.Node, }; -const NavLinkWithChildrenFunc = ({ to, exact = false, children, ...rest }) => ( - - {({ match }) => ( - - {children(match)} - - )} - -); - const TabLink = styled(NavLinkWithChildrenFunc)` position: relative; display: inline-flex; @@ -53,7 +41,8 @@ const transition = { damping: 30, }; -function Tab({ theme, children, ...rest }: Props) { +export default function Tab({ children, ...rest }: Props) { + const theme = useTheme(); const activeStyle = { color: theme.textSecondary, }; @@ -75,5 +64,3 @@ function Tab({ theme, children, ...rest }: Props) { ); } - -export default withTheme(Tab); diff --git a/app/components/Time.js b/app/components/Time.js index 8569de78df..78dd550a06 100644 --- a/app/components/Time.js +++ b/app/components/Time.js @@ -11,6 +11,7 @@ type Props = { children?: React.Node, tooltipDelay?: number, addSuffix?: boolean, + format?: string, shorten?: boolean, }; diff --git a/app/menus/RevisionMenu.js b/app/menus/RevisionMenu.js index 000f8099a4..1da8e43f01 100644 --- a/app/menus/RevisionMenu.js +++ b/app/menus/RevisionMenu.js @@ -5,7 +5,6 @@ import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; import { useMenuState } from "reakit/Menu"; import Document from "models/Document"; -import Revision from "models/Revision"; import ContextMenu from "components/ContextMenu"; import MenuItem from "components/ContextMenu/MenuItem"; import OverflowMenuButton from "components/ContextMenu/OverflowMenuButton"; @@ -16,12 +15,11 @@ import { documentHistoryUrl } from "utils/routeHelpers"; type Props = {| document: Document, - revision: Revision, - iconColor?: string, + revisionId: string, className?: string, |}; -function RevisionMenu({ document, revision, className, iconColor }: Props) { +function RevisionMenu({ document, revisionId, className }: Props) { const { showToast } = useToasts(); const menu = useMenuState({ modal: true }); const { t } = useTranslation(); @@ -30,11 +28,11 @@ function RevisionMenu({ document, revision, className, iconColor }: Props) { const handleRestore = React.useCallback( async (ev: SyntheticEvent<>) => { ev.preventDefault(); - await document.restore({ revisionId: revision.id }); + await document.restore({ revisionId }); showToast(t("Document restored"), { type: "success" }); history.push(document.url); }, - [history, showToast, t, document, revision] + [history, showToast, t, document, revisionId] ); const handleCopy = React.useCallback(() => { @@ -43,14 +41,14 @@ function RevisionMenu({ document, revision, className, iconColor }: Props) { const url = `${window.location.origin}${documentHistoryUrl( document, - revision.id + revisionId )}`; return ( <> diff --git a/app/models/Event.js b/app/models/Event.js index d9e69b0d04..f3d5e997c6 100644 --- a/app/models/Event.js +++ b/app/models/Event.js @@ -20,20 +20,6 @@ class Event extends BaseModel { published: boolean, templateId: string, }; - - get model() { - return this.name.split(".")[0]; - } - - get verb() { - return this.name.split(".")[1]; - } - - get verbPastTense() { - const v = this.verb; - if (v.endsWith("e")) return `${v}d`; - return `${v}ed`; - } } export default Event; diff --git a/app/stores/EventsStore.js b/app/stores/EventsStore.js new file mode 100644 index 0000000000..4f0dcbec00 --- /dev/null +++ b/app/stores/EventsStore.js @@ -0,0 +1,23 @@ +// @flow +import { sortBy, filter } from "lodash"; +import { computed } from "mobx"; +import Event from "models/Event"; +import BaseStore from "./BaseStore"; +import RootStore from "./RootStore"; + +export default class EventsStore extends BaseStore { + actions = ["list"]; + + constructor(rootStore: RootStore) { + super(rootStore, Event); + } + + @computed + get orderedData(): Event[] { + return sortBy(Array.from(this.data.values()), "createdAt").reverse(); + } + + inDocument(documentId: string): Event[] { + return filter(this.orderedData, (event) => event.documentId === documentId); + } +} diff --git a/app/stores/RootStore.js b/app/stores/RootStore.js index 48718686f9..13ebf28c0e 100644 --- a/app/stores/RootStore.js +++ b/app/stores/RootStore.js @@ -5,6 +5,7 @@ import CollectionGroupMembershipsStore from "./CollectionGroupMembershipsStore"; import CollectionsStore from "./CollectionsStore"; import DocumentPresenceStore from "./DocumentPresenceStore"; import DocumentsStore from "./DocumentsStore"; +import EventsStore from "./EventsStore"; import GroupMembershipsStore from "./GroupMembershipsStore"; import GroupsStore from "./GroupsStore"; import IntegrationsStore from "./IntegrationsStore"; @@ -24,6 +25,7 @@ export default class RootStore { collections: CollectionsStore; collectionGroupMemberships: CollectionGroupMembershipsStore; documents: DocumentsStore; + events: EventsStore; groups: GroupsStore; groupMemberships: GroupMembershipsStore; integrations: IntegrationsStore; @@ -46,6 +48,7 @@ export default class RootStore { this.collections = new CollectionsStore(this); this.collectionGroupMemberships = new CollectionGroupMembershipsStore(this); this.documents = new DocumentsStore(this); + this.events = new EventsStore(this); this.groups = new GroupsStore(this); this.groupMemberships = new GroupMembershipsStore(this); this.integrations = new IntegrationsStore(this); @@ -66,6 +69,7 @@ export default class RootStore { this.collections.clear(); this.collectionGroupMemberships.clear(); this.documents.clear(); + this.events.clear(); this.groups.clear(); this.groupMemberships.clear(); this.integrations.clear(); diff --git a/app/test/setup.js b/app/test/setup.js index bfed90c966..23ce7ef786 100644 --- a/app/test/setup.js +++ b/app/test/setup.js @@ -3,6 +3,9 @@ import localStorage from '../../__mocks__/localStorage'; import Enzyme from "enzyme"; import Adapter from "enzyme-adapter-react-16"; +import { initI18n } from "shared/i18n"; + +initI18n(); Enzyme.configure({ adapter: new Adapter() }); diff --git a/app/utils/dates.js b/app/utils/dates.js new file mode 100644 index 0000000000..a902f475b2 --- /dev/null +++ b/app/utils/dates.js @@ -0,0 +1,51 @@ +// @flow +import { + isToday, + isYesterday, + differenceInCalendarWeeks, + differenceInCalendarMonths, +} from "date-fns"; +import * as React from "react"; +import { type TFunction } from "react-i18next"; +import LocaleTime from "components/LocaleTime"; + +export function dateToHeading(dateTime: string, t: TFunction) { + const date = Date.parse(dateTime); + const now = new Date(); + + if (isToday(date)) { + return t("Today"); + } + + if (isYesterday(date)) { + return t("Yesterday"); + } + + // If the current calendar week but not today or yesterday then return the day + // of the week as a string. We use the LocaleTime component here to gain + // async bundle loading of languages + const weekDiff = differenceInCalendarWeeks(now, date); + if (weekDiff === 0) { + return ; + } + + if (weekDiff === 1) { + return t("Last week"); + } + + const monthDiff = differenceInCalendarMonths(now, date); + if (monthDiff === 0) { + return t("This month"); + } + + if (monthDiff === 1) { + return t("Last month"); + } + + if (monthDiff <= 12) { + return t("This year"); + } + + // If older than the current calendar year then just print the year e.g 2020 + return ; +} diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 9a3494829c..2012361ade 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -14,6 +14,8 @@ "Drafts": "Drafts", "Templates": "Templates", "Deleted Collection": "Deleted Collection", + "History": "History", + "Oh weird, there's nothing here": "Oh weird, there's nothing here", "New": "New", "Only visible to you": "Only visible to you", "Draft": "Draft", @@ -110,6 +112,14 @@ "our engineers have been notified": "our engineers have been notified", "Report a Bug": "Report a Bug", "Show Detail": "Show Detail", + "Latest version": "Latest version", + "{{userName}} edited": "{{userName}} edited", + "{{userName}} archived": "{{userName}} archived", + "{{userName}} restored": "{{userName}} restored", + "{{userName}} deleted": "{{userName}} deleted", + "{{userName}} moved from trash": "{{userName}} moved from trash", + "{{userName}} published": "{{userName}} published", + "{{userName}} moved": "{{userName}} moved", "Icon": "Icon", "Show menu": "Show menu", "Choose icon": "Choose icon", @@ -200,7 +210,6 @@ "Unpublish": "Unpublish", "Permanently delete": "Permanently delete", "Move": "Move", - "History": "History", "Download": "Download", "Print": "Print", "Move {{ documentName }}": "Move {{ documentName }}", @@ -552,5 +561,11 @@ "Joined": "Joined", "{{ time }} ago.": "{{ time }} ago.", "Edit Profile": "Edit Profile", - "{{ userName }} hasn’t updated any documents yet.": "{{ userName }} hasn’t updated any documents yet." + "{{ userName }} hasn’t updated any documents yet.": "{{ userName }} hasn’t updated any documents yet.", + "Today": "Today", + "Yesterday": "Yesterday", + "Last week": "Last week", + "This month": "This month", + "Last month": "Last month", + "This year": "This year" } From 5bdee1204e0f6d1a5e60b62d4ab83d86cd2cfd50 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 6 Aug 2021 09:39:03 -0700 Subject: [PATCH 08/10] fix: Copying header results in '#' copied fix: urls in text become linked when reloading doc fix: Allow creation of links to anchors from link toolbar --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 78e4d8e324..9e9bd2250a 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "react-window": "^1.8.6", "reakit": "^1.3.8", "regenerator-runtime": "^0.13.7", - "rich-markdown-editor": "^11.17.1", + "rich-markdown-editor": "^11.17.2", "semver": "^7.3.2", "sequelize": "^6.3.4", "sequelize-cli": "^6.2.0", diff --git a/yarn.lock b/yarn.lock index 217303ad2c..a550dc38e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11566,10 +11566,10 @@ retry-as-promised@^3.2.0: dependencies: any-promise "^1.3.0" -rich-markdown-editor@^11.17.1: - version "11.17.1" - resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.17.1.tgz#ace87dccf7e7c7f6e093d73accb467794d3cee60" - integrity sha512-/V7nPhjASnKVqFRW0CFKCe1+PrRZywVWzjvlpwzAKjpYW8QSWL/fViIkYzWBsynYamCT/A/iLx8ms6KJr6gSjw== +rich-markdown-editor@^11.17.2: + version "11.17.2" + resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.17.2.tgz#dfe37db78f05275a127f3044e37c89e655003927" + integrity sha512-YlforkrZlrvzDWz9C58O7+GU7ulJC8M+UdftMObhkt5LagpzBXXzPvOiMkR0qzlouxsEwSA22/S4J16obJpNWA== dependencies: copy-to-clipboard "^3.0.8" lodash "^4.17.11" From 42b384688dcf611c2826294ffc35f20335a568ab Mon Sep 17 00:00:00 2001 From: Saumya Pandey Date: Fri, 6 Aug 2021 22:58:26 +0530 Subject: [PATCH 09/10] fix: Options to create a document is available when the policies of collection in the context doesn't permits the user (#2424) --- app/components/DocumentListItem.js | 4 ++- app/menus/DocumentMenu.js | 40 +++++++++++++++----------- app/menus/NewDocumentMenu.js | 46 ++++++++++++++++-------------- app/menus/NewTemplateMenu.js | 38 +++++++++++++----------- app/scenes/Search/Search.js | 5 +++- 5 files changed, 78 insertions(+), 55 deletions(-) diff --git a/app/components/DocumentListItem.js b/app/components/DocumentListItem.js index 610a1b48df..78f04182b9 100644 --- a/app/components/DocumentListItem.js +++ b/app/components/DocumentListItem.js @@ -66,6 +66,7 @@ function DocumentListItem(props: Props, ref) { const canStar = !document.isDraft && !document.isArchived && !document.isTemplate; const can = policies.abilities(currentTeam.id); + const canCollection = policies.abilities(document.collectionId); return ( ); @@ -51,19 +67,7 @@ function NewDocumentMenu() {
{t("Choose a collection")}
-