text
stringlengths
1
2.83M
id
stringlengths
16
152
metadata
dict
__index_level_0__
int64
0
949
/* eslint-disable max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import App from '../../../base' // uses the PDFJS text layer renderer to provide invisible overlayed // text for searching App.factory('pdfTextLayer', function () { let pdfTextLayer return (pdfTextLayer = class pdfTextLayer { constructor(options) { this.textLayerDiv = options.textLayerDiv this.divContentDone = false this.viewport = options.viewport this.textDivs = [] this.renderer = options.renderer this.renderingDone = false } render(timeout) { if (this.renderingDone || !this.divContentDone) { return } if (this.textLayerRenderTask != null) { this.textLayerRenderTask.cancel() this.textLayerRenderTask = null } this.textDivs = [] const textLayerFrag = document.createDocumentFragment() this.textLayerRenderTask = this.renderer({ textContent: this.textContent, container: textLayerFrag, viewport: this.viewport, textDivs: this.textDivs, timeout, enhanceTextSelection: this.enhanceTextSelection, }) const textLayerSuccess = () => { this.textLayerDiv.appendChild(textLayerFrag) return (this.renderingDone = true) } const textLayerFailure = function () { // canceled or failed to render text layer -- skipping errors } return this.textLayerRenderTask.promise.then( textLayerSuccess, textLayerFailure ) } setTextContent(textContent) { if (this.textLayerRenderTask) { this.textLayerRenderTask.cancel() this.textLayerRenderTask = null } this.textContent = textContent return (this.divContentDone = true) } }) })
overleaf/web/frontend/js/ide/pdfng/directives/pdfTextLayer.js/0
{ "file_path": "overleaf/web/frontend/js/ide/pdfng/directives/pdfTextLayer.js", "repo_id": "overleaf", "token_count": 816 }
497
/* eslint-disable max-len, no-return-assign, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import App from '../../../base' export default App.directive('resolvedCommentEntry', () => ({ restrict: 'E', templateUrl: 'resolvedCommentEntryTemplate', scope: { thread: '=', permissions: '=', onUnresolve: '&', onDelete: '&', }, link(scope, element, attrs) { scope.contentLimit = 40 scope.needsCollapsing = false scope.isCollapsed = true scope.toggleCollapse = () => (scope.isCollapsed = !scope.isCollapsed) return scope.$watch( 'thread.content.length', contentLength => (scope.needsCollapsing = contentLength > scope.contentLimit) ) }, }))
overleaf/web/frontend/js/ide/review-panel/directives/resolvedCommentEntry.js/0
{ "file_path": "overleaf/web/frontend/js/ide/review-panel/directives/resolvedCommentEntry.js", "repo_id": "overleaf", "token_count": 342 }
498
import { postJSON } from './fetch-json' import sessionStorage from '../infrastructure/session-storage' const CACHE_KEY = 'mbEvents' export function send(category, action, label, value) { if (typeof window.ga === 'function') { window.ga('send', 'event', category, action, label, value) } } export function sendMB(key, segmentation = {}) { postJSON(`/event/${key}`, { body: segmentation, keepalive: true }).catch( () => { // ignore errors } ) } export function sendMBOnce(key, segmentation = {}) { let eventCache = sessionStorage.getItem(CACHE_KEY) // Initialize as an empy object if the event cache is still empty. if (eventCache == null) { eventCache = {} sessionStorage.setItem(CACHE_KEY, eventCache) } const isEventInCache = eventCache[key] || false if (!isEventInCache) { eventCache[key] = true sessionStorage.setItem(CACHE_KEY, eventCache) sendMB(key, segmentation) } } export function sendMBSampled(key, body = {}, rate = 0.01) { if (Math.random() < rate) { sendMB(key, body) } }
overleaf/web/frontend/js/infrastructure/event-tracking.js/0
{ "file_path": "overleaf/web/frontend/js/infrastructure/event-tracking.js", "repo_id": "overleaf", "token_count": 380 }
499
/* eslint-disable max-len, no-return-assign, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import App from '../base' export default App.controller( 'AnnualUpgradeController', function ($scope, $http, $modal) { const MESSAGES_URL = '/user/subscription/upgrade-annual' $scope.upgradeComplete = false const savings = { student: '19.2', collaborator: '36', } $scope.$watch($scope.planName, function () { $scope.yearlySaving = savings[$scope.planName] if ($scope.planName === 'annual') { return ($scope.upgradeComplete = true) } }) return ($scope.completeAnnualUpgrade = function () { const body = { planName: $scope.planName, _csrf: window.csrfToken, } $scope.inflight = true return $http .post(MESSAGES_URL, body) .then(() => ($scope.upgradeComplete = true)) .catch(() => console.log('something went wrong changing plan')) }) } )
overleaf/web/frontend/js/main/annual-upgrade.js/0
{ "file_path": "overleaf/web/frontend/js/main/annual-upgrade.js", "repo_id": "overleaf", "token_count": 475 }
500
import _ from 'lodash' import App from '../../base' import './services/project-list' App.controller('ProjectPageController', function ( $scope, $modal, $window, queuedHttp, eventTracking, // eslint-disable-line camelcase $timeout, localStorage, ProjectListService ) { $scope.projects = window.data.projects $scope.tags = window.data.tags $scope.notifications = window.data.notifications $scope.notificationsInstitution = window.data.notificationsInstitution $scope.allSelected = false $scope.selectedProjects = [] $scope.filter = 'all' $scope.predicate = 'lastUpdated' $scope.nUntagged = 0 $scope.reverse = true $scope.searchText = { value: '' } $scope.$watch('predicate', function (newValue) { $scope.comparator = newValue === 'ownerName' ? ownerNameComparator : defaultComparator }) $timeout(() => recalculateProjectListHeight(), 10) $scope.$watch( () => $scope.projects.filter( project => (project.tags == null || project.tags.length === 0) && !project.archived && !project.trashed ).length, newVal => ($scope.nUntagged = newVal) ) var recalculateProjectListHeight = function () { const $projListCard = $('.project-list-card') if (!$projListCard || !$projListCard.offset()) return const topOffset = $projListCard.offset().top const cardPadding = $projListCard.outerHeight() - $projListCard.height() const bottomOffset = $('footer').outerHeight() const height = $window.innerHeight - topOffset - bottomOffset - cardPadding $scope.projectListHeight = height } function defaultComparator(v1, v2) { var result = 0 var type1 = v1.type var type2 = v2.type if ($scope.predicate === 'ownerName') { return } if (type1 === type2) { var value1 = v1.value var value2 = v2.value if (type1 === 'string') { // Compare strings case-insensitively value1 = value1.toLowerCase() value2 = value2.toLowerCase() } else if (type1 === 'object') { // For basic objects, use the position of the object // in the collection instead of the value if (angular.isObject(value1)) value1 = v1.index if (angular.isObject(value2)) value2 = v2.index } if (value1 !== value2) { result = value1 < value2 ? -1 : 1 } } else { result = type1 < type2 ? -1 : 1 } return result } function ownerNameComparator(v1, v2) { if ($scope.predicate !== 'ownerName') { return } if (v1.value === 'You') { if (v2.value === 'You') { return v1.index < v2.index ? -1 : 1 } else { return 1 } } else if (v1.value === 'An Overleaf v1 User' || v1.value === 'None') { if (v2.value === 'An Overleaf v1 User' || v2.value === 'None') { return v1.index < v2.index ? -1 : 1 } else { return -1 } } else { if (v2.value === 'You') { return -1 } else if (v2.value === 'An Overleaf v1 User' || v2.value === 'None') { return 1 } else { return v1.value > v2.value ? -1 : 1 } } } angular.element($window).bind('resize', function () { recalculateProjectListHeight() $scope.$apply() }) $scope.$on('project-list:notifications-received', () => $scope.$applyAsync(() => recalculateProjectListHeight()) ) // Allow tags to be accessed on projects as well const projectsById = {} for (const project of $scope.projects) { projectsById[project.id] = project } $scope.getProjectById = id => projectsById[id] for (const tag of $scope.tags) { for (const projectId of tag.project_ids || []) { const project = projectsById[projectId] if (project) { if (!project.tags) { project.tags = [] } project.tags.push(tag) } } } $scope.changePredicate = function (newPredicate) { if ($scope.predicate === newPredicate) { $scope.reverse = !$scope.reverse } $scope.predicate = newPredicate } $scope.getSortIconClass = function (column) { if (column === $scope.predicate && $scope.reverse) { return 'fa-caret-down' } else if (column === $scope.predicate && !$scope.reverse) { return 'fa-caret-up' } else { return '' } } $scope.searchProjects = function () { eventTracking.send( 'project-list-page-interaction', 'project-search', 'keydown' ) $scope.updateVisibleProjects() } $scope.clearSearchText = function () { $scope.searchText.value = '' $scope.filter = 'all' $scope.$emit('search:clear') $scope.updateVisibleProjects() } $scope.setFilter = function (filter) { $scope.filter = filter $scope.updateVisibleProjects() } $scope.updateSelectedProjects = function () { $scope.selectedProjects = $scope.projects.filter( project => project.selected ) } $scope.getSelectedProjects = () => $scope.selectedProjects $scope.getSelectedProjectIds = () => $scope.selectedProjects.map(project => project.id) $scope.getFirstSelectedProject = () => $scope.selectedProjects[0] $scope.hasLeavableProjectsSelected = () => _.some( $scope.getSelectedProjects(), project => project.accessLevel !== 'owner' && project.trashed ) $scope.hasDeletableProjectsSelected = () => _.some( $scope.getSelectedProjects(), project => project.accessLevel === 'owner' && project.trashed ) $scope.updateVisibleProjects = function () { $scope.visibleProjects = [] const selectedTag = $scope.getSelectedTag() for (const project of $scope.projects) { let visible = true // Only show if it matches any search text if ($scope.searchText.value !== '') { if ( project.name .toLowerCase() .indexOf($scope.searchText.value.toLowerCase()) === -1 ) { visible = false } } // Only show if it matches the selected tag if ( $scope.filter === 'tag' && selectedTag != null && !selectedTag.project_ids.includes(project.id) ) { visible = false } // Hide tagged projects if we only want to see the uncategorized ones if ( $scope.filter === 'untagged' && (project.tags != null ? project.tags.length : undefined) > 0 ) { visible = false } // Hide projects we own if we only want to see shared projects if ($scope.filter === 'shared' && project.accessLevel === 'owner') { visible = false } // Hide projects we don't own if we only want to see owned projects if ($scope.filter === 'owned' && project.accessLevel !== 'owner') { visible = false } if ($scope.filter === 'archived') { // Only show archived projects if (!project.archived) { visible = false } } else { // Only show non-archived projects if (project.archived) { visible = false } } if ($scope.filter === 'trashed') { // Only show trashed projects if (!project.trashed) { visible = false } } else { // Only show non-trashed projects if (project.trashed) { visible = false } } if (visible) { $scope.visibleProjects.push(project) } else { // We don't want hidden selections project.selected = false } } localStorage( 'project_list', JSON.stringify({ filter: $scope.filter, selectedTagId: selectedTag != null ? selectedTag._id : undefined, }) ) $scope.updateSelectedProjects() } $scope.getSelectedTag = function () { for (const tag of $scope.tags) { if (tag.selected) { return tag } } return null } $scope._removeProjectIdsFromTagArray = function (tag, removeProjectIds) { // Remove project_id from tag.project_ids const remainingProjectIds = [] const removedProjectIds = [] for (const projectId of tag.project_ids) { if (!removeProjectIds.includes(projectId)) { remainingProjectIds.push(projectId) } else { removedProjectIds.push(projectId) } } tag.project_ids = remainingProjectIds return removedProjectIds } $scope._removeProjectFromList = function (project) { const index = $scope.projects.indexOf(project) if (index > -1) { $scope.projects.splice(index, 1) } } $scope.removeSelectedProjectsFromTag = function (tag) { tag.showWhenEmpty = true const selectedProjectIds = $scope.getSelectedProjectIds() const selectedProjects = $scope.getSelectedProjects() const removedProjectIds = $scope._removeProjectIdsFromTagArray( tag, selectedProjectIds ) // Remove tag from project.tags for (const project of selectedProjects) { if (!project.tags) { project.tags = [] } const index = project.tags.indexOf(tag) if (index > -1) { project.tags.splice(index, 1) } } for (const projectId of removedProjectIds) { queuedHttp({ method: 'DELETE', url: `/tag/${tag._id}/project/${projectId}`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } // If we're filtering by this tag then we need to remove // the projects from view $scope.updateVisibleProjects() } $scope.removeProjectFromTag = function (project, tag) { tag.showWhenEmpty = true if (!project.tags) { project.tags = [] } const index = project.tags.indexOf(tag) if (index > -1) { $scope._removeProjectIdsFromTagArray(tag, [project.id]) project.tags.splice(index, 1) queuedHttp({ method: 'DELETE', url: `/tag/${tag._id}/project/${project.id}`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) $scope.updateVisibleProjects() } } $scope.addSelectedProjectsToTag = function (tag) { const selectedProjects = $scope.getSelectedProjects() eventTracking.send( 'project-list-page-interaction', 'project action', 'addSelectedProjectsToTag' ) // Add project_ids into tag.project_ids const addedProjectIds = [] for (const projectId of $scope.getSelectedProjectIds()) { if (!tag.project_ids.includes(projectId)) { tag.project_ids.push(projectId) addedProjectIds.push(projectId) } } // Add tag into each project.tags for (const project of selectedProjects) { if (!project.tags) { project.tags = [] } if (!project.tags.includes(tag)) { project.tags.push(tag) } } for (const projectId of addedProjectIds) { queuedHttp.post(`/tag/${tag._id}/project/${projectId}`, { _csrf: window.csrfToken, }) } } $scope.openNewTagModal = function (e) { const modalInstance = $modal.open({ templateUrl: 'newTagModalTemplate', controller: 'NewTagModalController', }) modalInstance.result.then(function (tag) { const tagIsDuplicate = $scope.tags.find(function (existingTag) { return tag.name === existingTag.name }) if (!tagIsDuplicate) { $scope.tags.push(tag) $scope.addSelectedProjectsToTag(tag) } }) } $scope.createProject = function (name, template) { if (template == null) { template = 'none' } return queuedHttp .post('/project/new', { _csrf: window.csrfToken, projectName: name, template, }) .then(function (response) { const { data } = response $scope.projects.push({ name, id: data.project_id, accessLevel: 'owner', owner: data.owner, // TODO: Check access level if correct after adding it in // to the rest of the app }) $scope.updateVisibleProjects() }) } $scope.openCreateProjectModal = function (template) { if (template == null) { template = 'none' } eventTracking.send('project-list-page-interaction', 'new-project', template) const modalInstance = $modal.open({ templateUrl: 'newProjectModalTemplate', controller: 'NewProjectModalController', resolve: { template() { return template }, }, scope: $scope, }) modalInstance.result.then( projectId => (window.location = `/project/${projectId}`) ) } $scope.renameProject = (project, newName) => queuedHttp .post(`/project/${project.id}/rename`, { newProjectName: newName, _csrf: window.csrfToken, }) .then(() => (project.name = newName)) $scope.openRenameProjectModal = function () { const project = $scope.getFirstSelectedProject() if (!project || project.accessLevel !== 'owner') { return } eventTracking.send( 'project-list-page-interaction', 'project action', 'Rename' ) $modal.open({ templateUrl: 'renameProjectModalTemplate', controller: 'RenameProjectModalController', resolve: { project() { return project }, }, scope: $scope, }) } $scope.cloneProject = function (project, cloneName) { eventTracking.send( 'project-list-page-interaction', 'project action', 'Clone' ) return queuedHttp .post(`/project/${project.id}/clone`, { _csrf: window.csrfToken, projectName: cloneName, }) .then(function (response) { const { data } = response $scope.projects.push({ name: data.name, id: data.project_id, accessLevel: 'owner', owner: data.owner, // TODO: Check access level if correct after adding it in // to the rest of the app }) $scope.updateVisibleProjects() }) } $scope.openCloneProjectModal = function (project) { if (!project) { return } $modal.open({ templateUrl: 'cloneProjectModalTemplate', controller: 'CloneProjectModalController', resolve: { project() { return project }, }, scope: $scope, }) } // Methods to create modals for archiving, trashing, leaving and deleting projects const _createArchiveTrashLeaveOrDeleteProjectsModal = function ( action, projects ) { eventTracking.send( 'project-list-page-interaction', 'project action', action ) return $modal.open({ templateUrl: 'archiveTrashLeaveOrDeleteProjectsModalTemplate', controller: 'ArchiveTrashLeaveOrDeleteProjectsModalController', resolve: { projects() { return projects }, action() { return action }, }, }) } $scope.createArchiveProjectsModal = function (projects) { return _createArchiveTrashLeaveOrDeleteProjectsModal('archive', projects) } $scope.createTrashProjectsModal = function (projects) { return _createArchiveTrashLeaveOrDeleteProjectsModal('trash', projects) } $scope.createLeaveProjectsModal = function (projects) { return _createArchiveTrashLeaveOrDeleteProjectsModal('leave', projects) } $scope.createDeleteProjectsModal = function (projects) { return _createArchiveTrashLeaveOrDeleteProjectsModal('delete', projects) } $scope.createLeaveOrDeleteProjectsModal = function (projects) { return _createArchiveTrashLeaveOrDeleteProjectsModal( 'leaveOrDelete', projects ) } // $scope.openArchiveProjectsModal = function () { const modalInstance = $scope.createArchiveProjectsModal( $scope.getSelectedProjects() ) modalInstance.result.then(() => $scope.archiveSelectedProjects()) } $scope.openTrashProjectsModal = function () { const modalInstance = $scope.createTrashProjectsModal( $scope.getSelectedProjects() ) modalInstance.result.then(() => $scope.trashSelectedProjects()) } $scope.openLeaveProjectsModal = function () { const modalInstance = $scope.createLeaveProjectsModal( $scope.getSelectedProjects() ) modalInstance.result.then(() => $scope.leaveSelectedProjects()) } $scope.openDeleteProjectsModal = function () { const modalInstance = $scope.createDeleteProjectsModal( $scope.getSelectedProjects() ) modalInstance.result.then(() => $scope.deleteSelectedProjects()) } $scope.openLeaveOrDeleteProjectsModal = function () { const modalInstance = $scope.createLeaveOrDeleteProjectsModal( $scope.getSelectedProjects() ) modalInstance.result.then(() => $scope.leaveOrDeleteSelectedProjects()) } // $scope.archiveSelectedProjects = () => $scope.archiveProjects($scope.getSelectedProjects()) $scope.unarchiveSelectedProjects = () => $scope.unarchiveProjects($scope.getSelectedProjects()) $scope.trashSelectedProjects = () => $scope.trashProjects($scope.getSelectedProjects()) $scope.untrashSelectedProjects = () => $scope.untrashProjects($scope.getSelectedProjects()) $scope.leaveSelectedProjects = () => $scope.leaveProjects($scope.getSelectedProjects()) $scope.deleteSelectedProjects = () => $scope.deleteProjects($scope.getSelectedProjects()) $scope.leaveOrDeleteSelectedProjects = () => $scope.leaveOrDeleteProjects($scope.getSelectedProjects()) // $scope.archiveProjects = function (projects) { for (const project of projects) { project.archived = true project.trashed = false _archiveProject(project) } $scope.updateVisibleProjects() } $scope.unarchiveProjects = function (projects) { for (const project of projects) { project.archived = false _unarchiveProject(project) } $scope.updateVisibleProjects() } $scope.trashProjects = function (projects) { for (const project of projects) { project.trashed = true project.archived = false _trashProject(project) } $scope.updateVisibleProjects() } $scope.untrashProjects = function (projects) { for (const project of projects) { project.trashed = false _untrashProject(project) } $scope.updateVisibleProjects() } $scope.leaveProjects = function (projects) { _deleteOrLeaveProjectsLocally(projects) for (const project of projects) { _leaveProject(project) } $scope.updateVisibleProjects() } $scope.deleteProjects = function (projects) { _deleteOrLeaveProjectsLocally(projects) for (const project of projects) { _deleteProject(project) } $scope.updateVisibleProjects() } $scope.leaveOrDeleteProjects = function (projects) { _deleteOrLeaveProjectsLocally(projects) for (const project of projects) { if (project.accessLevel === 'owner') { _deleteProject(project) } else { _leaveProject(project) } } $scope.updateVisibleProjects() } // Actual interaction with the backend---we could move this into a service const _archiveProject = function (project) { return queuedHttp({ method: 'POST', url: `/project/${project.id}/archive`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _unarchiveProject = function (project) { return queuedHttp({ method: 'DELETE', url: `/project/${project.id}/archive`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _trashProject = function (project) { return queuedHttp({ method: 'POST', url: `/project/${project.id}/trash`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _untrashProject = function (project) { return queuedHttp({ method: 'DELETE', url: `/project/${project.id}/trash`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _leaveProject = function (project) { return queuedHttp({ method: 'POST', url: `/project/${project.id}/leave`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _deleteProject = function (project) { return queuedHttp({ method: 'DELETE', url: `/project/${project.id}`, headers: { 'X-CSRF-Token': window.csrfToken, }, }) } const _deleteOrLeaveProjectsLocally = function (projects) { const projectIds = projects.map(p => p.id) for (const tag of $scope.tags || []) { $scope._removeProjectIdsFromTagArray(tag, projectIds) } for (const project of projects || []) { $scope._removeProjectFromList(project) } } $scope.getValueForCurrentPredicate = function (project) { if ($scope.predicate === 'ownerName') { return ProjectListService.getOwnerName(project) } else { return project[$scope.predicate] } } $scope.openUploadProjectModal = function () { $modal.open({ templateUrl: 'uploadProjectModalTemplate', controller: 'UploadProjectModalController', }) } $scope.downloadSelectedProjects = () => $scope.downloadProjectsById($scope.getSelectedProjectIds()) $scope.downloadProjectsById = function (projectIds) { let path eventTracking.send( 'project-list-page-interaction', 'project action', 'Download Zip' ) if (projectIds.length > 1) { path = `/project/download/zip?project_ids=${projectIds.join(',')}` } else { path = `/project/${projectIds[0]}/download/zip` } return (window.location = path) } const markTagAsSelected = id => { for (const tag of $scope.tags) { if (tag._id === id) { tag.selected = true } else { tag.selected = false } } } const storedUIOpts = JSON.parse(localStorage('project_list')) if (storedUIOpts && storedUIOpts.filter) { if (storedUIOpts.filter === 'tag' && storedUIOpts.selectedTagId) { markTagAsSelected(storedUIOpts.selectedTagId) } $scope.setFilter(storedUIOpts.filter) } else { $scope.updateVisibleProjects() } }) App.controller( 'ProjectListItemController', function ($scope, $modal, queuedHttp, ProjectListService) { $scope.projectLink = function (project) { return `/project/${project.id}` } $scope.isLinkSharingProject = project => project.source === 'token' $scope.hasGenericOwnerName = () => { /* eslint-disable camelcase */ const { first_name, last_name, email } = $scope.project.owner return !first_name && !last_name && !email /* eslint-enable camelcase */ } $scope.getOwnerName = ProjectListService.getOwnerName $scope.getUserName = ProjectListService.getUserName $scope.isOwner = () => $scope.project.owner && window.user_id === $scope.project.owner._id $scope.$watch('project.selected', function (value) { if (value != null) { $scope.updateSelectedProjects() } }) $scope.clone = function (e) { e.stopPropagation() $scope.openCloneProjectModal($scope.project) } $scope.download = function (e) { e.stopPropagation() $scope.downloadProjectsById([$scope.project.id]) } $scope.archive = function (e) { e.stopPropagation() $scope.createArchiveProjectsModal([$scope.project]).result.then(() => { $scope.archiveProjects([$scope.project]) }) } $scope.unarchive = function (e) { e.stopPropagation() $scope.unarchiveProjects([$scope.project]) } $scope.trash = function (e) { e.stopPropagation() $scope.createTrashProjectsModal([$scope.project]).result.then(() => { $scope.trashProjects([$scope.project]) }) } $scope.untrash = function (e) { e.stopPropagation() $scope.untrashProjects([$scope.project]) } $scope.leave = function (e) { e.stopPropagation() $scope.createLeaveProjectsModal([$scope.project]).result.then(() => { $scope.leaveProjects([$scope.project]) }) } $scope.delete = function (e) { e.stopPropagation() $scope.createDeleteProjectsModal([$scope.project]).result.then(() => { $scope.deleteProjects([$scope.project]) }) } } )
overleaf/web/frontend/js/main/project-list/project-list.js/0
{ "file_path": "overleaf/web/frontend/js/main/project-list/project-list.js", "repo_id": "overleaf", "token_count": 9987 }
501
import { v4 as uuid } from 'uuid' const OError = require('@overleaf/o-error') // VERSION should get incremented when making changes to caching behavior or // adjusting metrics collection. // Keep in sync with PdfJsMetrics. const VERSION = 2 const CLEAR_CACHE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/output$/ const COMPILE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/compile$/ const PDF_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/.*\/output.pdf$/ const PDF_JS_CHUNK_SIZE = 128 * 1024 const MAX_SUBREQUEST_COUNT = 4 const MAX_SUBREQUEST_BYTES = 4 * PDF_JS_CHUNK_SIZE const INCREMENTAL_CACHE_SIZE = 1000 // Each compile request defines a context (essentially the specific pdf file for // that compile), requests for that pdf file can use the hashes in the compile // response, which are stored in the context. const CLIENT_CONTEXT = new Map() /** * @param {string} clientId */ function getClientContext(clientId) { let clientContext = CLIENT_CONTEXT.get(clientId) if (!clientContext) { const cached = new Set() const pdfs = new Map() const metrics = { version: VERSION, id: uuid(), epoch: Date.now(), failedCount: 0, tooLargeOverheadCount: 0, tooManyRequestsCount: 0, cachedCount: 0, cachedBytes: 0, fetchedCount: 0, fetchedBytes: 0, requestedCount: 0, requestedBytes: 0, compileCount: 0, } clientContext = { pdfs, metrics, cached } CLIENT_CONTEXT.set(clientId, clientContext) // clean up old client maps expirePdfContexts() } return clientContext } /** * @param {string} clientId * @param {string} path * @param {Object} pdfContext */ function registerPdfContext(clientId, path, pdfContext) { const clientContext = getClientContext(clientId) const { pdfs, metrics, cached, clsiServerId } = clientContext pdfContext.metrics = metrics pdfContext.cached = cached if (pdfContext.clsiServerId !== clsiServerId) { // VM changed, this invalidates all browser caches. clientContext.clsiServerId = pdfContext.clsiServerId cached.clear() } // we only need to keep the last 3 contexts for (const key of pdfs.keys()) { if (pdfs.size < 3) { break } pdfs.delete(key) // the map keys are returned in insertion order, so we are deleting the oldest entry here } pdfs.set(path, pdfContext) } /** * @param {string} clientId * @param {string} path */ function getPdfContext(clientId, path) { const { pdfs } = getClientContext(clientId) return pdfs.get(path) } function expirePdfContexts() { // discard client maps for clients that are no longer connected const currentClientSet = new Set() self.clients.matchAll().then(function (clientList) { clientList.forEach(client => { currentClientSet.add(client.id) }) CLIENT_CONTEXT.forEach((map, clientId) => { if (!currentClientSet.has(clientId)) { CLIENT_CONTEXT.delete(clientId) } }) }) } /** * * @param {Object} metrics * @param {number} size * @param {number} cachedCount * @param {number} cachedBytes * @param {number} fetchedCount * @param {number} fetchedBytes */ function trackDownloadStats( metrics, { size, cachedCount, cachedBytes, fetchedCount, fetchedBytes } ) { metrics.cachedCount += cachedCount metrics.cachedBytes += cachedBytes metrics.fetchedCount += fetchedCount metrics.fetchedBytes += fetchedBytes metrics.requestedCount++ metrics.requestedBytes += size } /** * @param {Object} metrics * @param {boolean} sizeDiffers * @param {boolean} mismatch * @param {boolean} success */ function trackChunkVerify(metrics, { sizeDiffers, mismatch, success }) { if (sizeDiffers) { metrics.chunkVerifySizeDiffers |= 0 metrics.chunkVerifySizeDiffers += 1 } if (mismatch) { metrics.chunkVerifyMismatch |= 0 metrics.chunkVerifyMismatch += 1 } if (success) { metrics.chunkVerifySuccess |= 0 metrics.chunkVerifySuccess += 1 } } /** * @param {Array} chunks */ function countBytes(chunks) { return chunks.reduce((totalBytes, chunk) => { return totalBytes + (chunk.end - chunk.start) }, 0) } /** * @param {FetchEvent} event */ function onFetch(event) { const url = new URL(event.request.url) const path = url.pathname if (path.match(COMPILE_REQUEST_MATCHER)) { return processCompileRequest(event) } if (path.match(PDF_REQUEST_MATCHER)) { const ctx = getPdfContext(event.clientId, path) if (ctx) { return processPdfRequest(event, ctx) } } if ( event.request.method === 'DELETE' && path.match(CLEAR_CACHE_REQUEST_MATCHER) ) { return processClearCacheRequest(event) } // other request, ignore } /** * @param {FetchEvent} event */ function processClearCacheRequest(event) { CLIENT_CONTEXT.delete(event.clientId) // use default request proxy. } /** * @param {FetchEvent} event */ function processCompileRequest(event) { event.respondWith( fetch(event.request).then(response => { if (response.status !== 200) return response return response.json().then(body => { handleCompileResponse(event, response, body) // Send the service workers metrics to the frontend. const { metrics } = getClientContext(event.clientId) metrics.compileCount++ body.serviceWorkerMetrics = metrics return new Response(JSON.stringify(body), response) }) }) ) } /** * @param {Request} request * @param {Object} file * @return {Response} */ function handleProbeRequest(request, file) { // PDF.js starts the pdf download with a probe request that has no // range headers on it. // Upon seeing the response headers, it decides whether to upgrade the // transport to chunked requests or keep reading the response body. // For small PDFs (2*chunkSize = 2*128kB) it just sends one request. // We will fetch all the ranges in bulk and emit them. // For large PDFs it sends this probe request, aborts that request before // reading any data and then sends multiple range requests. // It would be wasteful to action this probe request with all the ranges // that are available in the PDF and serve the full PDF content to // PDF.js for the probe request. // We are emitting a dummy response to the probe request instead. // It triggers the chunked transfer and subsequent fewer ranges need to be // requested -- only those of visible pages in the pdf viewer. // https://github.com/mozilla/pdf.js/blob/6fd899dc443425747098935207096328e7b55eb2/src/display/network_utils.js#L43-L47 const pdfJSWillUseChunkedTransfer = file.size > 2 * PDF_JS_CHUNK_SIZE const isRangeRequest = request.headers.has('Range') if (!isRangeRequest && pdfJSWillUseChunkedTransfer) { const headers = new Headers() headers.set('Accept-Ranges', 'bytes') headers.set('Content-Length', file.size) headers.set('Content-Type', 'application/pdf') return new Response('', { headers, status: 200, statusText: 'OK', }) } } /** * * @param {FetchEvent} event * @param {Object} file * @param {string} clsiServerId * @param {string} compileGroup * @param {Date} pdfCreatedAt * @param {Object} metrics * @param {Set} cached */ function processPdfRequest( event, { file, clsiServerId, compileGroup, pdfCreatedAt, metrics, cached } ) { const response = handleProbeRequest(event.request, file) if (response) { return event.respondWith(response) } const verifyChunks = event.request.url.includes('verify_chunks=true') const rangeHeader = event.request.headers.get('Range') || `bytes=0-${file.size - 1}` const [start, last] = rangeHeader .slice('bytes='.length) .split('-') .map(i => parseInt(i, 10)) const end = last + 1 // Check that handling the range request won't trigger excessive subrequests, // (to avoid unwanted latency compared to the original request). const { chunks, newChunks } = cutRequestAmplification( getMatchingChunks(file.ranges, start, end), cached, metrics ) const dynamicChunks = getInterleavingDynamicChunks(chunks, start, end) const chunksSize = countBytes(newChunks) const size = end - start if (chunks.length === 0 && dynamicChunks.length === 1) { // fall back to the original range request when no chunks are cached. trackDownloadStats(metrics, { size, cachedCount: 0, cachedBytes: 0, fetchedCount: 1, fetchedBytes: size, }) return } if ( chunksSize > MAX_SUBREQUEST_BYTES && !(dynamicChunks.length === 0 && newChunks.length <= 1) ) { // fall back to the original range request when a very large amount of // object data would be requested, unless it is the only object in the // request or everything is already cached. metrics.tooLargeOverheadCount++ trackDownloadStats(metrics, { size, cachedCount: 0, cachedBytes: 0, fetchedCount: 1, fetchedBytes: size, }) return } // URL prefix is /project/:id/user/:id/build/... or /project/:id/build/... // for authenticated and unauthenticated users respectively. const perUserPrefix = file.url.slice(0, file.url.indexOf('/build/')) const byteRanges = dynamicChunks .map(chunk => `${chunk.start}-${chunk.end - 1}`) .join(',') const coalescedDynamicChunks = [] switch (dynamicChunks.length) { case 0: break case 1: coalescedDynamicChunks.push({ chunk: dynamicChunks[0], url: event.request.url, init: { headers: { Range: `bytes=${byteRanges}` } }, }) break default: coalescedDynamicChunks.push({ chunk: dynamicChunks, url: event.request.url, init: { headers: { Range: `bytes=${byteRanges}` } }, }) } const requests = chunks .map(chunk => { const path = `${perUserPrefix}/content/${file.contentId}/${chunk.hash}` const url = new URL(path, event.request.url) if (clsiServerId) { url.searchParams.set('clsiserverid', clsiServerId) } if (compileGroup) { url.searchParams.set('compileGroup', compileGroup) } return { chunk, url: url.toString() } }) .concat(coalescedDynamicChunks) let cachedCount = 0 let cachedBytes = 0 let fetchedCount = 0 let fetchedBytes = 0 const reAssembledBlob = new Uint8Array(size) event.respondWith( Promise.all( requests.map(({ chunk, url, init }) => fetch(url, init) .then(response => { if (!(response.status === 206 || response.status === 200)) { throw new OError( 'non successful response status: ' + response.status ) } const boundary = getMultipartBoundary(response) if (Array.isArray(chunk) && !boundary) { throw new OError('missing boundary on multipart request', { headers: Object.fromEntries(response.headers.entries()), chunk, }) } const blobFetchDate = getServerTime(response) const blobSize = getResponseSize(response) if (blobFetchDate && blobSize) { const chunkSize = Math.min(end, chunk.end) - Math.max(start, chunk.start) // Example: 2MB PDF, 1MB image, 128KB PDF.js chunk. // | pdf.js chunk | // | A BIG IMAGE BLOB | // | THE FULL PDF | if (blobFetchDate < pdfCreatedAt) { cachedCount++ cachedBytes += chunkSize // Roll the position of the hash in the Map. cached.delete(chunk.hash) cached.add(chunk.hash) } else { // Blobs are fetched in bulk. fetchedCount++ fetchedBytes += blobSize } } return response .blob() .then(blob => blob.arrayBuffer()) .then(arraybuffer => { return { boundary, chunk, data: backFillObjectContext(chunk, arraybuffer), } }) }) .catch(error => { throw OError.tag(error, 'cannot fetch chunk', { url }) }) ) ) .then(rawResponses => { const responses = [] for (const response of rawResponses) { if (response.boundary) { responses.push( ...getMultiPartResponses(response, file, metrics, verifyChunks) ) } else { responses.push(response) } } responses.forEach(({ chunk, data }) => { // overlap: // | REQUESTED_RANGE | // | CHUNK | const offsetStart = Math.max(start - chunk.start, 0) // overlap: // | REQUESTED_RANGE | // | CHUNK | const offsetEnd = Math.max(chunk.end - end, 0) if (offsetStart > 0 || offsetEnd > 0) { // compute index positions for slice to handle case where offsetEnd=0 const chunkSize = chunk.end - chunk.start data = data.subarray(offsetStart, chunkSize - offsetEnd) } const insertPosition = Math.max(chunk.start - start, 0) reAssembledBlob.set(data, insertPosition) }) let verifyProcess = Promise.resolve(reAssembledBlob) if (verifyChunks) { verifyProcess = fetch(event.request) .then(response => response.arrayBuffer()) .then(arrayBuffer => { const fullBlob = new Uint8Array(arrayBuffer) const stats = {} if (reAssembledBlob.byteLength !== fullBlob.byteLength) { stats.sizeDiffers = true } else if ( !reAssembledBlob.every((v, idx) => v === fullBlob[idx]) ) { stats.mismatch = true } else { stats.success = true } trackChunkVerify(metrics, stats) if (stats.success === true) { return reAssembledBlob } else { return fullBlob } }) } return verifyProcess.then(blob => { trackDownloadStats(metrics, { size, cachedCount, cachedBytes, fetchedCount, fetchedBytes, }) return new Response(blob, { status: 206, headers: { 'Accept-Ranges': 'bytes', 'Content-Length': size, 'Content-Range': `bytes ${start}-${last}/${file.size}`, 'Content-Type': 'application/pdf', }, }) }) }) .catch(error => { fetchedBytes += size metrics.failedCount++ trackDownloadStats(metrics, { size, cachedCount: 0, cachedBytes: 0, fetchedCount, fetchedBytes, }) reportError(event, OError.tag(error, 'failed to compose pdf response')) return fetch(event.request) }) ) } /** * * @param {Response} response */ function getServerTime(response) { const raw = response.headers.get('Date') if (!raw) return new Date() return new Date(raw) } /** * * @param {Response} response */ function getResponseSize(response) { const raw = response.headers.get('Content-Length') if (!raw) return 0 return parseInt(raw, 10) } /** * * @param {Response} response */ function getMultipartBoundary(response) { const raw = response.headers.get('Content-Type') if (!raw.includes('multipart/byteranges')) return '' const idx = raw.indexOf('boundary=') if (idx === -1) return '' return raw.slice(idx + 'boundary='.length) } /** * @param {Object} response * @param {Object} file * @param {Object} metrics * @param {boolean} verifyChunks */ function getMultiPartResponses(response, file, metrics, verifyChunks) { const { chunk: chunks, data, boundary } = response const responses = [] let offsetStart = 0 for (const chunk of chunks) { const header = `\r\n--${boundary}\r\nContent-Type: application/pdf\r\nContent-Range: bytes ${ chunk.start }-${chunk.end - 1}/${file.size}\r\n\r\n` const headerSize = header.length // Verify header content. A proxy might have tampered with it. const headerRaw = ENCODER.encode(header) if ( !data .subarray(offsetStart, offsetStart + headerSize) .every((v, idx) => v === headerRaw[idx]) ) { metrics.headerVerifyFailure |= 0 metrics.headerVerifyFailure++ throw new OError('multipart response header does not match', { actual: new TextDecoder().decode( data.subarray(offsetStart, offsetStart + headerSize) ), expected: header, }) } offsetStart += headerSize const chunkSize = chunk.end - chunk.start responses.push({ chunk, data: data.subarray(offsetStart, offsetStart + chunkSize), }) offsetStart += chunkSize } return responses } /** * @param {FetchEvent} event * @param {Response} response * @param {Object} body */ function handleCompileResponse(event, response, body) { if (!body || body.status !== 'success') return const pdfCreatedAt = getServerTime(response) for (const file of body.outputFiles) { if (file.path !== 'output.pdf') continue // not the pdf used for rendering if (file.ranges) { file.ranges.forEach(backFillEdgeBounds) const { clsiServerId, compileGroup } = body registerPdfContext(event.clientId, file.url, { pdfCreatedAt, file, clsiServerId, compileGroup, }) } break } } const ENCODER = new TextEncoder() function backFillEdgeBounds(chunk) { if (chunk.objectId) { chunk.objectId = ENCODER.encode(chunk.objectId) chunk.start -= chunk.objectId.byteLength } return chunk } /** * @param chunk * @param {ArrayBuffer} arrayBuffer * @return {Uint8Array} */ function backFillObjectContext(chunk, arrayBuffer) { if (!chunk.objectId) { // This is a dynamic chunk return new Uint8Array(arrayBuffer) } const { start, end, objectId } = chunk const header = Uint8Array.from(objectId) const fullBuffer = new Uint8Array(end - start) fullBuffer.set(header, 0) fullBuffer.set(new Uint8Array(arrayBuffer), objectId.length) return fullBuffer } /** * @param {Array} chunks * @param {number} start * @param {number} end * @returns {Array} */ function getMatchingChunks(chunks, start, end) { const matchingChunks = [] for (const chunk of chunks) { if (chunk.end <= start) { // no overlap: // | REQUESTED_RANGE | // | CHUNK | continue } if (chunk.start >= end) { // no overlap: // | REQUESTED_RANGE | // | CHUNK | break } matchingChunks.push(chunk) } return matchingChunks } /** * @param {Array} potentialChunks * @param {Set} cached * @param {Object} metrics */ function cutRequestAmplification(potentialChunks, cached, metrics) { const chunks = [] const newChunks = [] let tooManyRequests = false for (const chunk of potentialChunks) { if (cached.has(chunk.hash)) { chunks.push(chunk) continue } if (newChunks.length < MAX_SUBREQUEST_COUNT) { chunks.push(chunk) newChunks.push(chunk) } else { tooManyRequests = true } } if (tooManyRequests) { metrics.tooManyRequestsCount++ } if (cached.size > INCREMENTAL_CACHE_SIZE) { for (const key of cached) { if (cached.size < INCREMENTAL_CACHE_SIZE) { break } // Map keys are stored in insertion order. // We re-insert keys on cache hit, 'cached' is a cheap LRU. cached.delete(key) } } return { chunks, newChunks } } /** * @param {Array} chunks * @param {number} start * @param {number} end * @returns {Array} */ function getInterleavingDynamicChunks(chunks, start, end) { const dynamicChunks = [] for (const chunk of chunks) { if (start < chunk.start) { dynamicChunks.push({ start, end: chunk.start }) } start = chunk.end } if (start < end) { dynamicChunks.push({ start, end }) } return dynamicChunks } /** * @param {FetchEvent} event */ function onFetchWithErrorHandling(event) { try { onFetch(event) } catch (error) { reportError(event, OError.tag(error, 'low level error in onFetch')) } } // allow fetch event listener to be removed if necessary const controller = new AbortController() // listen to all network requests self.addEventListener('fetch', onFetchWithErrorHandling, { signal: controller.signal, }) // complete setup ASAP self.addEventListener('install', event => { event.waitUntil(self.skipWaiting()) }) self.addEventListener('activate', event => { event.waitUntil(self.clients.claim()) }) self.addEventListener('message', event => { if (event.data && event.data.type === 'disable') { controller.abort() // removes the fetch event listener } }) /** * * @param {FetchEvent} event * @param {Error} error */ function reportError(event, error) { self.clients .get(event.clientId) .then(client => { if (!client) { // The client disconnected. return } client.postMessage( JSON.stringify({ extra: { url: event.request.url, info: OError.getFullInfo(error) }, error: { name: error.name, message: error.message, stack: OError.getFullStack(error), }, }) ) }) .catch(() => {}) }
overleaf/web/frontend/js/serviceWorker.js/0
{ "file_path": "overleaf/web/frontend/js/serviceWorker.js", "repo_id": "overleaf", "token_count": 8884 }
502
import App from '../../../base' import { react2angular } from 'react2angular' import { rootContext } from '../root-context' App.component( 'sharedContextReact', react2angular(rootContext.component, [], ['ide', 'settings']) )
overleaf/web/frontend/js/shared/context/controllers/root-context-controller.js/0
{ "file_path": "overleaf/web/frontend/js/shared/context/controllers/root-context-controller.js", "repo_id": "overleaf", "token_count": 72 }
503
import { useLayoutEffect, useRef, useCallback } from 'react' function useResizeObserver(observedElement, observedData, callback) { const resizeObserver = useRef() const observe = useCallback(() => { resizeObserver.current = new ResizeObserver(function (elementsObserved) { callback(elementsObserved[0]) }) }, [callback]) function unobserve(observedCurrent) { resizeObserver.current.unobserve(observedCurrent) } useLayoutEffect(() => { if ('ResizeObserver' in window) { const observedCurrent = observedElement && observedElement.current if (observedCurrent) { observe(observedElement.current) } if (resizeObserver.current && observedCurrent) { resizeObserver.current.observe(observedCurrent) } return () => { if (observedCurrent) { unobserve(observedCurrent) } } } }, [observedElement, observedData, observe]) } export default useResizeObserver
overleaf/web/frontend/js/shared/hooks/use-resize-observer.js/0
{ "file_path": "overleaf/web/frontend/js/shared/hooks/use-resize-observer.js", "repo_id": "overleaf", "token_count": 354 }
504
# 2021-07-05 For https://github.com/overleaf/issues/issues/4503#issuecomment-873961735 #### Fork base Based on v2.2.228 (d7afb74a6e1980da5041f376e7a7c7caef5f42ea) #### Changes: - fix handling of fetch errors (9826c6eb1ecd501ac3eb1e9d9a98a3e6edde3fd0) - do not bundle NodeJS stream backend (6d118ec35e6e6f954938a485178748f1bb8bdd8a) #### Reproducing of artifacts - NodeJS v10.23.3 in docker - npm v6.14.11 in docker - `pdf.js$ npm ci` - `pdf.js$ npx gulp generic` - `pdf.js$ cp build/generic/build/pdf.* build/generic/LICENSE HERE/build` #### Testing PDF.JS does not properly handle network errors for range requests. Any of the initial probe request or following chunk requests can get the editor stuck. Once any of the requests has failed, the current pdf.js document is stuck and it's (loading) promise never resolves/rejects. This is in turn breaking the frontend cleanup ahead of switching the pdf. New successful compiles will get queued on top of the stuck promise. https://github.com/overleaf/web-internal/blob/9ed96cd93d3c4d3b23ff223c658ce80bc895484a/frontend/js/ide/pdfng/directives/pdfRenderer.js#L549-L552 https://github.com/overleaf/web-internal/blob/9ed96cd93d3c4d3b23ff223c658ce80bc895484a/frontend/js/ide/pdfng/directives/pdfViewer.js#L46-L47 Steps to reproduce: ### old (and new) logs ui - set network speed to something very slow (the chrome dev-tools allow custom profiles, set 1kb/s up/down and 1s latency) - wait for the compile response to arrive (see new pending requests for log/pdf) - trigger a clear cache in another browser tab - resume fast network speed ### new logs ui - open dropdown of (re-)compile button - set network speed to something very slow - wait for the compile response to arrive (see new pending requests for log/pdf) - click re-compile from scratch (which shifts over the stop compile open of the dropdown) - resume fast network speed Alternative reproduction steps involving hacking the ssl-proxy: - https://digital-science.slack.com/archives/C0216GDEG9L/p1625240302143900 - https://digital-science.slack.com/archives/C0216GDEG9L/p1625238107141300
overleaf/web/frontend/js/vendor/libs/pdfjs-dist/CHANGELOG.md/0
{ "file_path": "overleaf/web/frontend/js/vendor/libs/pdfjs-dist/CHANGELOG.md", "repo_id": "overleaf", "token_count": 707 }
505
const { createMacro, MacroError } = require('babel-plugin-macros') const Settings = require('@overleaf/settings') const macro = createMacro(importOverleafModuleMacro) function importOverleafModuleMacro({ references, state, babel }) { references.default.forEach(referencePath => { const { types: t } = babel const modulePaths = getModulePaths(referencePath.parentPath) const { importNodes, importedVariables } = modulePaths.reduce( (all, path) => { // Generate a unique variable name for the module const id = referencePath.scope.generateUidIdentifier(path) // Generate an import statement for the module // In the form: import * as __ID__ from "__PATH__" all.importNodes.push( t.importDeclaration( [t.importNamespaceSpecifier(id)], t.stringLiteral(path) ) ) // Also keep track of the imported variable, so it can be added to // the assigned array all.importedVariables.push( t.objectExpression([ t.objectProperty(t.identifier('import'), id), t.objectProperty(t.identifier('path'), t.stringLiteral(path)), ]) ) return all }, { importNodes: [], importedVariables: [] } ) // Generate an array of imported variables const arrayExpression = t.arrayExpression(importedVariables) // Inject the import statements at the top of the file const program = state.file.path program.node.body.unshift(...importNodes) // Replace the importFromSettings line with the generated array of imported // variables referencePath.parentPath.replaceWith(arrayExpression) }) } function getModulePaths(callExpressionPath) { // Get the first argument to importFromSettings const key = callExpressionPath.get('arguments')[0].evaluate().value if (!Settings.overleafModuleImports) { throw new MacroError('Settings.overleafModuleImports not found') } // Get the module paths const modulePaths = Settings.overleafModuleImports[key] if (!modulePaths) { throw new MacroError(`Overleaf module '${key}' not found`) } return modulePaths } module.exports = macro
overleaf/web/frontend/macros/import-overleaf-module.macro.js/0
{ "file_path": "overleaf/web/frontend/macros/import-overleaf-module.macro.js", "repo_id": "overleaf", "token_count": 796 }
506
import { useEffect } from 'react' import FileTreeContext from '../../../js/features/file-tree/components/file-tree-context' import FileTreeCreateNameProvider from '../../../js/features/file-tree/contexts/file-tree-create-name' import FileTreeCreateFormProvider from '../../../js/features/file-tree/contexts/file-tree-create-form' import { useFileTreeActionable } from '../../../js/features/file-tree/contexts/file-tree-actionable' import PropTypes from 'prop-types' const defaultContextProps = { projectId: 'project-1', hasWritePermissions: true, userHasFeature: () => true, refProviders: {}, reindexReferences: () => { console.log('reindex references') }, setRefProviderEnabled: provider => { console.log(`ref provider ${provider} enabled`) }, setStartedFreeTrial: () => { console.log('started free trial') }, rootFolder: [ { docs: [ { _id: 'entity-1', }, ], fileRefs: [], folders: [], }, ], initialSelectedEntityId: 'entity-1', onSelect: () => { console.log('selected') }, } export const mockCreateFileModalFetch = fetchMock => fetchMock .get('path:/user/projects', { projects: [ { _id: 'project-1', name: 'Project One', }, { _id: 'project-2', name: 'Project Two', }, ], }) .get('path:/mendeley/groups', { groups: [ { id: 'group-1', name: 'Group One', }, { id: 'group-2', name: 'Group Two', }, ], }) .get('express:/project/:projectId/entities', { entities: [ { path: '/foo.tex', }, { path: '/bar.tex', }, ], }) .post('express:/project/:projectId/compile', { status: 'success', outputFiles: [ { build: 'foo', path: 'baz.jpg', }, { build: 'foo', path: 'ball.jpg', }, ], }) .post('express:/project/:projectId/doc', (path, req) => { console.log({ path, req }) return 204 }) .post('express:/project/:projectId/upload', (path, req) => { console.log({ path, req }) return 204 }) .post('express:/project/:projectId/linked_file', (path, req) => { console.log({ path, req }) return 204 }) export const createFileModalDecorator = ( contextProps = {}, createMode = 'doc' // eslint-disable-next-line react/display-name ) => Story => { return ( <FileTreeContext {...defaultContextProps} {...contextProps}> <FileTreeCreateNameProvider> <FileTreeCreateFormProvider> <OpenCreateFileModal createMode={createMode}> <Story /> </OpenCreateFileModal> </FileTreeCreateFormProvider> </FileTreeCreateNameProvider> </FileTreeContext> ) } function OpenCreateFileModal({ children, createMode }) { const { startCreatingFile } = useFileTreeActionable() useEffect(() => { startCreatingFile(createMode) }, [createMode]) // eslint-disable-line react-hooks/exhaustive-deps return <>{children}</> } OpenCreateFileModal.propTypes = { createMode: PropTypes.string, children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.node), PropTypes.node, ]).isRequired, }
overleaf/web/frontend/stories/modals/create-file/create-file-modal-decorator.js/0
{ "file_path": "overleaf/web/frontend/stories/modals/create-file/create-file-modal-decorator.js", "repo_id": "overleaf", "token_count": 1470 }
507
import PropTypes from 'prop-types' import WordCountModal from '../js/features/word-count-modal/components/word-count-modal' import useFetchMock from './hooks/use-fetch-mock' export const Interactive = ({ mockResponse = 200, mockResponseDelay = 500, ...args }) => { useFetchMock(fetchMock => { fetchMock.get( 'express:/project/:projectId/wordcount', () => { switch (mockResponse) { case 400: return { status: 400, body: 'The project id is not valid' } case 200: return { texcount: { headers: 4, mathDisplay: 40, mathInline: 400, textWords: 4000, }, } default: return mockResponse } }, { delay: mockResponseDelay } ) }) return <WordCountModal {...args} /> } Interactive.propTypes = { mockResponse: PropTypes.number, mockResponseDelay: PropTypes.number, } export default { title: 'Modals / Word Count', component: WordCountModal, args: { clsiServerId: 'server-id', projectId: 'project-id', show: true, }, argTypes: { handleHide: { action: 'handleHide' }, mockResponse: { name: 'Mock Response Status', type: { name: 'number', required: false }, description: 'The status code that should be returned by the mock server', defaultValue: 200, control: { type: 'radio', options: [200, 500, 400], }, }, mockResponseDelay: { name: 'Mock Response Delay', type: { name: 'number', required: false }, description: 'The delay before returning a response from the mock server', defaultValue: 500, control: { type: 'range', min: 0, max: 2500, step: 250, }, }, }, }
overleaf/web/frontend/stories/word-count-modal.stories.js/0
{ "file_path": "overleaf/web/frontend/stories/word-count-modal.stories.js", "repo_id": "overleaf", "token_count": 829 }
508
@new-message-height: 80px; #chat-wrapper { > .ui-layout-resizer > .ui-layout-toggler { display: none !important; } } .chat { .loading { font-family: @font-family-serif; padding: @line-height-computed / 2; text-align: center; } .no-messages { padding: @line-height-computed / 2; color: @chat-instructions-color; } .first-message { position: absolute; bottom: 0; width: 100%; padding: @line-height-computed / 2; color: @chat-instructions-color; } .chat-error { position: absolute; top: 0; bottom: 0; background-color: @chat-bg; padding: @line-height-computed / 2; text-align: center; } .messages { position: absolute; top: 0; left: 0; right: 0; bottom: @new-message-height; overflow-x: hidden; background-color: @chat-bg; li.message { margin: @line-height-computed / 2; .date { font-size: 12px; color: @chat-message-date-color; margin-bottom: @line-height-computed / 2; text-align: right; } .message-wrapper { .name { font-size: 12px; color: @chat-message-name-color; margin-bottom: 4px; min-height: 16px; } .message { border-left: 3px solid transparent; font-size: 14px; box-shadow: @chat-message-box-shadow; border-radius: @chat-message-border-radius; position: relative; .message-content { padding: @chat-message-padding; overflow-x: auto; color: @chat-message-color; font-weight: @chat-message-weight; } .arrow { transform: rotate(90deg); right: 90%; top: -15px; border: solid; content: ' '; height: 0; width: 0; position: absolute; pointer-events: none; border-top-color: transparent !important; border-bottom-color: transparent !important; border-width: 10px; } } p { margin-bottom: @line-height-computed / 4; &:last-child { margin-bottom: 0; } } } &:not(.self) { .message { .arrow { border-left-color: transparent !important; } } } &.self { margin-top: @line-height-computed; .message-wrapper .message { border-left: none; border-right: 3px solid transparent; .arrow { left: 100%; right: auto; border-right-color: transparent !important; } } } } } .new-message { .full-size; top: auto; height: @new-message-height; background-color: @chat-new-message-bg; padding: @line-height-computed / 4; border-top: 1px solid @chat-new-message-border-color; textarea { overflow: auto; resize: none; border-radius: @border-radius-base; border: 1px solid @chat-new-message-border-color; height: 100%; width: 100%; color: @chat-new-message-textarea-color; font-size: 14px; padding: @line-height-computed / 4; background-color: @chat-new-message-textarea-bg; } } } .break-word { word-break: break-all; }
overleaf/web/frontend/stylesheets/app/editor/chat.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/editor/chat.less", "repo_id": "overleaf", "token_count": 1685 }
509
.modal-body-share { h3 { border-bottom: 1px solid @gray-lighter; padding-bottom: @line-height-computed / 4; margin: 0; font-size: 1rem; } .project-member.form-group { margin-bottom: 0; } .project-member .form-control-static.text-center { padding-top: 0; } .project-member .remove-button { font-size: inherit; } .project-member, .project-invite, .public-access-level { padding: (@line-height-computed / 2) 0; border-bottom: 1px solid @gray-lighter; font-size: 14px; } .public-access-level { padding-top: 0; font-size: 13px; padding-bottom: @modal-inner-padding; .access-token-display-area { margin-top: @line-height-computed / 4; .access-token-wrapper { padding-top: @line-height-computed / 4; .access-token { margin-top: @line-height-computed / 4; background-color: @gray-lightest; border: 1px solid @gray-lighter; padding: 6px 12px 6px 12px; display: flex; align-items: center; justify-content: space-between; } } } } .public-access-level.public-access-level--notice { background-color: @gray-lightest; border-bottom: none; margin-top: @margin-md; padding-top: @margin-md; } .project-member, .project-invite { &:hover { background-color: @gray-lightest; } } .invite-controls { .small { padding: 2px; margin-bottom: 0; } padding: @line-height-computed / 2; background-color: @gray-lightest; margin-top: @line-height-computed / 2; form { .form-group { margin-bottom: @line-height-computed / 2; &:last-child { margin-bottom: 0; } } .privileges { display: inline-block; width: auto; height: 30px; font-size: 14px; } } .add-collaborators-upgrade { display: flex; flex-direction: column; align-items: center; } } .rbt-menu > .dropdown-item { display: block; padding: 0.25rem 1rem; color: #212529; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; &:hover { text-decoration: none; background-color: @gray-lightest; } } } .modal-footer-share { .modal-footer-left { max-width: 70%; text-align: left; } } .copy-button:focus-within { outline: none; }
overleaf/web/frontend/stylesheets/app/editor/share.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/editor/share.less", "repo_id": "overleaf", "token_count": 1124 }
510
.plans { blockquote { footer { /* accessibility fix */ color: @ol-blue-gray-3; } } .plans-header { h1, h2 { color: @gray-dark; } } }
overleaf/web/frontend/stylesheets/app/plans-ol.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/plans-ol.less", "repo_id": "overleaf", "token_count": 97 }
511
// // Badges // -------------------------------------------------- // Base classes .badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: @font-size-small; font-weight: @badge-font-weight; color: @badge-color; line-height: @badge-line-height; vertical-align: baseline; white-space: nowrap; text-align: center; background-color: @badge-bg; border-radius: @badge-border-radius; // Empty badges collapse automatically (not available in IE8) &:empty { display: none; } // Quick fix for badges in buttons .btn & { position: relative; top: -1px; } .btn-xs & { top: 0; padding: 1px 5px; } } // Hover state, but only for links a.badge { &:hover, &:focus { color: @badge-link-hover-color; text-decoration: none; cursor: pointer; } } // Account for counters in navs a.list-group-item.active > .badge, .nav-pills > .active > a > .badge { color: @badge-active-color; background-color: @badge-active-bg; } .nav-pills > li > a > .badge { margin-left: 3px; }
overleaf/web/frontend/stylesheets/components/badges.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/badges.less", "repo_id": "overleaf", "token_count": 410 }
512
// // Forms // -------------------------------------------------- // Normalize non-controls // // Restyle and baseline non-control form elements. fieldset { padding: 0; margin: 0; border: 0; // Chrome and Firefox set a `min-width: -webkit-min-content;` on fieldsets, // so we reset that to ensure it behaves more like a standard block element. // See https://github.com/twbs/bootstrap/issues/12359. min-width: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: @line-height-computed; font-size: (@font-size-base * 1.5); line-height: inherit; color: @legend-color; border: 0; border-bottom: 1px solid @legend-border-color; } label { display: inline-block; margin-bottom: 5px; font-weight: bold; } // Normalize form controls // // While most of our form styles require extra classes, some basic normalization // is required to ensure optimum display with or without those classes to better // address browser inconsistencies. // Override content-box in Normalize (* isn't specific enough) input[type='search'] { .box-sizing(border-box); } // Position radios and checkboxes better input[type='radio'], input[type='checkbox'] { margin: 4px 0 0; margin-top: 1px \9; /* IE8-9 */ line-height: normal; } // Set the height of file controls to match text inputs input[type='file'] { display: block; } // Make range inputs behave like textual form controls input[type='range'] { display: block; width: 100%; } // Make multiple select elements height not fixed select[multiple], select[size] { height: auto; } // Focus for file, radio, and checkbox input[type='file']:focus, input[type='radio']:focus, input[type='checkbox']:focus { .tab-focus(); } // Adjust output element output { display: block; padding-top: (@padding-base-vertical + 1); font-size: @font-size-base; line-height: @line-height-base; color: @input-color; } // Common form controls // // Shared size and type resets for form controls. Apply `.form-control` to any // of the following form controls: // // select // textarea // input[type="text"] // input[type="password"] // input[type="datetime"] // input[type="datetime-local"] // input[type="date"] // input[type="month"] // input[type="time"] // input[type="week"] // input[type="number"] // input[type="email"] // input[type="url"] // input[type="search"] // input[type="tel"] // input[type="color"] .form-control { display: block; width: 100%; height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) padding: @padding-base-vertical @padding-base-horizontal; font-size: @font-size-base; line-height: @line-height-base; color: @input-color; background-color: @input-bg; background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 border: 1px solid @input-border; border-radius: @input-border-radius; .box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075)); .transition(~'border-color ease-in-out .15s, box-shadow ease-in-out .15s'); // Customize the `:focus` state to imitate native WebKit styles. .form-control-focus(); // Placeholder .placeholder(); // Disabled and read-only inputs // // HTML5 says that controls under a fieldset > legend:first-child won't be // disabled if the fieldset is disabled. Due to implementation difficulty, we // don't honor that edge case; we style them as disabled anyway. &[disabled], &[readonly], fieldset[disabled] & { cursor: not-allowed; background-color: @input-bg-disabled; opacity: 1; // iOS fix for unreadable disabled content } // Reset height for `textarea`s, and smaller border-radius textarea& { height: auto; border-radius: @border-radius-base; } // Smaller border-radius for `select` inputs select& { border-radius: @border-radius-base; } } // Search inputs in iOS // // This overrides the extra rounded corners on search inputs in iOS so that our // `.form-control` class can properly style them. Note that this cannot simply // be added to `.form-control` as it's not specific enough. For details, see // https://github.com/twbs/bootstrap/issues/11586. input[type='search'] { -webkit-appearance: none; } // Special styles for iOS date input // // In Mobile Safari, date inputs require a pixel line-height that matches the // given height of the input. input[type='date'] { line-height: @input-height-base; } // Form groups // // Designed to help with the organization and spacing of vertical forms. For // horizontal forms, use the predefined grid classes. .form-group { margin-bottom: 15px; } // Checkboxes and radios // // Indent the labels to position radios/checkboxes as hanging controls. .radio, .checkbox { display: block; min-height: @line-height-computed; // clear the floating input if there is no label text margin-top: 10px; margin-bottom: 10px; padding-left: 20px; label { display: inline; font-weight: normal; cursor: pointer; } } .fake-disabled-checkbox { opacity: 0.5; } .radio input[type='radio'], .radio-inline input[type='radio'], .checkbox input[type='checkbox'], .checkbox-inline input[type='checkbox'] { float: left; margin-left: -20px; } .radio + .radio, .checkbox + .checkbox { margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing } // Radios and checkboxes on same line .radio-inline, .checkbox-inline { display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: normal; cursor: pointer; } .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline { margin-top: 0; margin-left: 10px; // space out consecutive inline controls } // Apply same disabled cursor tweak as for inputs // // Note: Neither radios nor checkboxes can be readonly. input[type='radio'], input[type='checkbox'], .radio, .radio-inline, .checkbox, .checkbox-inline { &[disabled], fieldset[disabled] & { cursor: not-allowed; } } // Form control sizing // // Build on `.form-control` with modifier classes to decrease or increase the // height and font-size of form controls. .input-sm { .input-size( @input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small ); } .input-lg { .input-size( @input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large ); } // Form control feedback states // // Apply contextual and semantic states to individual form controls. .has-feedback { // Enable absolute positioning position: relative; // Ensure icons don't overlap text .form-control { padding-right: (@input-height-base * 1.25); } // Feedback icon (requires .glyphicon classes) .form-control-feedback { position: absolute; top: (@line-height-computed + 5); // Height of the `label` and its margin right: 0; display: block; width: @input-height-base; height: @input-height-base; line-height: @input-height-base; text-align: center; } } .has-feedback-left { position: relative; .form-control { padding-left: @input-height-base; } .form-control-feedback-left { position: absolute; top: (@line-height-computed + 5); // Height of the `label` and its margin left: 0; display: block; width: @input-height-base; height: @input-height-base; line-height: @input-height-base; text-align: center; } } // Feedback states .has-success { .form-control-validation( @state-success-text; @state-success-text; @state-success-bg ); } .has-warning { .form-control-validation( @state-warning-text; @state-warning-text; @state-warning-bg ); } .has-error { .form-control-validation( @state-danger-text; @state-danger-text; @state-danger-bg ); color: @red; } .form-control.ng-dirty.ng-invalid:not(:focus) { border-color: @state-danger-text; .box-shadow( inset 0 1px 1px rgba(0, 0, 0, 0.075) ); // Redeclare so transitions work &:focus { border-color: darken(@state-danger-text, 10%); @shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px lighten(@state-danger-text, 20%); .box-shadow(@shadow); } } // Static form control text // // Apply class to a `p` element to make any string of text align with labels in // a horizontal form layout. .form-control-static { margin-bottom: 0; // Remove default margin from `p` } // Help text // // Apply to any element you wish to create light text for placement immediately // below a form control. Use for general help, formatting, or instructional text. .help-block { display: block; // account for any element using help-block margin-top: 5px; margin-bottom: 10px; color: lighten(@text-color, 25%); // lighten the text some for contrast } // Inline forms // // Make forms appear inline(-block) by adding the `.form-inline` class. Inline // forms begin stacked on extra small (mobile) devices and then go inline when // viewports reach <768px. // // Requires wrapping inputs and labels with `.form-group` for proper display of // default HTML form controls and our custom form controls (e.g., input groups). // // Heads up! This is mixin-ed into `.navbar-form` in navbars.less. .form-inline { // Kick in the inline @media (min-width: @screen-sm-min) { // Inline-block all the things for "inline" .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } // In navbar-form, allow folks to *not* use `.form-group` .form-control { display: inline-block; width: auto; // Prevent labels from stacking above inputs in `.form-group` vertical-align: middle; } // Input groups need that 100% width though .input-group > .form-control { width: 100%; } .control-label { margin-bottom: 0; vertical-align: middle; } // Remove default margin on radios/checkboxes that were used for stacking, and // then undo the floating of radios and checkboxes to match (which also avoids // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969). .radio, .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; padding-left: 0; vertical-align: middle; } .radio input[type='radio'], .checkbox input[type='checkbox'] { float: none; margin-left: 0; } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; } } } // Horizontal forms // // Horizontal forms are built on grid classes and allow you to create forms with // labels on the left and inputs on the right. .form-horizontal { // Consistent vertical alignment of labels, radios, and checkboxes .control-label, .radio, .checkbox, .radio-inline, .checkbox-inline { margin-top: 0; margin-bottom: 0; padding-top: (@padding-base-vertical + 1); // Default padding plus a border } // Account for padding we're adding to ensure the alignment and of help text // and other content below items .radio, .checkbox { min-height: (@line-height-computed + (@padding-base-vertical + 1)); } // Make form groups behave like rows .form-group { .make-row(); } .form-control-static { padding-top: (@padding-base-vertical + 1); } // Only right align form labels here when the columns stop stacking @media (min-width: @screen-sm-min) { .control-label { text-align: right; } } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; right: (@grid-gutter-width / 2); } .has-feedback-left .form-control-feedback-left { top: 0; left: (@grid-gutter-width / 2); } }
overleaf/web/frontend/stylesheets/components/forms.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/forms.less", "repo_id": "overleaf", "token_count": 4136 }
513
.reconfirm-notification { display: flex; width: 100%; .fa-warning { margin-right: @margin-sm; } .btn-reconfirm { float: right; margin-left: @margin-sm; text-transform: capitalize; } } // Settings page .affiliations-table { .reconfirm-notification { margin: 0px auto @margin-sm auto !important; padding: @padding-md; } .reconfirm-row { td { border: 0; .alert { border: 0; padding: 0; } :not(.alert) { .reconfirm-notification { background-color: @ol-blue-gray-0; border-radius: @border-radius-base; .fa-warning { color: @brand-warning; } } } } } }
overleaf/web/frontend/stylesheets/components/notifications.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/notifications.less", "repo_id": "overleaf", "token_count": 352 }
514
.vertical-resizable-resizer { background-color: @vertical-resizable-resizer-bg; &:hover { background-color: @vertical-resizable-resizer-hover-bg; } &::after { content: '\00b7\00b7\00b7\00b7'; display: block; color: @ol-blue-gray-2; text-align: center; font-size: 20px; line-height: 3px; pointer-events: none; } } .vertical-resizable-resizer-disabled { pointer-events: none; opacity: 0.5; &::after { opacity: 0.5; } }
overleaf/web/frontend/stylesheets/components/vertical-resizable-panes.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/vertical-resizable-panes.less", "repo_id": "overleaf", "token_count": 211 }
515
@import (less) '../fonts/lato.css'; @import (less) '../fonts/merriweather.css'; @import (less) '../fonts/source-code-pro.css'; @import (less) '../fonts/stix-two-math.css'; @is-overleaf-light: false; @show-rich-text: true; // Core variables and mixins @import 'core/variables.less'; @import 'app/ol-style-guide.less'; @import '_style_includes.less'; @import '_ol_style_includes.less'; @import 'components/embed-responsive.less'; @import 'components/icons.less'; @import 'components/images.less'; @import 'components/navs-ol.less'; @import 'components/pagination.less'; @import 'components/tabs.less'; // Pages @import 'app/about.less'; @import 'app/blog-posts.less'; @import 'app/cms-page.less'; @import 'app/content_page.less'; @import 'app/plans-ol.less'; @import 'app/portals.less';
overleaf/web/frontend/stylesheets/style.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/style.less", "repo_id": "overleaf", "token_count": 299 }
516
{ "generic_linked_file_compile_error": "This project's output files are not available because it failed to compile. Please open the project to see the compilation error details.", "chat_error": "Could not load chat messages, please try again.", "reconnect": "Try again", "no_pdf_error_title": "No PDF", "no_pdf_error_explanation": "This compile didn't produce a PDF. This can happen if:", "no_pdf_error_reason_unrecoverable_error": "There is an unrecoverable LaTeX error. If there are LaTeX errors shown below or in the raw logs, please try to fix them and compile again.", "no_pdf_error_reason_no_content": "The <code>document</code> environment contains no content. If it's empty, please add some content and compile again.", "no_pdf_error_reason_output_pdf_already_exists": "This project contains a file called <code>output.pdf</code>. If that file exists, please rename it and compile again.", "logs_pane_info_message": "We are testing a new logs pane", "logs_pane_info_message_popup": "We are testing a new logs pane. Click here to give feedback.", "github_symlink_error": "Your Github repository contains symbolic link files, which are not currently supported by Overleaf. Please remove these and try again.", "address_line_1": "Address", "address_line_2": "Address (line 2, optional)", "postal_code": "Postal Code", "reload_editor": "Reload editor", "compile_error_description": "This project did not compile because of an error", "validation_issue_description": "This project did not compile because of a validation issue", "compile_error_entry_description": "An error which prevented this project from compiling", "validation_issue_entry_description": "A validation issue which prevented this project from compiling", "github_file_name_error": "Your project contains file(s) with an invalid filename. Please check your repository and try again.", "raw_logs_description": "Raw logs from the LaTeX compiler", "raw_logs": "Raw logs", "first_error_popup_label": "This project has errors. This is the first one.", "dismiss_error_popup": "Dismiss first error alert", "go_to_error_location": "Go to error location", "view_error": "View error", "view_error_plural": "View all errors", "log_entry_description": "Log entry with level: __level__", "navigate_log_source": "Navigate to log position in source code: __location__", "other_output_files": "Download other output files", "refresh": "Refresh", "toggle_output_files_list": "Toggle output files list", "n_warnings": "__count__ warning", "n_warnings_plural": "__count__ warnings", "n_errors": "__count__ error", "n_errors_plural": "__count__ errors", "toggle_compile_options_menu": "Toggle compile options menu", "view_pdf": "View PDF", "your_project_has_an_error": "This project has an error", "your_project_has_an_error_plural": "This project has errors", "view_warning": "View warning", "view_warning_plural": "View warnings", "view_logs": "View logs", "recompile_from_scratch": "Recompile from scratch", "tagline_free": "Perfect for getting started", "also_provides_free_plan": "__appName__ also provides a free plan -- simply <0>register here</0> to get started.", "compile_timeout": "Compile timeout (minutes)", "collabs_per_proj_single": "__collabcount__ collaborator per project", "premium_features": "Premium features", "special_price_student": "Special Price Student Plans", "hide_outline": "Hide File outline", "show_outline": "Show File outline", "expand": "Expand", "collapse": "Collapse", "file_outline": "File outline", "we_cant_find_any_sections_or_subsections_in_this_file": "We can’t find any sections or subsections in this file", "find_out_more_about_the_file_outline": "Find out more about the file outline", "invalid_institutional_email": "Your institution's SSO service returned your email address as __email__, which is at an unexpected domain that we do not recognise as belonging to it. You may be able to change your primary email address via your user profile at your institution to one at your institution's domain. Please contact your IT department if you have any questions.", "wed_love_you_to_stay": "We'd love you to stay", "yes_move_me_to_student_plan": "Yes, move me to the student plan", "last_login": "Last Login", "thank_you_for_being_part_of_our_beta_program": "Thank you for being part of our Beta Program, where you can have early access to new features and help us understand your needs better", "you_will_be_able_to_contact_us_any_time_to_share_your_feedback": "You will be able to contact us any time to share your feedback", "we_may_also_contact_you_from_time_to_time_by_email_with_a_survey": "We may also contact you from time to time by email with a survey, or to see if you would like to participate in other user research initiatives", "you_can_opt_in_and_out_of_the_program_at_any_time_on_this_page": "You can opt in and out of the program at any time on this page", "give_feedback": "Give feedback", "beta_feature_badge": "Beta feature badge", "invalid_filename": "Upload failed: check that the file name doesn't contain special characters, trailing/leading whitespace or more than __nameLimit__ characters", "clsi_unavailable": "Sorry, the compile server for your project was temporarily unavailable. Please try again in a few moments.", "x_price_per_month": "<0>__price__</0> per month", "x_price_per_year": "<0>__price__</0> per year", "x_price_for_first_month": "<0>__price__</0> for your first month", "x_price_for_first_year": "<0>__price__</0> for your first year", "x_price_per_month_tax": "<0>__total__</0> (__subtotal__ + __tax__ tax) per month", "x_price_per_year_tax": "<0>__total__</0> (__subtotal__ + __tax__ tax) per year", "x_price_for_first_month_tax": "<0>__total__</0> (__subtotal__ + __tax__ tax) for your first month", "x_price_for_first_year_tax": "<0>__total__</0> (__subtotal__ + __tax__ tax) for your first year", "normally_x_price_per_month": "Normally __price__ per month", "normally_x_price_per_year": "Normally __price__ per year", "then_x_price_per_month": "Then __price__ per month", "then_x_price_per_year": "Then __price__ per year", "for_your_first": "for your first", "sso_not_linked": "You have not linked your account to __provider__. Please log in to your account another way and link your __provider__ account via your account settings.", "template_gallery": "Template Gallery", "template_not_found_description": "This way of creating projects from templates has been removed. Please visit our template gallery to find more templates.", "dropbox_checking_sync_status": "Checking Dropbox Integration status", "dropbox_sync_in": "Updating Overleaf", "dropbox_sync_out": "Updating Dropbox", "dropbox_sync_both": "Updating Overleaf and Dropbox", "dropbox_synced": "Overleaf and Dropbox are up-to-date", "dropbox_sync_status_error": "An error has occurred with the Dropbox Integration", "requesting_password_reset": "Requesting password reset", "tex_live_version": "TeX Live version", "email_does_not_belong_to_university": "We don't recognize that domain as being affiliated with your university. Please contact us to add the affiliation.", "company_name": "Company Name", "add_company_details": "Add Company Details", "github_timeout_error": "Syncing your Overleaf project with Github has timed out. This may be due to the overall size of your project, or the number of files/changes to sync, being too large.", "github_large_files_error": "Merge failed: your Github repository contains files over the 50mb file size limit ", "no_history_available": "This project doesn't have any history yet. Please make some changes to the project and try again.", "project_approaching_file_limit": "This project is approaching the file limit", "recurly_email_updated": "Your billing email address was successfully updated", "recurly_email_update_needed": "Your billing email address is currently <0>__recurlyEmail__</0>. If needed you can update your billing address to <1>__userEmail__</1>.", "project_has_too_many_files": "This project has reached the 2000 file limit", "processing_your_request": "Please wait while we process your request.", "github_repository_diverged": "The master branch of the linked repository has been force-pushed. Pulling GitHub changes after a force push can cause Overleaf and GitHub to get out of sync. You might need to push changes after pulling to get back in sync.", "unlink_github_repository": "Unlink Github Repository", "unlinking": "Unlinking", "github_no_master_branch_error": "This repository cannot be imported as it is missing the master branch. Please make sure the project has a master branch", "confirmation_token_invalid": "Sorry, your confirmation token is invalid or has expired. Please request a new email confirmation link.", "confirmation_link_broken": "Sorry, something is wrong with your confirmation link. Please try copy and pasting the link from the bottom of your confirmation email.", "duplicate_file": "Duplicate File", "file_already_exists_in_this_location": "An item named <0>__fileName__</0> already exists in this location. If you wish to move this file, rename or remove the conflicting file and try again.", "blocked_filename": "This file name is blocked.", "group_full": "This group is already full", "no_selection_select_file": "Currently, no file is selected. Please select a file from the file tree.", "no_selection_create_new_file": "Your project is currently empty. Please create a new file.", "files_selected": "files selected.", "home": "Home", "this_action_cannot_be_undone": "This action cannot be undone.", "dropbox_email_not_verified": "We have been unable to retrieve updates from your Dropbox account. Dropbox reported that your email address is unverified. Please verify your email address in your Dropbox account to resolve this.", "portal_add_affiliation_to_join": "It looks like you are already logged in to __appName__! If you have a __portalTitle__ email you can add it now.", "token_access_success": "Access granted", "token_access_failure": "Cannot grant access; contact the project owner for help", "trashed_projects": "Trashed Projects", "trash": "Trash", "untrash": "Restore", "delete_and_leave": "Delete / Leave", "trash_projects": "Trash Projects", "about_to_trash_projects": "You are about to trash the following projects:", "archived_projects_info_note": "The Archive now works on a per-user basis. Projects that you decide to archive will only be archived for you, not your collaborators.", "trashed_projects_info_note": "Overleaf now has a Trash for projects you want to get rid of. Trashing a project won't affect your collaborators.", "archiving_projects_wont_affect_collaborators": "Archiving projects won't affect your collaborators.", "trashing_projects_wont_affect_collaborators": "Trashing projects won't affect your collaborators.", "register_intercept_sso": "You can link your __authProviderName__ account from the Account Settings page after logging in.", "continue_to": "Continue to __appName__", "project_ownership_transfer_confirmation_1": "Are you sure you want to make <0>__user__</0> the owner of <1>__project__</1>?", "project_ownership_transfer_confirmation_2": "This action cannot be undone. The new owner will be notified and will be able to change project access settings (including removing your own access).", "change_owner": "Change owner", "change_project_owner": "Change Project Owner", "faq_pay_by_invoice_answer": "Yes, if you'd like to purchase a group account or site license and would prefer to pay by invoice,\r\nor need to raise a purchase order, please <0>let us know</0>.\r\nFor individual accounts or accounts with monthly billing, we can only accept payment online\r\nvia credit or debit card, or PayPal.", "password_too_long_please_reset": "Maximum password length exceeded. Please reset your password.", "view_other_options_to_log_in": "View other options to log in", "we_logged_you_in": "We have logged you in.", "will_need_to_log_out_from_and_in_with": "You will need to <b>log out</b> from your <b>__email1__</b> account and then log in with <b>__email2__</b>.", "resubmit_institutional_email": "Please resubmit your institutional email.", "opted_out_linking": "You've opted out from linking your <b>__email__</b> <b>__appName__</b> account to your institutional account.", "please_link_to_institution_account": "Please link your <b>__email__</b> <b>__appName__</b> account to your <b>__institutionName__</b> institutional account.", "register_with_another_email": "<a href=\"__link__\">Register with __appName__</a> using another email.", "register_with_email_provided": "<a href=\"__link__\">Register with __appName__</a> using the email and password you provided.", "security_reasons_linked_accts": "For security reasons, as your institutional email is already associated with the <b>__email__</b> <b>__appName__</b> account, we can only allow account linking with that specific account.", "this_grants_access_to_features": "This grants you access to <b>__appName__</b> <b>__featureType__</b> features.", "to_add_email_accounts_need_to_be_linked": "To add this email, your <b>__appName__</b> and <b>__institutionName__</b> accounts will need to be linked.", "tried_to_log_in_with_email": "You've tried to login with <b>__email__</b>.", "tried_to_register_with_email": "You've tried to register with <b>__email__</b>, which is already registered with <b>__appName__</b> as an institutional account.", "log_in_with_email": "Log in with __email__", "log_in_with_existing_institution_email": "Please log in with your existing <b>__appName__</b> account in order to get your <b>__appName__</b> and <b>__institutionName__</b> institutional accounts linked.", "log_out_from": "Log out from __email__", "logged_in_with_acct_that_cannot_be_linked": "You've logged in with an <b>__appName__</b> account that cannot be linked to your institution account.", "logged_in_with_email": "You are currently logged in to <b>__appName__</b> with the email <b>__email__</b>.", "looks_like_logged_in_with_email": "It looks like you're already logged in to <b>__appName__</b> with the email <b>__email__</b>.", "make_primary_to_log_in_through_institution": "Make your <b>__email__</b> email primary to log in through your institution portal. ", "make_primary_which_will_allow_log_in_through_institution": "Making it your <b>primary __appName__</b> email will allow you to log in through your institution portal.", "need_to_do_this_to_access_license": "You'll need to do this in order to have access to the benefits from the <b>__institutionName__</b> site license.", "institutional_login_not_supported": "Your university doesn't support <b>institutional login</b> yet, but you can still register with your institutional email.", "institutional_login_unknown": "Sorry, we don't know which institution issued that email address. You can browse our <a href=\"__link__\">list of institutions</a> to find yours, or you can just register using your email address and password here.", "link_account": "Link Account", "link_accounts": "Link Accounts", "link_accounts_and_add_email": "Link Accounts and Add Email", "link_your_accounts": "Link your accounts", "log_in_and_link": "Log in and link", "log_in_and_link_accounts": "Log in and link accounts", "log_in_first_to_proceed": "You will need to <b>log in</b> first to proceed.", "log_in_through_institution": "Log in through your institution", "if_have_existing_can_link": "If you have an existing <b>__appName__</b> account on another email, you can link it to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.", "if_owner_can_link": "If you own the <b>__appName__</b> account with <b>__email__</b>, you will be allowed to link it to your <b>__institutionName__</b> institutional account.", "ignore_and_continue_institution_linking": "You can also ignore this and <a href=\"__link__\">continue to __appName__ with your <b>__email__</b> account</a>.", "in_order_to_match_institutional_metadata": "In order to match your institutional metadata, we've linked your account using <b>__email__</b>.", "in_order_to_match_institutional_metadata_associated": "In order to match your institutional metadata, your account is associated with the email <b>__email__</b>.", "institution_account_tried_to_add_already_registered": "The email/institution account you tried to add is <b>already registered</b> with __appName__.", "institution_account_tried_to_add_already_linked": "This institution is <b>already linked</b> with your account via another email address.", "institution_account_tried_to_add_not_affiliated": "This email is <b>already associated</b> with your account but not affiliated with this institution.", "institution_account_tried_to_add_affiliated_with_another_institution": "This email is <b>already associated</b> with your account but affiliated with another institution.", "institution_acct_successfully_linked": "Your <b>__appName__</b> account was successfully linked to your <b>__institutionName__</b> institutional account.", "institution_account_tried_to_confirm_saml": "This email cannot be confirmed. Please remove the email from your account and try adding it again.", "institution_email_new_to_app": "Your <b>__institutionName__</b> email (<b>__email__</b>) is new to __appName__.", "institutional": "Institutional", "doing_this_allow_log_in_through_institution": "Doing this will allow you to log in to <b>__appName__</b> through your institution portal.", "doing_this_will_verify_affiliation_and_allow_log_in": "Doing this will verify your affiliation with <b>__institutionName__</b> and will allow you to log in to <b>__appName__</b> through your institution.", "email_already_associated_with": "The <b>__email1__</b> email is already associated with the <b>__email2__</b> <b>__appName__</b> account.", "enter_institution_email_to_log_in": "Enter your institutional email to log in through your institution.", "find_out_more_about_institution_login": "Find out more about institutional login", "get_in_touch_having_problems": "<a href=\"__link__\">Get in touch with support</a> if you're having problems", "go_back_and_link_accts": "<a href=\"__link__\">Go back</a> and link your accounts", "go_back_and_log_in": "<a href=\"__link__\">Go back</a> and log in again", "go_back_to_institution": "Go back to your institution", "can_link_institution_email_by_clicking": "You can link your <b>__email__</b> <b>__appName__</b> account to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.", "can_link_institution_email_to_login": "You can link your <b>__email__</b> <b>__appName__</b> account to your <b>__institutionName__</b> account, which will allow you to log in to <b>__appName__</b> through your institution portal.", "can_link_your_institution_acct": "You can now <b>link</b> your <b>__appName__</b> account to your <b>__institutionName__</b> institutional account.", "can_now_link_to_institution_acct": "You can link your <b>__email__<b> <b>__appName__</b> account to your <b>__institutionName__</b> institutional account.</b></b>", "click_link_to_proceed": "Click <b>__clickText__</b> below to proceed.", "continue_with_email": "<a href=\"__link__\">Continue to __appName__</a> with your <b>__email__</b> account", "create_new_account": "Create new account", "do_not_have_acct_or_do_not_want_to_link": "If you don't have an <b>__appName__</b> account, or if you don't want to link to your <b>__institutionName__</b> account, please click <b>__clickText__</b>.", "do_not_link_accounts": "Don't link accounts", "account_has_been_link_to_institution_account": "Your __appName__ account on <b>__email__</b> has been linked to your <b>__institutionName__</b> institutional account.", "account_linking": "Account Linking", "account_with_email_exists": "It looks like an <b>__appName__</b> account with the email <b>__email__</b> already exists.", "acct_linked_to_institution_acct": "You can <b>log in</b> to Overleaf through your <b>__institutionName__</b> institutional login.", "alternatively_create_new_institution_account": "Alternatively, you can create a <b>new account</b> with your institution email (<b>__email__</b>) by clicking <b>__clickText__</b>.", "as_a_member_of_sso": "As a member of <b>__institutionName__</b>, you can log in to <b>__appName__</b> through your institution portal.", "as_a_member_of_sso_required": "As a member of <b>__institutionName__</b>, you must log in to <b>__appName__</b> through your institution portal.", "can_link_institution_email_acct_to_institution_acct": "You can now link your <b>__email__</b> <b>__appName__</b> account to your <b>__institutionName__</b> institutional account.", "can_link_institution_email_acct_to_institution_acct_alt": "You can link your <b>__email__</b> <b>__appName__</b> account to your <b>__institutionName__</b> institutional account.", "user_deletion_error": "Sorry, something went wrong deleting your account. Please try again in a minute.", "card_must_be_authenticated_by_3dsecure": "Your card must be authenticated with 3D Secure before continuing", "view_your_invoices": "View Your Invoices", "payment_provider_unreachable_error": "Sorry, there was an error talking to our payment provider. Please try again in a few moments.\nIf you are using any ad or script blocking extensions in your browser, you may need to temporarily disable them.", "dropbox_unlinked_because_access_denied": "Your Dropbox account has been unlinked because the Dropbox service rejected your stored credentials. Please relink your Dropbox account to continue using it with Overleaf.", "dropbox_unlinked_because_full": "Your Dropbox account has been unlinked because it is full, and we can no longer send updates to it. Please free up some space and relink your Dropbox account to continue using it with Overleaf.", "upgrade_for_longer_compiles": "Upgrade to increase your timeout limit.", "ask_proj_owner_to_upgrade_for_longer_compiles": "Please ask the project owner to upgrade to increase the timeout limit.", "plus_upgraded_accounts_receive": "Plus with an upgraded account you get", "sso_account_already_linked": "Account already linked to another __appName__ user", "subscription_admins_cannot_be_deleted": "You cannot delete your account while on a subscription. Please cancel your subscription and try again. If you keep seeing this message please contact us.", "delete_acct_no_existing_pw": "Please use the password reset form to set a password before deleting your account", "empty_zip_file": "Zip doesn't contain any file", "you_can_now_login_through_overleaf_sl": "You can now log in to your ShareLaTeX account through Overleaf.", "find_out_more_nt": "Find out more.", "register_error": "Registration error", "login_error": "Login error", "sso_link_error": "Error linking SSO account", "more_info": "More Info", "synctex_failed": "Couldn't find the corresponding source file", "linked_collabratec_description": "Use Collabratec to manage your __appName__ projects.", "reset_from_sl": "Please reset your password from ShareLaTeX and login there to move your account to Overleaf", "dropbox_already_linked_error": "Your Dropbox account cannot be linked as it is already linked with another Overleaf account.", "github_too_many_files_error": "This repository cannot be imported as it exceeds the maximum number of files allowed", "linked_accounts": "linked accounts", "linked_accounts_explained": "You can link your __appName__ account with other services to enable the features described below", "oauth_orcid_description": " <a href=\"__link__\">Securely establish your identity by linking your ORCID iD to your __appName__ account</a>. Submissions to participating publishers will automatically include your ORCID iD for improved workflow and visibility. ", "no_existing_password": "Please use the password reset form to set your password", " to_reactivate_your_subscription_go_to": "To reactivate your subscription go to", "subscription_canceled": "Subscription Canceled", "coupons_not_included": "This does not include your current discounts, which will be applied automatically before your next payment", "email_already_registered_secondary": "This email is already registered as a secondary email", "secondary_email_password_reset": "That email is registered as a secondary email. Please enter the primary email for your account.", "if_registered_email_sent": "If you have an account, we have sent you an email.", "reconfirm": "reconfirm", "request_reconfirmation_email": "Request reconfirmation email", "reconfirm_explained": "We need to reconfirm your account. Please request a password reset link via the form below to reconfirm your account. If you have any problems reconfirming your account, please contact us at", "upload_failed": "Upload failed", "file_too_large": "File too large", "zip_contents_too_large": "Zip contents too large", "invalid_zip_file": "Invalid zip file", "make_primary": "Make Primary", "make_email_primary_description": "Make this the primary email, used to log in", "github_sync_repository_not_found_description": "The linked repository has either been removed, or you no longer have access to it. You can set up sync with a new repository by cloning the project and using the 'Github' menu item. You can also unlink the repository from this project.", "unarchive": "Restore", "cant_see_what_youre_looking_for_question": "Can't see what you're looking for?", "something_went_wrong_canceling_your_subscription": "Something went wrong canceling your subscription. Please contact support.", "department": "Department", "notification_features_upgraded_by_affiliation": "Good news! Your affiliated organization __institutionName__ has a partnership with Overleaf, and you now have access to all of Overleaf's Professional features.", "notification_personal_subscription_not_required_due_to_affiliation": " Good news! Your affiliated organization __institutionName__ has a partnership with Overleaf, and you now have access to Overleaf's Professional features through your affiliation. You can cancel your personal subscription without losing access to any of your benefits.", "github_private_description": "You choose who can see and commit to this repository.", "notification_project_invite_message": "<b>__userName__</b> would like you to join <b>__projectName__</b>", "notification_project_invite_accepted_message": "You've joined <b>__projectName__</b>", "subject_to_additional_vat": "Prices may be subject to additional VAT, depending on your country.", "select_country_vat": "Please select your country on the payment page to view the total price including any VAT.", "to_change_access_permissions": "To change access permissions, please ask the project owner", "file_name_in_this_project": "File Name In This Project", "new_snippet_project": "Untitled", "loading_content": "Creating Project", "there_was_an_error_opening_your_content": "There was an error creating your project", "sorry_something_went_wrong_opening_the_document_please_try_again": "Sorry, an unexpected error occurred when trying to open this content on Overleaf. Please try again.", "the_required_parameters_were_not_supplied": "The link to open this content on Overleaf was missing some required parameters. If this keeps happening for links on a particular site, please report this to them.", "more_than_one_kind_of_snippet_was_requested": "The link to open this content on Overleaf included some invalid parameters. If this keeps happening for links on a particular site, please report this to them.", "the_supplied_parameters_were_invalid": "The link to open this content on Overleaf included some invalid parameters. If this keeps happening for links on a particular site, please report this to them.", "unable_to_extract_the_supplied_zip_file": "Opening this content on Overleaf failed because the zip file could not be extracted. Please ensure that it is a valid zip file. If this keeps happening for links on a particular site, please report this to them.", "the_file_supplied_is_of_an_unsupported_type ": "The link to open this content on Overleaf pointed to the wrong kind of file. Valid file types are .tex documents and .zip files. If this keeps happening for links on a particular site, please report this to them.", "the_requested_publisher_was_not_found": "The link to open this content on Overleaf specified a publisher that could not be found. If this keeps happening for links on a particular site, please report this to them.", "the_supplied_uri_is_invalid": "The link to open this content on Overleaf included an invalid URI. If this keeps happening for links on a particular site, please report this to them.", "the_requested_conversion_job_was_not_found": "The link to open this content on Overleaf specified a conversion job that could not be found. It's possible that the job has expired and needs to be run again. If this keeps happening for links on a particular site, please report this to them.", "not_found_error_from_the_supplied_url": "The link to open this content on Overleaf pointed to a file that could not be found. If this keeps happening for links on a particular site, please report this to them.", "too_many_requests": "Too many requests were received in a short space of time. Please wait for a few moments and try again.", "password_change_passwords_do_not_match": "Passwords do not match", "github_for_link_shared_projects": "This project was accessed via link-sharing and won't be synchronised with your Github unless you are invited via e-mail by the project owner.", "browsing_project_latest_for_pseudo_label": "Browsing your project's current state", "history_label_project_current_state": "Current state", "download_project_at_this_version": "Download project at this version", "submit": "submit", "submit_title": "Submit", "help_articles_matching": "Help articles matching your subject", "dropbox_for_link_share_projs": "This project was accessed via link-sharing and won't be synchronised to your Dropbox unless you are invited via e-mail by the project owner.", "clear_search": "clear search", "email_registered_try_alternative": "Sorry, we do not have an account matching those credentials. Perhaps you signed up using a different provider?", "access_your_projects_with_git": "Access your projects with Git", "ask_proj_owner_to_upgrade_for_git_bridge": "Ask the project owner to upgrade their account to use git", "export_csv": "Export CSV", "add_comma_separated_emails_help": "Separate multiple email addresses using the comma (,) character.", "members_management": "Members management", "managers_management": "Managers management", "institution_account": "Institution Account", "git": "Git", "clone_with_git": "Clone with Git", "git_bridge_modal_description": "You can <code>git</code> <code>clone</code> your project using the link displayed below.", "managers_cannot_remove_admin": "Admins cannot be removed", "managers_cannot_remove_self": "Managers cannot remove themselves", "user_not_found": "User not found", "user_already_added": "User already added", "bonus_twitter_share_text": "I'm using __appName__, the free online collaborative LaTeX editor - it's awesome and easy to use!", "bonus_email_share_header": "Online LaTeX editor you may like", "bonus_email_share_body": "Hey, I have been using the online LaTeX editor __appName__ recently and thought you might like to check it out.", "bonus_share_link_text": "Online LaTeX Editor __appName__", "bonus_facebook_name": "__appName__ - Online LaTeX Editor", "bonus_facebook_caption": "Free Unlimited Projects and Compiles", "bonus_facebook_description": "__appName__ is a free online LaTeX Editor. Real time collaboration like Google Docs, with Dropbox, history and auto-complete.", "remove_manager": "Remove manager", "invalid_element_name": "Could not copy your project because of filenames containing invalid characters\r\n(such as asterisks, slashes or control characters). Please rename the files and\r\ntry again.", "collabratec_account_not_registered": "IEEE Collabratec™ account not registered. Please connect to Overleaf from IEEE Collabratec™ or login with a different account.", "password_change_failed_attempt": "Password change failed", "password_change_successful": "Password changed", "not_registered": "Not registered", "featured_latex_templates": "Featured LaTeX Templates", "no_featured_templates": "No featured templates", "try_again": "Please try again", "email_required": "Email required", "registration_error": "Registration error", "newsletter-accept": "I’d like emails about product offers and company news and events.", "resending_confirmation_email": "Resending confirmation email", "please_confirm_email": "Please confirm your email __emailAddress__ by clicking on the link in the confirmation email ", "register_using_service": "Register using __service__", "login_to_overleaf": "Log in to Overleaf", "login_with_email": "Log in with your email", "login_with_service": "Log in with __service__", "first_time_sl_user": "First time here as a ShareLaTeX user", "migrate_from_sl": "Migrate from ShareLaTeX", "dont_have_account": "Don't have an account?", "sl_extra_info_tooltip": "Please log in to ShareLaTeX to move your account to Overleaf. It will only take a few seconds. If you have a ShareLaTeX subscription, it will automatically be transferred to Overleaf.", "register_using_email": "Register using your email", "login_register_or": "or", "to_add_more_collaborators": "To add more collaborators or turn on link sharing, please ask the project owner", "by": "by", "emails": "Emails", "editor_theme": "Editor theme", "overall_theme": "Overall theme", "faq_how_does_free_trial_works_answer": "You get full access to your chosen __appName__ plan during your __len__-day free trial. There is no obligation to continue beyond the trial. Your card will be charged at the end of your __len__ day trial unless you cancel before then. You can cancel via your subscription settings.", "thousands_templates": "Thousands of templates", "get_instant_access_to": "Get instant access to", "ask_proj_owner_to_upgrade_for_full_history": "Please ask the project owner to upgrade to access this project's full history.", "currently_seeing_only_24_hrs_history": "You're currently seeing the last 24 hours of changes in this project.", "archive_projects": "Archive Projects", "archive_and_leave_projects": "Archive and Leave Projects", "about_to_archive_projects": "You are about to archive the following projects:", "please_confirm_your_email_before_making_it_default": "Please confirm your email before making it the primary.", "back_to_editor": "Back to the editor", "generic_history_error": "Something went wrong trying to fetch your project's history. If the error persists, please contact us via:", "unconfirmed": "Unconfirmed", "please_check_your_inbox": "Please check your inbox", "resend_confirmation_email": "Resend confirmation email", "history_label_created_by": "Created by", "history_label_this_version": "Label this version", "history_add_label": "Add label", "history_adding_label": "Adding label", "history_new_label_name": "New label name", "history_new_label_added_at": "A new label will be added as of", "history_delete_label": "Delete label", "history_deleting_label": "Deleting label", "history_are_you_sure_delete_label": "Are you sure you want to delete the following label", "browsing_project_labelled": "Browsing project version labelled", "history_view_all": "All history", "history_view_labels": "Labels", "history_view_a11y_description": "Show all of the project history or only labelled versions.", "add_another_email": "Add another email", "start_by_adding_your_email": "Start by adding your email address.", "is_email_affiliated": "Is your email affiliated with an institution? ", "let_us_know": "Let us know", "add_new_email": "Add new email", "error_performing_request": "An error has occurred while performing your request.", "reload_emails_and_affiliations": "Reload emails and affiliations", "emails_and_affiliations_title": "Emails and Affiliations", "emails_and_affiliations_explanation": "Add additional email addresses to your account to access any upgrades your university or institution has, to make it easier for collaborators to find you, and to make sure you can recover your account.", "institution_and_role": "Institution and role", "add_role_and_department": "Add role and department", "save_or_cancel-save": "Save", "save_or_cancel-or": "or", "save_or_cancel-cancel": "Cancel", "make_default": "Make default", "remove": "Remove", "confirm_email": "Confirm Email", "invited_to_join_team": "You have been invited to join a team", "join_team": "Join Team", "accepted_invite": "Accepted invite", "invited_to_group": "__inviterName__ has invited you to join a team on __appName__", "join_team_explanation": "Please click the button below to join the team and enjoy the benefits of an upgraded __appName__ account", "accept_invitation": "Accept invitation", "joined_team": "You have joined the team managed by __inviterName__", "compare_to_another_version": "Compare to another version", "file_action_edited": "Edited", "file_action_renamed": "Renamed", "file_action_created": "Created", "file_action_deleted": "Deleted", "browsing_project_as_of": "Browsing project as of", "view_single_version": "View single version", "font_family": "Font Family", "line_height": "Line Height", "compact": "Compact", "wide": "Wide", "default": "Default", "leave": "Leave", "archived_projects": "Archived Projects", "archive": "Archive", "student_disclaimer": "The educational discount applies to all students at secondary and postsecondary institutions (schools and universities). We may contact you to confirm that you're eligible for the discount.", "billed_after_x_days": "You won’t be billed until after your __len__ day trial expires.", "looking_multiple_licenses": "Looking for multiple licenses?", "reduce_costs_group_licenses": "You can cut down on paperwork and reduce costs with our discounted group licenses.", "find_out_more": "Find out More", "compare_plan_features": "Compare Plan Features", "in_good_company": "You're In Good Company", "unlimited": "Unlimited", "priority_support": "Priority support", "dropbox_integration_lowercase": "Dropbox integration", "github_integration_lowercase": "Git and GitHub integration", "discounted_group_accounts": "discounted group accounts", "referring_your_friends": "referring your friends", "still_have_questions": "Still have questions?", "quote_erdogmus": "The ability to track changes and the real-time collaborative nature is what sets ShareLaTeX apart.", "quote_henderson": "ShareLaTeX has proven to be a powerful and robust collaboration tool that is widely used in our School.", "best_value": "Best value", "faq_how_free_trial_works_question": "How does the free trial work?", "faq_change_plans_question": "Can I change plans later?", "faq_do_collab_need_premium_question": "Do my collaborators also need premium accounts?", "faq_need_more_collab_question": "What if I need more collaborators?", "faq_purchase_more_licenses_question": "Can I purchase additional licenses for my colleagues?", "faq_monthly_or_annual_question": "Should I choose monthly or annual billing?", "faq_how_to_pay_question": "Can I pay online with a credit or debit card, or PayPal?", "faq_pay_by_invoice_question": "Can I pay by invoice / purchase order?", "reference_search": "Advanced reference search", "reference_search_info": "You can always search by citation key, and advanced reference search lets you also search by author, title, year or journal.", "reference_sync": "Reference manager sync", "reference_sync_info": "Manage your reference library in Mendeley and link it directly to a .bib file in Overleaf, so you can easily cite anything in your Mendeley library.", "faq_how_free_trial_works_answer": "You get full access to your chosen __appName__ plan during your __len__-day free trial. There is no obligation to continue beyond the trial. Your card will be charged at the end of your __len__ day trial unless you cancel before then. You can cancel via your subscription settings.", "faq_change_plans_answer": "Yes, you can change your plan at any time via your subscription settings. This includes options to switch to a different plan, or to switch between monthly and annual billing options, or to cancel to downgrade to the free plan.", "faq_do_collab_need_premium_answer": "Premium features, such as tracked changes, will be available to your collaborators on projects that you have created, even if those collaborators have free accounts.", "faq_need_more_collab_answer": "You can upgrade to one of our paid accounts, which support more collaborators. You can also earn additional collaborators on our free accounts by __referFriendsLink__.", "faq_purchase_more_licenses_answer": "Yes, we provide __groupLink__, which are easy to manage, help to save on paperwork, and reduce the cost of purchasing multiple licenses.", "faq_monthly_or_annual_answer": "Annual billing offers a way to cut down on your admin and paperwork. If you’d prefer to manage a single payment every year, instead of twelve, annual billing is for you.", "faq_how_to_pay_answer": "Yes, you can. All major credit and debit cards and Paypal are supported. Select the plan you’d like above, and you’ll have the option to pay by card or to go through to PayPal when it’s time to set up payment.", "powerful_latex_editor": "Powerful LaTeX editor", "realtime_track_changes": "Real-time track changes", "realtime_track_changes_info": "Now you don’t have to choose between tracked changes and typesetting in LaTeX. Leave comments, keep track of TODOs, and accept or reject others’ changes.", "full_doc_history_info": "Travel back in time to see any version and who made changes. No matter what happens, we've got your back.", "dropbox_integration_info": "Work online and offline seamlessly with two-way Dropbox sync. Changes you make locally will be sent automatically to the version on Overleaf and vice versa.", "github_integration_info": "Push and pull commits to and from GitHub or directly from Git, so you or your collaborators can work offline with Git and online with Overleaf.", "latex_editor_info": "Everything you need in a modern LaTeX editor --- spell check, intelligent autocomplete, syntax highlighting, dozens of color themes, vim and emacs bindings, help with LaTeX warnings and error messages, and much more.", "change_plans_any_time": "You can change plans or change your account at any time. ", "number_collab": "Number of collaborators", "unlimited_private_info": "All your projects are private by default. Invite collaborators to read or edit by email address or by sending them a secret link.", "unlimited_private": "Unlimited private projects", "realtime_collab": "Real-time collaboration", "realtime_collab_info": "When you’re working together, you can see your collaborators’ cursors and their changes in real time, so everyone always has the latest version.", "hundreds_templates": "Hundreds of templates", "hundreds_templates_info": "Produce beautiful documents starting from our gallery of LaTeX templates for journals, conferences, theses, reports, CVs and much more.", "instant_access": "Get instant access to __appName__", "tagline_personal": "Ideal when working solo", "tagline_collaborator": "Great for shared projects", "tagline_professional": "For those working with many", "tagline_student_annual": "Save even more", "tagline_student_monthly": "Great for a single term", "all_premium_features": "All premium features", "sync_dropbox_github": "Sync with Dropbox and GitHub", "demonstrating_git_integration": "Demonstrating Git integration", "collaborate_online_and_offline": "Collaborate online and offline, using your own workflow", "get_collaborative_benefits": "Get the collaborative benefits from __appName__, even if you prefer to work offline", "use_your_own_machine": "Use your own machine, with your own setup", "store_your_work": "Store your work on your own infrastructure", "track_changes": "Track changes", "tooltip_hide_pdf": "Click to hide the PDF", "tooltip_show_pdf": "Click to show the PDF", "tooltip_hide_filetree": "Click to hide the file-tree", "tooltip_show_filetree": "Click to show the file-tree", "cannot_verify_user_not_robot": "Sorry, we could not verify that you are not a robot. Please check that Google reCAPTCHA is not being blocked by an ad blocker or firewall.", "uncompiled_changes": "Uncompiled Changes", "code_check_failed": "Code check failed", "code_check_failed_explanation": "Your code has errors that need to be fixed before the auto-compile can run", "tags_slash_folders": "Tags/Folders", "file_already_exists": "A file or folder with this name already exists", "import_project_to_v2": "Import Project to V2", "open_in_v1": "Open in V1", "import_to_v2": "Import to V2", "never_mind_open_in_v1": "Never mind, open in V1", "yes_im_sure": "Yes, I'm sure", "drop_files_here_to_upload": "Drop files here to upload", "drag_here": "drag here", "creating_project": "Creating project", "select_a_zip_file": "Select a .zip file", "drag_a_zip_file": "drag a .zip file", "v1_badge": "V1 Badge", "v1_projects": "V1 Projects", "open_your_billing_details_page": "Open Your Billing Details Page", "try_out_link_sharing": "Try the new link sharing feature!", "try_link_sharing": "Try Link Sharing", "try_link_sharing_description": "Give access to your project by simply sharing a link.", "learn_more_about_link_sharing": "Learn more about Link Sharing", "link_sharing": "Link sharing", "tc_switch_everyone_tip": "Toggle track-changes for everyone", "tc_switch_user_tip": "Toggle track-changes for this user", "tc_switch_guests_tip": "Toggle track-changes for all link-sharing guests", "tc_guests": "Guests", "select_all_projects": "Select all", "select_project": "Select", "main_file_not_found": "Unknown main document", "please_set_main_file": "Please choose the main file for this project in the project menu. ", "link_sharing_is_off": "Link sharing is off, only invited users can view this project.", "turn_on_link_sharing": "Turn on link sharing", "link_sharing_is_on": "Link sharing is on", "turn_off_link_sharing": "Turn off link sharing", "anyone_with_link_can_edit": "Anyone with this link can edit this project", "anyone_with_link_can_view": "Anyone with this link can view this project", "turn_on_link_sharing_consequences": "When link sharing is enabled, anyone with the relevant link will be able to access or edit this project", "turn_off_link_sharing_consequences": "When link sharing is disabled, only people who are invited to this project will be have access", "autocompile_disabled": "Autocompile disabled", "autocompile_disabled_reason": "Due to high server load, background recompilation has been temporarily disabled. Please recompile by clicking the button above.", "auto_compile_onboarding_description": "When enabled, your project will compile as you type.", "try_out_auto_compile_setting": "Try out the new auto compile setting!", "got_it": "Got it", "pdf_compile_in_progress_error": "A previous compile is still running. Please wait a minute and try compiling again.", "pdf_compile_try_again": "Please wait for your other compile to finish before trying again.", "invalid_email": "An email address is invalid", "auto_compile": "Auto Compile", "on": "On", "tc_everyone": "Everyone", "per_user_tc_title": "Per-user Track Changes", "you_can_use_per_user_tc": "Now you can use Track Changes on a per-user basis", "turn_tc_on_individuals": "Turn Track Changes on for individuals users", "keep_tc_on_like_before": "Or keep it on for everyone, like before", "auto_close_brackets": "Auto-close Brackets", "auto_pair_delimiters": "Auto-Pair Delimiters", "successfull_dropbox_link": "Dropbox successfully linked, redirecting to settings page.", "show_link": "Show Link", "hide_link": "Hide Link", "aggregate_changed": "Changed", "aggregate_to": "to", "confirm_password_to_continue": "Confirm password to continue", "confirm_password_footer": "We won't ask for your password again for a while.", "accept_all": "Accept all", "reject_all": "Reject all", "bulk_accept_confirm": "Are you sure you want to accept the selected __nChanges__ changes?", "bulk_reject_confirm": "Are you sure you want to reject the selected __nChanges__ changes?", "uncategorized": "Uncategorized", "pdf_compile_rate_limit_hit": "Compile rate limit hit", "project_flagged_too_many_compiles": "This project has been flagged for compiling too often. The limit will be lifted shortly.", "reauthorize_github_account": "Reauthorize your GitHub Account", "github_credentials_expired": "Your GitHub authorization credentials have expired", "hit_enter_to_reply": "Hit Enter to reply", "add_your_comment_here": "Add your comment here", "resolved_comments": "Resolved comments", "try_it_for_free": "Try it for free", "please_ask_the_project_owner_to_upgrade_to_track_changes": "Please ask the project owner to upgrade to use track changes", "mark_as_resolved": "Mark as resolved", "reopen": "Re-open", "add_comment": "Add comment", "no_resolved_threads": "No resolved threads", "upgrade_to_track_changes": "Upgrade to Track Changes", "see_changes_in_your_documents_live": "See changes in your documents, live", "track_any_change_in_real_time": "Track any change, in real-time", "review_your_peers_work": "Review your peers' work", "accept_or_reject_each_changes_individually": "Accept or reject each change individually", "accept": "Accept", "reject": "Reject", "no_comments": "No comments", "edit": "Edit", "are_you_sure": "Are you sure?", "resolve": "Resolve", "reply": "Reply", "quoted_text_in": "Quoted text in", "review": "Review", "track_changes_is_on": "Track changes is <strong>on</strong>", "track_changes_is_off": "Track changes is <strong>off</strong>", "current_file": "Current file", "overview": "Overview", "tracked_change_added": "Added", "tracked_change_deleted": "Deleted", "show_all": "show all", "show_less": "show less", "dropbox_sync_error": "Dropbox Sync Error", "send": "Send", "sending": "Sending", "invalid_password": "Invalid Password", "error": "Error", "other_actions": "Other Actions", "send_test_email": "Send a test email", "email_sent": "Email Sent", "create_first_admin_account": "Create the first Admin account", "ldap": "LDAP", "ldap_create_admin_instructions": "Choose an email address for the first __appName__ admin account. This should correspond to an account in the LDAP system. You will then be asked to log in with this account.", "saml": "SAML", "saml_create_admin_instructions": "Choose an email address for the first __appName__ admin account. This should correspond to an account in the SAML system. You will then be asked to log in with this account.", "admin_user_created_message": "Created admin user, <a href=\"__link__\">Log in here</a> to continue", "status_checks": "Status Checks", "editor_resources": "Editor Resources", "checking": "Checking", "cannot_invite_self": "Can't send invite to yourself", "cannot_invite_non_user": "Can't send invite. Recipient must already have a __appName__ account", "log_in_with": "Log in with __provider__", "return_to_login_page": "Return to Login page", "login_failed": "Login failed", "delete_account_warning_message_3": "You are about to permanently <strong>delete all of your account data</strong>, including your projects and settings. Please type your account email address and password in the boxes below to proceed.", "delete_account_warning_message_2": "You are about to permanently <strong>delete all of your account data</strong>, including your projects and settings. Please type your account email address into the box below to proceed.", "your_sessions": "Your Sessions", "clear_sessions_description": "This is a list of other sessions (logins) which are active on your account, not including your current session. Click the \"Clear Sessions\" button below to log them out.", "no_other_sessions": "No other sessions active", "ip_address": "IP Address", "session_created_at": "Session Created At", "clear_sessions": "Clear Sessions", "clear_sessions_success": "Sessions Cleared", "sessions": "Sessions", "manage_sessions": "Manage Your Sessions", "syntax_validation": "Code check", "history": "History", "joining": "Joining", "open_project": "Open Project", "files_cannot_include_invalid_characters": "File name is empty or contains invalid characters", "invalid_file_name": "Invalid File Name", "autocomplete_references": "Reference Autocomplete (inside a <code>\\cite{}</code> block)", "autocomplete": "Autocomplete", "failed_compile_check": "It looks like your project has some fatal syntax errors that you should fix before we compile it", "failed_compile_check_try": "Try compiling anyway", "failed_compile_option_or": "or", "failed_compile_check_ignore": "turn off syntax checking", "compile_time_checks": "Syntax Checks", "stop_on_validation_error": "Check syntax before compile", "ignore_validation_errors": "Don't check syntax", "run_syntax_check_now": "Run syntax check now", "your_billing_details_were_saved": "Your billing details were saved", "security_code": "Security code", "paypal_upgrade": "To upgrade, click on the button below and log on to PayPal using your email and password.", "upgrade_cc_btn": "Upgrade now, pay after 7 days", "upgrade_paypal_btn": "Continue", "notification_project_invite": "<b>__userName__</b> would like you to join <b>__projectName__</b> <a class=\"btn btn-sm btn-info pull-right\" href=\"/project/__projectId__/invite/token/__token__\">Join Project</a>", "file_restored": "Your file (__filename__) has been recovered.", "file_restored_back_to_editor": "You can go back to the editor and work on it again.", "file_restored_back_to_editor_btn": "Back to editor", "view_project": "View Project", "join_project": "Join Project", "invite_not_accepted": "Invite not yet accepted", "resend": "Resend", "syntax_check": "Syntax check", "revoke": "Revoke", "revoke_invite": "Revoke Invite", "pending": "Pending", "invite_not_valid": "This is not a valid project invite", "invite_not_valid_description": "The invite may have expired. Please contact the project owner", "accepting_invite_as": "You are accepting this invite as", "accept_invite": "Accept invite", "log_hint_ask_extra_feedback": "Can you help us understand why this hint wasn't helpful?", "log_hint_extra_feedback_didnt_understand": "I didn’t understand the hint", "log_hint_extra_feedback_not_applicable": "I can’t apply this solution to my document", "log_hint_extra_feedback_incorrect": "This doesn’t fix the error", "log_hint_extra_feedback_other": "Other:", "log_hint_extra_feedback_submit": "Submit", "if_you_are_registered": "If you are already registered", "stop_compile": "Stop compilation", "terminated": "Compilation cancelled", "compile_terminated_by_user": "The compile was cancelled using the 'Stop Compilation' button. You can download the raw logs to see where the compile stopped.", "site_description": "An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.", "knowledge_base": "knowledge base", "contact_message_label": "Message", "kb_suggestions_enquiry": "Have you checked our <0>__kbLink__</0>?", "answer_yes": "Yes", "answer_no": "No", "log_hint_extra_info": "Learn more", "log_hint_feedback_label": "Was this hint helpful?", "log_hint_feedback_gratitude": "Thank you for your feedback!", "recompile_pdf": "Recompile the PDF", "about_paulo_reis": "is a front-end software developer and user experience researcher living in Aveiro, Portugal. Paulo has a PhD in user experience and is passionate about shaping technology towards human usage — either in concept or testing/validation, in design or implementation.", "login_or_password_wrong_try_again": "Your login or password is incorrect. Please try again", "manage_beta_program_membership": "Manage Beta Program Membership", "beta_program_opt_out_action": "Opt-Out of Beta Program", "disable_beta": "Disable Beta", "beta_badge_tooltip": "We made some improvements to __feature__. We hope you like it! Click here to manage your beta program membership", "beta_program_badge_description": "While using __appName__, you will see beta features marked with this badge:", "beta_program_current_beta_features_description": "We are currently testing the following new features in beta:", "enable_beta": "Enable Beta", "user_in_beta_program": "User is participating in Beta Program", "beta_program_already_participating": "You are enrolled in the Beta Program", "sharelatex_beta_program": "__appName__ Beta Program", "beta_program_benefits": "We're always improving __appName__. By joining our Beta program you can have early access to new features and help us understand your needs better.", "beta_program_opt_in_action": "Opt-In to Beta Program", "conflicting_paths_found": "Conflicting Paths Found", "following_paths_conflict": "The following files and folders conflict with the same path", "open_a_file_on_the_left": "Open a file on the left", "reference_error_relink_hint": "If this error persists, try re-linking your account here:", "pdf_rendering_error": "PDF Rendering Error", "something_went_wrong_rendering_pdf": "Something went wrong while rendering this PDF.", "mendeley_reference_loading_error_expired": "Mendeley token expired, please re-link your account", "zotero_reference_loading_error_expired": "Zotero token expired, please re-link your account", "mendeley_reference_loading_error_forbidden": "Could not load references from Mendeley, please re-link your account and try again", "zotero_reference_loading_error_forbidden": "Could not load references from Zotero, please re-link your account and try again", "mendeley_integration": "Mendeley Integration", "mendeley_sync_description": "With Mendeley integration you can import your references from Mendeley into your __appName__ projects.", "mendeley_is_premium": "Mendeley Integration is a premium feature", "link_to_mendeley": "Link to Mendeley", "unlink_to_mendeley": "Unlink Mendeley", "mendeley_reference_loading": "Loading references from Mendeley", "mendeley_reference_loading_success": "Loaded references from Mendeley", "mendeley_reference_loading_error": "Error, could not load references from Mendeley", "mendeley_groups_loading_error": "There was an error loading groups from Mendeley", "zotero_integration": "Zotero Integration.", "zotero_sync_description": "With Zotero integration you can import your references from Zotero into your __appName__ projects.", "zotero_is_premium": "Zotero Integration is a premium feature", "link_to_zotero": "Link to Zotero", "unlink_to_zotero": "Unlink Zotero", "zotero_reference_loading": "Loading references from Zotero", "zotero_reference_loading_success": "Loaded references from Zotero", "zotero_reference_loading_error": "Error, could not load references from Zotero", "zotero_groups_loading_error": "There was an error loading groups from Zotero", "reference_import_button": "Import References to", "unlink_reference": "Unlink References Provider", "unlink_warning_reference": "Warning: When you unlink your account from this provider you will not be able to import references into your projects.", "mendeley": "Mendeley", "zotero": "Zotero", "from_provider": "From __provider__", "suggest_new_doc": "Suggest new doc", "request_sent_thank_you": "Message sent! Our team will review it and reply by email.", "suggestion": "Suggestion", "project_url": "Affected project URL", "subject": "Subject", "confirm": "Confirm", "cancel_personal_subscription_first": "You already have a personal subscription, would you like us to cancel this first before joining the group licence?", "delete_projects": "Delete Projects", "leave_projects": "Leave Projects", "delete_and_leave_projects": "Delete and Leave Projects", "too_recently_compiled": "This project was compiled very recently, so this compile has been skipped.", "clsi_maintenance": "The compile servers are down for maintenance, and will be back shortly.", "references_search_hint": "Press CTRL-Space to Search", "ask_proj_owner_to_upgrade_for_references_search": "Please ask the project owner to upgrade to use the References Search feature.", "ask_proj_owner_to_upgrade_for_faster_compiles": "Please ask the project owner to upgrade for faster compiles and to increase the timeout limit.", "search_bib_files": "Search by author, title, year", "leave_group": "Leave group", "leave_now": "Leave now", "sure_you_want_to_leave_group": "Are you sure you want to leave this group?", "notification_group_invite": "You have been invited to join the __groupName__, <a href=\"/user/subscription/__subscription_id__/group/invited\">Join Here</a>.", "search_references": "Search the .bib files in this project", "no_search_results": "No Search Results", "email_already_registered": "This email is already registered", "compile_mode": "Compile Mode", "normal": "Normal", "fast": "Fast", "rename_folder": "Rename Folder", "delete_folder": "Delete Folder", "about_to_delete_folder": "You are about to delete the following folders (any projects in them will not be deleted):", "to_modify_your_subscription_go_to": "To modify your subscription go to", "manage_subscription": "Manage Subscription", "activate_account": "Activate your account", "yes_please": "Yes Please!", "nearly_activated": "You're one step away from activating your __appName__ account!", "please_set_a_password": "Please set a password", "activation_token_expired": "Your activation token has expired, you will need to get another one sent to you.", "activate": "Activate", "activating": "Activating", "ill_take_it": "I'll take it!", "cancel_your_subscription": "Stop Your Subscription", "no_thanks_cancel_now": "No thanks, I still want to cancel", "cancel_my_account": "Cancel my subscription", "sure_you_want_to_cancel": "Are you sure you want to cancel?", "i_want_to_stay": "I want to stay", "have_more_days_to_try": "Have another <strong>__days__ days</strong> on your Trial!", "interested_in_cheaper_plan": "Would you be interested in the cheaper <strong>__price__</strong> student plan?", "session_expired_redirecting_to_login": "Session Expired. Redirecting to login page in __seconds__ seconds", "maximum_files_uploaded_together": "Maximum __max__ files uploaded together", "too_many_files_uploaded_throttled_short_period": "Too many files uploaded, your uploads have been throttled for short period. Please wait 15 minutes and try again.", "compile_larger_projects": "Compile larger projects", "upgrade_to_get_feature": "Upgrade to get __feature__, plus:", "new_group": "New Group", "about_to_delete_groups": "You are about to delete the following groups:", "removing": "Removing", "adding": "Adding", "groups": "Groups", "rename_group": "Rename Group", "renaming": "Renaming", "create_group": "Create Group", "delete_group": "Delete Group", "delete_groups": "Delete Groups", "your_groups": "Your Groups", "group_name": "Group Name", "no_groups": "No Groups", "Subscription": "Subscription", "Documentation": "Documentation", "Universities": "Universities", "Account Settings": "Account Settings", "Projects": "Projects", "Account": "Account", "global": "global", "Terms": "Terms", "Security": "Security", "About": "About", "editor_disconected_click_to_reconnect": "Editor disconnected, click anywhere to reconnect.", "word_count": "Word Count", "please_compile_pdf_before_word_count": "Please compile your project before performing a word count", "total_words": "Total Words", "headers": "Headers", "math_inline": "Math Inline", "math_display": "Math Display", "connected_users": "Connected Users", "projects": "Projects", "upload_project": "Upload Project", "all_projects": "All Projects", "your_projects": "Your Projects", "shared_with_you": "Shared with you", "deleted_projects": "Deleted Projects", "templates": "Templates", "new_folder": "New Folder", "create_your_first_project": "Create your first project!", "complete": "Complete", "on_free_sl": "You are using the free version of __appName__", "upgrade": "Upgrade", "or_unlock_features_bonus": "or unlock some free bonus features by", "sharing_sl": "sharing __appName__", "add_to_folder": "Add to folder", "create_new_folder": "Create New Folder", "more": "More", "rename": "Rename", "make_copy": "Make a copy", "restore": "Restore", "title": "Title", "last_modified": "Last Modified", "no_projects": "No projects", "welcome_to_sl": "Welcome to __appName__!", "new_to_latex_look_at": "New to LaTeX? Start by having a look at our", "or": "or", "or_create_project_left": "or create your first project on the left.", "thanks_settings_updated": "Thanks, your settings have been updated.", "update_account_info": "Update Account Info", "must_be_email_address": "Must be an email address", "first_name": "First Name", "last_name": "Last Name", "update": "Update", "change_password": "Change Password", "current_password": "Current Password", "new_password": "New Password", "confirm_new_password": "Confirm New Password", "required": "Required", "doesnt_match": "Doesn't match", "dropbox_integration": "Dropbox Integration", "learn_more": "Learn more", "dropbox_is_premium": "Dropbox sync is a premium feature", "account_is_linked": "Account is linked", "unlink_dropbox": "Unlink Dropbox", "link_to_dropbox": "Link to Dropbox", "newsletter_info_and_unsubscribe": "Every few months we send a newsletter out summarizing the new features available. If you would prefer not to receive this email then you can unsubscribe at any time:", "unsubscribed": "Unsubscribed", "unsubscribing": "Unsubscribing", "unsubscribe": "Unsubscribe", "need_to_leave": "Need to leave?", "delete_your_account": "Delete your account", "delete_account": "Delete Account", "delete_account_warning_message": "You are about to permanently <strong>delete all of your account data</strong>, including your projects and settings. Please type your account email address into the box below to proceed.", "deleting": "Deleting", "delete": "Delete", "sl_benefits_plans": "__appName__ is the world's easiest to use LaTeX editor. Stay up to date with your collaborators, keep track of all changes to your work, and use our LaTeX environment from anywhere in the world.", "monthly": "Monthly", "personal": "Personal", "free": "Free", "one_collaborator": "Only one collaborator", "collaborator": "Collaborator", "collabs_per_proj": "__collabcount__ collaborators per project", "full_doc_history": "Full document history", "sync_to_dropbox": "Sync to Dropbox", "start_free_trial": "Start Free Trial!", "professional": "Professional", "unlimited_collabs": "Unlimited collaborators", "name": "Name", "student": "Student", "university": "University", "position": "Position", "choose_plan_works_for_you": "Choose the plan that works for you with our __len__-day free trial. Cancel at any time.", "interested_in_group_licence": "Interested in using __appName__ with a group, team or department wide account?", "get_in_touch_for_details": "Get in touch for details!", "group_plan_enquiry": "Group Plan Enquiry", "enjoy_these_features": "Enjoy all of these great features", "create_unlimited_projects": "Create as many projects as you need.", "never_loose_work": "Never lose a step, we've got your back.", "access_projects_anywhere": "Access your projects everywhere.", "log_in": "Log In", "login": "Login", "logging_in": "Logging in", "forgot_your_password": "Forgot your password", "password_reset": "Password Reset", "password_reset_email_sent": "You have been sent an email to complete your password reset.", "please_enter_email": "Please enter your email address", "request_password_reset": "Request password reset", "reset_your_password": "Reset your password", "password_has_been_reset": "Your password has been reset", "login_here": "Login here", "set_new_password": "Set new password", "user_wants_you_to_see_project": "__username__ would like you to join __projectname__", "join_sl_to_view_project": "Join __appName__ to view this project", "register_to_edit_template": "Please register to edit the __templateName__ template", "already_have_sl_account": "Already have a __appName__ account?", "register": "Register", "password": "Password", "registering": "Registering", "planned_maintenance": "Planned Maintenance", "no_planned_maintenance": "There is currently no planned maintenance", "cant_find_page": "Sorry, we can't find the page you are looking for.", "take_me_home": "Take me home!", "no_preview_available": "Sorry, no preview is available.", "no_messages": "No messages", "send_first_message": "Send your first message to your collaborators", "account_not_linked_to_dropbox": "Your account is not linked to Dropbox", "update_dropbox_settings": "Update Dropbox Settings", "refresh_page_after_starting_free_trial": "Please refresh this page after starting your free trial.", "refresh_page_after_linking_dropbox": "Please refresh this page after linking your account to Dropbox.", "checking_dropbox_status": "Checking Dropbox status", "manage_files_from_your_dropbox_folder": "Manage files from your Dropbox folder", "have_an_extra_backup": "Have an extra backup", "work_with_non_overleaf_users": "Work with non Overleaf users", "work_offline": "Work offline", "easily_manage_your_project_files_everywhere": "Easily manage your project files, everywhere", "dismiss": "Dismiss", "deleted_files": "Deleted Files", "new_file": "New File", "upload_file": "Upload File", "create": "Create", "creating": "Creating", "upload_files": "Upload File(s)", "sure_you_want_to_delete": "Are you sure you want to permanently delete the following files?", "common": "Common", "navigation": "Navigation", "editing": "Editing", "ok": "OK", "source": "Source", "actions": "Actions", "copy_project": "Copy Project", "publish_as_template": "Manage Template", "sync": "Sync", "settings": "Settings", "main_document": "Main document", "off": "Off", "auto_complete": "Auto-complete", "theme": "Theme", "font_size": "Font Size", "pdf_viewer": "PDF Viewer", "built_in": "Built-In", "native": "Native", "show_hotkeys": "Show Hotkeys", "new_name": "New Name", "copying": "Copying", "copy": "Copy", "compiling": "Compiling", "click_here_to_preview_pdf": "Click here to preview your work as a PDF.", "server_error": "Server Error", "somthing_went_wrong_compiling": "Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.", "timedout": "Timed out", "proj_timed_out_reason": "Sorry, your compile took too long to run and timed out. This may be due to a LaTeX error, or a large number of high-res images or complicated diagrams.", "no_errors_good_job": "No errors, good job!", "compile_error": "Compile Error", "generic_failed_compile_message": "Sorry, your LaTeX code couldn't compile for some reason. Please check the errors below for details, or view the raw log", "other_logs_and_files": "Other logs and files", "view_raw_logs": "View Raw Logs", "hide_raw_logs": "Hide Raw Logs", "clear_cache": "Clear cache", "clear_cache_explanation": "This will clear all hidden LaTeX files (.aux, .bbl, etc) from our compile server. You generally don't need to do this unless you're having trouble with references.", "clear_cache_is_safe": "Your project files will not be deleted or changed.", "clearing": "Clearing", "template_description": "Template Description", "project_last_published_at": "Your project was last published at", "template_title_taken_from_project_title": "The template title will be taken automatically from the project title", "problem_talking_to_publishing_service": "There is a problem with our publishing service, please try again in a few minutes", "unpublishing": "Unpublishing", "republish": "Republish", "publishing": "Publishing", "share_project": "Share Project", "this_project_is_private": "This project is private and can only be accessed by the people below.", "make_public": "Make Public", "this_project_is_public": "This project is public and can be edited by anyone with the URL.", "make_private": "Make Private", "can_edit": "Can Edit", "share_with_your_collabs": "Share with your collaborators", "share": "Share", "need_to_upgrade_for_more_collabs": "You need to upgrade your account to add more collaborators", "make_project_public": "Make project public", "make_project_public_consequences": "If you make your project public then anyone with the URL will be able to access it.", "allow_public_editing": "Allow public editing", "allow_public_read_only": "Allow public read only access", "make_project_private": "Disable link-sharing", "make_project_private_consequences": "If you make your project private then only the people you choose to share it with will have access.", "need_to_upgrade_for_history": "You need to upgrade your account to use the History feature.", "ask_proj_owner_to_upgrade_for_history": "Please ask the project owner to upgrade to use the History feature.", "anonymous": "Anonymous", "generic_something_went_wrong": "Sorry, something went wrong", "generic_if_problem_continues_contact_us": "If the problem continues please contact us", "restoring": "Restoring", "restore_to_before_these_changes": "Restore to before these changes", "profile_complete_percentage": "Your profile is __percentval__% complete", "file_has_been_deleted": "__filename__ has been deleted", "sure_you_want_to_restore_before": "Are you sure you want to restore <0>__filename__</0> to before the changes on __date__?", "rename_project": "Rename Project", "about_to_delete_projects": "You are about to delete the following projects:", "about_to_leave_projects": "You are about to leave the following projects:", "upload_zipped_project": "Upload Zipped Project", "upload_a_zipped_project": "Upload a zipped project", "your_profile": "Your Profile", "institution": "Institution", "role": "Role", "folders": "Folders", "disconnected": "Disconnected", "please_refresh": "Please refresh the page to continue.", "lost_connection": "Lost Connection", "reconnecting_in_x_secs": "Reconnecting in __seconds__ secs", "try_now": "Try Now", "reconnecting": "Reconnecting", "saving_notification_with_seconds": "Saving __docname__... (__seconds__ seconds of unsaved changes)", "help_us_spread_word": "Help us spread the word about __appName__", "share_sl_to_get_rewards": "Share __appName__ with your friends and colleagues and unlock the rewards below", "post_on_facebook": "Post on Facebook", "share_us_on_googleplus": "Share us on Google+", "email_us_to_your_friends": "Email us to your friends", "link_to_us": "Link to us from your website", "direct_link": "Direct Link", "sl_gives_you_free_stuff_see_progress_below": "When someone starts using __appName__ after your recommendation we'll give you some <strong>free stuff</strong> to say thanks! Check your progress below.", "spread_the_word_and_fill_bar": "Spread the word and fill this bar up", "one_free_collab": "One free collaborator", "three_free_collab": "Three free collaborators", "free_dropbox_and_history": "Free Dropbox and History", "you_not_introed_anyone_to_sl": "You've not introduced anyone to __appName__ yet. Get sharing!", "you_introed_small_number": " You've introduced <0>__numberOfPeople__</0> person to __appName__. Good job, but can you get some more?", "you_introed_high_number": " You've introduced <0>__numberOfPeople__</0> people to __appName__. Good job!", "link_to_sl": "Link to __appName__", "can_link_to_sl_with_html": "You can link to __appName__ with the following HTML:", "year": "year", "month": "month", "subscribe_to_this_plan": "Subscribe to this plan", "your_plan": "Your plan", "your_new_plan": "Your new plan", "your_subscription": "Your Subscription", "on_free_trial_expiring_at": "You are currently using a free trial which expires on __expiresAt__.", "choose_a_plan_below": "Choose a plan below to subscribe to.", "currently_subscribed_to_plan": "You are currently subscribed to the <0>__planName__</0> plan.", "your_plan_is_changing_at_term_end": "Your plan is changing to <0>__pendingPlanName__</0> at the end of the current billing period.", "want_change_to_apply_before_plan_end": "If you wish this change to apply before the end of your current billing period, please contact us.", "change_plan": "Change plan", "next_payment_of_x_collectected_on_y": "The next payment of <0>__paymentAmmount__</0> will be collected on <1>__collectionDate__</1>.", "additional_licenses": "Your subscription includes <0>__additionalLicenses__</0> additional license(s) for a total of <1>__totalLicenses__</1> licenses.", "pending_additional_licenses": "Your subscription is changing to include <0>__pendingAdditionalLicenses__</0> additional license(s) for a total of <1>__pendingTotalLicenses__</1> licenses.", "update_your_billing_details": "Update Your Billing Details", "subscription_canceled_and_terminate_on_x": " Your subscription has been canceled and will terminate on <0>__terminateDate__</0>. No further payments will be taken.", "your_subscription_has_expired": "Your subscription has expired.", "account_has_past_due_invoice_change_plan_warning": "Your account currently has a past due invoice. You will not be able to change your plan until this is resolved.", "create_new_subscription": "Create New Subscription", "problem_with_subscription_contact_us": "There is a problem with your subscription. Please contact us for more information.", "manage_group": "Manage Group", "loading_billing_form": "Loading billing details form", "you_have_added_x_of_group_size_y": "You have added <0>__addedUsersSize__</0> of <1>__groupSize__</1> available members", "remove_from_group": "Remove from group", "group_account": "Group Account", "registered": "Registered", "no_members": "No members", "add_more_members": "Add more members", "add": "Add", "thanks_for_subscribing": "Thanks for subscribing!", "your_card_will_be_charged_soon": "Your card will be charged soon.", "if_you_dont_want_to_be_charged": "If you do not want to be charged again ", "add_your_first_group_member_now": "Add your first group members now", "thanks_for_subscribing_you_help_sl": "Thank you for subscribing to the __planName__ plan. It's support from people like yourself that allows __appName__ to continue to grow and improve.", "back_to_your_projects": "Back to your projects", "goes_straight_to_our_inboxes": "It goes straight to both our inboxes", "need_anything_contact_us_at": "If there is anything you ever need please feel free to contact us directly at", "regards": "Regards", "about": "About", "comment": "Comment", "restricted_no_permission": "Restricted, sorry you don't have permission to load this page.", "online_latex_editor": "Online LaTeX Editor", "meet_team_behind_latex_editor": "Meet the team behind your favourite online LaTeX editor.", "follow_me_on_twitter": "Follow me on Twitter", "motivation": "Motivation", "evolved": "Evolved", "the_easy_online_collab_latex_editor": "The easy to use, online, collaborative LaTeX editor", "get_started_now": "Get started now", "sl_used_over_x_people_at": "__appName__ is used by over __numberOfUsers__ students and academics at:", "collaboration": "Collaboration", "work_on_single_version": "Work together on a single version", "view_collab_edits": "View collaborator edits ", "view_collab_edits_in_real_time": "View collaborator edits in real time.", "ease_of_use": " Ease of Use", "no_complicated_latex_install": "No complicated LaTeX installation", "all_packages_and_templates": "All the packages and <0>__templatesLink__</0> you need", "document_history": "Document history", "see_what_has_been": "See what has been ", "added": "added", "and": "and", "removed": "removed", "restore_to_any_older_version": "Restore to any older version", "work_from_anywhere": "Work from anywhere", "acces_work_from_anywhere": "Access your work from anywhere in the world", "work_offline_and_sync_with_dropbox": "Work offline and sync your files via Dropbox and GitHub", "over": "over", "view_templates": "View templates", "nothing_to_install_ready_to_go": "There's nothing complicated or difficult for you to install, and you can <0>__start_now__</0>, even if you've never seen it before. __appName__ comes with a complete, ready to go LaTeX environment which runs on our servers.", "start_using_latex_now": "start using LaTeX right now", "get_same_latex_setup": "With __appName__ you get the same LaTeX set-up wherever you go. By working with your colleagues and students on __appName__, you know that you're not going to hit any version inconsistencies or package conflicts.", "support_lots_of_features": "We support almost all LaTeX features, including inserting images, bibliographies, equations, and much more! Read about all the exciting things you can do with __appName__ in our <0>__help_guides_link__</0>", "latex_guides": "LaTeX guides", "reset_password": "Reset Password", "set_password": "Set Password", "updating_site": "Updating Site", "bonus_please_recommend_us": "Bonus - Please recommend us", "admin": "admin", "subscribe": "Subscribe", "update_billing_details": "Update Billing Details", "group_admin": "Group Admin", "all_templates": "All Templates", "your_settings": "Your settings", "maintenance": "Maintenance", "to_many_login_requests_2_mins": "This account has had too many login requests. Please wait 2 minutes before trying to log in again", "email_or_password_wrong_try_again": "Your email or password is incorrect. Please try again", "rate_limit_hit_wait": "Rate limit hit. Please wait a while before retrying", "problem_changing_email_address": "There was a problem changing your email address. Please try again in a few moments. If the problem continues please contact us.", "single_version_easy_collab_blurb": "__appName__ makes sure that you're always up to date with your collaborators and what they are doing. There is only a single master version of each document which everyone has access to. It's impossible to make conflicting changes, and you don't have to wait for your colleagues to send you the latest draft before you can keep working.", "can_see_collabs_type_blurb": "If multiple people want to work on a document at the same time then that's no problem. You can see where your colleagues are typing directly in the editor and their changes show up on your screen immediately.", "work_directly_with_collabs": "Work directly with your collaborators", "work_with_word_users": "Work with Word users", "work_with_word_users_blurb": "__appName__ is so easy to get started with that you'll be able to invite your non-LaTeX colleagues to contribute directly to your LaTeX documents. They'll be productive from day one and be able to pick up small amounts of LaTeX as they go.", "view_which_changes": "View which changes have been", "sl_included_history_of_changes_blurb": "__appName__ includes a history of all of your changes so you can see exactly who changed what, and when. This makes it extremely easy to keep up to date with any progress made by your collaborators and allows you to review recent work.", "can_revert_back_blurb": "In a collaboration or on your own, sometimes mistakes are made. Reverting back to previous versions is simple and removes the risk of losing work or regretting a change.", "start_using_sl_now": "Start using __appName__ now", "over_x_templates_easy_getting_started": "There are thousands of __templates__ in our template gallery, so it's really easy to get started, whether you're writing a journal article, thesis, CV or something else.", "done": "Done", "change": "Change", "change_or_cancel-change": "Change", "change_or_cancel-or": "or", "change_or_cancel-cancel": "cancel", "page_not_found": "Page Not Found", "please_see_help_for_more_info": "Please see our help guide for more information", "this_project_will_appear_in_your_dropbox_folder_at": "This project will appear in your Dropbox folder at ", "member_of_group_subscription": "You are a member of a group subscription managed by __admin_email__. Please contact them to manage your subscription.\n", "about_henry_oswald": "is a software engineer living in London. He built the original prototype of __appName__ and has been responsible for building a stable and scalable platform. Henry is a strong advocate of Test Driven Development and makes sure we keep the __appName__ code clean and easy to maintain.", "about_james_allen": "has a PhD in theoretical physics and is passionate about LaTeX. He created one of the first online LaTeX editors, ScribTeX, and has played a large role in developing the technologies that make __appName__ possible.", "two_strong_principles_behind_sl": "There are two strong driving principles behind our work on __appName__:", "want_to_improve_workflow_of_as_many_people_as_possible": "We want to improve the workflow of as many people as possible.", "detail_on_improve_peoples_workflow": "LaTeX is notoriously hard to use, and collaboration is always difficult to coordinate. We believe that we've developed some great solutions to help people who face these problems, and we want to make sure that __appName__ is accessible to as many people as possible. We've tried to keep our pricing fair, and have released much of __appName__ as open source so that anyone can host their own.", "want_to_create_sustainable_lasting_legacy": "We want to create a sustainable and lasting legacy.", "details_on_legacy": "Development and maintenance of a product like __appName__ takes a lot of time and work, so it's important that we can find a business model that will support this both now, and in the long term. We don't want __appName__ to be dependent on external funding or disappear due to a failed business model. I'm pleased to say that we're currently able to run __appName__ profitably and sustainably, and expect to be able to do so in the long term.", "get_in_touch": "Get in touch", "want_to_hear_from_you_email_us_at": "We'd love to hear from anyone who is using __appName__, or wants to have a chat about what we're doing. You can get in touch with us at ", "cant_find_email": "That email address is not registered, sorry.", "plans_amper_pricing": "Plans &amp; Pricing", "documentation": "Documentation", "account": "Account", "subscription": "Subscription", "log_out": "Log Out", "en": "English", "pt": "Portuguese", "es": "Spanish", "fr": "French", "de": "German", "it": "Italian", "da": "Danish", "sv": "Swedish", "no": "Norwegian", "nl": "Dutch", "pl": "Polish", "ru": "Russian", "uk": "Ukrainian", "ro": "Romanian", "click_here_to_view_sl_in_lng": "Click here to use __appName__ in <0>__lngName__</0>", "language": "Language", "upload": "Upload", "menu": "Menu", "full_screen": "Full screen", "logs_and_output_files": "Logs and output files", "download_pdf": "Download PDF", "split_screen": "Split screen", "clear_cached_files": "Clear cached files", "go_to_code_location_in_pdf": "Go to code location in PDF", "please_compile_pdf_before_download": "Please compile your project before downloading the PDF", "remove_collaborator": "Remove collaborator", "add_to_folders": "Add to folders", "download_zip_file": "Download .zip File", "download_file": "Download <0>__type__</0> file", "price": "Price", "close": "Close", "keybindings": "Keybindings", "restricted": "Restricted", "start_x_day_trial": "Start Your __len__-Day Free Trial Today!", "buy_now": "Buy Now!", "cs": "Czech", "view_all": "View All", "terms": "Terms", "privacy": "Privacy", "contact": "Contact", "change_to_this_plan": "Change to this plan", "keep_current_plan": "Keep my current plan", "processing": "processing", "sure_you_want_to_change_plan": "Are you sure you want to change plan to <0>__planName__</0>?", "sure_you_want_to_cancel_plan_change": "Are you sure you want to revert your scheduled plan change? You will remain subscribed to the <0>__planName__</0> plan.", "revert_pending_plan_change": "Revert scheduled plan change", "existing_plan_active_until_term_end": "Your existing plan and its features will remain active until the end of the current billing period.", "move_to_annual_billing": "Move to Annual Billing", "annual_billing_enabled": "Annual billing enabled", "move_to_annual_billing_now": "Move to annual billing now", "change_to_annual_billing_and_save": "Get <0>__percentage__</0> off with annual billing. If you switch now you'll save <1>__yearlySaving__</1> per year.", "missing_template_question": "Missing Template?", "tell_us_about_the_template": "If we are missing a template please either: Send us a copy of the template, a __appName__ url to the template or let us know where we can find the template. Also please let us know a little about the template for the description.", "email_us": "Email us", "this_project_is_public_read_only": "This project is public and can be viewed but not edited by anyone with the URL", "tr": "Turkish", "select_files": "Select file(s)", "drag_files": "drag file(s)", "upload_failed_sorry": "Upload failed, sorry :(", "inserting_files": "Inserting file...", "password_reset_token_expired": "Your password reset token has expired. Please request a new password reset email and follow the link there.", "merge_project_with_github": "Merge Project with GitHub", "pull_github_changes_into_sharelatex": "Pull GitHub changes into __appName__", "push_sharelatex_changes_to_github": "Push __appName__ changes to GitHub", "features": "Features", "commit": "Commit", "commiting": "Committing", "importing_and_merging_changes_in_github": "Importing and merging changes in GitHub", "upgrade_for_faster_compiles": "Upgrade for faster compiles and to increase your timeout limit", "free_accounts_have_timeout_upgrade_to_increase": "Free accounts have a one minute timeout, whereas upgraded accounts have a timeout of four minutes.", "learn_how_to_make_documents_compile_quickly": "Learn how to fix compile timeouts", "zh-CN": "Chinese", "cn": "Chinese (Simplified)", "sync_to_github": "Sync to GitHub", "sync_to_dropbox_and_github": "Sync to Dropbox and GitHub", "project_too_large": "Project too large", "project_too_large_please_reduce": "This project has too much editable text, please try and reduce it. The largest files are:", "project_too_much_editable_text": "This project has too much editable text, please try to reduce it.", "please_ask_the_project_owner_to_link_to_github": "Please ask the project owner to link this project to a GitHub repository", "go_to_pdf_location_in_code": "Go to PDF location in code", "ko": "Korean", "ja": "Japanese", "about_brian_gough": "is a software developer and former theoretical high energy physicist at Fermilab and Los Alamos. For many years he published free software manuals commercially using TeX and LaTeX and was also the maintainer of the GNU Scientific Library.", "first_few_days_free": "First __trialLen__ days free", "every": "per", "credit_card": "Credit Card", "credit_card_number": "Credit Card Number", "invalid": "Invalid", "expiry": "Expiry Date", "january": "January", "february": "February", "march": "March", "april": "April", "may": "May", "june": "June", "july": "July", "august": "August", "september": "September", "october": "October", "november": "November", "december": "December", "zip_post_code": "Zip / Post Code", "city": "City", "address": "Address", "coupon_code": "Coupon code", "country": "Country", "billing_address": "Billing Address", "upgrade_now": "Upgrade Now", "state": "State", "vat_number": "VAT Number", "you_have_joined": "You have joined __groupName__", "claim_premium_account": "You have claimed your premium account provided by __groupName__.", "you_are_invited_to_group": "You are invited to join __groupName__", "you_can_claim_premium_account": "You can claim a premium account provided by __groupName__ by verifying your email", "not_now": "Not now", "verify_email_join_group": "Verify email and join Group", "check_email_to_complete_group": "Please check your email to complete joining the group", "verify_email_address": "Verify Email Address", "group_provides_you_with_premium_account": "__groupName__ provides you with a premium account. Verifiy your email address to upgrade your account.", "check_email_to_complete_the_upgrade": "Please check your email to complete the upgrade", "email_link_expired": "Email link expired, please request a new one.", "services": "Services", "about_shane_kilkelly": "is a software developer living in Edinburgh. Shane is a strong advocate for Functional Programming, Test Driven Development and takes pride in building quality software.", "this_is_your_template": "This is your template from your project", "links": "Links", "account_settings": "Account Settings", "search_projects": "Search projects", "clone_project": "Clone Project", "delete_project": "Delete Project", "download_zip": "Download Zip", "new_project": "New Project", "blank_project": "Blank Project", "example_project": "Example Project", "from_template": "From Template", "cv_or_resume": "CV or Resume", "cover_letter": "Cover Letter", "journal_article": "Journal Article", "presentation": "Presentation", "thesis": "Thesis", "bibliographies": "Bibliographies", "terms_of_service": "Terms of Service", "privacy_policy": "Privacy Policy", "plans_and_pricing": "Plans and Pricing", "university_licences": "University Licenses", "security": "Security", "contact_us": "Contact Us", "thanks": "Thanks", "blog": "Blog", "latex_editor": "LaTeX Editor", "get_free_stuff": "Get free stuff", "chat": "Chat", "your_message": "Your Message", "loading": "Loading", "connecting": "Connecting", "recompile": "Recompile", "download": "Download", "email": "Email", "owner": "Owner", "read_and_write": "Read and Write", "read_only": "Read Only", "publish": "Publish", "view_in_template_gallery": "View it in the template gallery", "description": "Description", "unpublish": "Unpublish", "hotkeys": "Hotkeys", "saving": "Saving", "cancel": "Cancel", "project_name": "Project Name", "root_document": "Root Document", "spell_check": "Spell check", "compiler": "Compiler", "private": "Private", "public": "Public", "delete_forever": "Delete Forever", "support_and_feedback": "Support and feedback", "help": "Help", "latex_templates": "LaTeX Templates", "info": "Info", "latex_help_guide": "LaTeX help guide", "choose_your_plan": "Choose your plan", "indvidual_plans": "Individual Plans", "free_forever": "Free forever", "low_priority_compile": "Low priority compiling", "unlimited_projects": "Unlimited projects", "unlimited_compiles": "Unlimited compiles", "full_history_of_changes": "Full history of changes", "highest_priority_compiling": "Highest priority compiling", "dropbox_sync": "Dropbox Sync", "beta": "Beta", "sign_up_now": "Sign Up Now", "annual": "Annual", "half_price_student": "Half Price Student Plans", "about_us": "About Us", "loading_recent_github_commits": "Loading recent commits", "no_new_commits_in_github": "No new commits in GitHub since last merge.", "dropbox_sync_description": "Keep your __appName__ projects in sync with your Dropbox. Changes in __appName__ are automatically sent to your Dropbox, and the other way around.", "github_sync_description": "With GitHub Sync you can link your __appName__ projects to GitHub repositories. Create new commits from __appName__, and merge with commits made offline or in GitHub.", "github_import_description": "With GitHub Sync you can import your GitHub Repositories into __appName__. Create new commits from __appName__, and merge with commits made offline or in GitHub.", "link_to_github_description": "You need to authorise __appName__ to access your GitHub account to allow us to sync your projects.", "unlink": "Unlink", "unlink_github_warning": "Any projects that you have synced with GitHub will be disconnected and no longer kept in sync with GitHub. Are you sure you want to unlink your GitHub account?", "github_account_successfully_linked": "GitHub Account Successfully Linked!", "github_successfully_linked_description": "Thanks, we've successfully linked your GitHub account to __appName__. You can now export your __appName__ projects to GitHub, or import projects from your GitHub repositories.", "import_from_github": "Import from GitHub", "github_sync_error": "Sorry, there was an error talking to our GitHub service. Please try again in a few moments.", "loading_github_repositories": "Loading your GitHub repositories", "select_github_repository": "Select a GitHub repository to import into __appName__.", "import_to_sharelatex": "Import to __appName__", "importing": "Importing", "github_sync": "GitHub Sync", "checking_project_github_status": "Checking project status in GitHub", "account_not_linked_to_github": "Your account is not linked to GitHub", "project_not_linked_to_github": "This project is not linked to a GitHub repository. You can create a repository for it in GitHub:", "create_project_in_github": "Create a GitHub repository", "project_synced_with_git_repo_at": "This project is synced with the GitHub repository at", "recent_commits_in_github": "Recent commits in GitHub", "sync_project_to_github": "Sync project to GitHub", "sync_project_to_github_explanation": "Any changes you have made in __appName__ will be committed and merged with any updates in GitHub.", "github_merge_failed": "Your changes in __appName__ and GitHub could not be automatically merged. Please manually merge the <0>__sharelatex_branch__</0> branch into the <1>__master_branch__</1> branch in git. Click below to continue, after you have manually merged.", "continue_github_merge": "I have manually merged. Continue", "export_project_to_github": "Export Project to GitHub", "github_validation_check": "Please check that the repository name is valid, and that you have permission to create the repository.", "github_git_folder_error": "This project contains a .git folder at the top level, indicating that it is already a git repository. The Overleaf Github sync service cannot sync git histories. Please remove the .git folder and try again.", "repository_name": "Repository Name", "optional": "Optional", "github_public_description": "Anyone can see this repository. You choose who can commit.", "github_commit_message_placeholder": "Commit message for changes made in __appName__...", "merge": "Merge", "merging": "Merging", "github_account_is_linked": "Your GitHub account is successfully linked.", "unlink_github": "Unlink your GitHub account", "link_to_github": "Link to your GitHub account", "github_integration": "GitHub Integration", "github_is_premium": "GitHub sync is a premium feature", "remote_service_error": "The remote service produced an error", "linked_file": "Imported file", "n_items": "__count__ item", "n_items_plural": "__count__ items", "you_can_now_log_in_sso": "You can now log in through your institution and may receive <0>free __appName__ Professional features</0>!", "link_institutional_email_get_started": "Link an institutional email address to your account to get started.", "looks_like_youre_at": "It looks like you're at <0>__institutionName__</0>!", "add_affiliation": "Add Affiliation", "did_you_know_institution_providing_professional": "Did you know that __institutionName__ is providing <0>free __appName__ Professional features</0> to everyone at __institutionName__?", "add_email_to_claim_features": "Add an institutional email address to claim your features.", "please_change_primary_to_remove": "Please change your primary email in order to remove", "please_reconfirm_your_affiliation_before_making_this_primary": "Please confirm your affiliation before making this the primary.", "please_link_before_making_primary": "Please confirm your email by linking to your institutional account before making it the primary email.", "dropbox_duplicate_project_names": "Your Dropbox account has been unlinked, because you have more than one project called <0>\"__projectName__\"</0>.", "dropbox_duplicate_project_names_suggestion": "Please make your project names unique across all your <0>active, archived and trashed</0> projects and then re-link your Dropbox account.", "please_reconfirm_institutional_email": "Please take a moment to confirm your institutional email address or <0>remove it</0> from your account.", "need_to_add_new_primary_before_remove": "You'll need to add a new primary email address before you can remove this one.", "are_you_still_at": "Are you still at <0>__institutionName__</0>?", "confirm_affiliation": "Confirm Affiliation", "please_check_your_inbox_to_confirm": "Please check your email inbox to confirm your <0>__institutionName__</0> affiliation.", "your_affiliation_is_confirmed": "Your <0>__institutionName__</0> affiliation is confirmed.", "thank_you": "Thank you!", "imported_from_mendeley_at_date": "Imported from Mendeley at __formattedDate__ __relativeDate__", "imported_from_zotero_at_date": "Imported from Zotero at __formattedDate__ __relativeDate__", "imported_from_external_provider_at_date": "Imported from <0>__shortenedUrlHTML__</0> at __formattedDate__ __relativeDate__", "imported_from_another_project_at_date": "Imported from <0>Another project</0>/__sourceEntityPathHTML__, at __formattedDate__ __relativeDate__", "imported_from_the_output_of_another_project_at_date": "Imported from the output of <0>Another project</0>: __sourceOutputFilePathHTML__, at __formattedDate__ __relativeDate__", "refreshing": "Refreshing", "if_error_persists_try_relinking_provider": "If this error persists, try re-linking your __provider__ account here", "select_from_source_files": "select from source files", "select_from_output_files": "select from output files", "select_a_project": "Select a Project", "please_select_a_project": "Please Select a Project", "no_other_projects_found": "No other projects found, please create another project first", "select_an_output_file": "Select an Output File", "please_select_an_output_file": "Please Select an Output File", "select_a_file": "Select a File", "please_select_a_file": "Please Select a File", "url_to_fetch_the_file_from": "URL to fetch the file from", "invalid_request": "Invalid Request. Please correct the data and try again.", "session_error": "Session error. Please check you have cookies enabled. If the problem persists, try clearing your cache and cookies.", "too_many_attempts": "Too many attempts. Please wait for a while and try again.", "something_went_wrong_server": "Something went wrong talking to the server :(. Please try again.", "file_name": "File Name", "from_another_project": "From Another Project", "from_external_url": "From External URL", "thank_you_exclamation": "Thank you!", "add_files": "Add Files", "hotkey_find_and_replace": "Find (and replace)", "hotkey_compile": "Compile", "hotkey_undo": "Undo", "hotkey_redo": "Redo", "hotkey_beginning_of_document": "Beginning of document", "hotkey_end_of_document": "End of document", "hotkey_go_to_line": "Go To Line", "hotkey_toggle_comment": "Toggle Comment", "hotkey_delete_current_line": "Delete Current Line", "hotkey_select_all": "Select All", "hotkey_to_uppercase": "To Uppercase", "hotkey_to_lowercase": "To Lowercase", "hotkey_indent_selection": "Indent Selection", "hotkey_bold_text": "Bold text", "hotkey_italic_text": "Italic Text", "hotkey_autocomplete_menu": "Autocomplete Menu", "hotkey_select_candidate": "Select Candidate", "hotkey_insert_candidate": "Insert Candidate", "hotkey_search_references": "Search References", "hotkey_toggle_review_panel": "Toggle review panel", "hotkey_toggle_track_changes": "Toggle track changes", "hotkey_add_a_comment": "Add a comment", "category_greek": "Greek", "category_arrows": "Arrows", "category_operators": "Operators", "category_relations": "Relations", "category_misc": "Misc", "no_symbols_found": "No symbols found", "find_out_more_about_latex_symbols": "Find out more about LaTeX symbols", "showing_symbol_search_results": "Showing search results for \"__search__\"", "search": "Search", "also": "Also", "add_email": "Add Email", "dropbox_unlinked_premium_feature": "<0>Your Dropbox account has been unlinked</0> because Dropbox Sync is a premium feature that you had through an institutional license.", "confirm_affiliation_to_relink_dropbox": "Please confirm you are still at the institution and on their license, or upgrade your account in order to relink your Dropbox account.", "pay_with_visa_mastercard_or_amex": "Pay with Mastercard, Visa, or Amex", "pay_with_paypal": "Pay with PayPal", "this_field_is_required": "This field is required", "by_subscribing_you_agree_to_our_terms_of_service": "By subscribing, you agree to our <0>terms of service</0>.", "cancel_anytime": "We're confident that you'll love __appName__, but if not you can cancel anytime. We'll give you your money back, no questions asked, if you let us know within 30 days.", "for_visa_mastercard_and_discover": "For <0>Visa, MasterCard and Discover</0>, the <1>3 digits</1> on the <2>back</2> of your card.", "for_american_express": "For <0>American Express</0>, the <1>4 digits</1> on the <2>front</2> of your card.", "request_password_reset_to_reconfirm": "Request password reset email to reconfirm", "go_next_page": "Go to Next Page", "go_prev_page": "Go to Previous Page", "page_current": "Page __page__, Current Page", "go_page": "Go to page __page__", "pagination_navigation": "Pagination Navigation", "can_now_relink_dropbox": "You can now <0>relink your Dropbox account</0>.", "skip_to_content": "Skip to content" }
overleaf/web/locales/en.json/0
{ "file_path": "overleaf/web/locales/en.json", "repo_id": "overleaf", "token_count": 32290 }
517
/* eslint-disable no-unused-vars */ /* * Example migration for a script: * * This migration demonstrates how to run a script. In this case, the example * script will print "hello world" if there are no users in the users collection * or "hello <name>", when User.findOne() finds something. */ const runScript = require('../scripts/example/script_for_migration.js') exports.tags = [] exports.migrate = async client => { const { db } = client await runScript() } exports.rollback = async client => { const { db } = client }
overleaf/web/migrations/20190730093801_script_example.js/0
{ "file_path": "overleaf/web/migrations/20190730093801_script_example.js", "repo_id": "overleaf", "token_count": 163 }
518
/* eslint-disable no-unused-vars */ const Helpers = require('./lib/helpers') exports.tags = ['saas'] const indexes = [ { unique: true, key: { id: 1, }, name: 'id_1', }, ] exports.migrate = async client => { const { db } = client await Helpers.addIndexesToCollection(db.oauthApplications, indexes) } exports.rollback = async client => { const { db } = client try { await Helpers.dropIndexesFromCollection(db.oauthApplications, indexes) } catch (err) { console.error('Something went wrong rolling back the migrations', err) } }
overleaf/web/migrations/20190912145016_create_oauthApplications_indexes.js/0
{ "file_path": "overleaf/web/migrations/20190912145016_create_oauthApplications_indexes.js", "repo_id": "overleaf", "token_count": 216 }
519
/* eslint-disable no-unused-vars */ const Helpers = require('./lib/helpers') exports.tags = ['server-ce', 'server-pro', 'saas'] const indexes = [ { unique: true, key: { email: 1, }, name: 'email_case_insensitive', collation: { locale: 'en', caseLevel: false, caseFirst: 'off', strength: 2, numericOrdering: false, alternate: 'non-ignorable', maxVariable: 'punct', normalization: false, backwards: false, version: '57.1', }, }, { key: { 'dropbox.access_token.oauth_token_secret': 1, }, name: 'has dropbox', }, { unique: true, key: { 'overleaf.id': 1, }, name: 'overleaf.id_1', partialFilterExpression: { 'overleaf.id': { $exists: true, }, }, }, { unique: true, key: { 'thirdPartyIdentifiers.externalUserId': 1, 'thirdPartyIdentifiers.providerId': 1, }, name: 'thirdPartyIdentifiers.externalUserId_1_thirdPartyIdentifiers.providerId_1', sparse: true, }, { key: { 'subscription.freeTrialDowngraded': 1, }, name: 'subscription.freeTrialDowngraded_1', }, { key: { signUpDate: 1, }, name: 'signUpDate', }, { unique: true, key: { 'emails.email': 1, }, name: 'emails_email_1', partialFilterExpression: { 'emails.email': { $exists: true, }, }, }, { unique: true, key: { 'emails.email': 1, }, name: 'emails_email_case_insensitive', partialFilterExpression: { 'emails.email': { $exists: true, }, }, collation: { locale: 'en', caseLevel: false, caseFirst: 'off', strength: 2, numericOrdering: false, alternate: 'non-ignorable', maxVariable: 'punct', normalization: false, backwards: false, version: '57.1', }, }, { unique: true, key: { 'dropbox.access_token.uid': 1, }, name: 'dropbox.access_token.uid_unique', sparse: true, }, { key: { password: 1, email: 1, }, name: 'password_and_email', }, { key: { referal_id: 1, }, name: 'referal_id', }, { key: { 'subscription.freeTrialExpiresAt': 1, }, name: 'subscription.freeTrialExpiresAt_1', }, { key: { auth_token: 1, }, name: 'auth_token_1', }, { unique: true, key: { email: 1, }, name: 'email_1', }, { key: { 'emails.reversedHostname': 1, }, name: 'emails.reversedHostname_1', }, ] exports.migrate = async client => { const { db } = client await Helpers.addIndexesToCollection(db.users, indexes) } exports.rollback = async client => { const { db } = client try { await Helpers.dropIndexesFromCollection(db.users, indexes) } catch (err) { console.error('Something went wrong rolling back the migrations', err) } }
overleaf/web/migrations/20190912145032_create_users_indexes.js/0
{ "file_path": "overleaf/web/migrations/20190912145032_create_users_indexes.js", "repo_id": "overleaf", "token_count": 1413 }
520
const Helpers = require('./lib/helpers') exports.tags = ['server-ce', 'server-pro', 'saas'] const indexes = [ { key: { project_id: 1, deleted: 1, deletedAt: -1, }, name: 'project_id_deleted_deletedAt_1', }, ] exports.migrate = async client => { const { db } = client await Helpers.addIndexesToCollection(db.docs, indexes) } exports.rollback = async client => { const { db } = client await Helpers.dropIndexesFromCollection(db.docs, indexes) }
overleaf/web/migrations/20210408123210_create_docs_project_id_deleted_deletedAt_index.js/0
{ "file_path": "overleaf/web/migrations/20210408123210_create_docs_project_id_deleted_deletedAt_index.js", "repo_id": "overleaf", "token_count": 195 }
521
const base = require(process.env.BASE_CONFIG) module.exports = base.mergeWith({ enableLegacyLogin: true, test: { counterInit: 210000, }, })
overleaf/web/modules/launchpad/test/acceptance/config/settings.test.js/0
{ "file_path": "overleaf/web/modules/launchpad/test/acceptance/config/settings.test.js", "repo_id": "overleaf", "token_count": 58 }
522
extends ../../../../../app/views/layout block append meta meta(name="ol-passwordStrengthOptions" data-type="json" content=settings.passwordStrengthOptions) block content main.content.content-alt#main-content .container .row .col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 .alert.alert-success #{translate("nearly_activated")} .row .col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 .card .page-header h1 #{translate("please_set_a_password")} form( async-form="activate", name="activationForm", action="/user/password/set", method="POST", ng-cloak ) input(name='_csrf', type='hidden', value=csrfToken) input( type="hidden", name="passwordResetToken", value=token ng-non-bindable ) .alert.alert-danger(ng-show="activationForm.response.error") | #{translate("activation_token_expired")} .form-group label(for='email') #{translate("email")} input.form-control( type='email', name='email', placeholder="email@example.com" required, ng-model="email", ng-model-options="{ updateOn: 'blur' }", disabled ) .form-group label(for='password') #{translate("password")} input.form-control#passwordField( type='password', name='password', placeholder="********", required, ng-model="password", complex-password, focus="true" ) span.small.text-primary(ng-show="activationForm.password.$error.complexPassword", ng-bind-html="complexPasswordErrorMessage") .actions button.btn-primary.btn( type='submit' ng-disabled="activationForm.inflight || activationForm.password.$error.required|| activationForm.password.$error.complexPassword" ) span(ng-show="!activationForm.inflight") #{translate("activate")} span(ng-show="activationForm.inflight") #{translate("activating")}…
overleaf/web/modules/user-activate/app/views/user/activate.pug/0
{ "file_path": "overleaf/web/modules/user-activate/app/views/user/activate.pug", "repo_id": "overleaf", "token_count": 979 }
523
-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1 mQENBFRKK00BCADUis0s5avrxbfylhl0btKoyQcST6BlGwejbryJHEkeVxoVPJ6q YkDTlMB4RMDGNC5wK901d8McYf3UiTzhqw50lX9CZGCzZIkjAvuySD/ectLuRD96 ft2qwNUISyCfLUdFItnhq7PQLZcgVvBjBL5UjX6yItZQLeFIkxEZrN3+fm9wjlg8 0V8OctWs+d1HgtL03bNJk6YSc21g4NBsca8+1pvjEi12JS78ZOvWRwk8y+XM9nny f+1y++HJZFE3mtLUNzP5t7DA0zgpg3QrY6l9tA0n5AF7kg1jumkaeveAoxH4nz37 3trK/AocXEg14BBwEJYO/0VvDj4HUhh7kTGXABEBAAG0IFNoYXJlTGFUZVggPHRl YW1Ac2hhcmVsYXRleC5jb20+iQE4BBMBAgAiBQJUSitNAhsDBgsJCAcDAgYVCAIJ CgsEFgIDAQIeAQIXgAAKCRDUTe3hJW06cZA6CAC2zS9PSWVUgGcCI4BxHrGBUcCy bsUzqhuKHVXtCmfrCVYhHiohXqWTqoR0JA51DVi9kn7f2xeXllZGhJtT54xynN12 Wna1G2Fq2rBG+G2j9hFHR/WKdG2z1i6MRRAshOm8axmKHKL/KR80yzsazHlnDcT5 4RMXIF2hRfdW97ePKh5SCe8yeCRKkJY5XWQo66AoQO3tB6mlAzl3J1L/W5SAVqwx /1wC+kftn38Rgrn+kterHogdQMxYl9B2U2FXolMn0m1Y2DWmZglGL67XXI+yuugP RLXhC8VROjmD7FVgZDVuiJUelABxr/eg0SqnfpiFskMfjj8hq/DlKUSPBjdvuQEN BFRKK00BCADK/c9LsxSK43T5aKeZwztsmo0ZCAmG08NVw4LkKtJOizdywuenLZoj Tma8L9/OlmGPKsIYMODil4UCTeaOLSPhSiuJQQFw4epbSANp7sD3ZwtEF8vsML5U 3YnPMHh/3EAJXG08+5GHQdAHh3m7DtSRRQ3nJUrtN4w1jh8dUOe5ApIQx4ZB7xLA Eio2KMdYHlcxAwmd7qBNMQ/cBoLssqvrLFIxbdBMNQgl+Ly2u1NBpMpeaiF4xSr+ 9RrR5Z911eFYBJ+WkzShjuhYQDlHjLEwm1Xcv0t4lNyRniTK3i0w5gYj3G1dqJji /xozhpcU2tk6CRb1EE+QrTV2tGNdVyCJABEBAAGJAR8EGAECAAkFAlRKK00CGwwA CgkQ1E3t4SVtOnFY1wf/eKmWlzxAutmde1Irh2QzDc1nY/vSHOT5IHhoR8/ZcGr4 o7MYu9wpMAKHtLea3MoOhFmfcRjsFR+GUtYsD7W299vz3XpRuhSKZ9RZy6qZ7od9 HDN5891TPMJng3LY8RVhtCXmoaVCkJwRYXkz2+9dsM7Z1+rgytUxI71k4StsqZde EA+/Qwd5FBymMAQb9JsvA/PaN74E43jFQj39bHaNYjzvONQAV695ANHuMN9sovEg U5j6+6b3OPXEM/OLLvqiIfHjs9QqEKBH3OVf1YRzGjHVBbfG8BfKd88RKRYmfEAn 9KPdxwVzKk+NpEbbU4iuyqo6NDdTPnqsa5PGQk7AVQ== =l+45 -----END PGP PUBLIC KEY BLOCK-----
overleaf/web/public/sharelatex-security.pub/0
{ "file_path": "overleaf/web/public/sharelatex-security.pub", "repo_id": "overleaf", "token_count": 1260 }
524
# Delete Orphaned Docs Because of the large numbers of documents and projects it is necessary to detect orphaned docs using bulk exports of the raw data. ## Exporting Data Files Follow the directions in `google-ops/README.md` for exporting data from mongo and copying the files to your local machine. ### Exporting docs Run the following doc export command to export all doc ids and their associated project ids in batches of 10,000,000. ``` mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection docs --fields '_id,project_id' --skip 0 --limit 10000000 --type=csv --out docs.00000000.csv ``` This will produce files like: ``` _id,project_id ObjectId(5babb6f864c952737a9a4c32),ObjectId(5b98bba5e2f38b7c88f6a625) ObjectId(4eecaffcbffa66588e000007),ObjectId(4eecaffcbffa66588e00000d) ``` Concatenate these into a single file: `cat docs.*csv > all-docs-doc_id-project_id.csv` For object ids the script will accept either plain hex strings or the `ObjectId(...)` format used by mongoexport. ### Exporting Projects Export project ids from all `projects` and `deletedProjects` ``` mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection projects --fields '_id' --type=csv --out projects.csv mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection deletedProjects --fields 'project._id' --type=csv --out deleted-projects.csv ``` Concatenate these: `cat projects.csv deleted-projects.csv > all-projects-project_id.csv` ## Processing Exported Data ### Create a unique sorted list of project ids from docs ``` cut -d, -f 2 all-docs-doc_id-project_id.csv | sort | uniq > all-docs-project_ids.sorted.uniq.csv ``` ### Create a unique sorted list of projects ids from projects ``` sort all-projects-project_id.csv | uniq > all-projects-project_id.sorted.uniq.csv ``` ### Create list of project ids in docs but not in projects ``` comm --check-order -23 all-docs-project_ids.sorted.uniq.csv all-projects-project_id.sorted.uniq.csv > orphaned-doc-project_ids.csv ``` ### Create list of docs ids with project ids not in projects ``` grep -F -f orphaned-doc-project_ids.csv all-docs-doc_id-project_id.csv > orphaned-doc-doc_id-project_id.csv ``` ## Run doc deleter ``` node delete-orphaned-docs orphaned-doc-doc_id-project_id.csv ``` ### Commit Changes By default the script will only print the list of project ids and docs ids to be deleted. In order to actually delete docs run with the `--commit` argument. ### Selecting Input Lines to Process The `--limit` and `--offset` arguments can be used to specify which lines to process. There is one doc per line so a single project will often have multiple lines, but deletion is based on project id, so if one doc for a project is deleted all will be deleted, even if all of the input lines are not processed.
overleaf/web/scripts/delete-orphaned-docs/README.md/0
{ "file_path": "overleaf/web/scripts/delete-orphaned-docs/README.md", "repo_id": "overleaf", "token_count": 888 }
525
const InstitutionsReconfirmationHandler = require('../modules/overleaf-integration/app/src/Institutions/InstitutionsReconfirmationHandler') InstitutionsReconfirmationHandler.processLapsed() .then(() => { process.exit(0) }) .catch(error => { console.error(error) process.exit(1) })
overleaf/web/scripts/process_lapsed_reconfirmations.js/0
{ "file_path": "overleaf/web/scripts/process_lapsed_reconfirmations.js", "repo_id": "overleaf", "token_count": 105 }
526
/* This script will aid the process of inserting HTML fragments into all the locales. We are migrating from locale: 'PRE __key1__ POST' pug: translate(localeKey, { key1: '<b>VALUE</b>' }) to locale: 'PRE <0>__key1__</0> POST' pug: translate(localeKey, { key1: 'VALUE' }, ['b']) MAPPING entries: localeKey: ['key1', 'key2'] click_here_to_view_sl_in_lng: ['lngName'] */ const MAPPING = { support_lots_of_features: ['help_guides_link'], nothing_to_install_ready_to_go: ['start_now'], all_packages_and_templates: ['templatesLink'], github_merge_failed: ['sharelatex_branch', 'master_branch'], kb_suggestions_enquiry: ['kbLink'], sure_you_want_to_restore_before: ['filename'], you_have_added_x_of_group_size_y: ['addedUsersSize', 'groupSize'], x_price_per_month: ['price'], x_price_per_year: ['price'], x_price_for_first_month: ['price'], x_price_for_first_year: ['price'], sure_you_want_to_change_plan: ['planName'], subscription_canceled_and_terminate_on_x: ['terminateDate'], next_payment_of_x_collectected_on_y: ['paymentAmmount', 'collectionDate'], currently_subscribed_to_plan: ['planName'], recurly_email_update_needed: ['recurlyEmail', 'userEmail'], change_to_annual_billing_and_save: ['percentage', 'yearlySaving'], project_ownership_transfer_confirmation_1: ['user', 'project'], you_introed_high_number: ['numberOfPeople'], you_introed_small_number: ['numberOfPeople'], click_here_to_view_sl_in_lng: ['lngName'], } const { transformLocales } = require('./transformLocales') function transformLocale(locale, components) { components.forEach((key, idx) => { const i18nKey = `__${key}__` const replacement = `<${idx}>${i18nKey}</${idx}>` if (!locale.includes(replacement)) { locale = locale.replace(new RegExp(i18nKey, 'g'), replacement) } }) return locale } function main() { transformLocales(MAPPING, transformLocale) } if (require.main === module) { main() }
overleaf/web/scripts/translations/insertHTMLFragments.js/0
{ "file_path": "overleaf/web/scripts/translations/insertHTMLFragments.js", "repo_id": "overleaf", "token_count": 769 }
527
const { merge } = require('@overleaf/settings/merge') const baseApp = require('../../../config/settings.overrides.saas') const baseTest = require('./settings.test.defaults') const httpAuthUser = 'sharelatex' const httpAuthPass = 'password' const httpAuthUsers = {} httpAuthUsers[httpAuthUser] = httpAuthPass const overrides = { enableSubscriptions: true, apis: { project_history: { sendProjectStructureOps: true, initializeHistoryForNewProjects: true, displayHistoryForNewProjects: true, url: `http://localhost:3054`, }, recurly: { url: 'http://localhost:6034', subdomain: 'test', apiKey: 'private-nonsense', webhookUser: 'recurly', webhookPass: 'webhook', }, tpdsworker: { // Disable tpdsworker in CI. url: undefined, }, v1: { url: 'http://localhost:5000', user: 'overleaf', pass: 'password', }, v1_history: { url: `http://localhost:3100/api`, user: 'overleaf', pass: 'password', }, }, oauthProviders: { provider: { name: 'provider', }, collabratec: { name: 'collabratec', }, google: { name: 'google', }, }, overleaf: { oauth: undefined, }, saml: undefined, // Disable contentful module. contentful: undefined, } module.exports = baseApp.mergeWith(baseTest.mergeWith(overrides)) for (const redisKey of Object.keys(module.exports.redis)) { module.exports.redis[redisKey].host = process.env.REDIS_HOST || 'localhost' } module.exports.mergeWith = function (overrides) { return merge(overrides, module.exports) }
overleaf/web/test/acceptance/config/settings.test.saas.js/0
{ "file_path": "overleaf/web/test/acceptance/config/settings.test.saas.js", "repo_id": "overleaf", "token_count": 668 }
528
const User = require('./helpers/User') const request = require('./helpers/request') const async = require('async') const { expect } = require('chai') const settings = require('@overleaf/settings') const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb') const MockDocstoreApiClass = require('./mocks/MockDocstoreApi') const MockFilestoreApiClass = require('./mocks/MockFilestoreApi') let MockDocstoreApi, MockFilestoreApi before(function () { MockDocstoreApi = MockDocstoreApiClass.instance() MockFilestoreApi = MockFilestoreApiClass.instance() }) describe('Deleting a user', function () { beforeEach(function (done) { this.user = new User() async.series( [ this.user.ensureUserExists.bind(this.user), this.user.login.bind(this.user), ], done ) }) it('Should remove the user from active users', function (done) { this.user.get((error, user) => { expect(error).not.to.exist expect(user).to.exist this.user.deleteUser(error => { expect(error).not.to.exist this.user.get((error, user) => { expect(error).not.to.exist expect(user).not.to.exist done() }) }) }) }) it('Should create a soft-deleted user', function (done) { this.user.get((error, user) => { expect(error).not.to.exist this.user.deleteUser(error => { expect(error).not.to.exist db.deletedUsers.findOne( { 'user._id': user._id }, (error, deletedUser) => { expect(error).not.to.exist expect(deletedUser).to.exist // it should set the 'deleterData' correctly expect(deletedUser.deleterData.deleterId.toString()).to.equal( user._id.toString() ) expect(deletedUser.deleterData.deletedUserId.toString()).to.equal( user._id.toString() ) expect(deletedUser.deleterData.deletedUserReferralId).to.equal( user.referal_id ) // it should set the 'user' correctly expect(deletedUser.user._id.toString()).to.equal( user._id.toString() ) expect(deletedUser.user.email).to.equal(user.email) done() } ) }) }) }) it("Should delete the user's projects", function (done) { this.user.createProject('wombat', (error, projectId) => { expect(error).not.to.exist this.user.getProject(projectId, (error, project) => { expect(error).not.to.exist expect(project).to.exist this.user.deleteUser(error => { expect(error).not.to.exist this.user.getProject(projectId, (error, project) => { expect(error).not.to.exist expect(project).not.to.exist done() }) }) }) }) }) describe('when scrubbing the user', function () { beforeEach(function (done) { this.user.get((error, user) => { if (error) { throw error } this.userId = user._id this.user.deleteUser(done) }) }) it('Should remove the user data from mongo', function (done) { db.deletedUsers.findOne( { 'deleterData.deletedUserId': this.userId }, (error, deletedUser) => { expect(error).not.to.exist expect(deletedUser).to.exist expect(deletedUser.deleterData.deleterIpAddress).to.exist expect(deletedUser.user).to.exist request.post( `/internal/users/${this.userId}/expire`, { auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, }, (error, res) => { expect(error).not.to.exist expect(res.statusCode).to.equal(204) db.deletedUsers.findOne( { 'deleterData.deletedUserId': this.userId }, (error, deletedUser) => { expect(error).not.to.exist expect(deletedUser).to.exist expect(deletedUser.deleterData.deleterIpAddress).not.to.exist expect(deletedUser.user).not.to.exist done() } ) } ) } ) }) }) }) describe('Deleting a project', function () { beforeEach(function (done) { this.user = new User() this.projectName = 'wombat' this.user.ensureUserExists(() => { this.user.login(() => { this.user.createProject(this.projectName, (_e, projectId) => { this.projectId = projectId done() }) }) }) }) it('Should remove the project from active projects', function (done) { this.user.getProject(this.projectId, (error, project) => { expect(error).not.to.exist expect(project).to.exist this.user.deleteProject(this.projectId, error => { expect(error).not.to.exist this.user.getProject(this.projectId, (error, project) => { expect(error).not.to.exist expect(project).not.to.exist done() }) }) }) }) it('Should create a soft-deleted project', function (done) { this.user.getProject(this.projectId, (error, project) => { expect(error).not.to.exist this.user.get((error, user) => { expect(error).not.to.exist this.user.deleteProject(this.projectId, error => { expect(error).not.to.exist db.deletedProjects.findOne( { 'deleterData.deletedProjectId': project._id }, (error, deletedProject) => { expect(error).not.to.exist expect(deletedProject).to.exist // it should set the 'deleterData' correctly expect(deletedProject.deleterData.deleterId.toString()).to.equal( user._id.toString() ) expect( deletedProject.deleterData.deletedProjectId.toString() ).to.equal(project._id.toString()) expect( deletedProject.deleterData.deletedProjectOwnerId.toString() ).to.equal(user._id.toString()) // it should set the 'user' correctly expect(deletedProject.project._id.toString()).to.equal( project._id.toString() ) expect(deletedProject.project.name).to.equal(this.projectName) done() } ) }) }) }) }) describe('when the project has deleted files', function () { beforeEach('get rootFolder id', function (done) { this.user.getProject(this.projectId, (error, project) => { if (error) return done(error) this.rootFolder = project.rootFolder[0]._id done() }) }) let allFileIds beforeEach('reset allFileIds', function () { allFileIds = [] }) function createAndDeleteFile(name) { let fileId beforeEach(`create file ${name}`, function (done) { this.user.uploadExampleFileInProject( this.projectId, this.rootFolder, name, (error, theFileId) => { fileId = theFileId allFileIds.push(theFileId) done(error) } ) }) beforeEach(`delete file ${name}`, function (done) { this.user.deleteItemInProject(this.projectId, 'file', fileId, done) }) } for (const name of ['a.png', 'another.png']) { createAndDeleteFile(name) } it('should have two deleteFiles entries', async function () { const files = await db.deletedFiles .find({}, { sort: { _id: 1 } }) .toArray() expect(files).to.have.length(2) expect(files.map(file => file._id.toString())).to.deep.equal(allFileIds) }) describe('When the deleted project is expired', function () { beforeEach('soft delete the project', function (done) { this.user.deleteProject(this.projectId, done) }) beforeEach('hard delete the project', function (done) { request.post( `/internal/project/${this.projectId}/expire-deleted-project`, { auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, }, (error, res) => { expect(error).not.to.exist expect(res.statusCode).to.equal(200) done() } ) }) it('should cleanup the deleteFiles', async function () { const files = await db.deletedFiles .find({}, { sort: { _id: 1 } }) .toArray() expect(files).to.deep.equal([]) }) }) }) describe('When the project has docs', function () { beforeEach(function (done) { this.user.getProject(this.projectId, (error, project) => { if (error) { throw error } this.user.createDocInProject( this.projectId, project.rootFolder[0]._id, 'potato', (error, docId) => { if (error) { throw error } this.docId = docId done() } ) MockFilestoreApi.files[this.projectId.toString()] = { dummyFile: 'wombat', } }) }) describe('When the deleted project is expired', function () { beforeEach(function (done) { this.user.deleteProject(this.projectId, error => { if (error) { throw error } done() }) }) it('Should destroy the docs', function (done) { expect( MockDocstoreApi.docs[this.projectId.toString()][this.docId.toString()] ).to.exist request.post( `/internal/project/${this.projectId}/expire-deleted-project`, { auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, }, (error, res) => { expect(error).not.to.exist expect(res.statusCode).to.equal(200) expect(MockDocstoreApi.docs[this.projectId.toString()]).not.to.exist done() } ) }) it('Should destroy the files', function (done) { expect(MockFilestoreApi.files[this.projectId.toString()]).to.exist request.post( `/internal/project/${this.projectId}/expire-deleted-project`, { auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, }, (error, res) => { expect(error).not.to.exist expect(res.statusCode).to.equal(200) expect(MockFilestoreApi.files[this.projectId.toString()]).not.to .exist done() } ) }) it('Should remove the project data from mongo', function (done) { db.deletedProjects.findOne( { 'deleterData.deletedProjectId': ObjectId(this.projectId) }, (error, deletedProject) => { expect(error).not.to.exist expect(deletedProject).to.exist expect(deletedProject.project).to.exist expect(deletedProject.deleterData.deleterIpAddress).to.exist expect(deletedProject.deleterData.deletedAt).to.exist request.post( `/internal/project/${this.projectId}/expire-deleted-project`, { auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, }, (error, res) => { expect(error).not.to.exist expect(res.statusCode).to.equal(200) db.deletedProjects.findOne( { 'deleterData.deletedProjectId': ObjectId(this.projectId) }, (error, deletedProject) => { expect(error).not.to.exist expect(deletedProject).to.exist expect(deletedProject.project).not.to.exist expect(deletedProject.deleterData.deleterIpAddress).not.to .exist expect(deletedProject.deleterData.deletedAt).to.exist done() } ) } ) } ) }) }) }) })
overleaf/web/test/acceptance/src/DeletionTests.js/0
{ "file_path": "overleaf/web/test/acceptance/src/DeletionTests.js", "repo_id": "overleaf", "token_count": 6377 }
529
const { expect } = require('chai') const { ObjectId } = require('mongodb') const Path = require('path') const fs = require('fs') const { Project } = require('../../../app/src/models/Project') const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter.js') const User = require('./helpers/User') const MockDocStoreApiClass = require('./mocks/MockDocstoreApi') const MockDocUpdaterApiClass = require('./mocks/MockDocUpdaterApi') let MockDocStoreApi, MockDocUpdaterApi before(function () { MockDocUpdaterApi = MockDocUpdaterApiClass.instance() MockDocStoreApi = MockDocStoreApiClass.instance() }) describe('ProjectStructureChanges', function () { let owner beforeEach(function (done) { owner = new User() owner.login(done) }) function createExampleProject(owner, callback) { owner.createProject( 'example-project', { template: 'example' }, (error, projectId) => { if (error) { return callback(error) } ProjectGetter.getProject(projectId, (error, project) => { if (error) { return callback(error) } const rootFolderId = project.rootFolder[0]._id.toString() callback(null, projectId, rootFolderId) }) } ) } function createExampleDoc(owner, projectId, callback) { ProjectGetter.getProject(projectId, (error, project) => { if (error) { return callback(error) } owner.request.post( { uri: `project/${projectId}/doc`, json: { name: 'new.tex', parent_folder_id: project.rootFolder[0]._id, }, }, (error, res, body) => { if (error) { return callback(error) } if (res.statusCode < 200 || res.statusCode >= 300) { return callback(new Error(`failed to add doc ${res.statusCode}`)) } callback(null, body._id) } ) }) } function createExampleFolder(owner, projectId, callback) { owner.request.post( { uri: `project/${projectId}/folder`, json: { name: 'foo', }, }, (error, res, body) => { if (error) { return callback(error) } if (res.statusCode < 200 || res.statusCode >= 300) { return callback(new Error(`failed to add doc ${res.statusCode}`)) } callback(null, body._id) } ) } function uploadExampleProject(owner, zipFilename, options, callback) { if (typeof options === 'function') { callback = options options = {} } const zipFile = fs.createReadStream( Path.resolve(Path.join(__dirname, '..', 'files', zipFilename)) ) owner.request.post( { uri: 'project/new/upload', formData: { qqfile: zipFile, }, }, (error, res, body) => { if (error) { return callback(error) } if ( !options.allowBadStatus && (res.statusCode < 200 || res.statusCode >= 300) ) { return new Error(`failed to upload project ${res.statusCode}`) } callback(null, JSON.parse(body).project_id, res) } ) } function deleteItem(owner, projectId, type, itemId, callback) { owner.deleteItemInProject(projectId, type, itemId, callback) } describe('uploading a project with a name', function () { let exampleProjectId const testProjectName = 'wombat' beforeEach(function (done) { uploadExampleProject( owner, 'test_project_with_name.zip', (err, projectId) => { if (err) { return done(err) } exampleProjectId = projectId done() } ) }) it('should set the project name from the zip contents', function (done) { ProjectGetter.getProject(exampleProjectId, (error, project) => { expect(error).not.to.exist expect(project.name).to.equal(testProjectName) done() }) }) }) describe('uploading a project with an invalid name', function () { let exampleProjectId const testProjectMatch = /^bad[^\\]+name$/ beforeEach(function (done) { uploadExampleProject( owner, 'test_project_with_invalid_name.zip', (error, projectId) => { if (error) { return done(error) } exampleProjectId = projectId done() } ) }) it('should set the project name from the zip contents', function (done) { ProjectGetter.getProject(exampleProjectId, (error, project) => { expect(error).not.to.exist expect(project.name).to.match(testProjectMatch) done() }) }) }) describe('uploading an empty zipfile', function () { let res beforeEach(function (done) { uploadExampleProject( owner, 'test_project_empty.zip', { allowBadStatus: true }, (err, projectId, response) => { if (err) { return done(err) } res = response done() } ) }) it('should fail with 422 error', function () { expect(res.statusCode).to.equal(422) }) }) describe('uploading a zipfile containing only empty directories', function () { let res beforeEach(function (done) { uploadExampleProject( owner, 'test_project_with_empty_folder.zip', { allowBadStatus: true }, (err, projectId, response) => { if (err) { return done(err) } res = response done() } ) }) it('should fail with 422 error', function () { expect(res.statusCode).to.equal(422) }) }) describe('uploading a project with a shared top-level folder', function () { let exampleProjectId beforeEach(function (done) { uploadExampleProject( owner, 'test_project_with_shared_top_level_folder.zip', (err, projectId) => { if (err) { return done(err) } exampleProjectId = projectId done() } ) }) it('should not create the top-level folder', function (done) { ProjectGetter.getProject(exampleProjectId, (error, project) => { expect(error).not.to.exist expect(project.rootFolder[0].folders.length).to.equal(0) expect(project.rootFolder[0].docs.length).to.equal(2) done() }) }) }) describe('uploading a project with backslashes in the path names', function () { let exampleProjectId beforeEach(function (done) { uploadExampleProject( owner, 'test_project_with_backslash_in_filename.zip', (err, projectId) => { if (err) { return done(err) } exampleProjectId = projectId done() } ) }) it('should treat the backslash as a directory separator', function (done) { ProjectGetter.getProject(exampleProjectId, (error, project) => { expect(error).not.to.exist expect(project.rootFolder[0].folders[0].name).to.equal('styles') expect(project.rootFolder[0].folders[0].docs[0].name).to.equal('ao.sty') done() }) }) }) describe('deleting docs', function () { beforeEach(function (done) { createExampleProject(owner, (err, projectId) => { if (err) { return done(err) } this.exampleProjectId = projectId createExampleFolder(owner, projectId, (err, folderId) => { if (err) { return done(err) } this.exampleFolderId = folderId createExampleDoc(owner, projectId, (err, docId) => { if (err) { return done(err) } this.exampleDocId = docId MockDocUpdaterApi.reset() ProjectGetter.getProject( this.exampleProjectId, (error, project) => { if (error) { throw error } this.project0 = project done() } ) }) }) }) }) it('should pass the doc name to docstore', function (done) { deleteItem( owner, this.exampleProjectId, 'doc', this.exampleDocId, error => { if (error) return done(error) expect( MockDocStoreApi.getDeletedDocs(this.exampleProjectId) ).to.deep.equal([{ _id: this.exampleDocId, name: 'new.tex' }]) done() } ) }) describe('when rootDoc_id matches doc being deleted', function () { beforeEach(function (done) { Project.updateOne( { _id: this.exampleProjectId }, { $set: { rootDoc_id: this.exampleDocId } }, done ) }) it('should clear rootDoc_id', function (done) { deleteItem( owner, this.exampleProjectId, 'doc', this.exampleDocId, () => { ProjectGetter.getProject( this.exampleProjectId, (error, project) => { if (error) { throw error } expect(project.rootDoc_id).to.be.undefined done() } ) } ) }) }) describe('when rootDoc_id does not match doc being deleted', function () { beforeEach(function (done) { this.exampleRootDocId = new ObjectId() Project.updateOne( { _id: this.exampleProjectId }, { $set: { rootDoc_id: this.exampleRootDocId } }, done ) }) it('should not clear rootDoc_id', function (done) { deleteItem( owner, this.exampleProjectId, 'doc', this.exampleDocId, () => { ProjectGetter.getProject( this.exampleProjectId, (error, project) => { if (error) { throw error } expect(project.rootDoc_id.toString()).to.equal( this.exampleRootDocId.toString() ) done() } ) } ) }) }) }) })
overleaf/web/test/acceptance/src/ProjectStructureTests.js/0
{ "file_path": "overleaf/web/test/acceptance/src/ProjectStructureTests.js", "repo_id": "overleaf", "token_count": 4995 }
530
const { expect } = require('chai') const MockSubscription = require('./Subscription') const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/SubscriptionUpdater') const SubscriptionModel = require('../../../../app/src/models/Subscription') .Subscription const DeletedSubscriptionModel = require(`../../../../app/src/models/DeletedSubscription`) .DeletedSubscription class DeletedSubscription { constructor(options = {}) { this.subscription = new MockSubscription(options) } ensureExists(callback) { this.subscription.ensureExists(error => { if (error) { return callback(error) } SubscriptionUpdater.deleteSubscription(this.subscription, {}, callback) }) } expectRestored(callback) { DeletedSubscriptionModel.findOne( { 'subscription._id': this.subscription._id }, (error, deletedSubscription) => { if (error) { return callback(error) } expect(deletedSubscription).to.be.null SubscriptionModel.findById( this.subscription._id, (error, subscription) => { expect(subscription).to.exist expect(subscription._id.toString()).to.equal( this.subscription._id.toString() ) expect(subscription.admin_id.toString()).to.equal( this.subscription.admin_id.toString() ) callback(error) } ) } ) } } module.exports = DeletedSubscription
overleaf/web/test/acceptance/src/helpers/DeletedSubscription.js/0
{ "file_path": "overleaf/web/test/acceptance/src/helpers/DeletedSubscription.js", "repo_id": "overleaf", "token_count": 618 }
531
const AbstractMockApi = require('./AbstractMockApi') class MockAnalyticsApi extends AbstractMockApi { reset() { this.updates = {} } applyRoutes() { this.app.get('/graphs/:graph', (req, res) => { return res.json({}) }) this.app.get('/recentInstitutionActivity', (req, res) => { res.json({ institutionId: 123, day: { projects: 0, users: 0, }, week: { projects: 0, users: 0, }, month: { projects: 1, users: 2, }, }) }) } } module.exports = MockAnalyticsApi // type hint for the inherited `instance` method /** * @function instance * @memberOf MockAnalyticsApi * @static * @returns {MockAnalyticsApi} */
overleaf/web/test/acceptance/src/mocks/MockAnalyticsApi.js/0
{ "file_path": "overleaf/web/test/acceptance/src/mocks/MockAnalyticsApi.js", "repo_id": "overleaf", "token_count": 367 }
532
import { expect } from 'chai' import { render, screen } from '@testing-library/react' import Message from '../../../../../frontend/js/features/chat/components/message' import { stubMathJax, tearDownMathJaxStubs } from './stubs' describe('<Message />', function () { const currentUser = { id: 'fake_user', first_name: 'fake_user_first_name', email: 'fake@example.com', } beforeEach(function () { window.user = currentUser stubMathJax() }) afterEach(function () { delete window.user tearDownMathJaxStubs() }) it('renders a basic message', function () { const message = { contents: ['a message'], user: currentUser, } render(<Message userId={currentUser.id} message={message} />) screen.getByText('a message') }) it('renders a message with multiple contents', function () { const message = { contents: ['a message', 'another message'], user: currentUser, } render(<Message userId={currentUser.id} message={message} />) screen.getByText('a message') screen.getByText('another message') }) it('renders HTML links within messages', function () { const message = { contents: [ 'a message with a <a href="https://overleaf.com">link to Overleaf</a>', ], user: currentUser, } render(<Message userId={currentUser.id} message={message} />) screen.getByRole('link', { name: 'https://overleaf.com' }) }) describe('when the message is from the user themselves', function () { const message = { contents: ['a message'], user: currentUser, } it('does not render the user name nor the email', function () { render(<Message userId={currentUser.id} message={message} />) expect(screen.queryByText(currentUser.first_name)).to.not.exist expect(screen.queryByText(currentUser.email)).to.not.exist }) }) describe('when the message is from other user', function () { const otherUser = { id: 'other_user', first_name: 'other_user_first_name', } const message = { contents: ['a message'], user: otherUser, } it('should render the other user name', function () { render(<Message userId={currentUser.id} message={message} />) screen.getByText(otherUser.first_name) }) it('should render the other user email when their name is not available', function () { const msg = { contents: message.contents, user: { id: otherUser.id, email: 'other@example.com', }, } render(<Message userId={currentUser.id} message={msg} />) expect(screen.queryByText(otherUser.first_name)).to.not.exist screen.getByText(msg.user.email) }) }) })
overleaf/web/test/frontend/features/chat/components/message.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/chat/components/message.test.js", "repo_id": "overleaf", "token_count": 1031 }
533
import sinon from 'sinon' import { expect } from 'chai' import { screen, fireEvent } from '@testing-library/react' import renderWithContext from '../../helpers/render-with-context' import FileTreeitemMenu from '../../../../../../frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu' describe('<FileTreeitemMenu />', function () { const setContextMenuCoords = sinon.stub() afterEach(function () { setContextMenuCoords.reset() }) it('renders dropdown', function () { renderWithContext( <FileTreeitemMenu id="123abc" setContextMenuCoords={setContextMenuCoords} /> ) const toggleButton = screen.getByRole('button', { name: 'Menu' }) fireEvent.click(toggleButton) screen.getByRole('menu') }) it('open / close', function () { renderWithContext( <FileTreeitemMenu id="123abc" setContextMenuCoords={setContextMenuCoords} /> ) expect(screen.queryByRole('menu')).to.be.null const toggleButton = screen.getByRole('button', { name: 'Menu' }) fireEvent.click(toggleButton) screen.getByRole('menu', { visible: true }) fireEvent.click(toggleButton) screen.getByRole('menu', { visible: false }) }) })
overleaf/web/test/frontend/features/file-tree/components/file-tree-item/file-tree-item-menu.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/file-tree/components/file-tree-item/file-tree-item-menu.test.js", "repo_id": "overleaf", "token_count": 457 }
534
import { screen, render } from '@testing-library/react' import OutlineList from '../../../../../frontend/js/features/outline/components/outline-list' describe('<OutlineList />', function () { const jumpToLine = () => {} it('renders items', function () { const outline = [ { title: 'Section 1', line: 1, level: 10, }, { title: 'Section 2', line: 2, level: 10, }, ] render(<OutlineList outline={outline} isRoot jumpToLine={jumpToLine} />) screen.getByRole('treeitem', { name: 'Section 1' }) screen.getByRole('treeitem', { name: 'Section 2' }) }) it('renders as root', function () { const outline = [ { title: 'Section', line: 1, level: 10, }, ] render(<OutlineList outline={outline} isRoot jumpToLine={jumpToLine} />) screen.getByRole('tree') }) it('renders as non-root', function () { const outline = [ { title: 'Section', line: 1, level: 10, }, ] render(<OutlineList outline={outline} jumpToLine={jumpToLine} />) screen.getByRole('group') }) })
overleaf/web/test/frontend/features/outline/components/outline-list.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/outline/components/outline-list.test.js", "repo_id": "overleaf", "token_count": 509 }
535
/* eslint-disable no-return-assign, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import { expect } from 'chai' import displayNameForUser from '../../../../../frontend/js/ide/history/util/displayNameForUser' export default describe('displayNameForUser', function () { beforeEach(function () { return (window.user = { id: 42 }) }) it("should return 'Anonymous' with no user", function () { return expect(displayNameForUser(null)).to.equal('Anonymous') }) it("should return 'you' when the user has the same id as the window", function () { return expect( displayNameForUser({ id: window.user.id, email: 'james.allen@overleaf.com', first_name: 'James', last_name: 'Allen', }) ).to.equal('you') }) it('should return the first_name and last_name when present', function () { return expect( displayNameForUser({ id: window.user.id + 1, email: 'james.allen@overleaf.com', first_name: 'James', last_name: 'Allen', }) ).to.equal('James Allen') }) it('should return only the firstAname if no last_name', function () { return expect( displayNameForUser({ id: window.user.id + 1, email: 'james.allen@overleaf.com', first_name: 'James', last_name: '', }) ).to.equal('James') }) it('should return the email username if there are no names', function () { return expect( displayNameForUser({ id: window.user.id + 1, email: 'james.allen@overleaf.com', first_name: '', last_name: '', }) ).to.equal('james.allen') }) it("should return the '?' if it has nothing", function () { return expect( displayNameForUser({ id: window.user.id + 1, email: '', first_name: '', last_name: '', }) ).to.equal('?') }) })
overleaf/web/test/frontend/ide/history/util/displayNameForUserTests.js/0
{ "file_path": "overleaf/web/test/frontend/ide/history/util/displayNameForUserTests.js", "repo_id": "overleaf", "token_count": 855 }
536
const fs = require('fs') const Path = require('path') const Settings = require('@overleaf/settings') const { getCsrfTokenForFactory } = require('./support/Csrf') const { SmokeTestFailure } = require('./support/Errors') const { requestFactory, assertHasStatusCode, } = require('./support/requestHelper') const { processWithTimeout } = require('./support/timeoutHelper') const STEP_TIMEOUT = Settings.smokeTest.stepTimeout const PATH_STEPS = Path.join(__dirname, './steps') const STEPS = fs .readdirSync(PATH_STEPS) .sort() .map(name => { const step = require(Path.join(PATH_STEPS, name)) step.name = Path.basename(name, '.js') return step }) async function runSmokeTests({ isAborted, stats }) { let lastStep = stats.start function completeStep(key) { const step = Date.now() stats.steps.push({ [key]: step - lastStep }) lastStep = step } const request = requestFactory({ timeout: STEP_TIMEOUT }) const getCsrfTokenFor = getCsrfTokenForFactory({ request }) const ctx = { assertHasStatusCode, getCsrfTokenFor, processWithTimeout, request, stats, timeout: STEP_TIMEOUT, } const cleanupSteps = [] async function runAndTrack(id, fn) { let result try { result = await fn(ctx) } catch (e) { throw new SmokeTestFailure(`${id} failed`, {}, e) } finally { completeStep(id) } Object.assign(ctx, result) } completeStep('init') let err try { for (const step of STEPS) { if (isAborted()) break const { name, run, cleanup } = step if (cleanup) cleanupSteps.unshift({ name, cleanup }) await runAndTrack(`run.${name}`, run) } } catch (e) { err = e } const cleanupErrors = [] for (const step of cleanupSteps) { const { name, cleanup } = step try { await runAndTrack(`cleanup.${name}`, cleanup) } catch (e) { // keep going with cleanup cleanupErrors.push(e) } } if (err) throw err if (cleanupErrors.length) { if (cleanupErrors.length === 1) throw cleanupErrors[0] throw new SmokeTestFailure('multiple cleanup steps failed', { stats, cleanupErrors, }) } } module.exports = { runSmokeTests, SmokeTestFailure }
overleaf/web/test/smoke/src/SmokeTests.js/0
{ "file_path": "overleaf/web/test/smoke/src/SmokeTests.js", "repo_id": "overleaf", "token_count": 843 }
537
/* eslint-disable node/handle-callback-err, max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const sinon = require('sinon') const { expect } = require('chai') const modulePath = '../../../../app/src/Features/Authorization/AuthorizationManager.js' const SandboxedModule = require('sandboxed-module') const Errors = require('../../../../app/src/Features/Errors/Errors.js') const { ObjectId } = require('mongodb') describe('AuthorizationManager', function () { beforeEach(function () { this.AuthorizationManager = SandboxedModule.require(modulePath, { requires: { mongodb: { ObjectId }, '../Collaborators/CollaboratorsGetter': (this.CollaboratorsGetter = {}), '../Collaborators/CollaboratorsHandler': (this.CollaboratorsHandler = {}), '../Project/ProjectGetter': (this.ProjectGetter = {}), '../../models/User': { User: (this.User = {}), }, '../TokenAccess/TokenAccessHandler': (this.TokenAccessHandler = { validateTokenForAnonymousAccess: sinon .stub() .callsArgWith(2, null, false, false), }), '@overleaf/settings': { passwordStrengthOptions: {} }, }, }) this.user_id = 'user-id-1' this.project_id = 'project-id-1' this.token = 'some-token' return (this.callback = sinon.stub()) }) describe('isRestrictedUser', function () { it('should produce the correct values', function () { const notRestrictedScenarios = [ [null, 'readAndWrite', false], ['id', 'readAndWrite', true], ['id', 'readOnly', false], ] const restrictedScenarios = [ [null, 'readOnly', false], ['id', 'readOnly', true], [null, false, true], [null, false, false], ['id', false, true], ['id', false, false], ] for (var notRestrictedArgs of notRestrictedScenarios) { expect( this.AuthorizationManager.isRestrictedUser(...notRestrictedArgs) ).to.equal(false) } for (var restrictedArgs of restrictedScenarios) { expect( this.AuthorizationManager.isRestrictedUser(...restrictedArgs) ).to.equal(true) } }) }) describe('getPrivilegeLevelForProject', function () { beforeEach(function () { this.ProjectGetter.getProject = sinon.stub() this.AuthorizationManager.isUserSiteAdmin = sinon.stub() return (this.CollaboratorsGetter.getMemberIdPrivilegeLevel = sinon.stub()) }) describe('with a token-based project', function () { beforeEach(function () { return this.ProjectGetter.getProject .withArgs(this.project_id, { publicAccesLevel: 1 }) .yields(null, { publicAccesLevel: 'tokenBased' }) }) describe('with a user_id with a privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, 'readOnly') return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it("should return the user's privilege level", function () { return this.callback .calledWith(null, 'readOnly', false, false) .should.equal(true) }) }) describe('with a user_id with no privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return false', function () { return this.callback .calledWith(null, false, false, false) .should.equal(true) }) }) describe('with a user_id who is an admin', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, true) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return the user as an owner', function () { return this.callback .calledWith(null, 'owner', false, true) .should.equal(true) }) }) describe('with no user (anonymous)', function () { describe('when the token is not valid', function () { beforeEach(function () { this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon .stub() .withArgs(this.project_id, this.token) .yields(null, false, false) return this.AuthorizationManager.getPrivilegeLevelForProject( null, this.project_id, this.token, this.callback ) }) it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () { return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal( false ) }) it('should not call AuthorizationManager.isUserSiteAdmin', function () { return this.AuthorizationManager.isUserSiteAdmin.called.should.equal( false ) }) it('should check if the token is valid', function () { return this.TokenAccessHandler.validateTokenForAnonymousAccess .calledWith(this.project_id, this.token) .should.equal(true) }) it('should return false', function () { return this.callback .calledWith(null, false, false, false) .should.equal(true) }) }) describe('when the token is valid for read-and-write', function () { beforeEach(function () { this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon .stub() .withArgs(this.project_id, this.token) .yields(null, true, false) return this.AuthorizationManager.getPrivilegeLevelForProject( null, this.project_id, this.token, this.callback ) }) it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () { return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal( false ) }) it('should not call AuthorizationManager.isUserSiteAdmin', function () { return this.AuthorizationManager.isUserSiteAdmin.called.should.equal( false ) }) it('should check if the token is valid', function () { return this.TokenAccessHandler.validateTokenForAnonymousAccess .calledWith(this.project_id, this.token) .should.equal(true) }) it('should give read-write access', function () { return this.callback .calledWith(null, 'readAndWrite', false) .should.equal(true) }) }) describe('when the token is valid for read-only', function () { beforeEach(function () { this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon .stub() .withArgs(this.project_id, this.token) .yields(null, false, true) return this.AuthorizationManager.getPrivilegeLevelForProject( null, this.project_id, this.token, this.callback ) }) it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () { return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal( false ) }) it('should not call AuthorizationManager.isUserSiteAdmin', function () { return this.AuthorizationManager.isUserSiteAdmin.called.should.equal( false ) }) it('should check if the token is valid', function () { return this.TokenAccessHandler.validateTokenForAnonymousAccess .calledWith(this.project_id, this.token) .should.equal(true) }) it('should give read-only access', function () { return this.callback .calledWith(null, 'readOnly', false) .should.equal(true) }) }) }) }) describe('with a private project', function () { beforeEach(function () { return this.ProjectGetter.getProject .withArgs(this.project_id, { publicAccesLevel: 1 }) .yields(null, { publicAccesLevel: 'private' }) }) describe('with a user_id with a privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, 'readOnly') return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it("should return the user's privilege level", function () { return this.callback .calledWith(null, 'readOnly', false, false) .should.equal(true) }) }) describe('with a user_id with no privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return false', function () { return this.callback .calledWith(null, false, false, false) .should.equal(true) }) }) describe('with a user_id who is an admin', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, true) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return the user as an owner', function () { return this.callback .calledWith(null, 'owner', false, true) .should.equal(true) }) }) describe('with no user (anonymous)', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject( null, this.project_id, this.token, this.callback ) }) it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () { return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal( false ) }) it('should not call AuthorizationManager.isUserSiteAdmin', function () { return this.AuthorizationManager.isUserSiteAdmin.called.should.equal( false ) }) it('should return false', function () { return this.callback .calledWith(null, false, false, false) .should.equal(true) }) }) }) describe('with a public project', function () { beforeEach(function () { return this.ProjectGetter.getProject .withArgs(this.project_id, { publicAccesLevel: 1 }) .yields(null, { publicAccesLevel: 'readAndWrite' }) }) describe('with a user_id with a privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, 'readOnly') return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it("should return the user's privilege level", function () { return this.callback .calledWith(null, 'readOnly', false) .should.equal(true) }) }) describe('with a user_id with no privilege level', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return the public privilege level', function () { return this.callback .calledWith(null, 'readAndWrite', true) .should.equal(true) }) }) describe('with a user_id who is an admin', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, true) this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, false) return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, this.callback ) }) it('should return the user as an owner', function () { return this.callback .calledWith(null, 'owner', false) .should.equal(true) }) }) describe('with no user (anonymous)', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject( null, this.project_id, this.token, this.callback ) }) it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () { return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal( false ) }) it('should not call AuthorizationManager.isUserSiteAdmin', function () { return this.AuthorizationManager.isUserSiteAdmin.called.should.equal( false ) }) it('should return the public privilege level', function () { return this.callback .calledWith(null, 'readAndWrite', true) .should.equal(true) }) }) }) describe("when the project doesn't exist", function () { beforeEach(function () { return this.ProjectGetter.getProject .withArgs(this.project_id, { publicAccesLevel: 1 }) .yields(null, null) }) it('should return a NotFoundError', function () { return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, this.token, error => error.should.be.instanceof(Errors.NotFoundError) ) }) }) describe('when the project id is not valid', function () { beforeEach(function () { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) return this.CollaboratorsGetter.getMemberIdPrivilegeLevel .withArgs(this.user_id, this.project_id) .yields(null, 'readOnly') }) it('should return a error', function (done) { return this.AuthorizationManager.getPrivilegeLevelForProject( undefined, 'not project id', this.token, err => { this.ProjectGetter.getProject.called.should.equal(false) expect(err).to.exist return done() } ) }) }) }) describe('canUserReadProject', function () { beforeEach(function () { return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub()) }) describe('when user is owner', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'owner', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, this.token, (error, canRead) => { expect(canRead).to.equal(true) return done() } ) }) }) describe('when user has read-write access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readAndWrite', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, this.token, (error, canRead) => { expect(canRead).to.equal(true) return done() } ) }) }) describe('when user has read-only access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readOnly', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, this.token, (error, canRead) => { expect(canRead).to.equal(true) return done() } ) }) }) describe('when user has no access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, this.token, (error, canRead) => { expect(canRead).to.equal(false) return done() } ) }) }) }) describe('canUserWriteProjectContent', function () { beforeEach(function () { return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub()) }) describe('when user is owner', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'owner', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(true) return done() } ) }) }) describe('when user has read-write access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readAndWrite', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(true) return done() } ) }) }) describe('when user has read-only access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readOnly', false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(false) return done() } ) }) }) describe('when user has no access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(false) return done() } ) }) }) }) describe('canUserWriteProjectSettings', function () { beforeEach(function () { return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub()) }) describe('when user is owner', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'owner', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(true) return done() } ) }) }) describe('when user has read-write access as a collaborator', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readAndWrite', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(true) return done() } ) }) }) describe('when user has read-write access as the public', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readAndWrite', true) }) it('should return false', function (done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(false) return done() } ) }) }) describe('when user has read-only access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readOnly', false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(false) return done() } ) }) }) describe('when user has no access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, this.token, (error, canWrite) => { expect(canWrite).to.equal(false) return done() } ) }) }) }) describe('canUserAdminProject', function () { beforeEach(function () { return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub()) }) describe('when user is owner', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'owner', false) }) it('should return true', function (done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, this.token, (error, canAdmin) => { expect(canAdmin).to.equal(true) return done() } ) }) }) describe('when user has read-write access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readAndWrite', false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, this.token, (error, canAdmin) => { expect(canAdmin).to.equal(false) return done() } ) }) }) describe('when user has read-only access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, 'readOnly', false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, this.token, (error, canAdmin) => { expect(canAdmin).to.equal(false) return done() } ) }) }) describe('when user has no access', function () { beforeEach(function () { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) it('should return false', function (done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, this.token, (error, canAdmin) => { expect(canAdmin).to.equal(false) return done() } ) }) }) }) describe('isUserSiteAdmin', function () { beforeEach(function () { return (this.User.findOne = sinon.stub()) }) describe('when user is admin', function () { beforeEach(function () { return this.User.findOne .withArgs({ _id: this.user_id }, { isAdmin: 1 }) .yields(null, { isAdmin: true }) }) it('should return true', function (done) { return this.AuthorizationManager.isUserSiteAdmin( this.user_id, (error, isAdmin) => { expect(isAdmin).to.equal(true) return done() } ) }) }) describe('when user is not admin', function () { beforeEach(function () { return this.User.findOne .withArgs({ _id: this.user_id }, { isAdmin: 1 }) .yields(null, { isAdmin: false }) }) it('should return false', function (done) { return this.AuthorizationManager.isUserSiteAdmin( this.user_id, (error, isAdmin) => { expect(isAdmin).to.equal(false) return done() } ) }) }) describe('when user is not found', function () { beforeEach(function () { return this.User.findOne .withArgs({ _id: this.user_id }, { isAdmin: 1 }) .yields(null, null) }) it('should return false', function (done) { return this.AuthorizationManager.isUserSiteAdmin( this.user_id, (error, isAdmin) => { expect(isAdmin).to.equal(false) return done() } ) }) }) describe('when no user is passed', function () { it('should return false', function (done) { return this.AuthorizationManager.isUserSiteAdmin( null, (error, isAdmin) => { this.User.findOne.called.should.equal(false) expect(isAdmin).to.equal(false) return done() } ) }) }) }) })
overleaf/web/test/unit/src/Authorization/AuthorizationManagerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Authorization/AuthorizationManagerTests.js", "repo_id": "overleaf", "token_count": 14217 }
538
/* eslint-disable node/handle-callback-err, max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const sinon = require('sinon') const { expect } = require('chai') const modulePath = '../../../../app/src/Features/Compile/ClsiStateManager.js' const SandboxedModule = require('sandboxed-module') describe('ClsiStateManager', function () { beforeEach(function () { this.ClsiStateManager = SandboxedModule.require(modulePath, { requires: { '@overleaf/settings': (this.settings = {}), '../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}), }, }) this.project = 'project' this.options = { draft: true, isAutoCompile: false } return (this.callback = sinon.stub()) }) describe('computeHash', function () { beforeEach(function (done) { this.docs = [ { path: '/main.tex', doc: { _id: 'doc-id-1' } }, { path: '/folder/sub.tex', doc: { _id: 'doc-id-2' } }, ] this.files = [ { path: '/figure.pdf', file: { _id: 'file-id-1', rev: 123, created: 'aaaaaa' }, }, { path: '/folder/fig2.pdf', file: { _id: 'file-id-2', rev: 456, created: 'bbbbbb' }, }, ] this.ProjectEntityHandler.getAllEntitiesFromProject = sinon .stub() .callsArgWith(1, null, this.docs, this.files) return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash0 = hash return done() } ) }) describe('with a sample project', function () { beforeEach(function () { return this.ClsiStateManager.computeHash( this.project, this.options, this.callback ) }) it('should call the callback with a hash value', function () { return this.callback .calledWith(null, '21b1ab73aa3892bec452baf8ffa0956179e1880f') .should.equal(true) }) }) describe('when the files and docs are in a different order', function () { beforeEach(function () { ;[this.docs[0], this.docs[1]] = Array.from([this.docs[1], this.docs[0]]) ;[this.files[0], this.files[1]] = Array.from([ this.files[1], this.files[0], ]) return this.ClsiStateManager.computeHash( this.project, this.options, this.callback ) }) it('should call the callback with the same hash value', function () { return this.callback.calledWith(null, this.hash0).should.equal(true) }) }) describe('when a doc is renamed', function () { beforeEach(function (done) { this.docs[0].path = '/new.tex' return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when a file is renamed', function () { beforeEach(function (done) { this.files[0].path = '/newfigure.pdf' return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when a doc is added', function () { beforeEach(function (done) { this.docs.push({ path: '/newdoc.tex', doc: { _id: 'newdoc-id' } }) return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when a file is added', function () { beforeEach(function (done) { this.files.push({ path: '/newfile.tex', file: { _id: 'newfile-id', rev: 123 }, }) return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when a doc is removed', function () { beforeEach(function (done) { this.docs.pop() return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when a file is removed', function () { beforeEach(function (done) { this.files.pop() return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe("when a file's revision is updated", function () { beforeEach(function (done) { this.files[0].file.rev++ return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe("when a file's date is updated", function () { beforeEach(function (done) { this.files[0].file.created = 'zzzzzz' return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when the compile options are changed', function () { beforeEach(function (done) { this.options.draft = !this.options.draft return this.ClsiStateManager.computeHash( this.project, this.options, (err, hash) => { this.hash1 = hash return done() } ) }) it('should call the callback with a different hash value', function () { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) describe('when the isAutoCompile option is changed', function () { beforeEach(function () { this.options.isAutoCompile = !this.options.isAutoCompile return this.ClsiStateManager.computeHash( this.project, this.options, this.callback ) }) it('should call the callback with the same hash value', function () { return this.callback.calledWith(null, this.hash0).should.equal(true) }) }) }) })
overleaf/web/test/unit/src/Compile/ClsiStateManagerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Compile/ClsiStateManagerTests.js", "repo_id": "overleaf", "token_count": 3877 }
539
const SandboxedModule = require('sandboxed-module') const cheerio = require('cheerio') const path = require('path') const { expect } = require('chai') const MODULE_PATH = path.join( __dirname, '../../../../app/src/Features/Email/EmailBuilder' ) const EmailMessageHelper = require('../../../../app/src/Features/Email/EmailMessageHelper') const ctaEmailBody = require('../../../../app/src/Features/Email/Bodies/cta-email') const NoCTAEmailBody = require('../../../../app/src/Features/Email/Bodies/NoCTAEmailBody') const BaseWithHeaderEmailLayout = require('../../../../app/src/Features/Email/Layouts/BaseWithHeaderEmailLayout') describe('EmailBuilder', function () { before(function () { this.settings = { appName: 'testApp', siteUrl: 'https://www.overleaf.com', } this.EmailBuilder = SandboxedModule.require(MODULE_PATH, { requires: { './EmailMessageHelper': EmailMessageHelper, './Bodies/cta-email': ctaEmailBody, './Bodies/NoCTAEmailBody': NoCTAEmailBody, './Layouts/BaseWithHeaderEmailLayout': BaseWithHeaderEmailLayout, '@overleaf/settings': this.settings, }, }) }) describe('projectInvite', function () { beforeEach(function () { this.opts = { to: 'bob@bob.com', first_name: 'bob', owner: { email: 'sally@hally.com', }, inviteUrl: 'http://example.com/invite', project: { url: 'http://www.project.com', name: 'standard project', }, } }) describe('when sending a normal email', function () { beforeEach(function () { this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts) }) it('should have html and text properties', function () { expect(this.email.html != null).to.equal(true) expect(this.email.text != null).to.equal(true) }) it('should not have undefined in it', function () { this.email.html.indexOf('undefined').should.equal(-1) this.email.subject.indexOf('undefined').should.equal(-1) }) }) describe('when someone is up to no good', function () { beforeEach(function () { this.opts.project.name = "<img src='http://evilsite.com/evil.php'>" this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts) }) it('should not contain unescaped html in the html part', function () { expect(this.email.html).to.contain('New Project') }) it('should not have undefined in it', function () { this.email.html.indexOf('undefined').should.equal(-1) this.email.subject.indexOf('undefined').should.equal(-1) }) }) }) describe('SpamSafe', function () { beforeEach(function () { this.opts = { to: 'bob@joe.com', first_name: 'bob', owner: { email: 'sally@hally.com', }, inviteUrl: 'http://example.com/invite', project: { url: 'http://www.project.com', name: 'come buy my product at http://notascam.com', }, } this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts) }) it('should replace spammy project name', function () { this.email.html.indexOf('a new project').should.not.equal(-1) this.email.subject.indexOf('New Project').should.not.equal(-1) }) }) describe('ctaTemplate', function () { describe('missing required content', function () { const content = { title: () => {}, greeting: () => {}, message: () => {}, secondaryMessage: () => {}, ctaText: () => {}, ctaURL: () => {}, gmailGoToAction: () => {}, } it('should throw an error when missing title', function () { const { title, ...missing } = content expect(() => { this.EmailBuilder.ctaTemplate(missing) }).to.throw(Error) }) it('should throw an error when missing message', function () { const { message, ...missing } = content expect(() => { this.EmailBuilder.ctaTemplate(missing) }).to.throw(Error) }) it('should throw an error when missing ctaText', function () { const { ctaText, ...missing } = content expect(() => { this.EmailBuilder.ctaTemplate(missing) }).to.throw(Error) }) it('should throw an error when missing ctaURL', function () { const { ctaURL, ...missing } = content expect(() => { this.EmailBuilder.ctaTemplate(missing) }).to.throw(Error) }) }) }) describe('templates', function () { describe('CTA', function () { describe('canceledSubscription', function () { beforeEach(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, } this.email = this.EmailBuilder.buildEmail( 'canceledSubscription', this.opts ) this.expectedUrl = 'https://docs.google.com/forms/d/e/1FAIpQLSfa7z_s-cucRRXm70N4jEcSbFsZeb0yuKThHGQL8ySEaQzF0Q/viewform?usp=sf_link' }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("Leave Feedback")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.expectedUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.expectedUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.expectedUrl) }) }) }) describe('confirmEmail', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.userId = 'abc123' this.opts = { to: this.emailAddress, confirmEmailUrl: `${this.settings.siteUrl}/user/emails/confirm?token=aToken123`, sendingUser_id: this.userId, } this.email = this.EmailBuilder.buildEmail('confirmEmail', this.opts) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("Confirm Email")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.opts.confirmEmailUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.opts.confirmEmailUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.confirmEmailUrl) }) }) }) describe('ownershipTransferConfirmationNewOwner', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, previousOwner: {}, project: { _id: 'abc123', name: 'example project', }, } this.email = this.EmailBuilder.buildEmail( 'ownershipTransferConfirmationNewOwner', this.opts ) this.expectedUrl = `${ this.settings.siteUrl }/project/${this.opts.project._id.toString()}` }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('td a') expect(buttonLink).to.exist expect(buttonLink.attr('href')).to.equal(this.expectedUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback).to.exist const fallbackLink = fallback.html().replace(/&amp;/g, '&') expect(fallbackLink).to.contain(this.expectedUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.expectedUrl) }) }) }) describe('passwordResetRequested', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, setNewPasswordUrl: `${ this.settings.siteUrl }/user/password/set?passwordResetToken=aToken&email=${encodeURIComponent( this.emailAddress )}`, } this.email = this.EmailBuilder.buildEmail( 'passwordResetRequested', this.opts ) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('td a') expect(buttonLink).to.exist expect(buttonLink.attr('href')).to.equal( this.opts.setNewPasswordUrl ) const fallback = dom('.force-overleaf-style').last() expect(fallback).to.exist const fallbackLink = fallback.html().replace(/&amp;/g, '&') expect(fallbackLink).to.contain(this.opts.setNewPasswordUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.setNewPasswordUrl) }) }) }) describe('reconfirmEmail', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.userId = 'abc123' this.opts = { to: this.emailAddress, confirmEmailUrl: `${this.settings.siteUrl}/user/emails/confirm?token=aToken123`, sendingUser_id: this.userId, } this.email = this.EmailBuilder.buildEmail('reconfirmEmail', this.opts) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("Reconfirm Email")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.opts.confirmEmailUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.opts.confirmEmailUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.confirmEmailUrl) }) }) }) describe('verifyEmailToJoinTeam', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, acceptInviteUrl: `${this.settings.siteUrl}/subscription/invites/aToken123/`, inviter: { email: 'deanna@overleaf.com', first_name: 'Deanna', last_name: 'Troi', }, } this.email = this.EmailBuilder.buildEmail( 'verifyEmailToJoinTeam', this.opts ) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("Join now")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.opts.acceptInviteUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.opts.acceptInviteUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.acceptInviteUrl) }) }) }) describe('reactivatedSubscription', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, } this.email = this.EmailBuilder.buildEmail( 'reactivatedSubscription', this.opts ) this.expectedUrl = `${this.settings.siteUrl}/user/subscription` }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("View Subscription Dashboard")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.expectedUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.expectedUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.expectedUrl) }) }) }) describe('testEmail', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, } this.email = this.EmailBuilder.buildEmail('testEmail', this.opts) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom( `a:contains("Open ${this.settings.appName}")` ) expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.settings.siteUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html() expect(fallbackLink).to.contain(this.settings.siteUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain( `Open ${this.settings.appName}: ${this.settings.siteUrl}` ) }) }) }) describe('registered', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.opts = { to: this.emailAddress, setNewPasswordUrl: `${this.settings.siteUrl}/user/activate?token=aToken123&user_id=aUserId123`, } this.email = this.EmailBuilder.buildEmail('registered', this.opts) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("Set password")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal( this.opts.setNewPasswordUrl ) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html().replace(/&amp;/, '&') expect(fallbackLink).to.contain(this.opts.setNewPasswordUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.setNewPasswordUrl) }) }) }) describe('projectInvite', function () { before(function () { this.emailAddress = 'example@overleaf.com' this.owner = { email: 'owner@example.com', name: 'Bailey', } this.projectName = 'Top Secret' this.opts = { inviteUrl: `${this.settings.siteUrl}/project/projectId123/invite/token/aToken123?` + [ `project_name=${encodeURIComponent(this.projectName)}`, `user_first_name=${encodeURIComponent(this.owner.name)}`, ].join('&'), owner: { email: this.owner.email, }, project: { name: this.projectName, }, to: this.emailAddress, } this.email = this.EmailBuilder.buildEmail('projectInvite', this.opts) }) it('should build the email', function () { expect(this.email.html).to.exist expect(this.email.text).to.exist }) describe('HTML email', function () { it('should include a CTA button and a fallback CTA link', function () { const dom = cheerio.load(this.email.html) const buttonLink = dom('a:contains("View project")') expect(buttonLink.length).to.equal(1) expect(buttonLink.attr('href')).to.equal(this.opts.inviteUrl) const fallback = dom('.force-overleaf-style').last() expect(fallback.length).to.equal(1) const fallbackLink = fallback.html().replace(/&amp;/g, '&') expect(fallbackLink).to.contain(this.opts.inviteUrl) }) }) describe('plain text email', function () { it('should contain the CTA link', function () { expect(this.email.text).to.contain(this.opts.inviteUrl) }) }) }) }) describe('no CTA', function () { describe('securityAlert', function () { before(function () { this.message = 'more details about the action' this.messageHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${this.message}</i></b></span>` this.messageNotAllowedHTML = `<div></div>${this.messageHTML}` this.actionDescribed = 'an action described' this.actionDescribedHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${this.actionDescribed}</i></b>` this.actionDescribedNotAllowedHTML = `<div></div>${this.actionDescribedHTML}` this.opts = { to: this.email, actionDescribed: this.actionDescribedNotAllowedHTML, action: 'an action', message: [this.messageNotAllowedHTML], } this.email = this.EmailBuilder.buildEmail('securityAlert', this.opts) }) it('should build the email', function () { expect(this.email.html != null).to.equal(true) expect(this.email.text != null).to.equal(true) }) describe('HTML email', function () { it('should clean HTML in opts.actionDescribed', function () { expect(this.email.html).to.not.contain( this.actionDescribedNotAllowedHTML ) expect(this.email.html).to.contain(this.actionDescribedHTML) }) it('should clean HTML in opts.message', function () { expect(this.email.html).to.not.contain(this.messageNotAllowedHTML) expect(this.email.html).to.contain(this.messageHTML) }) }) describe('plain text email', function () { it('should remove all HTML in opts.actionDescribed', function () { expect(this.email.text).to.not.contain(this.actionDescribedHTML) expect(this.email.text).to.contain(this.actionDescribed) }) it('should remove all HTML in opts.message', function () { expect(this.email.text).to.not.contain(this.messageHTML) expect(this.email.text).to.contain(this.message) }) }) }) }) }) })
overleaf/web/test/unit/src/Email/EmailBuilderTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Email/EmailBuilderTests.js", "repo_id": "overleaf", "token_count": 10234 }
540
const { expect } = require('chai') const sinon = require('sinon') const SandboxedModule = require('sandboxed-module') const { ObjectId } = require('mongodb') const MODULE_PATH = '../../../../app/src/Features/History/HistoryManager' describe('HistoryManager', function () { beforeEach(function () { this.user_id = 'user-id-123' this.AuthenticationController = { getLoggedInUserId: sinon.stub().returns(this.user_id), } this.request = { post: sinon.stub(), delete: sinon.stub().resolves(), } this.projectHistoryUrl = 'http://project_history.example.com' this.v1HistoryUrl = 'http://v1_history.example.com' this.v1HistoryUser = 'system' this.v1HistoryPassword = 'verysecret' this.settings = { apis: { trackchanges: { enabled: false, url: 'http://trackchanges.example.com', }, project_history: { url: this.projectHistoryUrl, }, v1_history: { url: this.v1HistoryUrl, user: this.v1HistoryUser, pass: this.v1HistoryPassword, }, }, } this.UserGetter = { promises: { getUsersByV1Ids: sinon.stub(), getUsers: sinon.stub(), }, } this.HistoryManager = SandboxedModule.require(MODULE_PATH, { requires: { 'request-promise-native': this.request, '@overleaf/settings': this.settings, '../User/UserGetter': this.UserGetter, }, }) }) describe('initializeProject', function () { describe('with project history enabled', function () { beforeEach(function () { this.settings.apis.project_history.initializeHistoryForNewProjects = true }) describe('project history returns a successful response', function () { beforeEach(async function () { this.overleaf_id = 1234 this.request.post.resolves( JSON.stringify({ project: { id: this.overleaf_id } }) ) this.result = await this.HistoryManager.promises.initializeProject() }) it('should call the project history api', function () { this.request.post .calledWith({ url: `${this.settings.apis.project_history.url}/project`, }) .should.equal(true) }) it('should return the overleaf id', function () { expect(this.result).to.deep.equal({ overleaf_id: this.overleaf_id }) }) }) describe('project history returns a response without the project id', function () { it('should throw an error', async function () { this.request.post.resolves(JSON.stringify({ project: {} })) await expect(this.HistoryManager.promises.initializeProject()).to.be .rejected }) }) describe('project history errors', function () { it('should propagate the error', async function () { this.request.post.rejects(new Error('problem connecting')) await expect(this.HistoryManager.promises.initializeProject()).to.be .rejected }) }) }) describe('with project history disabled', function () { it('should return without errors', async function () { this.settings.apis.project_history.initializeHistoryForNewProjects = false await expect(this.HistoryManager.promises.initializeProject()).to.be .fulfilled }) }) }) describe('injectUserDetails', function () { beforeEach(function () { this.user1 = { _id: (this.user_id1 = '123456'), first_name: 'Jane', last_name: 'Doe', email: 'jane@example.com', overleaf: { id: 5011 }, } this.user1_view = { id: this.user_id1, first_name: 'Jane', last_name: 'Doe', email: 'jane@example.com', } this.user2 = { _id: (this.user_id2 = 'abcdef'), first_name: 'John', last_name: 'Doe', email: 'john@example.com', } this.user2_view = { id: this.user_id2, first_name: 'John', last_name: 'Doe', email: 'john@example.com', } this.UserGetter.promises.getUsersByV1Ids.resolves([this.user1]) this.UserGetter.promises.getUsers.resolves([this.user1, this.user2]) }) describe('with a diff', function () { it('should turn user_ids into user objects', async function () { const diff = await this.HistoryManager.promises.injectUserDetails({ diff: [ { i: 'foo', meta: { users: [this.user_id1], }, }, { i: 'bar', meta: { users: [this.user_id2], }, }, ], }) expect(diff.diff[0].meta.users).to.deep.equal([this.user1_view]) expect(diff.diff[1].meta.users).to.deep.equal([this.user2_view]) }) it('should handle v1 user ids', async function () { const diff = await this.HistoryManager.promises.injectUserDetails({ diff: [ { i: 'foo', meta: { users: [5011], }, }, { i: 'bar', meta: { users: [this.user_id2], }, }, ], }) expect(diff.diff[0].meta.users).to.deep.equal([this.user1_view]) expect(diff.diff[1].meta.users).to.deep.equal([this.user2_view]) }) it('should leave user objects', async function () { const diff = await this.HistoryManager.promises.injectUserDetails({ diff: [ { i: 'foo', meta: { users: [this.user1_view], }, }, { i: 'bar', meta: { users: [this.user_id2], }, }, ], }) expect(diff.diff[0].meta.users).to.deep.equal([this.user1_view]) expect(diff.diff[1].meta.users).to.deep.equal([this.user2_view]) }) it('should handle a binary diff marker', async function () { const diff = await this.HistoryManager.promises.injectUserDetails({ diff: { binary: true }, }) expect(diff.diff.binary).to.be.true }) }) describe('with a list of updates', function () { it('should turn user_ids into user objects', async function () { const updates = await this.HistoryManager.promises.injectUserDetails({ updates: [ { fromV: 5, toV: 8, meta: { users: [this.user_id1], }, }, { fromV: 4, toV: 5, meta: { users: [this.user_id2], }, }, ], }) expect(updates.updates[0].meta.users).to.deep.equal([this.user1_view]) expect(updates.updates[1].meta.users).to.deep.equal([this.user2_view]) }) it('should leave user objects', async function () { const updates = await this.HistoryManager.promises.injectUserDetails({ updates: [ { fromV: 5, toV: 8, meta: { users: [this.user1_view], }, }, { fromV: 4, toV: 5, meta: { users: [this.user_id2], }, }, ], }) expect(updates.updates[0].meta.users).to.deep.equal([this.user1_view]) expect(updates.updates[1].meta.users).to.deep.equal([this.user2_view]) }) }) }) describe('deleteProject', function () { const projectId = new ObjectId() const historyId = new ObjectId() beforeEach(async function () { await this.HistoryManager.promises.deleteProject(projectId, historyId) }) it('should call the project-history service', async function () { expect(this.request.delete).to.have.been.calledWith( `${this.projectHistoryUrl}/project/${projectId}` ) }) it('should call the v1-history service', async function () { expect(this.request.delete).to.have.been.calledWith({ url: `${this.v1HistoryUrl}/projects/${historyId}`, auth: { user: this.v1HistoryUser, pass: this.v1HistoryPassword, }, }) }) }) })
overleaf/web/test/unit/src/History/HistoryManagerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/History/HistoryManagerTests.js", "repo_id": "overleaf", "token_count": 4198 }
541
/* eslint-disable node/handle-callback-err, max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const SandboxedModule = require('sandboxed-module') const assert = require('assert') const path = require('path') const sinon = require('sinon') const { expect } = require('chai') const modulePath = path.join( __dirname, '../../../../app/src/Features/PasswordReset/PasswordResetHandler' ) describe('PasswordResetHandler', function () { beforeEach(function () { this.settings = { siteUrl: 'www.sharelatex.com' } this.OneTimeTokenHandler = { getNewToken: sinon.stub(), getValueFromTokenAndExpire: sinon.stub(), } this.UserGetter = { getUserByMainEmail: sinon.stub(), getUser: sinon.stub(), getUserByAnyEmail: sinon.stub(), } this.EmailHandler = { sendEmail: sinon.stub() } this.AuthenticationManager = { setUserPasswordInV2: sinon.stub(), promises: { setUserPassword: sinon.stub().resolves(), }, } this.PasswordResetHandler = SandboxedModule.require(modulePath, { requires: { '../User/UserAuditLogHandler': (this.UserAuditLogHandler = { promises: { addEntry: sinon.stub().resolves(), }, }), '../User/UserGetter': this.UserGetter, '../Security/OneTimeTokenHandler': this.OneTimeTokenHandler, '../Email/EmailHandler': this.EmailHandler, '../Authentication/AuthenticationManager': this.AuthenticationManager, '@overleaf/settings': this.settings, }, }) this.token = '12312321i' this.user_id = 'user_id_here' this.user = { email: (this.email = 'bob@bob.com'), _id: this.user_id } this.password = 'my great secret password' this.callback = sinon.stub() // this should not have any effect now this.settings.overleaf = true }) afterEach(function () { this.settings.overleaf = false }) describe('generateAndEmailResetToken', function () { it('should check the user exists', function () { this.UserGetter.getUserByAnyEmail.yields() this.PasswordResetHandler.generateAndEmailResetToken( this.user.email, this.callback ) this.UserGetter.getUserByAnyEmail.should.have.been.calledWith( this.user.email ) }) it('should send the email with the token', function (done) { this.UserGetter.getUserByAnyEmail.yields(null, this.user) this.OneTimeTokenHandler.getNewToken.yields(null, this.token) this.EmailHandler.sendEmail.yields() this.PasswordResetHandler.generateAndEmailResetToken( this.user.email, (err, status) => { this.EmailHandler.sendEmail.called.should.equal(true) status.should.equal('primary') const args = this.EmailHandler.sendEmail.args[0] args[0].should.equal('passwordResetRequested') args[1].setNewPasswordUrl.should.equal( `${this.settings.siteUrl}/user/password/set?passwordResetToken=${ this.token }&email=${encodeURIComponent(this.user.email)}` ) done() } ) }) describe('when the email exists', function () { beforeEach(function () { this.UserGetter.getUserByAnyEmail.yields(null, this.user) this.OneTimeTokenHandler.getNewToken.yields(null, this.token) this.EmailHandler.sendEmail.yields() this.PasswordResetHandler.generateAndEmailResetToken( this.email, this.callback ) }) it('should set the password token data to the user id and email', function () { this.OneTimeTokenHandler.getNewToken.should.have.been.calledWith( 'password', { email: this.email, user_id: this.user._id, } ) }) it('should send an email with the token', function () { this.EmailHandler.sendEmail.called.should.equal(true) const args = this.EmailHandler.sendEmail.args[0] args[0].should.equal('passwordResetRequested') args[1].setNewPasswordUrl.should.equal( `${this.settings.siteUrl}/user/password/set?passwordResetToken=${ this.token }&email=${encodeURIComponent(this.user.email)}` ) }) it('should return status == true', function () { this.callback.calledWith(null, 'primary').should.equal(true) }) }) describe("when the email doesn't exist", function () { beforeEach(function () { this.UserGetter.getUserByAnyEmail.yields(null, null) this.PasswordResetHandler.generateAndEmailResetToken( this.email, this.callback ) }) it('should not set the password token data', function () { this.OneTimeTokenHandler.getNewToken.called.should.equal(false) }) it('should send an email with the token', function () { this.EmailHandler.sendEmail.called.should.equal(false) }) it('should return status == null', function () { this.callback.calledWith(null, null).should.equal(true) }) }) describe('when the email is a secondary email', function () { beforeEach(function () { this.UserGetter.getUserByAnyEmail.callsArgWith(1, null, this.user) this.PasswordResetHandler.generateAndEmailResetToken( 'secondary@email.com', this.callback ) }) it('should not set the password token data', function () { this.OneTimeTokenHandler.getNewToken.called.should.equal(false) }) it('should not send an email with the token', function () { this.EmailHandler.sendEmail.called.should.equal(false) }) it('should return status == secondary', function () { this.callback.calledWith(null, 'secondary').should.equal(true) }) }) }) describe('setNewUserPassword', function () { beforeEach(function () { this.auditLog = { ip: '0:0:0:0' } }) describe('when no data is found', function () { beforeEach(function () { this.OneTimeTokenHandler.getValueFromTokenAndExpire.yields(null, null) }) it('should return found == false and reset == false', function () { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (error, result) => { expect(error).to.not.exist expect(result).to.deep.equal({ found: false, reset: false, userId: null, }) } ) }) }) describe('when the token has a user_id and email', function () { beforeEach(function () { this.OneTimeTokenHandler.getValueFromTokenAndExpire .withArgs('password', this.token) .yields(null, { user_id: this.user._id, email: this.email, }) this.AuthenticationManager.promises.setUserPassword .withArgs(this.user, this.password) .resolves(true) }) describe('when no user is found with this email', function () { beforeEach(function () { this.UserGetter.getUserByMainEmail .withArgs(this.email) .yields(null, null) }) it('should return found == false and reset == false', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { found, reset, userId } = result expect(err).to.not.exist expect(found).to.be.false expect(reset).to.be.false done() } ) }) }) describe("when the email and user don't match", function () { beforeEach(function () { this.UserGetter.getUserByMainEmail .withArgs(this.email) .yields(null, { _id: 'not-the-same', email: this.email }) }) it('should return found == false and reset == false', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { found, reset, userId } = result expect(err).to.not.exist expect(found).to.be.false expect(reset).to.be.false done() } ) }) }) describe('when the email and user match', function () { describe('success', function () { beforeEach(function () { this.UserGetter.getUserByMainEmail.yields(null, this.user) }) it('should update the user audit log', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (error, result) => { const { reset, userId } = result expect(error).to.not.exist const logCall = this.UserAuditLogHandler.promises.addEntry .lastCall expect(logCall.args[0]).to.equal(this.user_id) expect(logCall.args[1]).to.equal('reset-password') expect(logCall.args[2]).to.equal(undefined) expect(logCall.args[3]).to.equal(this.auditLog.ip) expect(logCall.args[4]).to.equal(undefined) done() } ) }) it('should return reset == true and the user id', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { reset, userId } = result expect(err).to.not.exist expect(reset).to.be.true expect(userId).to.equal(this.user._id) done() } ) }) describe('when logged in', function () { beforeEach(function () { this.auditLog.initiatorId = this.user_id }) it('should update the user audit log with initiatorId', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (error, result) => { const { reset, userId } = result expect(error).to.not.exist const logCall = this.UserAuditLogHandler.promises.addEntry .lastCall expect(logCall.args[0]).to.equal(this.user_id) expect(logCall.args[1]).to.equal('reset-password') expect(logCall.args[2]).to.equal(this.user_id) expect(logCall.args[3]).to.equal(this.auditLog.ip) expect(logCall.args[4]).to.equal(undefined) done() } ) }) }) }) describe('errors', function () { describe('via UserAuditLogHandler', function () { beforeEach(function () { this.PasswordResetHandler.promises.getUserForPasswordResetToken = sinon .stub() .withArgs(this.token) .resolves(this.user) this.UserAuditLogHandler.promises.addEntry.rejects( new Error('oops') ) }) it('should return the error', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (error, _result) => { expect(error).to.exist expect( this.UserAuditLogHandler.promises.addEntry.callCount ).to.equal(1) expect(this.AuthenticationManager.promises.setUserPassword).to .have.been.called done() } ) }) }) }) }) }) describe('when the token has a v1_user_id and email', function () { beforeEach(function () { this.user.overleaf = { id: 184 } this.OneTimeTokenHandler.getValueFromTokenAndExpire .withArgs('password', this.token) .yields(null, { v1_user_id: this.user.overleaf.id, email: this.email, }) this.AuthenticationManager.promises.setUserPassword .withArgs(this.user, this.password) .resolves(true) }) describe('when no user is reset with this email', function () { beforeEach(function () { this.UserGetter.getUserByMainEmail .withArgs(this.email) .yields(null, null) }) it('should return reset == false', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { reset, userId } = result expect(err).to.not.exist expect(reset).to.be.false done() } ) }) }) describe("when the email and user don't match", function () { beforeEach(function () { this.UserGetter.getUserByMainEmail.withArgs(this.email).yields(null, { _id: this.user._id, email: this.email, overleaf: { id: 'not-the-same' }, }) }) it('should return reset == false', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { reset, userId } = result expect(err).to.not.exist expect(reset).to.be.false done() } ) }) }) describe('when the email and user match', function () { beforeEach(function () { this.UserGetter.getUserByMainEmail .withArgs(this.email) .yields(null, this.user) }) it('should return reset == true and the user id', function (done) { this.PasswordResetHandler.setNewUserPassword( this.token, this.password, this.auditLog, (err, result) => { const { reset, userId } = result expect(err).to.not.exist expect(reset).to.be.true expect(userId).to.equal(this.user._id) done() } ) }) }) }) }) })
overleaf/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js", "repo_id": "overleaf", "token_count": 7304 }
542
/* eslint-disable camelcase, max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS206: Consider reworking classes to avoid initClass * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const { assert, expect } = require('chai') const sinon = require('sinon') const modulePath = '../../../../app/src/Features/Project/ProjectHistoryHandler' const SandboxedModule = require('sandboxed-module') describe('ProjectHistoryHandler', function () { const project_id = '4eecb1c1bffa66588e0000a1' const userId = 1234 beforeEach(function () { let Project this.ProjectModel = Project = (function () { Project = class Project { static initClass() { this.prototype.rootFolder = [this.rootFolder] } constructor(options) { this._id = project_id this.name = 'project_name_here' this.rev = 0 } } Project.initClass() return Project })() this.project = new this.ProjectModel() this.callback = sinon.stub() return (this.ProjectHistoryHandler = SandboxedModule.require(modulePath, { requires: { '@overleaf/settings': (this.Settings = {}), '../../models/Project': { Project: this.ProjectModel, }, './ProjectDetailsHandler': (this.ProjectDetailsHandler = {}), '../History/HistoryManager': (this.HistoryManager = {}), './ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}), }, })) }) describe('starting history for an existing project', function () { beforeEach(function () { this.newHistoryId = 123456789 this.HistoryManager.initializeProject = sinon .stub() .callsArgWith(0, null, { overleaf_id: this.newHistoryId }) this.HistoryManager.flushProject = sinon.stub().callsArg(1) return (this.ProjectEntityUpdateHandler.resyncProjectHistory = sinon .stub() .callsArg(1)) }) describe('when the history does not already exist', function () { beforeEach(function () { this.ProjectDetailsHandler.getDetails = sinon .stub() .withArgs(project_id) .callsArgWith(1, null, this.project) this.ProjectModel.updateOne = sinon .stub() .callsArgWith(2, null, { n: 1 }) return this.ProjectHistoryHandler.ensureHistoryExistsForProject( project_id, this.callback ) }) it('should get any existing history id for the project', function () { return this.ProjectDetailsHandler.getDetails .calledWith(project_id) .should.equal(true) }) it('should initialize a new history in the v1 history service', function () { return this.HistoryManager.initializeProject.called.should.equal(true) }) it('should set the new history id on the project', function () { return this.ProjectModel.updateOne .calledWith( { _id: project_id, 'overleaf.history.id': { $exists: false } }, { 'overleaf.history.id': this.newHistoryId } ) .should.equal(true) }) it('should resync the project history', function () { return this.ProjectEntityUpdateHandler.resyncProjectHistory .calledWith(project_id) .should.equal(true) }) it('should flush the project history', function () { return this.HistoryManager.flushProject .calledWith(project_id) .should.equal(true) }) it('should call the callback without an error', function () { return this.callback.called.should.equal(true) }) }) describe('when the history already exists', function () { beforeEach(function () { this.project.overleaf = { history: { id: 1234 } } this.ProjectDetailsHandler.getDetails = sinon .stub() .withArgs(project_id) .callsArgWith(1, null, this.project) this.ProjectModel.updateOne = sinon.stub() return this.ProjectHistoryHandler.ensureHistoryExistsForProject( project_id, this.callback ) }) it('should get any existing history id for the project', function () { return this.ProjectDetailsHandler.getDetails .calledWith(project_id) .should.equal(true) }) it('should not initialize a new history in the v1 history service', function () { return this.HistoryManager.initializeProject.called.should.equal(false) }) it('should not set the new history id on the project', function () { return this.ProjectModel.updateOne.called.should.equal(false) }) it('should not resync the project history', function () { return this.ProjectEntityUpdateHandler.resyncProjectHistory.called.should.equal( false ) }) it('should not flush the project history', function () { return this.HistoryManager.flushProject.called.should.equal(false) }) it('should call the callback', function () { return this.callback.calledWith().should.equal(true) }) }) }) })
overleaf/web/test/unit/src/Project/ProjectHistoryHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Project/ProjectHistoryHandlerTests.js", "repo_id": "overleaf", "token_count": 2133 }
543
/* eslint-disable max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const SandboxedModule = require('sandboxed-module') const assert = require('assert') const path = require('path') const sinon = require('sinon') const modulePath = path.join( __dirname, '../../../../app/src/Features/Security/OneTimeTokenHandler' ) const { expect } = require('chai') const Errors = require('../../../../app/src/Features/Errors/Errors') const tk = require('timekeeper') describe('OneTimeTokenHandler', function () { beforeEach(function () { tk.freeze(Date.now()) // freeze the time for these tests this.stubbedToken = 'mock-token' this.callback = sinon.stub() return (this.OneTimeTokenHandler = SandboxedModule.require(modulePath, { requires: { '@overleaf/settings': this.settings, crypto: { randomBytes: () => this.stubbedToken, }, '../../infrastructure/mongodb': { db: (this.db = { tokens: {} }), }, }, })) }) afterEach(function () { return tk.reset() }) describe('getNewToken', function () { beforeEach(function () { return (this.db.tokens.insertOne = sinon.stub().yields()) }) describe('normally', function () { beforeEach(function () { return this.OneTimeTokenHandler.getNewToken( 'password', 'mock-data-to-store', this.callback ) }) it('should insert a generated token with a 1 hour expiry', function () { return this.db.tokens.insertOne .calledWith({ use: 'password', token: this.stubbedToken, createdAt: new Date(), expiresAt: new Date(Date.now() + 60 * 60 * 1000), data: 'mock-data-to-store', }) .should.equal(true) }) it('should call the callback with the token', function () { return this.callback .calledWith(null, this.stubbedToken) .should.equal(true) }) }) describe('with an optional expiresIn parameter', function () { beforeEach(function () { return this.OneTimeTokenHandler.getNewToken( 'password', 'mock-data-to-store', { expiresIn: 42 }, this.callback ) }) it('should insert a generated token with a custom expiry', function () { return this.db.tokens.insertOne .calledWith({ use: 'password', token: this.stubbedToken, createdAt: new Date(), expiresAt: new Date(Date.now() + 42 * 1000), data: 'mock-data-to-store', }) .should.equal(true) }) it('should call the callback with the token', function () { return this.callback .calledWith(null, this.stubbedToken) .should.equal(true) }) }) }) describe('getValueFromTokenAndExpire', function () { describe('successfully', function () { beforeEach(function () { this.db.tokens.findOneAndUpdate = sinon .stub() .yields(null, { value: { data: 'mock-data' } }) return this.OneTimeTokenHandler.getValueFromTokenAndExpire( 'password', 'mock-token', this.callback ) }) it('should expire the token', function () { return this.db.tokens.findOneAndUpdate .calledWith( { use: 'password', token: 'mock-token', expiresAt: { $gt: new Date() }, usedAt: { $exists: false }, }, { $set: { usedAt: new Date() }, } ) .should.equal(true) }) it('should return the data', function () { return this.callback.calledWith(null, 'mock-data').should.equal(true) }) }) describe('when a valid token is not found', function () { beforeEach(function () { this.db.tokens.findOneAndUpdate = sinon .stub() .yields(null, { value: null }) return this.OneTimeTokenHandler.getValueFromTokenAndExpire( 'password', 'mock-token', this.callback ) }) it('should return a NotFoundError', function () { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) }) }) }) })
overleaf/web/test/unit/src/Security/OneTimeTokenHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Security/OneTimeTokenHandlerTests.js", "repo_id": "overleaf", "token_count": 2114 }
544
const SandboxedModule = require('sandboxed-module') const sinon = require('sinon') const chai = require('chai') const { expect } = chai const modulePath = '../../../../app/src/Features/Subscription/SubscriptionHandler' const mockRecurlySubscriptions = { 'subscription-123-active': { uuid: 'subscription-123-active', plan: { name: 'Gold', plan_code: 'gold', }, current_period_ends_at: new Date(), state: 'active', unit_amount_in_cents: 999, account: { account_code: 'user-123', }, }, } const mockRecurlyClientSubscriptions = { 'subscription-123-active': { id: 'subscription-123-recurly-id', uuid: 'subscription-123-active', plan: { name: 'Gold', code: 'gold', }, currentPeriodEndsAt: new Date(), state: 'active', unitAmount: 10, account: { code: 'user-123', }, }, } const mockSubscriptionChanges = { 'subscription-123-active': { id: 'subscription-change-id', subscriptionId: 'subscription-123-recurly-id', // not the UUID }, } describe('SubscriptionHandler', function () { beforeEach(function () { this.Settings = { plans: [ { planCode: 'collaborator', name: 'Collaborator', features: { collaborators: -1, versioning: true, }, }, ], defaultPlanCode: { collaborators: 0, versioning: false, }, } this.activeRecurlySubscription = mockRecurlySubscriptions['subscription-123-active'] this.activeRecurlyClientSubscription = mockRecurlyClientSubscriptions['subscription-123-active'] this.activeRecurlySubscriptionChange = mockSubscriptionChanges['subscription-123-active'] this.User = {} this.user = { _id: (this.user_id = 'user_id_here_') } this.subscription = { recurlySubscription_id: this.activeRecurlySubscription.uuid, } this.RecurlyWrapper = { getSubscription: sinon .stub() .callsArgWith(2, null, this.activeRecurlySubscription), redeemCoupon: sinon.stub().callsArgWith(2), createSubscription: sinon .stub() .callsArgWith(3, null, this.activeRecurlySubscription), getBillingInfo: sinon.stub().yields(), getAccountPastDueInvoices: sinon.stub().yields(), attemptInvoiceCollection: sinon.stub().yields(), } this.RecurlyClient = { changeSubscriptionByUuid: sinon .stub() .yields(null, this.activeRecurlySubscriptionChange), getSubscription: sinon .stub() .yields(null, this.activeRecurlyClientSubscription), reactivateSubscriptionByUuid: sinon .stub() .yields(null, this.activeRecurlyClientSubscription), cancelSubscriptionByUuid: sinon.stub().yields(), } this.SubscriptionUpdater = { syncSubscription: sinon.stub().yields(), startFreeTrial: sinon.stub().callsArgWith(1), } this.LimitationsManager = { userHasV2Subscription: sinon.stub() } this.EmailHandler = { sendEmail: sinon.stub() } this.AnalyticsManager = { recordEvent: sinon.stub() } this.PlansLocator = { findLocalPlanInSettings: sinon.stub().returns({ planCode: 'plan' }), } this.SubscriptionHelper = { shouldPlanChangeAtTermEnd: sinon.stub(), } this.SubscriptionHandler = SandboxedModule.require(modulePath, { requires: { './RecurlyWrapper': this.RecurlyWrapper, './RecurlyClient': this.RecurlyClient, '@overleaf/settings': this.Settings, '../../models/User': { User: this.User, }, './SubscriptionUpdater': this.SubscriptionUpdater, './LimitationsManager': this.LimitationsManager, '../Email/EmailHandler': this.EmailHandler, '../Analytics/AnalyticsManager': this.AnalyticsManager, './PlansLocator': this.PlansLocator, './SubscriptionHelper': this.SubscriptionHelper, }, }) this.SubscriptionHandler.syncSubscriptionToUser = sinon .stub() .callsArgWith(2) }) describe('createSubscription', function () { beforeEach(function () { this.callback = sinon.stub() this.subscriptionDetails = { cvv: '123', number: '12345', } this.recurlyTokenIds = { billing: '45555666' } this.SubscriptionHandler.validateNoSubscriptionInRecurly = sinon .stub() .yields(null, true) }) describe('successfully', function () { beforeEach(function () { this.SubscriptionHandler.createSubscription( this.user, this.subscriptionDetails, this.recurlyTokenIds, this.callback ) }) it('should create the subscription with the wrapper', function () { this.RecurlyWrapper.createSubscription .calledWith(this.user, this.subscriptionDetails, this.recurlyTokenIds) .should.equal(true) }) it('should sync the subscription to the user', function () { this.SubscriptionUpdater.syncSubscription.calledOnce.should.equal(true) this.SubscriptionUpdater.syncSubscription.args[0][0].should.deep.equal( this.activeRecurlySubscription ) this.SubscriptionUpdater.syncSubscription.args[0][1].should.deep.equal( this.user._id ) }) }) describe('when there is already a subscription in Recurly', function () { beforeEach(function () { this.SubscriptionHandler.validateNoSubscriptionInRecurly = sinon .stub() .yields(null, false) this.SubscriptionHandler.createSubscription( this.user, this.subscriptionDetails, this.recurlyTokenIds, this.callback ) }) it('should an error', function () { this.callback.calledWith( new Error('user already has subscription in recurly') ) }) }) }) function shouldUpdateSubscription() { it('should update the subscription', function () { expect( this.RecurlyClient.changeSubscriptionByUuid ).to.have.been.calledWith(this.subscription.recurlySubscription_id) const updateOptions = this.RecurlyClient.changeSubscriptionByUuid .args[0][1] updateOptions.planCode.should.equal(this.plan_code) }) } function shouldSyncSubscription() { it('should sync the new subscription to the user', function () { expect(this.SubscriptionUpdater.syncSubscription).to.have.been.called this.SubscriptionUpdater.syncSubscription.args[0][0].should.deep.equal( this.activeRecurlySubscription ) this.SubscriptionUpdater.syncSubscription.args[0][1].should.deep.equal( this.user._id ) }) } function testUserWithASubscription(shouldPlanChangeAtTermEnd, timeframe) { describe( 'when change should happen with timeframe ' + timeframe, function () { beforeEach(function (done) { this.user.id = this.activeRecurlySubscription.account.account_code this.User.findById = (userId, projection, callback) => { userId.should.equal(this.user.id) callback(null, this.user) } this.plan_code = 'collaborator' this.SubscriptionHelper.shouldPlanChangeAtTermEnd = sinon .stub() .returns(shouldPlanChangeAtTermEnd) this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, true, this.subscription ) this.SubscriptionHandler.updateSubscription( this.user, this.plan_code, null, done ) }) shouldUpdateSubscription() shouldSyncSubscription() it('should update with timeframe ' + timeframe, function () { const updateOptions = this.RecurlyClient.changeSubscriptionByUuid .args[0][1] updateOptions.timeframe.should.equal(timeframe) }) } ) } describe('updateSubscription', function () { describe('with a user with a subscription', function () { testUserWithASubscription(false, 'now') testUserWithASubscription(true, 'term_end') describe('when plan(s) could not be located in settings', function () { beforeEach(function () { this.user.id = this.activeRecurlySubscription.account.account_code this.User.findById = (userId, projection, callback) => { userId.should.equal(this.user.id) callback(null, this.user) } this.plan_code = 'collaborator' this.PlansLocator.findLocalPlanInSettings = sinon.stub().returns(null) this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, true, this.subscription ) this.callback = sinon.stub() this.SubscriptionHandler.updateSubscription( this.user, this.plan_code, null, this.callback ) }) it('should not update the subscription', function () { this.RecurlyClient.changeSubscriptionByUuid.called.should.equal(false) }) it('should return an error to the callback', function () { this.callback .calledWith(sinon.match.instanceOf(Error)) .should.equal(true) }) }) }) describe('with a user without a subscription', function () { beforeEach(function (done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, false ) this.SubscriptionHandler.updateSubscription( this.user, this.plan_code, null, done ) }) it('should redirect to the subscription dashboard', function () { this.RecurlyClient.changeSubscriptionByUuid.called.should.equal(false) this.SubscriptionHandler.syncSubscriptionToUser.called.should.equal( false ) }) }) describe('with a coupon code', function () { beforeEach(function (done) { this.user.id = this.activeRecurlySubscription.account.account_code this.User.findById = (userId, projection, callback) => { userId.should.equal(this.user.id) callback(null, this.user) } this.plan_code = 'collaborator' this.coupon_code = '1231312' this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, true, this.subscription ) this.SubscriptionHandler.updateSubscription( this.user, this.plan_code, this.coupon_code, done ) }) it('should get the users account', function () { this.RecurlyWrapper.getSubscription .calledWith(this.activeRecurlySubscription.uuid) .should.equal(true) }) it('should redeem the coupon', function (done) { this.RecurlyWrapper.redeemCoupon .calledWith( this.activeRecurlySubscription.account.account_code, this.coupon_code ) .should.equal(true) done() }) it('should update the subscription', function () { expect(this.RecurlyClient.changeSubscriptionByUuid).to.be.calledWith( this.subscription.recurlySubscription_id ) const updateOptions = this.RecurlyClient.changeSubscriptionByUuid .args[0][1] updateOptions.planCode.should.equal(this.plan_code) }) }) }) describe('cancelSubscription', function () { describe('with a user without a subscription', function () { beforeEach(function (done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, false, this.subscription ) this.SubscriptionHandler.cancelSubscription(this.user, done) }) it('should redirect to the subscription dashboard', function () { this.RecurlyClient.cancelSubscriptionByUuid.called.should.equal(false) }) }) describe('with a user with a subscription', function () { beforeEach(function (done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, true, this.subscription ) this.SubscriptionHandler.cancelSubscription(this.user, done) }) it('should cancel the subscription', function () { this.RecurlyClient.cancelSubscriptionByUuid.called.should.equal(true) this.RecurlyClient.cancelSubscriptionByUuid .calledWith(this.subscription.recurlySubscription_id) .should.equal(true) }) }) }) describe('reactiveRecurlySubscription', function () { describe('with a user without a subscription', function () { beforeEach(function (done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, false, this.subscription ) this.SubscriptionHandler.reactivateSubscription(this.user, done) }) it('should redirect to the subscription dashboard', function () { this.RecurlyClient.reactivateSubscriptionByUuid.called.should.equal( false ) }) it('should not send a notification email', function () { sinon.assert.notCalled(this.EmailHandler.sendEmail) }) }) describe('with a user with a subscription', function () { beforeEach(function (done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, true, this.subscription ) this.SubscriptionHandler.reactivateSubscription(this.user, done) }) it('should reactivate the subscription', function () { this.RecurlyClient.reactivateSubscriptionByUuid.called.should.equal( true ) this.RecurlyClient.reactivateSubscriptionByUuid .calledWith(this.subscription.recurlySubscription_id) .should.equal(true) }) it('should send a notification email', function () { sinon.assert.calledWith( this.EmailHandler.sendEmail, 'reactivatedSubscription' ) }) }) }) describe('syncSubscription', function () { describe('with an actionable request', function () { beforeEach(function (done) { this.user.id = this.activeRecurlySubscription.account.account_code this.User.findById = (userId, projection, callback) => { userId.should.equal(this.user.id) callback(null, this.user) } this.SubscriptionHandler.syncSubscription( this.activeRecurlySubscription, {}, done ) }) it('should request the affected subscription from the API', function () { this.RecurlyWrapper.getSubscription .calledWith(this.activeRecurlySubscription.uuid) .should.equal(true) }) it('should request the account details of the subscription', function () { const options = this.RecurlyWrapper.getSubscription.args[0][1] options.includeAccount.should.equal(true) }) it('should sync the subscription to the user', function () { this.SubscriptionUpdater.syncSubscription.calledOnce.should.equal(true) this.SubscriptionUpdater.syncSubscription.args[0][0].should.deep.equal( this.activeRecurlySubscription ) this.SubscriptionUpdater.syncSubscription.args[0][1].should.deep.equal( this.user._id ) }) }) }) describe('attemptPaypalInvoiceCollection', function () { describe('for credit card users', function () { beforeEach(function (done) { this.RecurlyWrapper.getBillingInfo.yields(null, { paypal_billing_agreement_id: null, }) this.SubscriptionHandler.attemptPaypalInvoiceCollection( this.activeRecurlySubscription.account.account_code, done ) }) it('gets billing infos', function () { sinon.assert.calledWith( this.RecurlyWrapper.getBillingInfo, this.activeRecurlySubscription.account.account_code ) }) it('skips user', function () { sinon.assert.notCalled(this.RecurlyWrapper.getAccountPastDueInvoices) }) }) describe('for paypal users', function () { beforeEach(function (done) { this.RecurlyWrapper.getBillingInfo.yields(null, { paypal_billing_agreement_id: 'mock-billing-agreement', }) this.RecurlyWrapper.getAccountPastDueInvoices.yields(null, [ { invoice_number: 'mock-invoice-number' }, ]) this.SubscriptionHandler.attemptPaypalInvoiceCollection( this.activeRecurlySubscription.account.account_code, done ) }) it('gets past due invoices', function () { sinon.assert.calledWith( this.RecurlyWrapper.getAccountPastDueInvoices, this.activeRecurlySubscription.account.account_code ) }) it('calls attemptInvoiceCollection', function () { sinon.assert.calledWith( this.RecurlyWrapper.attemptInvoiceCollection, 'mock-invoice-number' ) }) }) }) describe('validateNoSubscriptionInRecurly', function () { beforeEach(function () { this.subscriptions = [] this.RecurlyWrapper.listAccountActiveSubscriptions = sinon .stub() .yields(null, this.subscriptions) this.SubscriptionUpdater.syncSubscription = sinon.stub().yields() this.callback = sinon.stub() }) describe('with no subscription in recurly', function () { beforeEach(function () { this.subscriptions.push((this.subscription = { mock: 'subscription' })) this.SubscriptionHandler.validateNoSubscriptionInRecurly( this.user_id, this.callback ) }) it('should call RecurlyWrapper.listAccountActiveSubscriptions with the user id', function () { this.RecurlyWrapper.listAccountActiveSubscriptions .calledWith(this.user_id) .should.equal(true) }) it('should sync the subscription', function () { this.SubscriptionUpdater.syncSubscription .calledWith(this.subscription, this.user_id) .should.equal(true) }) it('should call the callback with valid == false', function () { this.callback.calledWith(null, false).should.equal(true) }) }) describe('with a subscription in recurly', function () { beforeEach(function () { this.SubscriptionHandler.validateNoSubscriptionInRecurly( this.user_id, this.callback ) }) it('should not sync the subscription', function () { this.SubscriptionUpdater.syncSubscription.called.should.equal(false) }) it('should call the callback with valid == true', function () { this.callback.calledWith(null, true).should.equal(true) }) }) }) })
overleaf/web/test/unit/src/Subscription/SubscriptionHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Subscription/SubscriptionHandlerTests.js", "repo_id": "overleaf", "token_count": 8383 }
545
const SandboxedModule = require('sandboxed-module') const sinon = require('sinon') const modulePath = require('path').join( __dirname, '../../../../app/src/Features/ThirdPartyDataStore/UpdateMerger.js' ) const BufferedStream = require('bufferedstream') describe('UpdateMerger :', function () { beforeEach(function () { this.updateMerger = SandboxedModule.require(modulePath, { requires: { fs: (this.fs = { unlink: sinon.stub().callsArgWith(1) }), '../Editor/EditorController': (this.EditorController = {}), '../Uploads/FileTypeManager': (this.FileTypeManager = {}), '../../infrastructure/FileWriter': (this.FileWriter = {}), '../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}), '@overleaf/settings': { path: { dumpPath: 'dump_here' } }, }, }) this.project_id = 'project_id_here' this.user_id = 'mock-user-id' this.docPath = this.newDocPath = '/folder/doc.tex' this.filePath = this.newFilePath = '/folder/file.png' this.existingDocPath = '/folder/other.tex' this.existingFilePath = '/folder/fig1.pdf' this.linkedFileData = { provider: 'url' } this.existingDocs = [{ path: '/main.tex' }, { path: '/folder/other.tex' }] this.existingFiles = [{ path: '/figure.pdf' }, { path: '/folder/fig1.pdf' }] this.ProjectEntityHandler.getAllEntities = sinon .stub() .callsArgWith(1, null, this.existingDocs, this.existingFiles) this.fsPath = '/tmp/file/path' this.source = 'dropbox' this.updateRequest = new BufferedStream() this.FileWriter.writeStreamToDisk = sinon.stub().yields(null, this.fsPath) this.callback = sinon.stub() }) describe('mergeUpdate', function () { describe('doc updates for a new doc', function () { beforeEach(function () { this.FileTypeManager.getType = sinon .stub() .yields(null, { binary: false, encoding: 'utf-8' }) this.updateMerger.p.processDoc = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.docPath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should process update as doc', function () { this.updateMerger.p.processDoc .calledWith( this.project_id, this.user_id, this.fsPath, this.docPath, this.source ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) describe('file updates for a new file ', function () { beforeEach(function () { this.FileTypeManager.getType = sinon .stub() .yields(null, { binary: true }) this.updateMerger.p.processFile = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.filePath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should process update as file', function () { this.updateMerger.p.processFile .calledWith( this.project_id, this.fsPath, this.filePath, this.source, this.user_id ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) describe('doc updates for an existing doc', function () { beforeEach(function () { this.FileTypeManager.getType = sinon .stub() .yields(null, { binary: false, encoding: 'utf-8' }) this.updateMerger.p.processDoc = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.existingDocPath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should process update as doc', function () { this.updateMerger.p.processDoc .calledWith( this.project_id, this.user_id, this.fsPath, this.existingDocPath, this.source ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) describe('file updates for an existing file', function () { beforeEach(function () { this.FileTypeManager.getType = sinon .stub() .yields(null, { binary: true }) this.updateMerger.p.processFile = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.existingFilePath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should process update as file', function () { this.updateMerger.p.processFile .calledWith( this.project_id, this.fsPath, this.existingFilePath, this.source, this.user_id ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) }) describe('file updates for an existing doc', function () { beforeEach(function () { this.FileTypeManager.getType = sinon.stub().yields(null, { binary: true }) this.updateMerger.deleteUpdate = sinon.stub().yields() this.updateMerger.p.processFile = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.existingDocPath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should delete the existing doc', function () { this.updateMerger.deleteUpdate .calledWith( this.user_id, this.project_id, this.existingDocPath, this.source ) .should.equal(true) }) it('should process update as file', function () { this.updateMerger.p.processFile .calledWith( this.project_id, this.fsPath, this.existingDocPath, this.source, this.user_id ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) describe('doc updates for an existing file', function () { beforeEach(function () { this.FileTypeManager.getType = sinon.stub().yields(null, { binary: true }) this.updateMerger.deleteUpdate = sinon.stub().yields() this.updateMerger.p.processFile = sinon.stub().yields() this.updateMerger.mergeUpdate( this.user_id, this.project_id, this.existingFilePath, this.updateRequest, this.source, this.callback ) }) it('should look at the file contents', function () { this.FileTypeManager.getType.called.should.equal(true) }) it('should not delete the existing file', function () { this.updateMerger.deleteUpdate.called.should.equal(false) }) it('should process update as file', function () { this.updateMerger.p.processFile .calledWith( this.project_id, this.fsPath, this.existingFilePath, this.source, this.user_id ) .should.equal(true) }) it('removes the temp file from disk', function () { this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) describe('deleteUpdate', function () { beforeEach(function () { this.EditorController.deleteEntityWithPath = sinon.stub().yields() this.updateMerger.deleteUpdate( this.user_id, this.project_id, this.docPath, this.source, this.callback ) }) it('should delete the entity in the editor controller', function () { this.EditorController.deleteEntityWithPath .calledWith(this.project_id, this.docPath, this.source, this.user_id) .should.equal(true) }) }) describe('private methods', function () { describe('processDoc', function () { beforeEach(function () { this.docLines = '\\documentclass{article}\n\\usepackage[utf8]{inputenc}\n\n\\title{42}\n\\author{Jane Doe}\n\\date{June 2011}' this.updateMerger.p.readFileIntoTextArray = sinon .stub() .yields(null, this.docLines) this.EditorController.upsertDocWithPath = sinon.stub().yields() this.updateMerger.p.processDoc( this.project_id, this.user_id, this.fsPath, this.docPath, this.source, this.callback ) }) it('reads the temp file from disk', function () { this.updateMerger.p.readFileIntoTextArray .calledWith(this.fsPath) .should.equal(true) }) it('should upsert the doc in the editor controller', function () { this.EditorController.upsertDocWithPath .calledWith( this.project_id, this.docPath, this.docLines, this.source, this.user_id ) .should.equal(true) }) }) describe('processFile', function () { beforeEach(function () { this.EditorController.upsertFileWithPath = sinon.stub().yields() this.updateMerger.p.processFile( this.project_id, this.fsPath, this.filePath, this.source, this.user_id, this.callback ) }) it('should upsert the file in the editor controller', function () { this.EditorController.upsertFileWithPath .calledWith( this.project_id, this.filePath, this.fsPath, null, this.source, this.user_id ) .should.equal(true) }) }) }) })
overleaf/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js", "repo_id": "overleaf", "token_count": 5002 }
546
const sinon = require('sinon') const modulePath = '../../../../app/src/Features/User/UserHandler.js' const SandboxedModule = require('sandboxed-module') describe('UserHandler', function () { beforeEach(function () { this.user = { _id: '12390i', email: 'bob@bob.com', remove: sinon.stub().callsArgWith(0), } this.TeamInvitesHandler = { createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields(), } this.UserHandler = SandboxedModule.require(modulePath, { requires: { '../Subscription/TeamInvitesHandler': this.TeamInvitesHandler, }, }) }) describe('populateTeamInvites', function () { beforeEach(function (done) { this.UserHandler.populateTeamInvites(this.user, done) }) it('notifies the user about legacy team invites', function () { this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail .calledWith(this.user.email) .should.eq(true) }) }) })
overleaf/web/test/unit/src/User/UserHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/User/UserHandlerTests.js", "repo_id": "overleaf", "token_count": 383 }
547
const mockModel = require('../MockModel') module.exports = mockModel('DeletedFile')
overleaf/web/test/unit/src/helpers/models/DeletedFile.js/0
{ "file_path": "overleaf/web/test/unit/src/helpers/models/DeletedFile.js", "repo_id": "overleaf", "token_count": 26 }
548
const accepts = require('accepts') const { expect } = require('chai') const MODULE_PATH = '../../../../app/src/infrastructure/RequestContentTypeDetection.js' const MockRequest = require('../helpers/MockRequest') const SandboxedModule = require('sandboxed-module') describe('RequestContentTypeDetection', function () { before(function () { this.RequestContentTypeDetection = SandboxedModule.require(MODULE_PATH) this.req = new MockRequest() this.req.accepts = function (...args) { return accepts(this).type(...args) } }) describe('isJson=true', function () { function expectJson(type) { it(type, function () { this.req.headers.accept = type expect(this.RequestContentTypeDetection.acceptsJson(this.req)).to.equal( true ) }) } expectJson('application/json') expectJson('application/json, text/plain, */*') expectJson('application/json, text/html, */*') }) describe('isJson=false', function () { function expectNonJson(type) { it(type, function () { this.req.headers.accept = type expect(this.RequestContentTypeDetection.acceptsJson(this.req)).to.equal( false ) }) } expectNonJson('*/*') expectNonJson('text/html') expectNonJson('text/html, application/json') expectNonJson('image/png') }) })
overleaf/web/test/unit/src/infrastructure/RequestContentTypeDetectionTests.js/0
{ "file_path": "overleaf/web/test/unit/src/infrastructure/RequestContentTypeDetectionTests.js", "repo_id": "overleaf", "token_count": 526 }
549
Bugfix: Set server config to ocis proxy in example config file We fixed the ocis example config to point to the default oCIS Proxy address instead of the default Web service address. https://github.com/owncloud/web/pull/3454
owncloud/web/changelog/0.10.0_2020-05-26/3454/0
{ "file_path": "owncloud/web/changelog/0.10.0_2020-05-26/3454", "repo_id": "owncloud", "token_count": 62 }
550
Bugfix: Set default permissions to public link quick action We've set a default permissions when creating a new public link via the quick actions. The permissions are set to `1`. https://github.com/owncloud/web/issues/3675 https://github.com/owncloud/web/pull/3678
owncloud/web/changelog/0.11.0_2020-06-26/set-default-permissions/0
{ "file_path": "owncloud/web/changelog/0.11.0_2020-06-26/set-default-permissions", "repo_id": "owncloud", "token_count": 72 }
551
Enhancement: Add ability to move files and folders into a different location We've added move action to the files list which enables move of resources into different locations. The move operation is executed in a new page called Location picker. https://github.com/owncloud/product/issues/101 https://github.com/owncloud/web/pull/3739
owncloud/web/changelog/0.12.0_2020-07-10/move/0
{ "file_path": "owncloud/web/changelog/0.12.0_2020-07-10/move", "repo_id": "owncloud", "token_count": 82 }
552
Change: Add default external apps for ocis We are enabling the settings-ui and accounts-ui by default now for ocis. https://github.com/owncloud/web/pull/3967
owncloud/web/changelog/0.16.0_2020-08-24/default-external-apps-ocis/0
{ "file_path": "owncloud/web/changelog/0.16.0_2020-08-24/default-external-apps-ocis", "repo_id": "owncloud", "token_count": 49 }
553
Enhancement: Update owncloud-design-system to v1.12.1 We've updated our design system to version 1.12.1. To see all new changes which this update brings, please check the changelog below. https://github.com/owncloud/owncloud-design-system/releases/tag/v1.12.1 https://github.com/owncloud/web/pull/4120
owncloud/web/changelog/0.18.0_2020-10-05/update-ods/0
{ "file_path": "owncloud/web/changelog/0.18.0_2020-10-05/update-ods", "repo_id": "owncloud", "token_count": 99 }
554
Change: File actions as accordion item in right sidebar We moved the menu items from `file actions` dropdown menu (the "three dots menu") as accordion item into the right sidebar and made it the default item to be opened when clicking the three dots. For the sake of consistency we now also made the right sidebar available for the `Deleted files` page, where we offer the actions accordion item with a `Restore` and `Delete` action. https://github.com/owncloud/web/pull/4255
owncloud/web/changelog/0.25.0_2020-11-16/actions-in-sidebar/0
{ "file_path": "owncloud/web/changelog/0.25.0_2020-11-16/actions-in-sidebar", "repo_id": "owncloud", "token_count": 117 }
555
Bugfix: Public link glitches We fixed a couple of glitches with public links: - Creating a folder in a public link context was showing an error message although the folder was created correctly. This was happening because reloading the current folder didn't take the public link context into account. - For public links with editor role the batch actions at the top of the files list were not showing. The public links route didn't have a specific flag for showing the batch actions. - Quick actions for sharing are not available in public link contexts by design. The check printed an error in the javascript console though. We made this check silent now. https://github.com/owncloud/ocis/issues/1028 https://github.com/owncloud/web/pull/4425
owncloud/web/changelog/0.29.0_2020-12-07/fix-public-link-issues/0
{ "file_path": "owncloud/web/changelog/0.29.0_2020-12-07/fix-public-link-issues", "repo_id": "owncloud", "token_count": 167 }
556
Enhancement: Fixed header for files tables We've made the header of files tables fixed so it is easier to know the meaning of table columns. https://github.com/owncloud/web/issues/1952 https://github.com/owncloud/web/pull/2995
owncloud/web/changelog/0.4.0_2020-02-14/1952/0
{ "file_path": "owncloud/web/changelog/0.4.0_2020-02-14/1952", "repo_id": "owncloud", "token_count": 66 }
557
Enhancement: Different message in overwrite dialog when versioning is enabled We've added a new message in the overwrite dialog when versioning is enabled. This message is intended to make it clear that the resource won't be overwritten but a new version of it will be created. https://github.com/owncloud/web/issues/3047 https://github.com/owncloud/web/pull/3050
owncloud/web/changelog/0.5.0_2020-03-02/3047/0
{ "file_path": "owncloud/web/changelog/0.5.0_2020-03-02/3047", "repo_id": "owncloud", "token_count": 93 }
558
Change: Don't import whole core-js bundle directly into core We've stopped importing whole core-js bundle directly into core and instead load only used parts with babel. https://github.com/owncloud/web/pull/3173
owncloud/web/changelog/0.7.0_2020-03-30/3173/0
{ "file_path": "owncloud/web/changelog/0.7.0_2020-03-30/3173", "repo_id": "owncloud", "token_count": 55 }
559
Bugfix: Fix name of selected extension on broken apps With the edge case of a broken app in config.json, the top bar is broken, because appInfo can't be loaded. We made ocis-web more robust by just showing the extension id in the top bar when the appInfo is not available. https://github.com/owncloud/web/pull/3376
owncloud/web/changelog/0.9.0_2020-04-27/3376/0
{ "file_path": "owncloud/web/changelog/0.9.0_2020-04-27/3376", "repo_id": "owncloud", "token_count": 86 }
560
Enhancement: Update ODS to 2.0.4 We've updated the ownCloud design system to version 2.0.4. https://github.com/owncloud/owncloud-design-system/releases/tag/v2.0.4 https://github.com/owncloud/web/pull/45001
owncloud/web/changelog/1.0.0_2020-12-16/update-ods-2.0.4/0
{ "file_path": "owncloud/web/changelog/1.0.0_2020-12-16/update-ods-2.0.4", "repo_id": "owncloud", "token_count": 77 }
561
Enhancement: Set locale on moment-js to render translated strings For i18n purposes we set the moment-js locale to the current selected locale (language) this allows us to show translated string for example in the updated column in the All files list (web-app-files package) https://github.com/owncloud/web/pull/4826
owncloud/web/changelog/2.1.0_2021-03-24/enhancement-moment-js-set-locale-for-i18n/0
{ "file_path": "owncloud/web/changelog/2.1.0_2021-03-24/enhancement-moment-js-set-locale-for-i18n", "repo_id": "owncloud", "token_count": 82 }
562
Bugfix: Editors for all routes If an extension doesn't define valid routes it should be allowed for all routes by default. That behaviour was not working properly and is fixed now. https://github.com/owncloud/web/pull/5095
owncloud/web/changelog/3.1.0_2021-05-12/bugfix-editors-for-all-routes/0
{ "file_path": "owncloud/web/changelog/3.1.0_2021-05-12/bugfix-editors-for-all-routes", "repo_id": "owncloud", "token_count": 56 }
563
Enhancement: Confirmation for public link deletion The deletion of public links is an irreversible interaction and should be handled with more care since users might have bookmarked or shared with other people. We have added a confirmation modal now to prevent users from accidentally deleting public links. https://github.com/owncloud/web/pull/5125
owncloud/web/changelog/3.2.0_2021-05-31/enhancement-confirmation-link-deletion/0
{ "file_path": "owncloud/web/changelog/3.2.0_2021-05-31/enhancement-confirmation-link-deletion", "repo_id": "owncloud", "token_count": 82 }
564
Bugfix: Resizeable html container We removed a critical accessibility offense by removing the hardcoded maximum-scale and allowing for user-scalable viewsizes. https://github.com/owncloud/web/pull/5052
owncloud/web/changelog/3.3.0_2021-06-23/bugfix-sizeable-html-container/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/bugfix-sizeable-html-container", "repo_id": "owncloud", "token_count": 55 }
565
Enhancement: Improve a11y in the files sidebar peoples & shares section We've did several improvements to enhance the accessibility on the files sidebar: - Gave `role="presentation" to the collaborator avatar - Refactored `<span>` and `<div>` tags into `<p>` tags and unified translations a bit - Enhanced hints in the collaborator quick action buttons with collaborator name - Hide private links if the capability is not enabled - Set avatar-images to `:aria-hidden="true"` since they're only visual elements and can be hidden from screenreaders - Changed `<section>` wrapper around private link shares - Removed `<section>` wrapper around public link shares - Removed `<section>` wrapper around collaborators - Added screenreader-only explain texts regarding collaborator/share ownership - Added aria-label for share receiver section - Worked on unifying the way we handle translations: Focus on v-translate and $gettext() - Turn tags into `<ul> & <li>` list, add aria-labelledby to both tag list and resharer tag list - Translated "Open with $appName" for sidebar quick actions https://github.com/owncloud/web/pull/5034 https://github.com/owncloud/web/pull/5043 https://github.com/owncloud/web/pull/5121
owncloud/web/changelog/3.3.0_2021-06-23/enhancement-files-sidebar-shares/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-files-sidebar-shares", "repo_id": "owncloud", "token_count": 312 }
566
Enhancement: Improve accessibility on trash bin Add more context to the empty trash bin button text and only render it, if resources are present. https://github.com/owncloud/web/pull/5046
owncloud/web/changelog/3.3.0_2021-06-23/enhancement-trashbin-a11y/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-trashbin-a11y", "repo_id": "owncloud", "token_count": 49 }
567
Bugfix: align view options to the right We've fixed the position of the view options button which would appear in any screen where actions are missing on the left. https://github.com/owncloud/web/pull/5493
owncloud/web/changelog/3.4.1_2021-07-12/bugfix-view-options-position/0
{ "file_path": "owncloud/web/changelog/3.4.1_2021-07-12/bugfix-view-options-position", "repo_id": "owncloud", "token_count": 52 }
568
Bugfix: escape file name in Media viewer We've started escaping the file name in the Media viewer extension so that a file with special characters in the name can still be loaded. https://github.com/owncloud/web/issues/5593 https://github.com/owncloud/web/pull/5655
owncloud/web/changelog/4.1.0_2021-08-20/bugfix-escape-file-path-in-media-viewer/0
{ "file_path": "owncloud/web/changelog/4.1.0_2021-08-20/bugfix-escape-file-path-in-media-viewer", "repo_id": "owncloud", "token_count": 71 }
569
Enhancement: Show sharing information in details sidebar We've added sharing information like from whom, when and where a file was shared to the detail view in the right sidebar. https://github.com/owncloud/web/issues/5735 https://github.com/owncloud/web/pull/5730
owncloud/web/changelog/4.2.0_2021-09-14/enhancement-show-sharing-details-sidebar/0
{ "file_path": "owncloud/web/changelog/4.2.0_2021-09-14/enhancement-show-sharing-details-sidebar", "repo_id": "owncloud", "token_count": 72 }
570
Bugfix: Unnecessary redirects on personal page Navigating to all files could lead to loading resources twice, first resources from root (/) and second the resources from the homeFolder (options.homeFolder). We've fixed this by detecting those cases and only load resources for the homeFolder. https://github.com/owncloud/web/pull/5893 https://github.com/owncloud/web/issues/5085 https://github.com/owncloud/web/issues/5875
owncloud/web/changelog/4.4.0_2021-10-26/bugfix-unnecessary-redirects-personal-home-folder/0
{ "file_path": "owncloud/web/changelog/4.4.0_2021-10-26/bugfix-unnecessary-redirects-personal-home-folder", "repo_id": "owncloud", "token_count": 112 }
571
Enhancement: Update ODS to v11.2.2 We updated the ownCloud Design System to version 11.2.2. Please refer to the full changelog in the ODS release (linked) for more details. Summary: - Bugfix - Limit select event in OcTableFiles: https://github.com/owncloud/owncloud-design-system/pull/1753 - Bugfix - Add word-break rule to OcNotificationMessage component: https://github.com/owncloud/owncloud-design-system/issues/1712 - Bugfix - OcTable sorting case sensitivity: https://github.com/owncloud/owncloud-design-system/issues/1698 - Bugfix - Drag and Drop triggers wrong actions: https://github.com/owncloud/web/issues/5808 - Bugfix - Fix files table event: https://github.com/owncloud/web/issues/1777 - Bugfix - Fix extension icon rendering: https://github.com/owncloud/web/issues/1779 - Enhancement - Make OcDatepicker themable: https://github.com/owncloud/owncloud-design-system/issues/1679 - Enhancement - Streamline OcTextInput: https://github.com/owncloud/owncloud-design-system/pull/1636 - Enhancement - Add accentuated class for OcTable: https://github.com/owncloud/owncloud-design-system/pull/5967 - Enhancement - Add Ghost Element for Drag & Drop: https://github.com/owncloud/owncloud-design-system/pull/5788 - Enhancement - Add "extension" svg icon: https://github.com/owncloud/owncloud-design-system/pull/1771 - Enhancement - Add closure to mutate resource dom selector: https://github.com/owncloud/owncloud-design-system/pull/1766 - Enhancement - Reduce filename text weight: https://github.com/owncloud/owncloud-design-system/pull/1759 https://github.com/owncloud/web/pull/6009 https://github.com/owncloud/owncloud-design-system/releases/tag/v11.2.2
owncloud/web/changelog/4.5.0_2021-11-16/enhancement-update-ods/0
{ "file_path": "owncloud/web/changelog/4.5.0_2021-11-16/enhancement-update-ods", "repo_id": "owncloud", "token_count": 505 }
572
Bugfix: Order extensions and default Ensure the default extensions are displayed first. Ensure that extensions can be set as default or not. https://github.com/owncloud/web/pull/5985
owncloud/web/changelog/4.7.0_2021-12-16/bugfix-order-extensions/0
{ "file_path": "owncloud/web/changelog/4.7.0_2021-12-16/bugfix-order-extensions", "repo_id": "owncloud", "token_count": 48 }
573
Bugfix: Application config not available to application We fixed a bug in providing config to external apps like draw-io. https://github.com/owncloud/web/issues/6296 https://github.com/owncloud/web/pull/6298
owncloud/web/changelog/5.0.0_2022-02-14/bugfix-application-config/0
{ "file_path": "owncloud/web/changelog/5.0.0_2022-02-14/bugfix-application-config", "repo_id": "owncloud", "token_count": 60 }
574
Enhancement: Redirect to IDP when opening apps from bookmark We've expanded the check for authentication requirements to the referrer of the current URL. As a result an app that doesn't necessarily require authentication can still require authentication based on the file context it was opened in. This is especially important for situations where an app is opened for a file from a bookmark, so that we cannot rely on the user already having an authenticated session. https://github.com/owncloud/web/issues/6045 https://github.com/owncloud/web/issues/6069 https://github.com/owncloud/web/pull/6314
owncloud/web/changelog/5.0.0_2022-02-14/enhancement-context-route-auth-redirect/0
{ "file_path": "owncloud/web/changelog/5.0.0_2022-02-14/enhancement-context-route-auth-redirect", "repo_id": "owncloud", "token_count": 140 }
575
Enhancement: Implement spaces list We added a new route that lists all available spaces of type "project". https://github.com/owncloud/web/pull/6199 https://github.com/owncloud/web/pull/6399 https://github.com/owncloud/web/issues/6104
owncloud/web/changelog/5.0.0_2022-02-14/enhancement-spaces-list/0
{ "file_path": "owncloud/web/changelog/5.0.0_2022-02-14/enhancement-spaces-list", "repo_id": "owncloud", "token_count": 74 }
576
Enhancement: Redesign create and upload buttons We have separated the "Create new file/folder" and "Upload" actions above the files list into two separate buttons, also using the new resource type icons for more consistency. https://github.com/owncloud/web/issues/6279 https://github.com/owncloud/web/pull/6358 https://github.com/owncloud/web/pull/6500
owncloud/web/changelog/5.2.0_2022-03-03/enhancement-redesign-create-upload-buttons/0
{ "file_path": "owncloud/web/changelog/5.2.0_2022-03-03/enhancement-redesign-create-upload-buttons", "repo_id": "owncloud", "token_count": 100 }
577
Bugfix: Resolve private links Private links didn't resolve correctly anymore because the internal file path handling was changed in our api client (owncloud-sdk). We've adjusted it accordingly so that private links now resolve correctly again. https://github.com/owncloud/web/pull/5654
owncloud/web/changelog/5.3.0_2022-03-23/bugfix-resolve-private-link/0
{ "file_path": "owncloud/web/changelog/5.3.0_2022-03-23/bugfix-resolve-private-link", "repo_id": "owncloud", "token_count": 67 }
578
Enhancement: Polish ViewOptions We've added an hover effect for ViewOptions buttons https://github.com/owncloud/web/issues/6492 https://github.com/owncloud/web/pull/6591
owncloud/web/changelog/5.3.0_2022-03-23/enhancement-polish-viewoptions/0
{ "file_path": "owncloud/web/changelog/5.3.0_2022-03-23/enhancement-polish-viewoptions", "repo_id": "owncloud", "token_count": 52 }
579
Bugfix: Accessible breadcrumb itemcount Our breadcrumbs announce the amount of resources inside a folder. Due to a bug the calculated number wasn't announced correctly, which we have resolved. https://github.com/owncloud/web/pull/6690 https://github.com/owncloud/web/issues/6022
owncloud/web/changelog/5.4.0_2022-04-11/bugfix-accessible-breadcrumb-itemcount/0
{ "file_path": "owncloud/web/changelog/5.4.0_2022-04-11/bugfix-accessible-breadcrumb-itemcount", "repo_id": "owncloud", "token_count": 76 }
580
Enhancement: Provide dependencies to applications We reduced the bundle size of externally built applications and the risk of clashing library instances by passing certain dependencies into applications (namely `@vue/composition-api`, `vuex` and `luxon`). https://github.com/owncloud/web/pull/6746 https://github.com/owncloud/web/issues/5716
owncloud/web/changelog/5.4.0_2022-04-11/enhancement-provide-dependencies-to-applications/0
{ "file_path": "owncloud/web/changelog/5.4.0_2022-04-11/enhancement-provide-dependencies-to-applications", "repo_id": "owncloud", "token_count": 93 }
581
Bugfix: Breadcrumb auto focus We've fixed a bug where the auto focus couldn't be set on the current breadcrumb item when navigating. https://github.com/owncloud/web/pull/6846
owncloud/web/changelog/5.5.0_2022-06-20/bugfix-breadcrumb-focus/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-breadcrumb-focus", "repo_id": "owncloud", "token_count": 51 }
582
Bugfix: Resetting store on logout When logging out, only some parts of vuex store were reset to default. This caused bugs by switching to another account that has some other/missing settings. For example, if the account has no quota, the quota of the previously logged in account was shown. We have fixed this by resetting the user store module on logout with reset function (vuex extensions library) and creating an action to reset dynamic nav items. https://github.com/owncloud/web/pull/6694 https://github.com/owncloud/web/issues/6549
owncloud/web/changelog/5.5.0_2022-06-20/bugfix-resetting-store-on-logout/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-resetting-store-on-logout", "repo_id": "owncloud", "token_count": 133 }
583
Bugfix: Drag and drop upload when a file is selected We've fixed a bug where uploading via drag and drop wouldn't work if one or more files were selected. https://github.com/owncloud/web/pull/7036 https://github.com/owncloud/web/issues/7006
owncloud/web/changelog/5.5.0_2022-06-20/bugfix-upload-drop-file-selection/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-upload-drop-file-selection", "repo_id": "owncloud", "token_count": 70 }
584
Enhancement: Design polishing We've fixed the following issues to enhance UI/UX: - wording for new space button - wording for invite space member submit button https://github.com/owncloud/web/pull/6781 https://github.com/owncloud/web/issues/6555
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-design-polishing/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-design-polishing", "repo_id": "owncloud", "token_count": 70 }
585
Enhancement: Redesign link sharing We have redesigned the public link list in the right sidebar. Links now can be edited in-line and have a similiar look-and-feel to people and group shares. Additionally, creating new links now is less cumbersome and the default name, while not configurable from the backend anymore, is now translated. https://github.com/owncloud/web/pull/6749 https://github.com/owncloud/web/pull/6885 https://github.com/owncloud/web/pull/6961 https://github.com/owncloud/web/issues/7149 https://github.com/owncloud/web/pull/7150
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-redesign-link-sharing/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-redesign-link-sharing", "repo_id": "owncloud", "token_count": 157 }
586
Enhancement: Upload progress & overlay improvements * Remove fetching of newly uploaded files and folders to improve performance * Redesign the upload overlay * Show uploading files in the upload overlay * Immediately show the upload overlay when uploading folders to tell the user that the upload is starting * Only show top level folders in the upload overlay when uploading folders * Remove the Uppy StatusBar plugin * Use `uppy.addFiles()` instead of calling `uppy.addFile()` for each file * The upload overlay now shows a more proper time estimation when uploading many files * The user feedback of the upload overlay during upload preparation has been improved * Several router bugs have been fixed in the upload overlay * Temporarily disabled `uploadDataDuringCreation` to prevent the local storage from getting to full * Some more refactoring under the hood has been made https://github.com/owncloud/web/pull/7067 https://github.com/owncloud/web/pull/7127 https://github.com/owncloud/web/issues/7066 https://github.com/owncloud/web/issues/7069
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-upload-improvements/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-upload-improvements", "repo_id": "owncloud", "token_count": 252 }
587
Bugfix: Dragging a file causes no selection We've fixed a bug that caused no selection when dragging a file. https://github.com/owncloud/web/pull/7473
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-drag-drop-no-selection/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-drag-drop-no-selection", "repo_id": "owncloud", "token_count": 44 }
588
Bugfix: Load only supported thumbnails (configurable) We've fixed a bug where web was trying to load thumbnails for files that are not supported. Due to configurable values, we avoid unnecessary requests. https://github.com/owncloud/web/pull/7474
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-load-only-supported-thumbnails/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-load-only-supported-thumbnails", "repo_id": "owncloud", "token_count": 64 }
589
Bugfix: Quicklinks not shown We've fixed a bug where existing quicklinks were not shown when the user had no rights to create them. https://github.com/owncloud/web/pull/7424 https://github.com/owncloud/web/issues/7406
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-quicklinks-not-shown/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-quicklinks-not-shown", "repo_id": "owncloud", "token_count": 65 }
590
Bugfix: Missing quick actions in spaces file list We've fixed a bug where the quick actions 'Add people' and 'Copy quicklink' were missing in the spaces file list. https://github.com/owncloud/web/pull/7349 https://github.com/owncloud/web/issues/7339
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-spaces-missing-quick-actions/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-spaces-missing-quick-actions", "repo_id": "owncloud", "token_count": 73 }
591
Enhancement: Loading context blocks application bootstrap The bootstrap architecture has been improved to ensure that the respective context (user or public link) is fully resolved before applications can finalize their boot process and switch over to rendering their content. This means that application developers can rely on user data / public link data being loaded (including e.g. capabilities) when the web runtime triggers the boot processes and rendering of applications. https://github.com/owncloud/web/issues/7030 https://github.com/owncloud/web/pull/7072
owncloud/web/changelog/5.7.0_2022-09-09/enhancement-blocking-application-bootstrap/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-blocking-application-bootstrap", "repo_id": "owncloud", "token_count": 124 }
592
Enhancement: Remove clickOutside directive We've removed the clickOutside directive because it isn't used anymore https://github.com/owncloud/web/pull/7584 https://github.com/owncloud/web/issues/7572
owncloud/web/changelog/5.7.0_2022-09-09/enhancement-remove-clickoutside-directive/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-remove-clickoutside-directive", "repo_id": "owncloud", "token_count": 57 }
593
Enhancement: User management app saved dialog We've replaced the pop up message when the user gets saved by a message which will be shown next to the save button. https://github.com/owncloud/web/pull/7375 https://github.com/owncloud/web/pull/7377 https://github.com/owncloud/web/issues/7351
owncloud/web/changelog/5.7.0_2022-09-09/enhancement-user-management-app-saved-dialog/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-user-management-app-saved-dialog", "repo_id": "owncloud", "token_count": 86 }
594
Bugfix: Folder conflict dialog * Fixed "Keep both" and "Skip" options in Firefox * Fixed "Keep both" and "Skip" options when uploading via the "Upload"-menu * Fixed broken "Upload"-menu after skipping all files (= no files uploaded) * Fixed issues when uploading a folder into another folder which has or starts with the same name https://github.com/owncloud/web/pull/7724 https://github.com/owncloud/web/issues/7680
owncloud/web/changelog/6.0.0_2022-11-29/bugfix-folder-conflict/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-folder-conflict", "repo_id": "owncloud", "token_count": 111 }
595
Bugfix: Resolve upload existing folder We've added a conflict dialog which handles name clashes when uploading files and folders. https://github.com/owncloud/web/pull/7504 https://github.com/owncloud/web/issues/6996
owncloud/web/changelog/6.0.0_2022-11-29/bugfix-resolve-upload-existing-folder/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-resolve-upload-existing-folder", "repo_id": "owncloud", "token_count": 59 }
596