text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
import CloneProjectModalContent from '../js/features/clone-project-modal/components/clone-project-modal-content'
export const Basic = args => {
return <CloneProjectModalContent {...args} />
}
export const Invalid = args => {
return (
<CloneProjectModalContent {...args} clonedProjectName="" valid={false} />
)
}
export const Inflight = args => {
return <CloneProjectModalContent {...args} inFlight />
}
export const GenericError = args => {
return <CloneProjectModalContent {...args} error />
}
export const SpecificError = args => {
return (
<CloneProjectModalContent {...args} error="There was a specific error" />
)
}
export default {
title: 'Modals / Clone Project / Content',
component: CloneProjectModalContent,
args: {
animation: false,
projectId: 'original-project',
clonedProjectName: 'Project Title',
show: true,
error: false,
inFlight: false,
valid: true,
},
argTypes: {
cancel: { action: 'cancel' },
handleSubmit: { action: 'submit' },
setClonedProjectName: { action: 'set project name' },
},
}
| overleaf/web/frontend/stories/clone-project-modal-content.stories.js/0 | {
"file_path": "overleaf/web/frontend/stories/clone-project-modal-content.stories.js",
"repo_id": "overleaf",
"token_count": 362
} | 560 |
import { useEffect } from 'react'
import {
createFileModalDecorator,
mockCreateFileModalFetch,
} from './create-file-modal-decorator'
import FileTreeModalCreateFile from '../../../js/features/file-tree/components/modals/file-tree-modal-create-file'
import useFetchMock from '../../hooks/use-fetch-mock'
export const MinimalFeatures = args => {
useFetchMock(mockCreateFileModalFetch)
return <FileTreeModalCreateFile {...args} />
}
MinimalFeatures.decorators = [
createFileModalDecorator({
userHasFeature: () => false,
}),
]
export const WithExtraFeatures = args => {
useFetchMock(mockCreateFileModalFetch)
useEffect(() => {
const originalValue = window.ExposedSettings.hasLinkUrlFeature
window.ExposedSettings.hasLinkUrlFeature = true
return () => {
window.ExposedSettings.hasLinkUrlFeature = originalValue
}
}, [])
return <FileTreeModalCreateFile {...args} />
}
WithExtraFeatures.decorators = [
createFileModalDecorator({
refProviders: { mendeley: true, zotero: true },
}),
]
export const ErrorImportingFileFromExternalURL = args => {
useFetchMock(fetchMock => {
mockCreateFileModalFetch(fetchMock)
fetchMock.post('express:/project/:projectId/linked_file', 500, {
overwriteRoutes: true,
})
})
useEffect(() => {
const originalValue = window.ExposedSettings.hasLinkUrlFeature
window.ExposedSettings.hasLinkUrlFeature = true
return () => {
window.ExposedSettings.hasLinkUrlFeature = originalValue
}
}, [])
return <FileTreeModalCreateFile {...args} />
}
ErrorImportingFileFromExternalURL.decorators = [createFileModalDecorator()]
export const ErrorImportingFileFromReferenceProvider = args => {
useFetchMock(fetchMock => {
mockCreateFileModalFetch(fetchMock)
fetchMock.post('express:/project/:projectId/linked_file', 500, {
overwriteRoutes: true,
})
})
return <FileTreeModalCreateFile {...args} />
}
ErrorImportingFileFromReferenceProvider.decorators = [
createFileModalDecorator({
refProviders: { mendeley: true, zotero: true },
}),
]
export const FileLimitReached = args => {
useFetchMock(mockCreateFileModalFetch)
return <FileTreeModalCreateFile {...args} />
}
FileLimitReached.decorators = [
createFileModalDecorator({
rootFolder: [
{
docs: Array.from({ length: 10 }, (_, index) => ({
_id: `entity-${index}`,
})),
fileRefs: [],
folders: [],
},
],
}),
]
export default {
title: 'Modals / Create File',
component: FileTreeModalCreateFile,
}
| overleaf/web/frontend/stories/modals/create-file/create-file-modal.stories.js/0 | {
"file_path": "overleaf/web/frontend/stories/modals/create-file/create-file-modal.stories.js",
"repo_id": "overleaf",
"token_count": 943
} | 561 |
@import (less) '../fonts/font-awesome.css';
@import 'core/mixins.less';
// Reset
@import 'core/normalize.less';
@import 'core/print.less';
// Vendor CSS
@import (less) 'vendor/pdfListView/TextLayer.css';
@import (less) 'vendor/pdfListView/AnnotationsLayer.css';
@import (less) 'vendor/pdfListView/HighlightsLayer.css';
@import (less) 'vendor/select/select.css';
@import (less) 'vendor/codemirror.css';
@import (less) 'vendor/codemirror-dialog.css';
@import (less) 'vendor/codemirror-show-hint.css';
// Core CSS
@import 'core/scaffolding.less';
@import 'core/type.less';
@import 'core/grid.less';
@import 'core/accessibility.less';
// Components
@import 'components/tables.less';
@import 'components/forms.less';
@import 'components/buttons.less';
@import 'components/card.less';
//@import "components/code.less";
@import 'components/component-animations.less';
@import 'components/dropdowns.less';
@import 'components/button-groups.less';
@import 'components/input-groups.less';
@import 'components/navs.less';
@import 'components/navbar.less';
@import 'components/footer.less';
//@import "components/breadcrumbs.less";
//@import "components/pagination.less";
@import 'components/notifications.less';
@import 'components/pager.less';
@import 'components/labels.less';
//@import "components/badges.less";
//@import "components/jumbotron.less";
@import 'components/thumbnails.less';
@import 'components/alerts.less';
@import 'components/progress-bars.less';
// @import "components/media.less";
// @import "components/list-group.less";
// @import "components/panels.less";
// @import "components/wells.less";
@import 'components/close.less';
@import 'components/fineupload.less';
@import 'components/hover.less';
@import 'components/ui-select.less';
@import 'components/input-suggestions.less';
@import 'components/nvd3.less';
@import 'components/nvd3_override.less';
@import 'components/infinite-scroll.less';
@import 'components/expand-collapse.less';
@import 'components/beta-badges.less';
// Components w/ JavaScript
@import 'components/modals.less';
@import 'components/tooltip.less';
@import 'components/popovers.less';
@import 'components/carousel.less';
@import 'components/daterange-picker';
@import 'components/vertical-resizable-panes.less';
// ngTagsInput
@import 'components/tags-input.less';
// Utility classes
@import 'core/utilities.less';
@import 'core/responsive-utilities.less';
// ShareLaTeX app classes
@import 'app/base.less';
@import 'app/account-settings.less';
@import 'app/beta-program.less';
@import 'app/about-page.less';
@import 'app/project-list.less';
@import 'app/editor.less';
@import 'app/homepage.less';
@import 'app/plans.less';
@import 'app/recurly.less';
@import 'app/bonus.less';
@import 'app/register.less';
@import 'app/blog.less';
@import 'app/features.less';
@import 'app/templates.less';
@import 'app/wiki.less';
@import 'app/translations.less';
@import 'app/contact-us.less';
@import 'app/subscription.less';
@import 'app/sprites.less';
@import 'app/invite.less';
@import 'app/error-pages.less';
@import 'app/editor/history-v2.less';
@import 'app/metrics.less';
@import 'app/open-in-overleaf.less';
| overleaf/web/frontend/stylesheets/_style_includes.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/_style_includes.less",
"repo_id": "overleaf",
"token_count": 1121
} | 562 |
.file-view,
.binary-file {
padding: @line-height-computed / 2;
background-color: @gray-lightest;
text-align: center;
overflow: auto;
img {
max-width: 100%;
max-height: 90%;
display: block;
margin: auto;
margin-top: @line-height-computed / 2;
border: 1px solid @gray;
.box-shadow(0 2px 3px @gray;);
background-color: white;
}
p.no-preview {
margin-top: @line-height-computed / 2;
font-size: 24px;
color: @gray;
}
.text-loading {
margin-top: @line-height-computed / 2;
font-size: 24px;
color: @gray;
}
.text-preview {
margin-top: @line-height-computed / 2;
.scroll-container {
background-color: white;
font-size: 0.8em;
line-height: 1.1em;
overflow: auto;
border: 1px solid @gray-lighter;
padding-left: 12px;
padding-right: 12px;
padding-top: 8px;
padding-bottom: 8px;
text-align: left;
white-space: pre;
font-family: monospace;
}
}
.linked-file-icon {
color: @blue;
}
.beta-badge {
float: left;
}
}
| overleaf/web/frontend/stylesheets/app/editor/file-view.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/app/editor/file-view.less",
"repo_id": "overleaf",
"token_count": 494
} | 563 |
@toolbar-height: 40px;
.toolbar {
display: flex;
align-items: center;
height: @toolbar-height;
border-bottom: @toolbar-border-bottom;
> a,
.toolbar-right > a {
position: relative;
.label {
position: absolute;
top: 0;
right: 0;
padding: 0.15em 0.6em 0.2em;
font-size: 60%;
pointer-events: none; // Labels were capturing button/anchor clicks.
}
}
> a:focus {
outline: none;
}
> a:not(.btn),
> button,
.toolbar-left > a:not(.btn),
.toolbar-left > button,
.toolbar-right > a:not(.btn),
.toolbar-right > button {
display: inline-block;
color: @toolbar-icon-btn-color;
background-color: transparent;
padding: 4px 2px;
line-height: 1;
height: 24px;
border-radius: @border-radius-small;
&.toolbar-header-back-projects {
padding: 5px 10px 4px;
margin-bottom: 1px;
}
&:hover {
text-shadow: @toolbar-icon-btn-hover-shadow;
color: @toolbar-icon-btn-hover-color;
background-color: transparent;
text-decoration: none;
}
&.active,
&:active {
.label {
display: none;
}
color: white;
background-color: @link-color;
box-shadow: @toolbar-icon-btn-hover-boxshadow;
&:hover {
color: white;
}
}
}
&.toolbar-pdf > a:not(.btn) {
margin-right: 3px;
}
.btn-full-height {
border: none;
border-radius: 0;
border-right: 1px solid @toolbar-header-btn-border-color;
color: @toolbar-btn-color;
padding: 3px 10px 5px;
font-size: 20px;
max-height: 39px;
&:hover {
text-shadow: @toolbar-btn-hover-text-shadow;
background-color: @toolbar-btn-hover-bg-color;
color: @toolbar-btn-hover-color;
}
&.active,
&:active {
color: @toolbar-btn-active-color;
background-color: @toolbar-btn-active-bg-color;
box-shadow: @toolbar-btn-active-shadow;
}
.label {
top: 4px;
right: 4px;
}
&.header-cobranding-logo-container {
height: @toolbar-height - 1;
padding: 8px 10px;
background-color: @toolbar-header-branded-btn-bg-color;
}
}
.btn-full-height-no-border {
border-right: 0;
border-left: 0;
}
.toolbar-left {
display: flex;
float: left;
text-align: center;
align-items: center;
}
.toolbar-right {
display: flex;
align-items: center;
flex-grow: 1;
justify-content: flex-end;
.btn-full-height {
border-right: 0;
border-left: 1px solid @toolbar-header-btn-border-color;
}
}
.toolbar-center {
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
// At small screen sizes, center relative to the left menu and right buttons
width: 100%;
display: flex;
justify-content: center;
}
&.toolbar-header {
background-color: @toolbar-header-bg-color;
box-shadow: @toolbar-header-shadow;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 1;
}
&.toolbar-small {
.toolbar-small-mixin;
}
&.toolbar-tall {
.toolbar-small-mixin;
}
&.toolbar-alt {
.toolbar-alt-mixin;
}
}
.header-cobranding-logo {
display: block;
width: auto;
max-height: 100%;
}
.toolbar-small-mixin() {
height: @toolbar-small-height;
}
.toolbar-tall-mixin() {
height: @toolbar-tall-height;
padding-top: 10px;
}
.toolbar-alt-mixin() {
background-color: @toolbar-alt-bg-color;
}
.toolbar-label {
display: none;
margin: 0 4px;
font-size: @toolbar-font-size;
font-weight: 600;
margin-bottom: 2px;
vertical-align: middle;
text-align: left;
@media (min-width: @screen-md-min) {
display: inline-block;
}
&.toolbar-label-multiline {
line-height: 1.1;
}
}
.editor-dark {
.toolbar-alt {
background-color: darken(@editor-dark-background-color, 0%);
}
.toolbar {
border-color: @editor-dark-toolbar-border-color;
.btn-full-height {
border-color: @editor-dark-toolbar-border-color;
&:hover {
background-color: black;
color: lighten(@link-color, 10%);
}
}
&.toolbar-header {
box-shadow: none;
}
> a:not(.btn) {
color: @gray;
&:hover {
color: @gray-light;
}
}
}
}
/**************************************
Toggle Switch
***************************************/
.toggle-wrapper {
min-width: 200px;
height: 24px;
}
.toggle-switch {
position: relative;
height: 100%;
width: 100%;
background-color: @toggle-switch-bg;
border-radius: @btn-border-radius-base;
}
.toggle-switch-label {
position: relative;
display: block;
font-weight: normal;
z-index: 2;
float: left;
width: 50%;
height: 100%;
line-height: 24px;
text-align: center;
margin-bottom: 0;
cursor: pointer;
user-select: none;
color: @text-color;
transition: color 0.12s ease-out;
}
.toggle-switch-input {
position: absolute;
opacity: 0;
}
.toggle-switch-input:checked + .toggle-switch-label {
color: #fff;
font-weight: bold;
}
.toggle-switch-selection {
display: block;
position: absolute;
z-index: 1;
top: 2px;
left: 2px;
right: 2px;
width: calc(~'50% - 2px');
height: calc(~'100% - 4px');
background: @toggle-switch-highlight-color;
border-radius: @btn-border-radius-base 0 0 @btn-border-radius-base;
transition: transform 0.12s ease-out, border-radius 0.12s ease-out;
}
.toggle-switch-input:checked:nth-child(4) ~ .toggle-switch-selection {
transform: translate(100%);
border-radius: 0 @btn-border-radius-base @btn-border-radius-base 0;
}
/**************************************
Formatting buttons
***************************************/
.formatting-buttons {
width: 100%;
overflow: hidden;
}
.formatting-buttons-wrapper {
display: flex;
}
.formatting-btn {
color: @formatting-btn-color;
background-color: @formatting-btn-bg;
padding: 0;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: none;
border: none;
border-left: 1px solid @formatting-btn-border;
border-radius: 0;
&:hover {
color: @formatting-btn-color;
}
&.active {
color: @toolbar-btn-active-color;
background-color: @toolbar-btn-active-bg-color;
box-shadow: @toolbar-btn-active-shadow;
}
&:focus {
color: @formatting-btn-color;
}
}
.formatting-btn--icon {
min-width: 32px;
width: 32px;
}
.formatting-btn--icon:last-of-type {
border-right: 1px solid @formatting-btn-border;
}
.formatting-btn--more {
padding-left: 9px;
padding-right: 9px;
.caret {
margin-top: 1px;
}
}
.formatting-icon {
font-style: normal;
line-height: 1.5;
}
.formatting-icon--small {
font-size: small;
line-height: 1.9;
}
.formatting-icon--serif {
font-family: @font-family-serif;
}
.formatting-more {
margin-left: auto;
}
.formatting-menu {
min-width: auto;
max-width: 130px;
background-color: @formatting-menu-bg;
}
.formatting-menu-item {
float: left;
}
.formatting-menu-item > .formatting-btn {
border-right: none;
}
// Disable border on left-most icon in menu
.formatting-menu-item:nth-of-type(4n + 1) > .formatting-btn {
border-left: none;
}
.toolbar.toolbar-pdf > a[disabled] {
cursor: not-allowed;
.opacity(0.65);
.box-shadow(none);
}
| overleaf/web/frontend/stylesheets/app/editor/toolbar.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/app/editor/toolbar.less",
"repo_id": "overleaf",
"token_count": 3087
} | 564 |
.content-portal {
padding-top: @navbar-height!important;
.join-rider {
margin-top: -(@line-height-computed / 2); // negate bottom margin from h4
}
/*
Begin Header
*/
.banner-image {
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
height: 375px;
}
.image-fill {
display: inline-block;
height: 100%;
vertical-align: middle;
}
.institution-logo {
left: 50%;
margin-left: -100px;
padding: 0;
position: absolute;
div {
background-color: @white;
box-shadow: 1px 11px 22px -9px @black-alpha-strong;
display: inline-block;
height: 125px;
overflow: hidden;
position: absolute;
text-align: center;
top: -110px;
white-space: nowrap;
width: @btn-portal-width;
}
img {
max-height: 75px;
max-width: 150px;
vertical-align: middle;
}
}
.portal-name {
background-color: @ol-blue-gray-0;
padding-bottom: @line-height-computed; //- center header when no tabs
padding-top: @padding-md;
text-align: center;
width: 100%;
}
// End Header
/*
Begin Layout
*/
.button-pull,
.content-pull {
float: left;
}
.button-pull {
text-align: right;
> a.btn {
white-space: normal;
width: @btn-portal-width;
text-align: center;
}
}
.content-pull {
padding-right: @padding-sm;
width: calc(~'100% - ' @btn-portal-width);
}
// End Layout
/*
Begin Card
*/
.card {
margin-bottom: @margin-md;
}
// End Card
/*
Begin Actions
*/
.portal-actions {
i {
margin-bottom: @margin-sm;
}
}
// End Actions
.nav-tabs {
margin-bottom: @margin-md;
}
/*
Begin Print
*/
.print {
.basic-metrics {
margin-bottom: 50px; /* get Departments header on next page */
}
.container {
width: auto;
}
.custom-donut-container svg {
max-width: 570px; /* safe width for printing */
}
.hidden-print {
display: none;
}
.portal-col {
/* for firefox */
margin: 0;
width: 100%;
}
.portal-name {
padding: 0;
}
.visible-print {
display: block !important;
}
}
@media print and (color) {
&:extend(.print);
}
// End Print
.nav-tabs {
background-color: @ol-blue-gray-0;
}
@media (max-width: @screen-size-sm-max) {
.content-pull {
padding: 0;
width: auto;
}
.button-pull {
> a.btn {
width: auto;
}
}
}
}
| overleaf/web/frontend/stylesheets/app/portals.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/app/portals.less",
"repo_id": "overleaf",
"token_count": 1167
} | 565 |
//
// Breadcrumbs
// --------------------------------------------------
.breadcrumb {
padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal;
margin-bottom: @line-height-computed;
list-style: none;
background-color: @breadcrumb-bg;
border-radius: @border-radius-base;
> li {
display: inline-block;
+ li:before {
content: '@{breadcrumb-separator}\00a0'; // Unicode space added since inline-block means non-collapsing white-space
padding: 0 5px;
color: @breadcrumb-color;
}
}
> .active {
color: @breadcrumb-active-color;
}
}
| overleaf/web/frontend/stylesheets/components/breadcrumbs.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/components/breadcrumbs.less",
"repo_id": "overleaf",
"token_count": 214
} | 566 |
// Colors
.icon-accent {
color: @accent-color-secondary!important;
}
// Sizes
.icon-lg {
font-size: @font-size-h1;
}
| overleaf/web/frontend/stylesheets/components/icons.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/components/icons.less",
"repo_id": "overleaf",
"token_count": 54
} | 567 |
.nvd3 {
.nv-axis {
.tick {
line {
opacity: 0;
}
}
path.domain {
opacity: 0;
}
}
}
svg.nvd3-iddle {
&:extend(svg.nvd3-svg);
}
| overleaf/web/frontend/stylesheets/components/nvd3_override.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/components/nvd3_override.less",
"repo_id": "overleaf",
"token_count": 110
} | 568 |
//
// Accessibility
// --------------------------------------------------
// For improving accessibility.
// If possible, add accessibiity styling to stylesheet where selector is
// defined. Otherwise, add here.
// <del> styling taken from:
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del#Accessibility_concerns
del::before,
del::after {
clip-path: inset(100%);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
del::before {
content: ' [deletion start] ';
}
del::after {
content: ' [deletion end] ';
}
| overleaf/web/frontend/stylesheets/core/accessibility.less/0 | {
"file_path": "overleaf/web/frontend/stylesheets/core/accessibility.less",
"repo_id": "overleaf",
"token_count": 202
} | 569 |
.CodeMirror-hints {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-hint {
margin: 0;
padding: 0 4px;
border-radius: 2px;
white-space: pre;
color: black;
cursor: pointer;
}
li.CodeMirror-hint-active {
background: #08f;
color: white;
}
| overleaf/web/frontend/stylesheets/vendor/codemirror-show-hint.css/0 | {
"file_path": "overleaf/web/frontend/stylesheets/vendor/codemirror-show-hint.css",
"repo_id": "overleaf",
"token_count": 270
} | 570 |
{
"projects": "Projektit",
"upload_project": "Siirrä projekti palvelimelle",
"all_projects": "Kaikki projektit",
"your_projects": "Sinun projektisi",
"shared_with_you": "Jaettu kanssasi",
"deleted_projects": "Poistetut projektit",
"templates": "Mallit",
"new_folder": "Uusi kansio",
"create_your_first_project": "Luo ensimmäinen projektisi!",
"complete": "Valmis",
"on_free_sl": "Käytät ohjelman __appName__ ilmaista versiota",
"upgrade": "Päivitä",
"or_unlock_features_bonus": "tai avaa ilmaisia lisäominaisuuksia",
"sharing_sl": "jaa __appName__",
"add_to_folder": "Lisää kansioon",
"create_new_folder": "Luo uusi kansio",
"more": "Lisää",
"rename": "Nimeä uudelleen",
"make_copy": "Tee kopio",
"restore": "Palauta",
"title": "Otsikko",
"last_modified": "Viimeksi muokattu",
"no_projects": "Ei projekteja",
"welcome_to_sl": "Tämä on __appName__, tervetuloa!",
"new_to_latex_look_at": "Uusi LaTeXin käyttäjä? Aloita katsomalla",
"or": "tai",
"or_create_project_left": "tai luo ensimmäinen projekti vasemmalta.",
"thanks_settings_updated": "Kiitos, asetuksesi ovat päivitetty.",
"update_account_info": "Päivitä tilin tiedot",
"must_be_email_address": "Täytyy olla sähköpostiosoite",
"first_name": "Etunimi",
"last_name": "Sukunimi",
"update": "Päivitä",
"change_password": "Vaihda salasana",
"current_password": "Nykyinen salasana",
"new_password": "Uusi salasana",
"confirm_new_password": "Vahvista uusi salasana",
"required": "vaadittu",
"doesnt_match": "Eivät vastaa toisiaan",
"dropbox_integration": "Dropboxiin yhdistäminen",
"learn_more": "Lue lisää",
"dropbox_is_premium": "Dropbox-synkronointi on premium-ominaisuus",
"account_is_linked": "Tili on yhdistetty",
"unlink_dropbox": "Poista Dropbox-yhteys",
"link_to_dropbox": "Yhdistä Dropboxiin",
"newsletter_info_and_unsubscribe": "Lähetämme muutaman kuukauden välein uutiskirjeen jossa kerromme lyhyesti uusista ominaisuuksista. Jos haluaisit olla saamatta tätä sähköpostia voit peruuttaa sen milloin tahansa:",
"unsubscribed": "Tilaus peruutettu",
"unsubscribing": "Tilausta peruutetaan",
"unsubscribe": "Peruuta tilaus",
"need_to_leave": "Haluatko lähteä?",
"delete_your_account": "Poista tilisi",
"delete_account": "Poista tili",
"delete_account_warning_message": "Olet <strong>poistamassa kaikki tilisi tiedot</strong> pysyvästi, mukaanlukien projektisi ja asetuksesi. Ole hyvä ja kirjoita DELETE allaolevaan laatikkoon jatkaaksesi.",
"deleting": "Poistetaan",
"delete": "Poista",
"sl_benefits_plans": "__appName__ on maailman helppokäyttöisin LaTeX-editori. Pysy ajan tasalla työtovereidesi kanssa, pidä kirjaa kaikista muutoksista, ja käytä LaTeX-ympäristöämme missä tahansa maailmaa oletkin.",
"monthly": "Kuukausittainen",
"personal": "Henkilökohtainen",
"free": "Ilmainen",
"one_collaborator": "Vain yksi työtoveri",
"collaborator": "Työtoveri",
"collabs_per_proj": "__collabcount__ työtoveria per projekti",
"full_doc_history": "Täysi dokumentin historia",
"sync_to_dropbox": "Yhdistä Dropboxiin",
"start_free_trial": "Aloita ilmainen kokeilu!",
"professional": "Ammattilainen",
"unlimited_collabs": "Rajattomasti työtovereita",
"name": "Nimi",
"student": "Opiskelija",
"university": "Yliopisto",
"position": "Asema",
"choose_plan_works_for_you": "Valitse sopivin sopimus __len__:n päivän mittaisella kokeilulla. Peruuta koska vain.",
"interested_in_group_licence": "Oletko kiinnostunut käyttämään sovellusta __appName__ koko ryhmän, tiimin tai osaston yhteiskäytössä olevalla tilillä?",
"get_in_touch_for_details": "Ota yhteyttä saadaksesi lisätietoja!",
"group_plan_enquiry": "Ryhmäsopimustiedustelu",
"enjoy_these_features": "Nauti kaikista näistä mahtavista ominaisuuksista",
"create_unlimited_projects": "Luo niin monta projektia kuin haluat.",
"never_loose_work": "Älä huoli, turvaamme selustasi.",
"access_projects_anywhere": "Pääse projekteihisi käsiksi mistä tahansa.",
"log_in": "Kirjaudu sisään",
"login": "Kirjaudu",
"logging_in": "Kirjaudutaan sisään",
"forgot_your_password": "Unohditko salasanasi",
"password_reset": "Nollaa salasana",
"password_reset_email_sent": "Sinulle on lähetetty sähköposti, jossa on ohjeet salasanan nollaamiseksi.",
"please_enter_email": "Syötä sähköpostiosoitteesi",
"request_password_reset": "Pyydä salasanan nollausta",
"reset_your_password": "Nollaa salasanasi",
"password_has_been_reset": "Salasanasi on nollattu",
"login_here": "Kirjaudu tästä",
"set_new_password": "Aseta uusi salasana",
"user_wants_you_to_see_project": "__username__ haluaisi katsoa projektiasi __projectname__",
"join_sl_to_view_project": "Liity sovellukseen __appName__ nähdäksesti tämän projektin",
"register_to_edit_template": "Ole hyvä ja rekisteröidy muokataksesi mallia __templateName__",
"already_have_sl_account": "Onko sinulla jo __appName__-tili?",
"register": "Rekisteröidy",
"password": "Salasana",
"registering": "Rekisteröidään",
"planned_maintenance": "Suunniteltu ylläpito",
"no_planned_maintenance": "Tällä hetkellä ei ole suunniteltuja ylläpitoja",
"cant_find_page": "Anteeksi, emme löydä hakemaasi sivua.",
"take_me_home": "Vie minut kotiin!",
"no_preview_available": "Anteeksi, esikatselua ei ole saatavilla.",
"no_messages": "Ei viestejä",
"send_first_message": "Lähetä ensimmäinen viestisi",
"account_not_linked_to_dropbox": "Tilisi ei ole yhdistetty Dropboxiin",
"update_dropbox_settings": "Päivitä Dropbox-asetukset",
"refresh_page_after_starting_free_trial": "Ole hyvä ja päivitä tämä sivu aloitettuasi ilmaisen kokeilusi.",
"checking_dropbox_status": "tarkistetaan Dropboxin tilaa",
"dismiss": "Ohita",
"new_file": "Uusi tiedosto",
"upload_file": "Vie tiedosto",
"create": "Luo",
"creating": "Luodaan",
"upload_files": "Vie tiedosto(ja)",
"sure_you_want_to_delete": "Oletko varma että haluat pysyvästi poistaa <strong>{{ entity.name }}</strong>?",
"common": "Yleisiä",
"navigation": "Navigointi",
"editing": "Muokkaaminen",
"ok": "OK",
"source": "Lähde",
"actions": "Toiminnot",
"copy_project": "Kopioi projekti",
"publish_as_template": "Julkaise mallina",
"sync": "Synkronointi",
"settings": "Asetukset",
"main_document": "Päädokumentti",
"off": "Pois",
"auto_complete": "Automaattinen täydennys",
"theme": "Teema",
"font_size": "Kirjasimen koko",
"pdf_viewer": "PDF-lukija",
"built_in": "Sisäänrakennettu",
"native": "natiivi",
"show_hotkeys": "Näytä pikanäppäimet",
"new_name": "Uusi nimi",
"copying": "kopioidaan",
"copy": "Kopioi",
"compiling": "Käännetään",
"click_here_to_preview_pdf": "Paina tästä esikatsellaksesi työtäsi PDF:nä.",
"server_error": "Palvelinvirhe",
"somthing_went_wrong_compiling": "Anteeksi, jokin meni pieleen ja projektiasi ei voitu kääntää. Yritä uudelleen hetken kuluttua.",
"timedout": "Aikakatkaisu",
"proj_timed_out_reason": "Kääntämisessä kesti liian pitkää ja se aikakatkaistiin. Tämä saattaa johtua liian suuresta määrästä korkearesoluutioisia kuvia tai monimutkaisista kaavioista.",
"no_errors_good_job": "Ei virheitä, hyvin tehty!",
"compile_error": "Virhe kääntämisessä",
"generic_failed_compile_message": "Anteeksi, LaTeX-koodisi ei kääntynyt jostain syystä. Ole hyvä ja katso tarkempia tietoja allaolevista virheilmoituksista, tai katso raakalokia.",
"other_logs_and_files": "Muut lokit & tiedostot",
"view_raw_logs": "Katso raakalokeja",
"hide_raw_logs": "Piilota raakalokit",
"clear_cache": "Tyhjennä välimuisti",
"clear_cache_explanation": "Tämä tyhjentää kaikki piilotetut LaTeX-tiedostot (.aux, .bbl, jne.) kääntämisen hoitavalta palvelimeltamme. Et yleensä joudu tekemään tätä, paitsi jos sinulla on ongelmia viittausten kanssa.",
"clear_cache_is_safe": "Projektisi tiedostoja ei poisteta tai muuteta.",
"clearing": "Tyhjennetään",
"template_description": "Mallin kuvaus",
"project_last_published_at": "Projektisi julkaistiin viimeksi",
"problem_talking_to_publishing_service": "Julkaisupalvelussamme on ongelma, ole hyvä ja yritä uudestaan muutaman minuutin kuluttua.",
"unpublishing": "Lopetetaan julkaiseminen",
"republish": "Uudelleenjulkaise",
"publishing": "Julkaistaan",
"share_project": "Jaa projekti",
"this_project_is_private": "Tämä projekti on yksityinen ja siihen pääsevät käsiksi vain alla luetellut ihmiset.",
"make_public": "Tee julkiseksi",
"this_project_is_public": "Tämä projekti on julkinen ja sitä voi muokata kuka tahansa, jolla on URL.",
"make_private": "Tee yksityiseksi",
"can_edit": "Voi muokata",
"share_with_your_collabs": "Jaa työtovereidesi kanssa",
"share": "Jaa",
"need_to_upgrade_for_more_collabs": "Sinun täytyy päivittää tilisi lisätäksesi työtovereta",
"make_project_public": "Tee projektista julkinen",
"make_project_public_consequences": "Jos teet projektistasi julkisen, kuka tahansa, jolla on URL, pääsee siihen käsiksi.",
"allow_public_editing": "Salli julkinen muokkaaminen",
"allow_public_read_only": "Salli julkinen vain luku -oikeus",
"make_project_private": "Tee projektista yksityinen",
"make_project_private_consequences": "Jos teet projektistasi yksityisen, vain valitsemasi henkilöt pääsevät siihen käsiksi.",
"need_to_upgrade_for_history": "Sinun täytyy päivittää tilisi käyttääksesi Historia-toimintoa.",
"ask_proj_owner_to_upgrade_for_history": "Ole hyvä ja pyydä projektin omistajaa päivittämään käyttääksesi Historia-ominaisuutta.",
"anonymous": "Anonyymi",
"generic_something_went_wrong": "Anteeksi, jokin meni pieleen :(",
"restoring": "Palautetaan",
"restore_to_before_these_changes": "Palauta versioon ennen näitä muutoksia",
"profile_complete_percentage": "Profiilisi on __percentval__% valmis",
"file_has_been_deleted": "__filename__ on poistettu",
"sure_you_want_to_restore_before": "Oletko varma, että haluat palauttaa tiedoston <0>__filename__</0> versioon ennen __date__ tehtyjä päivityksiä?",
"rename_project": "Uudelleennimeä projekti",
"about_to_delete_projects": "Olet poistamassa seuraavia projekteja:",
"about_to_leave_projects": "Olet jättämässä seuraavat projektit:",
"upload_zipped_project": "Vie pakattu projekti",
"upload_a_zipped_project": "Vie pakattu projekti",
"your_profile": "Profiilisi",
"institution": "Instituutio",
"role": "Rooli",
"folders": "Kansiot",
"disconnected": "Yhteys katkaistu",
"please_refresh": "Päivitä sivu jatkaaksesi.",
"lost_connection": "Yhteys menetettiin.",
"reconnecting_in_x_secs": "Yhteys muodostetaan uudestaan __seconds__ sekunnin kuluttua",
"try_now": "Yritä nyt",
"reconnecting": "Yhdistetään uudelleen",
"saving_notification_with_seconds": "Tallennetaan __docname__... (__seconds__ sekuntia tallentamattomia muutoksia)",
"help_us_spread_word": "Auta meitä jakamaan tietoa __appName__-sovelluksesta",
"share_sl_to_get_rewards": "Jaa __appName__ kavereille ja työtovereillesi ja avaa alla olevat palkinnot",
"post_on_facebook": "Julkaise Facebookissa",
"share_us_on_googleplus": "Jaa meidät Google+:ssa",
"email_us_to_your_friends": "Lähetä meistä sähköpostia kavereillesi",
"link_to_us": "Linkitä meihin nettisivuiltasi",
"direct_link": "Suora linkki",
"sl_gives_you_free_stuff_see_progress_below": "Kun joku alkaa käyttäämään __appName__-sovellusta suosituksesi perusteella, annamme sinulle <strong>ilmaista tavaraa</strong> kiitoksen osoitukseksi! Tarkista etenemisesi alla.",
"spread_the_word_and_fill_bar": "Levitä sanomaa ja täytä tämä palkki",
"one_free_collab": "Yksi ilmainen työtoveri",
"three_free_collab": "Kolme ilmaista työtoveria",
"free_dropbox_and_history": "Ilmainen Dropbox ja historia",
"you_not_introed_anyone_to_sl": "Et ole vielä esitellyt __appName__-sovellusta kenellekään. Aloita jakamaan!",
"you_introed_small_number": " Olet esitellyt __appName__-sovelluksen <0>__numberOfPeople__</0> henkilölle. Hyvää työtä, mutta löydätkö vielä lisää?",
"you_introed_high_number": " Olet esitellyt __appName__-sovelluksen <0>__numberOfPeople__</0> henkilölle. Hyvää työtä!",
"link_to_sl": "Linkitä sovellukseen __appName__",
"can_link_to_sl_with_html": "Voit linkittää sovellukseen __appName__ seuraavalla HTML-koodilla:",
"year": "vuosi",
"month": "kuukausi",
"subscribe_to_this_plan": "Tilaa tämä sopimus",
"your_plan": "Sopimuksesi",
"your_subscription": "Tilauksesi",
"on_free_trial_expiring_at": "Käytät tällä hetkellä ilmaista kokeiluversiota, joka vanhenee __expiresAt__.",
"choose_a_plan_below": "Valitse tilattava sopimus alta.",
"currently_subscribed_to_plan": "Sinula on tällä hetkellä <0>__planName__</0>-sopimus",
"change_plan": "Muuta sopimusta",
"next_payment_of_x_collectected_on_y": "Seuraava maksu on <0>__paymentAmmount__</0> ja se kerätään <1>__collectionDate__</1>",
"update_your_billing_details": "Päivitä laskutustietojasi",
"subscription_canceled_and_terminate_on_x": " Tilauksesi on peruutettu ja loppuu <0>__terminateDate__</0>. Lisämaksuja ei veloiteta.",
"your_subscription_has_expired": "Tilauksesi on umpeutunut.",
"create_new_subscription": "Luo uusi tilaus",
"problem_with_subscription_contact_us": "Tilauksessasi on on ongelma. Ole hyvä ja ota meihin yhteyttä saadaksesi lisätietoja.",
"manage_group": "Hallinnoi ryhmää",
"loading_billing_form": "Ladataan laskutustietolomaketta",
"you_have_added_x_of_group_size_y": "Olet lisännyt <0>__addedUsersSize__</0> saatavilla olevasta <1>__groupSize__</1> jäsenestä",
"remove_from_group": "Poista ryhmästä",
"group_account": "Ryhmätili",
"registered": "Rekisteröitynyt",
"no_members": "Ei jäseniä",
"add_more_members": "Lisää jäseniä",
"add": "Lisää",
"thanks_for_subscribing": "Kiitos tilauksesta!",
"your_card_will_be_charged_soon": "Kortiltasi veloitetaan pian.",
"if_you_dont_want_to_be_charged": "Jos et halua, että sinulta veloitetaan uudestaan ",
"add_your_first_group_member_now": "Lisää ensimmäiset ryhmäsi jäsenet nyt",
"thanks_for_subscribing_you_help_sl": "Kiitos, että tilasit __planName__-sopimuksen. Kaltaistesi ihmisten antama tuki mahdollistaa __appName__-sovelluksen kehittämisen jatkumisen.",
"back_to_your_projects": "Takaisin projekteihisi",
"goes_straight_to_our_inboxes": "Se menee suoraan meidän molempien sähköpostilaatikoihimme",
"need_anything_contact_us_at": "Jos ikinä tarvitset mitään, ota suoraan yhteyttä osoitteeseen",
"regards": "Kiittäen",
"about": "Tietoa",
"comment": "Kommentoi",
"restricted_no_permission": "Rajoitettu, sinulla ei valitettavasti ole lupaa ladata tätä sivua",
"online_latex_editor": "Verkossa toimiva LaTeX-editori",
"meet_team_behind_latex_editor": "Tutustu tiimiin verkossa toimivan suosikki-LaTeX-editorisi takana.",
"follow_me_on_twitter": "Seuraa minua Twitterissä",
"motivation": "Motivaatio",
"evolved": "Kehittynyt",
"the_easy_online_collab_latex_editor": "Helppokäyttöinen, verkossa toimiva, yhteistyön mahdollistava LaTeX-editori",
"get_started_now": "Aloita heti",
"sl_used_over_x_people_at": "__appName__-sovellusta käyttää yli __numberOfUsers__ opiskelijaa ja akateemista seuraavissa paikoissa kuin:",
"collaboration": "Yhteistyö",
"work_on_single_version": "Työskentele yhdessä yhdellä versiolla",
"view_collab_edits": "Katso työtovereiden tekemät muutokset ",
"ease_of_use": " Helppokäyttöisyys",
"no_complicated_latex_install": "Ei monimutkaista LaTeXin asennusta",
"all_packages_and_templates": "Kaikki paketit ja <0>__templatesLink__</0> mitä tarvitset",
"document_history": "Dokumenttihistoria",
"see_what_has_been": "Näe mitä on ",
"added": "lisätty",
"and": "ja",
"removed": "poistettu",
"restore_to_any_older_version": "Palauta mihin tahansa vanhempaan versioon",
"work_from_anywhere": "Työskentele mistä tahansa",
"acces_work_from_anywhere": "Pääse työhösi käsiksi mistä tahansa päin maailmaa",
"work_offline_and_sync_with_dropbox": "Työskentele ilman verkkoyhteyttä ja synkronoi tiedostosi Dropboxin ja GitHubin kautta",
"over": "yli",
"view_templates": "Katso mallipohjia",
"nothing_to_install_ready_to_go": "Sinun ei ole tarpeen asentaa mitään monimutkaista tai vaikeaa, ja voit <0>__start_now__</0>, vaikka et olisi ikinä nähnyt sitä ennen. __appName__-sovelluksen mukana tulee täydellinen palvelimillamme toimiva LaTeX-ympäristö, heti käyttöön.",
"start_using_latex_now": "aloita LaTeXin käyttäminen heti",
"get_same_latex_setup": "__appName__ antaa sinulle samat LaTeX-asetukset missä ikinä menetkin. Kun teet työtä __appName__-sovelluksella työtovereidesi ja opiskelijoiden kanssa, voit olla varma, että vältät versio-epäjohdonmukaisuudet ja pakettikonfliktit.",
"support_lots_of_features": "Tuemme lähes kaikkia LaTeXin ominaisuuksia, mukaanlukien kuvien lisäys, lähdeluettelot, yhtälöt ja paljon muuta! Lue mitä kaikkia jännittäviä asioita voit tehdä sovelluksen __appName__ avulla: <0>__help_guides_link__</0>",
"latex_guides": "LaTeX-oppaat",
"reset_password": "Nollaa salasana",
"set_password": "Aseta salasana",
"updating_site": "Päivitetään sivustoa",
"bonus_please_recommend_us": "Bonus - Ole hyvä ja suosittele meitä",
"admin": "ylläpitäjä",
"subscribe": "Tilaa",
"update_billing_details": "Päivitä laskutustiedot",
"group_admin": "Ryhmän ylläpitäjä",
"all_templates": "Kaikki mallipohjat",
"your_settings": "Asetuksesi",
"maintenance": "Huolto",
"to_many_login_requests_2_mins": "Tällä tilillä on liian monta sisäänkirjautumispyyntöä. Ole hyvä ja odota 2 minuuttia ennen kuin yrität kirjautua uudestaan",
"email_or_password_wrong_try_again": "Sähköpostiosoitteesi tai salasanasi oli väärä. Ole hyvä ja yritä uudelleen",
"rate_limit_hit_wait": "Vauhtiraja tuli vastaan. Odota hetki ennen kuin yrität uudelleen",
"problem_changing_email_address": "Sähköpostia muutettaessa tapahtui virhe. Ole hyvä ja yritä uudelleen hetken kuluttua. Jos ongelma jatkuu, ota meihin yhteyttä.",
"single_version_easy_collab_blurb": "__appName__ varmistaa, että olet aina ajan tasalla työtovereidesi kanssa ja tiedät mitä he ovat tekemässä. Jokaisesta dokumentista on olemassa vain yksi pääversio, johon kaikilla on pääsyoikeus. Sinun on mahdotonta tehdä keskenään ristiriidassa olevia muutoksia, eikä sinun tarvitse odottaa, että työtoverisi lähettävät sinulle viimeisimmän luonnoksen ennen kuin voit jatkaa työntekoa.",
"can_see_collabs_type_blurb": "Ei ole ongelma, jos useampi ihminen haluaa työskennellä saman dokumentin parissa samanaikaisesti. Näet missä kohtaa dokumenttia työtoverisi kirjoittavat ja heidän tekemänsä muutokset näkyvät suoraan editorissasi.",
"work_directly_with_collabs": "Työskentele suoraan työtovereidesi kanssa",
"work_with_word_users": "Työskentele Wordin käyttäjien kanssa",
"work_with_word_users_blurb": "Sovelluksen __appName__ käyttäminen on niin helppoa, että voit kutsua LaTeXia aikaisemmin käyttämättömät työtoverisi mukaan osallistumaan LaTeX-dokumentteihisi. He pystyvät olemaan tuottavia ja osallistumaan heti ensimmäisestä päivästä lähtien ja oppimaan lisää LaTeXia ajan mukaan.",
"view_which_changes": "Katso mitä muutoksia on",
"sl_included_history_of_changes_blurb": "__appName__ sisältää historiatiedot kaikista muutoksista, joten voit nähdä tarkalleen kuka muutti mitä, ja milloin. Näin pysyt kärryillä kuinka työtoverisi edistyvät ja voit tarkastella heidän tekemiä tuoreita muutoksia.",
"can_revert_back_blurb": "Tehdessä töitä itsenäisesti tai yhdessä tapahtuu joskus virheitä. Voit yksinkertaisesti palata takaisin aiempiin versioihin, joka poistaa sinulta riskin, että kadottaisit tehdyn työn tai kadut muutosta.",
"start_using_sl_now": "Ala käyttämään sovellusta __appName__ heti",
"over_x_templates_easy_getting_started": "Mallipohjagalleriastamme löytyy __yli__ 400 __mallipohjaa__, joten pääset todella helposti alkuun, kirjoitit sitten tiedeartikkelia, väitöstä, ansioluetteloa tai jotain muuta.",
"done": "Valmis",
"change": "Muuta",
"page_not_found": "Sivua Ei Löydy",
"please_see_help_for_more_info": "Lue lisätietoa ohjeoppaastamme",
"this_project_will_appear_in_your_dropbox_folder_at": "Tämä projekti ilmestyy Dropbox-kansioosi kohteessa ",
"member_of_group_subscription": "Olet ryhmätilauksen jäsen, jota hallitsee __admin_email__. Ota yhteyttä heihin hallitaksesi tilaustasi.\n",
"about_henry_oswald": "on Lontoossa asuva ohjelmistoinsinööri. Hän kehitti __appName__:in ensimmäisen prototyypin ja on vastannut vakaan ja skaalautuvan alustan suunnittelut. Henry uskoo vahvasti testauslähtöiseen kehittämiseen ja haluaa varmistaa, että sovelluksen __appName__ koodi pysyy selkeänä ja helposti ylläpidettävänä.",
"about_james_allen": "on teoreettisen fysiikan tohtori, joka suhtautuu LaTeXiin intohimolla. Hän loi yhden ensimmäisistä verkossa olevista LaTeX-editoreista, ScribTeXin, ja on ollut suuressa osassa muiden teknologioiden kehittämisessä, jotka ovat mahdollistaneet __appName__-sovelluksen kehittämisen.",
"two_strong_principles_behind_sl": "__appName__-sovelluksen parissa tekemäämme työtä ohjaa kaksi vahvaa periaatetta:",
"want_to_improve_workflow_of_as_many_people_as_possible": "Haluamme kehittää niin monen ihmisen työnkulkua kuin on vain mahdollista.",
"detail_on_improve_peoples_workflow": "LaTeX on pahamaineisen hankala käyttää ja yhteistyötä on aina hankala koordinoida. Uskomme, että olemme kehittäneet erinomaisia ratkaisuja, jotka auttavat ihmisiä kohtaamaan nämä ongelmat, ja haluamme varmistaa, että __appName__ saatavilla mahdollisimman monelle. Olemme pyrkineet pitämään hinnoittelumme reiluna ja julkaisseet suuren osan __appName__-sovelluksesta avoimena lähdekoodina, jolloin kuka tahansa voi ylläpitää sitä.",
"want_to_create_sustainable_lasting_legacy": "Me haluamme luoda kestävän ja jatkuvan perinnön.",
"details_on_legacy": "Tuotteen kuten __appName__ kehittäminen ja ylläpito vaatii paljon aikaa ja työtä, joten on tärkeää, että pystymme löytämään liiketoimintamallin, joka tukee tätä nyt ja pitkällä tähtäimellä. Emme halua, että __appName__ on riippuvainen ulkoisesta rahoituksesta tai katoaa, koska liiketoimintamalli ei toiminut. Voin onneksi kertoa, että __appName__ toimii tällä hetkellä kannattavasti ja kestävällä pohjalla, ja odotamme tämän jatkuvan myös tulevaisuudessa.",
"get_in_touch": "Ota yhteyttä",
"want_to_hear_from_you_email_us_at": "Kuulisimme mielellämme kaikista niistä, jotka käyttävät __appName__-sovellusta ja haluavat keskustella kanssamme siitä, mitä me teemme. Ota meihin yhteys osoitteessa ",
"cant_find_email": "Tämä sähköposti ei ole rekisteröity, pahoittelut.",
"plans_amper_pricing": "Sopimukset & Hinnoittelu",
"documentation": "Dokumentaatio",
"account": "Tili",
"subscription": "Tilaus",
"log_out": "Kirjaudu ulos",
"en": "Englanti",
"pt": "Portugali",
"es": "Espanja",
"fr": "Ranska",
"de": "Saksa",
"it": "Italia",
"da": "Tanska",
"sv": "Ruotsi",
"no": "Norja",
"nl": "Hollanti",
"pl": "Puola",
"ru": "Venäjä",
"uk": "Ukraina",
"ro": "Romania",
"click_here_to_view_sl_in_lng": "Klikkaa tästä käyttääksesi sovellusta __appName__ kielellä <0>__lngName__</0>",
"language": "Kieli",
"upload": "Siirrä",
"menu": "Valikko",
"full_screen": "Koko ruutu",
"logs_and_output_files": "Loki- ja tulostetiedostot",
"download_pdf": "Lataa PDF",
"split_screen": "Jaettu ruutu",
"clear_cached_files": "Tyhjennä väliaikaistiedostot",
"go_to_code_location_in_pdf": "Mene koodin sijaintiin PDF:ssä",
"please_compile_pdf_before_download": "Käännä projektisi ennen kuin lataat PDF:n",
"remove_collaborator": "Poista työtoveri",
"add_to_folders": "Lisää kansioihin",
"download_zip_file": "Lataa .zip-tiedosto",
"price": "Hinta",
"close": "Sulje",
"keybindings": "Näppäinasetukset",
"restricted": "Rajoitettu pääsy",
"start_x_day_trial": "Aloita __len__-Päivän Ilmainen Kokeilujakso Tänään!",
"buy_now": "Osta Heti!",
"cs": "Tsekki",
"view_all": "Näytä Kaikki",
"terms": "Ehdot",
"privacy": "Tietosuoja",
"contact": "Ota yhteyttä",
"change_to_this_plan": "Muutos tähän sopimukseen",
"processing": "käsitellään",
"sure_you_want_to_change_plan": "Oletko varma, että haluat vaihtaa sopimukseen <0>__planName__</0>?",
"move_to_annual_billing": "Siirry vuosilaskutukseen",
"annual_billing_enabled": "Vuosilaskutus käytössä",
"move_to_annual_billing_now": "Siirry vuosilaskutukseen nyt",
"change_to_annual_billing_and_save": "Saat <0>__percentage__</0> pois vuosilaskutuksella. Jos vaihdat nyt säästät <1>__yearlySaving__</1> vuodessa.",
"missing_template_question": "Puuttuva mallipohja?",
"tell_us_about_the_template": "Jos meiltä puuttuu mallipohja, voit joko: lähettää meille kopion mallipohjasta, __appName__-urlin mallipohjaan tai kertoa meille mistä voimme löytää mallipohjan. Kerro meille myös hiukan mallipohjasta kuvauksen luomista varten.",
"email_us": "Viestiä meille",
"this_project_is_public_read_only": "Tämä projekti on julkinen ja sitä voi katsoa mutta ei muokata URL-osoitteella",
"tr": "Turkki",
"select_files": "Valitse tiedosto(ja)",
"drag_files": "vedä tiedosto(ja)",
"upload_failed_sorry": "Siirto epäonnistui, pahoittelut :(",
"inserting_files": "Lisätään tiedostoa...",
"password_reset_token_expired": "Salasanan uusimislinkki on vanhentunut. Pyydä uusi salasanan uusimissähköposti ja seuraa saatua linkkiä.",
"merge_project_with_github": "Yhdistä Projekti GitHubiin",
"pull_github_changes_into_sharelatex": "Tuo __appName__-muutokset GitHubista",
"push_sharelatex_changes_to_github": "Vie __appName__-muutokset GitHubiin",
"features": "Ominaisuudet",
"commit": "Muuta",
"commiting": "Muuttaa",
"importing_and_merging_changes_in_github": "Tuodaan ja yhdistetään muutoksia GitHubissa",
"upgrade_for_faster_compiles": "Päivitä nopeampaan kääntämiseen ja lisää aikakatkaisun rajaa",
"free_accounts_have_timeout_upgrade_to_increase": "Ilmaisilla tileillä on minuutin aikakatkaisu. Päivitä lisätäksesi aikakatkaisun rajaa.",
"learn_how_to_make_documents_compile_quickly": "Lue kuinka saat dokumenttisi kääntymään nopeammin",
"zh-CN": "Kiina",
"cn": "Kiina (Yksinkertainen)",
"sync_to_github": "Synkronoi GitHubiin",
"sync_to_dropbox_and_github": "Synkronoi Dropboxiin ja GitHubiin",
"project_too_large": "Projekti liian suuri",
"project_too_large_please_reduce": "Tässä projektissa on liikaa tekstiä, yritä ja vähennä sitä.",
"please_ask_the_project_owner_to_link_to_github": "Pyydä projektin omistajaa linkittämään tämä projekti GitHub-repositoryyn",
"go_to_pdf_location_in_code": "Mene PDF-sijaintiin koodissa",
"ko": "Korea",
"ja": "Japani",
"about_brian_gough": "on sovelluskehittäjä ja entinen teoreettisen korkean energian fyysikko Fermilabissa ja Los Alamosissa. Hän on julkaissut useiden vuosien ajan vapaiden ohjelmistojen kaupallisia oppaita käyttämällä TeXiä ja LaTeXia sekä toiminut GNU Scientific Libraryn ylläpitäjänä.",
"first_few_days_free": "Ensimmäiset __trialLen__ päivää ilmaiseksi",
"every": "joka",
"credit_card": "Luottokortti",
"credit_card_number": "Luottokorttinumero",
"invalid": "Väärä",
"expiry": "Voimassa",
"january": "Tammikuu",
"february": "Helmikuu",
"march": "Maaliskuu",
"april": "Huhtikuu",
"may": "Toukokuu",
"june": "Kesäkuu",
"july": "Heinäkuu",
"august": "Elokuu",
"september": "Syyskuu",
"october": "Lokakuu",
"november": "Marraskuu",
"december": "Joulukuu",
"zip_post_code": "Postinumero",
"city": "Postitoimipaikka",
"address": "Osoite",
"coupon_code": "Kuponkikoodi",
"country": "Maa",
"billing_address": "Laskutusosoite",
"upgrade_now": "Päivitä Nyt",
"state": "Tila",
"vat_number": "Alv-numero",
"you_have_joined": "Olet liittynyt ryhmään __groupName__",
"claim_premium_account": "Olet ottanut käyttöön ryhmän __groupName__ tarjoaman premium-tilin.",
"you_are_invited_to_group": " Sinut on kutsuttu liittymään ryhmään __groupName__",
"you_can_claim_premium_account": "Voit ottaa käyttöön ryhmän __groupName__ tarjoaman premium-tilin vahvistamalla sähköpostisi",
"not_now": "Ei nyt",
"verify_email_join_group": "Vahvista sähköposti ja liity ryhmään",
"check_email_to_complete_group": "Ole hyvä ja tarkista vielä sähköpostisi liittyäksesi ryhmään",
"verify_email_address": "Vahvista sähköpostiosoite",
"group_provides_you_with_premium_account": "__groupName__ tarjoaa sinulle premium-tilin. Vahvista sähköpostiosoitteesi päivittääksesi tilisi uudelle tasolle.",
"check_email_to_complete_the_upgrade": "Ole hyvä ja tarkista sähköpostisi viimeistelläksesi päivitys",
"email_link_expired": "Sähköpostilinkki on vanhentunut, ole hyvä ja pyydä uusi.",
"account_settings": "Tilin asetukset",
"search_projects": "Etsi projekteja",
"clone_project": "Monista projekti",
"delete_project": "Poista projekti",
"download_zip": "Lataa Zip",
"new_project": "Uusi projekti",
"blank_project": "Tyhjä projekti",
"example_project": "Esimerkkiprojekti",
"from_template": "Mallista",
"cv_or_resume": "CV tai ansioluettelo",
"cover_letter": "Saatekirje",
"journal_article": "Tiedejulkaisun artikkeli",
"presentation": "Esitelmä",
"thesis": "Lopputyö",
"bibliographies": "Lähdeluettelot",
"terms_of_service": "Palveluehdot",
"privacy_policy": "Yksityisyyskäytäntö",
"plans_and_pricing": "Sopimukset ja hinnoittelu",
"university_licences": "Yliopistolisenssit",
"security": "Turvallisuus",
"contact_us": "Ota yhteyttä",
"thanks": "Kiitos",
"blog": "Blogi",
"latex_editor": "LaTeX-editori",
"get_free_stuff": "Hanki ilmaista tavaraa",
"chat": "Keskustelu",
"your_message": "Viestisi",
"loading": "Ladataan",
"connecting": "Yhdistetään",
"recompile": "Käännä uudestaan",
"download": "Lataa",
"email": "Sähköposti",
"owner": "Omistaja",
"read_and_write": "Lue ja kirjoita",
"read_only": "Read Only",
"publish": "Julkaise",
"view_in_template_gallery": "Katso mallikirjastossa",
"unpublish": "Lopeta julkaiseminen",
"hotkeys": "Pikanäppäimet",
"saving": "Tallennetaan",
"cancel": "Peru",
"project_name": "Projektin nimi",
"root_document": "Juuridokumentti",
"spell_check": "Oikeinkirjoituksen tarkistus",
"compiler": "Kääntäjä",
"private": "Yksityinen",
"public": "Julkinen",
"delete_forever": "Poista lopullisesti",
"support_and_feedback": "Tuki ja palaute",
"help": "Apua",
"latex_templates": "LaTeX-mallit",
"info": "Tietoa",
"latex_help_guide": "LaTeX-opas",
"choose_your_plan": "Valitse sopimustyyppi",
"indvidual_plans": "Yksilöllinen sopimus",
"free_forever": "Ikuisesti ilmainen",
"low_priority_compile": "Matalan tärkeystason kääntäminen",
"unlimited_projects": "Rajattomasti projekteja",
"unlimited_compiles": "Rajattomasti kääntämisiä",
"full_history_of_changes": "Täysi muutoshistoria",
"highest_priority_compiling": "Korkeimman tärkeystason kääntäminen",
"dropbox_sync": "Dropbox-synkronointi",
"beta": "Beta",
"sign_up_now": "Kirjoittaudu nyt",
"annual": "Vuosittainen",
"half_price_student": "Puolihintaiset opiskelijasopimukset",
"about_us": "Tietoa meistä",
"loading_recent_github_commits": "Ladataan viimeisiä muutoksia",
"no_new_commits_in_github": "Ei uusia muutoksia GitHubissa sitten viimeisen yhdistyksen.",
"dropbox_sync_description": "Pidä __appName__-projektisi synkronoituna Dropboxiisi. Sovelluksessa __appName__ tehdyt muutokset lähetetään automaattisesti Dropboxiin ja toisin päin.",
"github_sync_description": "Voit linkittää __appName__-projektisi GitHub-repositoryihin GitHub Syncin avulla. Tee uusia muutoksia sovelluksesta __appName__ ja yhdistä GitHubissa tai offline-tilassa tehtyihin muutoksiin.",
"github_import_description": "Voit tuoda omia GitHub Repositoryja sovellukseen __appName__ GitHub Syncin avulla. Tee uusia muutoksia sovelluksesta __appName__ ja yhdistä GitHubissa tai offline-tilassa tehtyihin muutoksiin.",
"link_to_github_description": "Sinun tulee antaa sovellukselle __appName__ pääsy GitHub-tilillesi, joka sallii meidän synkronoida projektisi.",
"unlink": "Poista linkki",
"unlink_github_warning": "Kaikkien GitHubin kanssa synkronoimasi projektien yhteys katkaistaan eikä niitä pidetä enää synkronituna GitHubin kanssa. Oletko varma, että haluat poistaa linkin GitHub-tilillesi?",
"github_account_successfully_linked": "GitHub-tili Linkitetty Onnistuneesti!",
"github_successfully_linked_description": "Kiitos, olemme linkittäneet GitHub-tilisi sovellukseen __appName__ onnistuneesti. Voit nyt viedä __appName__-projektejasi GitHubiin tai tuoda projekteja omista GitHub-repositoryistasi.",
"import_from_github": "Tuo GitHubista",
"github_sync_error": "Tapahtui virhe puhuessa GitHub-palvelullemme. Yritä uudelleen pienen hetken päästä.",
"loading_github_repositories": "Ladataan sinun GitHub-repositoryja",
"select_github_repository": "Valitse GitHub-repository tuotavaksi sovellukseen __appName__.",
"import_to_sharelatex": "Tuo sovellukseen __appName__",
"importing": "Tuodaan",
"github_sync": "GitHub Synkronointi",
"checking_project_github_status": "Tarkistetaan projektin tilaa GitHubissa",
"account_not_linked_to_github": "Tiliäsi ei ole linkitetty GitHubiin",
"project_not_linked_to_github": "Tämä projekti ei ole linkitetty GitHub-repositoryyn. Voit luoda sille repositoryn GitHubissa:",
"create_project_in_github": "Luo GitHub-repository",
"project_synced_with_git_repo_at": "Tämä projekti synkronoitiin GitHub-repositoryyn kohteessa",
"recent_commits_in_github": "Viimeiset muutokset GitHubissa",
"sync_project_to_github": "Synkronoi projekti GitHubiin",
"sync_project_to_github_explanation": "Kaikki __appName__-sovelluksessa tekemäsi muutokset viedään ja sulautetaan mihin tahansa GitHubissa oleviin päivityksiin.",
"github_merge_failed": "Muutoksiasi sovelluksessa __appName__ ja GitHubissa ei voitu yhdistää automaattisesti. Yhdistä haara <0>__sharelatex_branch__</0> haaraan <1>__master_branch__</1> gitissä. Klikkaa alla jatkaaksesi sen jälkeen kun olet yhdistänyt manuaalisesti.",
"continue_github_merge": "Olen yhdistänyt manuaalisesti. Jatka",
"export_project_to_github": "Vie Projekti GitHubiin",
"github_validation_check": "Tarkista, että repositoryn nimi on kelvollinen ja että sinulla on oikeudet luoda repository.",
"repository_name": "Repositoryn Nimi",
"optional": "Valinnainen",
"github_public_description": "Kuka tahansa voi nähdä tämän repositoryn. Voit valita kuka voi tehdä muutoksia.",
"github_commit_message_placeholder": "Tehdyt muutokset-viesti sovelluksessa __appName__ tehdyille muutoksille",
"merge": "Yhdistä",
"merging": "Yhdistetään",
"github_account_is_linked": "GitHub-tilisi on linkitetty onnistuneesti.",
"unlink_github": "Poista linkitys GitHub-tiliisi",
"link_to_github": "Linkitä GitHub-tiliisi",
"github_integration": "GitHub Integraatio",
"github_is_premium": "GitHub-synkronointi on premium-ominaisuus",
"thank_you": "Kiitos"
}
| overleaf/web/locales/fi.json/0 | {
"file_path": "overleaf/web/locales/fi.json",
"repo_id": "overleaf",
"token_count": 15282
} | 571 |
/* eslint-disable no-unused-vars */
const Helpers = require('./lib/helpers')
exports.tags = ['server-ce', 'server-pro', 'saas']
const indexes = [
{
key: {
'deleterData.deletedAt': 1,
},
name: 'deleterData.deletedAt_1',
},
{
key: {
'deleterData.deletedProjectId': 1,
},
name: 'deleterData.deletedProjectId_1',
},
]
exports.migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.deletedProjects, indexes)
}
exports.rollback = async client => {
const { db } = client
try {
await Helpers.dropIndexesFromCollection(db.deletedProjects, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}
}
| overleaf/web/migrations/20190912145002_create_deletedProjects_indexes.js/0 | {
"file_path": "overleaf/web/migrations/20190912145002_create_deletedProjects_indexes.js",
"repo_id": "overleaf",
"token_count": 291
} | 572 |
/* eslint-disable no-unused-vars */
const Helpers = require('./lib/helpers')
exports.tags = ['saas']
const indexes = [
{
key: {
project_id: 1,
},
name: 'project_id_1',
},
]
exports.migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
}
exports.rollback = async client => {
const { db } = client
try {
await Helpers.dropIndexesFromCollection(db.projectHistoryFailures, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}
}
| overleaf/web/migrations/20190912145018_create_projectHistoryFailures_indexes.js/0 | {
"file_path": "overleaf/web/migrations/20190912145018_create_projectHistoryFailures_indexes.js",
"repo_id": "overleaf",
"token_count": 214
} | 573 |
/* eslint-disable no-unused-vars */
const Helpers = require('./lib/helpers')
exports.tags = ['saas']
const indexes = [
{
key: {
providerId: 1,
},
name: 'providerId_1',
},
{
key: {
sessionId: 1,
},
name: 'sessionId_1',
},
{
// expire after 30 days
expireAfterSeconds: 60 * 60 * 24 * 30,
key: {
createdAt: 1,
},
name: 'createdAt_1',
},
]
exports.migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.samllog, indexes)
}
exports.rollback = async client => {
const { db } = client
try {
await Helpers.dropIndexesFromCollection(db.samllog, indexes)
} catch (err) {
console.error('Something went wrong rolling back the migrations', err)
}
}
| overleaf/web/migrations/20191106102104_saml-log-indexes.js/0 | {
"file_path": "overleaf/web/migrations/20191106102104_saml-log-indexes.js",
"repo_id": "overleaf",
"token_count": 319
} | 574 |
const updateStringDates = require('../scripts/confirmed_at_to_dates.js')
exports.tags = ['saas']
exports.migrate = async client => {
await updateStringDates()
}
exports.rollback = async client => {
/* nothing to do */
}
| overleaf/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.js/0 | {
"file_path": "overleaf/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.js",
"repo_id": "overleaf",
"token_count": 76
} | 575 |
const { expect } = require('chai')
const cheerio = require('cheerio')
const WEB_PATH = '../../../../..'
const UserHelper = require(`${WEB_PATH}/test/acceptance/src/helpers/UserHelper`)
describe('Launchpad', function () {
const adminEmail = 'admin@example.com'
const adminPassword = 'adreadfulsecret'
const user = new UserHelper()
it('should show the launchpad page', async function () {
const response = await user.request.get('/launchpad')
expect(response.statusCode).to.equal(200)
const $ = cheerio.load(response.body)
expect($('h2').first().text()).to.equal('Create the first Admin account')
expect($('form[name="email"]').first()).to.exist
expect($('form[name="password"]').first()).to.exist
})
it('should allow for creation of the first admin user', async function () {
// Load the launchpad page
const initialPageResponse = await user.request.get('/launchpad')
expect(initialPageResponse.statusCode).to.equal(200)
const $ = cheerio.load(initialPageResponse.body)
expect($('h2').first().text()).to.equal('Create the first Admin account')
expect($('form[name="email"]').first()).to.exist
expect($('form[name="password"]').first()).to.exist
// Submit the form
let csrfToken = await user.getCsrfToken()
const postResponse = await user.request.post({
url: '/launchpad/register_admin',
json: {
_csrf: csrfToken,
email: adminEmail,
password: adminPassword,
},
})
expect(postResponse.statusCode).to.equal(200)
expect(postResponse.body.redir).to.equal('')
expect(postResponse.body.email).to.equal(adminEmail)
expect(postResponse.body.id).to.exist
// Try to load the page again
const secondPageResponse = await user.request.get('/launchpad', {
simple: false,
})
expect(secondPageResponse.statusCode).to.equal(302)
expect(secondPageResponse.headers.location).to.equal('/login')
// Forbid submitting the form again
csrfToken = await user.getCsrfToken()
const badPostResponse = await user.request.post({
url: '/launchpad/register_admin',
json: {
_csrf: csrfToken,
email: adminEmail + '1',
password: adminPassword + '1',
},
simple: false,
})
expect(badPostResponse.statusCode).to.equal(403)
// Log in as this new admin user
const adminUser = await UserHelper.loginUser({
email: adminEmail,
password: adminPassword,
})
// Check we are actually admin
expect(await adminUser.isLoggedIn()).to.equal(true)
expect(adminUser.user.isAdmin).to.equal(true)
})
})
| overleaf/web/modules/launchpad/test/acceptance/src/LaunchpadTests.js/0 | {
"file_path": "overleaf/web/modules/launchpad/test/acceptance/src/LaunchpadTests.js",
"repo_id": "overleaf",
"token_count": 949
} | 576 |
const Path = require('path')
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const MODULE_PATH = Path.join(
__dirname,
'../../../app/src/UserActivateController.js'
)
const VIEW_PATH = Path.join(__dirname, '../../../app/views/user/activate')
describe('UserActivateController', function () {
beforeEach(function () {
this.user = {
_id: (this.user_id = 'kwjewkl'),
features: {},
email: 'joe@example.com',
}
this.UserGetter = { getUser: sinon.stub() }
this.ErrorController = { notFound: sinon.stub() }
this.UserActivateController = SandboxedModule.require(MODULE_PATH, {
requires: {
'../../../../app/src/Features/User/UserGetter': this.UserGetter,
'../../../../app/src/Features/Errors/ErrorController': this
.ErrorController,
},
})
this.req = {
query: {},
session: {
user: this.user,
},
}
this.res = {}
})
describe('activateAccountPage', function () {
beforeEach(function () {
this.UserGetter.getUser = sinon.stub().callsArgWith(2, null, this.user)
this.req.query.user_id = this.user_id
this.req.query.token = this.token = 'mock-token-123'
})
it('should 404 without a user_id', function (done) {
delete this.req.query.user_id
this.ErrorController.notFound = () => done()
this.UserActivateController.activateAccountPage(this.req, this.res)
})
it('should 404 without a token', function (done) {
delete this.req.query.token
this.ErrorController.notFound = () => done()
this.UserActivateController.activateAccountPage(this.req, this.res)
})
it('should 404 without a valid user_id', function (done) {
this.UserGetter.getUser = sinon.stub().callsArgWith(2, null, null)
this.ErrorController.notFound = () => done()
this.UserActivateController.activateAccountPage(this.req, this.res)
})
it('should 403 for complex user_id', function (done) {
this.ErrorController.forbidden = () => done()
this.req.query.user_id = { first_name: 'X' }
this.UserActivateController.activateAccountPage(this.req, this.res)
})
it('should redirect activated users to login', function (done) {
this.user.loginCount = 1
this.res.redirect = url => {
this.UserGetter.getUser.calledWith(this.user_id).should.equal(true)
url.should.equal('/login')
return done()
}
this.UserActivateController.activateAccountPage(this.req, this.res)
})
it('render the activation page if the user has not logged in before', function (done) {
this.user.loginCount = 0
this.res.render = (page, opts) => {
page.should.equal(VIEW_PATH)
opts.email.should.equal(this.user.email)
opts.token.should.equal(this.token)
return done()
}
this.UserActivateController.activateAccountPage(this.req, this.res)
})
})
})
| overleaf/web/modules/user-activate/test/unit/src/UserActivateControllerTests.js/0 | {
"file_path": "overleaf/web/modules/user-activate/test/unit/src/UserActivateControllerTests.js",
"repo_id": "overleaf",
"token_count": 1179
} | 577 |
const DocstoreManager = require('../app/src/Features/Docstore/DocstoreManager')
const { promisify } = require('util')
const { ObjectId, ReadPreference } = require('mongodb')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
const { promiseMapWithLimit } = require('../app/src/util/promises')
const sleep = promisify(setTimeout)
const NOW_IN_S = Date.now() / 1000
const ONE_WEEK_IN_S = 60 * 60 * 24 * 7
const TEN_SECONDS = 10 * 1000
const DRY_RUN = process.env.DRY_RUN === 'true'
if (!process.env.BATCH_LAST_ID) {
console.error('Set BATCH_LAST_ID and re-run.')
process.exit(1)
}
const BATCH_LAST_ID = ObjectId(process.env.BATCH_LAST_ID)
const INCREMENT_BY_S = parseInt(process.env.INCREMENT_BY_S, 10) || ONE_WEEK_IN_S
const BATCH_SIZE = parseInt(process.env.BATCH_SIZE, 10) || 1000
const READ_CONCURRENCY_SECONDARY =
parseInt(process.env.READ_CONCURRENCY_SECONDARY, 10) || 1000
const READ_CONCURRENCY_PRIMARY =
parseInt(process.env.READ_CONCURRENCY_PRIMARY, 10) || 500
const STOP_AT_S = parseInt(process.env.STOP_AT_S, 10) || NOW_IN_S
const WRITE_CONCURRENCY = parseInt(process.env.WRITE_CONCURRENCY, 10) || 10
const LET_USER_DOUBLE_CHECK_INPUTS_FOR =
parseInt(process.env.LET_USER_DOUBLE_CHECK_INPUTS_FOR, 10) || TEN_SECONDS
function getSecondsFromObjectId(id) {
return id.getTimestamp().getTime() / 1000
}
async function main() {
await letUserDoubleCheckInputs()
await waitForDb()
let lowerProjectId = BATCH_LAST_ID
let nProjectsProcessedTotal = 0
let nProjectsWithOrphanedDocsTotal = 0
let nDeletedDocsTotal = 0
while (getSecondsFromObjectId(lowerProjectId) <= STOP_AT_S) {
const upperTime = getSecondsFromObjectId(lowerProjectId) + INCREMENT_BY_S
let upperProjectId = ObjectId.createFromTime(upperTime)
const query = {
project_id: {
// exclude edge
$gt: lowerProjectId,
// include edge
$lte: upperProjectId,
},
}
const docs = await db.docs
.find(query, { readPreference: ReadPreference.SECONDARY })
.project({ project_id: 1 })
.sort({ project_id: 1 })
.limit(BATCH_SIZE)
.toArray()
if (docs.length) {
const projectIds = Array.from(
new Set(docs.map(doc => doc.project_id.toString()))
).map(ObjectId)
console.log('Checking projects', JSON.stringify(projectIds))
const { nProjectsWithOrphanedDocs, nDeletedDocs } = await processBatch(
projectIds
)
nProjectsProcessedTotal += projectIds.length
nProjectsWithOrphanedDocsTotal += nProjectsWithOrphanedDocs
nDeletedDocsTotal += nDeletedDocs
if (docs.length === BATCH_SIZE) {
// This project may have more than BATCH_SIZE docs.
const lastDoc = docs[docs.length - 1]
// Resume from after this projectId.
upperProjectId = lastDoc.project_id
}
}
console.error(
'Processed %d projects ' +
'(%d projects with orphaned docs/%d docs deleted) ' +
'until %s',
nProjectsProcessedTotal,
nProjectsWithOrphanedDocsTotal,
nDeletedDocsTotal,
upperProjectId
)
lowerProjectId = upperProjectId
}
}
async function getDeletedProject(projectId, readPreference) {
return await db.deletedProjects.findOne(
{ 'deleterData.deletedProjectId': projectId },
{
// There is no index on .project. Pull down something small.
projection: { 'project._id': 1 },
readPreference,
}
)
}
async function getProject(projectId, readPreference) {
return await db.projects.findOne(
{ _id: projectId },
{
// Pulling down an empty object is fine for differentiating with null.
projection: { _id: 0 },
readPreference,
}
)
}
async function getProjectDocs(projectId) {
return await db.docs
.find(
{ project_id: projectId },
{
projection: { _id: 1 },
readPreference: ReadPreference.PRIMARY,
}
)
.toArray()
}
async function checkProjectExistsWithReadPreference(projectId, readPreference) {
// NOTE: Possible race conditions!
// There are two processes which are racing with our queries:
// 1. project deletion
// 2. project restoring
// For 1. we check the projects collection before deletedProjects.
// If a project were to be delete in this very moment, we should see the
// soft-deleted entry which is created before deleting the projects entry.
// For 2. we check the projects collection after deletedProjects again.
// If a project were to be restored in this very moment, it is very likely
// to see the projects entry again.
// Unlikely edge case: Restore+Deletion in rapid succession.
// We could add locking to the ProjectDeleter for ruling ^ out.
if (await getProject(projectId, readPreference)) {
// The project is live.
return true
}
const deletedProject = await getDeletedProject(projectId, readPreference)
if (deletedProject && deletedProject.project) {
// The project is registered for hard-deletion.
return true
}
if (await getProject(projectId, readPreference)) {
// The project was just restored.
return true
}
// The project does not exist.
return false
}
async function checkProjectExistsOnPrimary(projectId) {
return await checkProjectExistsWithReadPreference(
projectId,
ReadPreference.PRIMARY
)
}
async function checkProjectExistsOnSecondary(projectId) {
return await checkProjectExistsWithReadPreference(
projectId,
ReadPreference.SECONDARY
)
}
async function processBatch(projectIds) {
const doubleCheckProjectIdsOnPrimary = []
let nDeletedDocs = 0
async function checkProjectOnSecondary(projectId) {
if (await checkProjectExistsOnSecondary(projectId)) {
// Finding a project with secondary confidence is sufficient.
return
}
// At this point, the secondaries deem this project as having orphaned docs.
doubleCheckProjectIdsOnPrimary.push(projectId)
}
const projectsWithOrphanedDocs = []
async function checkProjectOnPrimary(projectId) {
if (await checkProjectExistsOnPrimary(projectId)) {
// The project is actually live.
return
}
projectsWithOrphanedDocs.push(projectId)
const docs = await getProjectDocs(projectId)
nDeletedDocs += docs.length
console.log(
'Deleted project %s has %s orphaned docs: %s',
projectId,
docs.length,
JSON.stringify(docs.map(doc => doc._id))
)
}
await promiseMapWithLimit(
READ_CONCURRENCY_SECONDARY,
projectIds,
checkProjectOnSecondary
)
await promiseMapWithLimit(
READ_CONCURRENCY_PRIMARY,
doubleCheckProjectIdsOnPrimary,
checkProjectOnPrimary
)
if (!DRY_RUN) {
await promiseMapWithLimit(
WRITE_CONCURRENCY,
projectsWithOrphanedDocs,
DocstoreManager.promises.destroyProject
)
}
const nProjectsWithOrphanedDocs = projectsWithOrphanedDocs.length
return { nProjectsWithOrphanedDocs, nDeletedDocs }
}
async function letUserDoubleCheckInputs() {
console.error(
'Options:',
JSON.stringify(
{
BATCH_LAST_ID,
BATCH_SIZE,
DRY_RUN,
INCREMENT_BY_S,
STOP_AT_S,
READ_CONCURRENCY_SECONDARY,
READ_CONCURRENCY_PRIMARY,
WRITE_CONCURRENCY,
LET_USER_DOUBLE_CHECK_INPUTS_FOR,
},
null,
2
)
)
console.error(
'Waiting for you to double check inputs for',
LET_USER_DOUBLE_CHECK_INPUTS_FOR,
'ms'
)
await sleep(LET_USER_DOUBLE_CHECK_INPUTS_FOR)
}
main()
.then(() => {
console.error('Done.')
process.exit(0)
})
.catch(error => {
console.error({ error })
process.exit(1)
})
| overleaf/web/scripts/delete_orphaned_docs_online_check.js/0 | {
"file_path": "overleaf/web/scripts/delete_orphaned_docs_online_check.js",
"repo_id": "overleaf",
"token_count": 2935
} | 578 |
const RecurlyWrapper = require('../../app/src/Features/Subscription/RecurlyWrapper')
const async = require('async')
const minimist = require('minimist')
const slowCallback = (callback, error, data) =>
setTimeout(() => callback(error, data), 80)
const handleAPIError = (source, id, error, callback) => {
console.warn(`Errors in ${source} with id=${id}`, error)
if (typeof error === 'string' && error.match(/429$/)) {
return setTimeout(callback, 1000 * 60 * 5)
}
slowCallback(callback)
}
const attemptInvoiceCollection = (invoice, callback) => {
isAccountUsingPaypal(invoice, (error, isPaypal) => {
if (error || !isPaypal) {
return callback(error)
}
const accountId = invoice.account.url.match(/accounts\/(.*)/)[1]
if (USERS_COLLECTED.indexOf(accountId) > -1) {
console.warn(`Skipping duplicate user ${accountId}`)
return callback()
}
INVOICES_COLLECTED.push(invoice.invoice_number)
USERS_COLLECTED.push(accountId)
if (DRY_RUN) {
return callback()
}
RecurlyWrapper.attemptInvoiceCollection(
invoice.invoice_number,
(error, response) => {
if (error) {
return handleAPIError(
'attemptInvoiceCollection',
invoice.invoice_number,
error,
callback
)
}
INVOICES_COLLECTED_SUCCESS.push(invoice.invoice_number)
slowCallback(callback, null)
}
)
})
}
const isAccountUsingPaypal = (invoice, callback) => {
const accountId = invoice.account.url.match(/accounts\/(.*)/)[1]
RecurlyWrapper.getBillingInfo(accountId, (error, response) => {
if (error) {
return handleAPIError('billing info', accountId, error, callback)
}
if (response.billing_info.paypal_billing_agreement_id) {
return slowCallback(callback, null, true)
}
slowCallback(callback, null, false)
})
}
const attemptInvoicesCollection = callback => {
RecurlyWrapper.getPaginatedEndpoint(
'invoices',
{ state: 'past_due' },
(error, invoices) => {
console.log('invoices', invoices.length)
if (error) {
return callback(error)
}
async.eachSeries(invoices, attemptInvoiceCollection, callback)
}
)
}
const argv = minimist(process.argv.slice(2))
const DRY_RUN = argv.n !== undefined
const INVOICES_COLLECTED = []
const INVOICES_COLLECTED_SUCCESS = []
const USERS_COLLECTED = []
attemptInvoicesCollection(error => {
if (error) {
throw error
}
console.log(
`DONE (DRY_RUN=${DRY_RUN}). ${INVOICES_COLLECTED.length} invoices collection attempts for ${USERS_COLLECTED.length} users. ${INVOICES_COLLECTED_SUCCESS.length} successful collections`
)
console.dir(
{
INVOICES_COLLECTED,
INVOICES_COLLECTED_SUCCESS,
USERS_COLLECTED,
},
{ maxArrayLength: null }
)
if (INVOICES_COLLECTED_SUCCESS === 0) {
process.exit(1)
} else {
process.exit()
}
})
| overleaf/web/scripts/recurly/collect_paypal_past_due_invoice.js/0 | {
"file_path": "overleaf/web/scripts/recurly/collect_paypal_past_due_invoice.js",
"repo_id": "overleaf",
"token_count": 1205
} | 579 |
{
"dependencies": {
"@brainly/onesky-utils": "https://github.com/overleaf/nodejs-onesky-utils/archive/jpa-upstream-pr-43.tar.gz",
"node-fetch": "^2.6.1",
"sanitize-html": "^1.27.1"
}
}
| overleaf/web/scripts/translations/package.json/0 | {
"file_path": "overleaf/web/scripts/translations/package.json",
"repo_id": "overleaf",
"token_count": 98
} | 580 |
const { merge } = require('@overleaf/settings/merge')
const baseApp = require('../../../config/settings.overrides.server-pro')
const baseTest = require('./settings.test.defaults')
module.exports = baseApp.mergeWith(baseTest.mergeWith({}))
module.exports.mergeWith = function (overrides) {
return merge(overrides, module.exports)
}
| overleaf/web/test/acceptance/config/settings.test.server-pro.js/0 | {
"file_path": "overleaf/web/test/acceptance/config/settings.test.server-pro.js",
"repo_id": "overleaf",
"token_count": 112
} | 581 |
// silence settings module
console.log = function () {}
const Settings = require('@overleaf/settings')
const MODULES = Settings.moduleImportSequence
const TARGET = process.argv.slice(2).pop() || 'test_acceptance'
console.debug(MODULES.map(name => `modules/${name}/${TARGET}`).join('\n'))
| overleaf/web/test/acceptance/getModuleTargets.js/0 | {
"file_path": "overleaf/web/test/acceptance/getModuleTargets.js",
"repo_id": "overleaf",
"token_count": 94
} | 582 |
const User = require('./helpers/User')
const { expect } = require('chai')
describe('EditorHttpController', function () {
beforeEach('login', function (done) {
this.user = new User()
this.user.login(done)
})
beforeEach('create project', function (done) {
this.projectName = 'wombat'
this.user.createProject(this.projectName, (error, projectId) => {
if (error) return done(error)
this.projectId = projectId
done()
})
})
beforeEach('create doc', function (done) {
this.user.createDocInProject(
this.projectId,
null,
'potato.tex',
(error, docId) => {
this.docId = docId
done(error)
}
)
})
describe('joinProject', function () {
it('should emit an empty deletedDocs array', function (done) {
this.user.joinProject(this.projectId, (error, details) => {
if (error) return done(error)
expect(details.project.deletedDocs).to.deep.equal([])
done()
})
})
describe('after deleting a doc', function () {
beforeEach(function (done) {
this.user.deleteItemInProject(this.projectId, 'doc', this.docId, done)
})
it('should include the deleted doc in the deletedDocs array', function (done) {
this.user.joinProject(this.projectId, (error, details) => {
if (error) return done(error)
expect(details.project.deletedDocs).to.deep.equal([
{ _id: this.docId, name: 'potato.tex' },
])
done()
})
})
})
})
})
| overleaf/web/test/acceptance/src/EditorHttpControllerTests.js/0 | {
"file_path": "overleaf/web/test/acceptance/src/EditorHttpControllerTests.js",
"repo_id": "overleaf",
"token_count": 645
} | 583 |
const { exec } = require('child_process')
const { promisify } = require('util')
const { expect } = require('chai')
const logger = require('logger-sharelatex')
const { filterOutput } = require('./helpers/settings')
const { db } = require('../../../app/src/infrastructure/mongodb')
const BATCH_SIZE = 100
let n = 0
function getUniqueReferralId() {
return `unique_${n++}`
}
function getUserWithReferralId(referralId) {
const email = `${Math.random()}@example.com`
return {
referal_id: referralId,
// Make the unique indexes happy.
email,
emails: [{ email }],
}
}
async function getBatch(batchCounter) {
return (
await db.users
.find(
{},
{
projection: { _id: 1 },
skip: BATCH_SIZE * --batchCounter,
limit: BATCH_SIZE,
}
)
.toArray()
).map(user => user._id)
}
describe('RegenerateDuplicateReferralIds', function () {
let firstBatch, secondBatch, thirdBatch, forthBatch, duplicateAcrossBatch
beforeEach('insert duplicates', async function () {
// full batch of duplicates
await db.users.insertMany(
Array(BATCH_SIZE)
.fill(0)
.map(() => {
return getUserWithReferralId('duplicate1')
})
)
firstBatch = await getBatch(1)
// batch of 999 duplicates and 1 unique
await db.users.insertMany(
Array(BATCH_SIZE - 1)
.fill(0)
.map(() => {
return getUserWithReferralId('duplicate2')
})
.concat([getUserWithReferralId(getUniqueReferralId())])
)
secondBatch = await getBatch(2)
// duplicate outside batch
duplicateAcrossBatch = getUniqueReferralId()
await db.users.insertMany(
Array(BATCH_SIZE - 1)
.fill(0)
.map(() => {
return getUserWithReferralId(getUniqueReferralId())
})
.concat([getUserWithReferralId(duplicateAcrossBatch)])
)
thirdBatch = await getBatch(3)
// no new duplicates onwards
await db.users.insertMany(
Array(BATCH_SIZE - 1)
.fill(0)
.map(() => {
return getUserWithReferralId(getUniqueReferralId())
})
.concat([getUserWithReferralId(duplicateAcrossBatch)])
)
forthBatch = await getBatch(4)
})
let result
beforeEach('run script', async function () {
try {
result = await promisify(exec)(
[
// set low BATCH_SIZE
`BATCH_SIZE=${BATCH_SIZE}`,
// log details on duplicate matching
'VERBOSE_LOGGING=true',
// disable verbose logging from logger-sharelatex
'LOG_LEVEL=ERROR',
// actual command
'node',
'scripts/regenerate_duplicate_referral_ids',
].join(' ')
)
} catch (err) {
// dump details like exit code, stdErr and stdOut
logger.error({ err }, 'script failed')
throw err
}
})
it('should do the correct operations', function () {
let { stderr: stdErr, stdout: stdOut } = result
stdErr = stdErr
.split('\n')
.filter(line => !line.includes('DeprecationWarning'))
.filter(filterOutput)
stdOut = stdOut.split('\n').filter(filterOutput)
expect(stdErr).to.deep.equal([
`Completed batch ending ${firstBatch[BATCH_SIZE - 1]}`,
`Completed batch ending ${secondBatch[BATCH_SIZE - 1]}`,
`Completed batch ending ${thirdBatch[BATCH_SIZE - 1]}`,
`Completed batch ending ${forthBatch[BATCH_SIZE - 1]}`,
'Done.',
'',
])
expect(stdOut.filter(filterOutput)).to.deep.equal([
// only duplicates
`Running update on batch with ids ${JSON.stringify(firstBatch)}`,
'Got duplicates from looking at batch.',
'Found duplicate: duplicate1',
// duplicate in batch
`Running update on batch with ids ${JSON.stringify(secondBatch)}`,
'Got duplicates from looking at batch.',
'Found duplicate: duplicate2',
// duplicate with next batch
`Running update on batch with ids ${JSON.stringify(thirdBatch)}`,
'Got duplicates from running count.',
`Found duplicate: ${duplicateAcrossBatch}`,
// no new duplicates
`Running update on batch with ids ${JSON.stringify(forthBatch)}`,
'',
])
})
it('should give all users a unique refereal_id', async function () {
const users = await db.users
.find({}, { projection: { referal_id: 1 } })
.toArray()
const uniqueReferralIds = Array.from(
new Set(users.map(user => user.referal_id))
)
expect(users).to.have.length(4 * BATCH_SIZE)
expect(uniqueReferralIds).to.have.length(users.length)
})
})
| overleaf/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js/0 | {
"file_path": "overleaf/web/test/acceptance/src/RegenerateDuplicateReferralIdsTests.js",
"repo_id": "overleaf",
"token_count": 1929
} | 584 |
const { ObjectId } = require('mongodb')
const InstitutionModel = require('../../../../app/src/models/Institution')
.Institution
let count = parseInt(Math.random() * 999999)
class Institution {
constructor(options = {}) {
this.v1Id = options.v1Id || count
this.managerIds = []
count += 1
}
ensureExists(callback) {
const filter = { v1Id: this.v1Id }
const options = { upsert: true, new: true, setDefaultsOnInsert: true }
InstitutionModel.findOneAndUpdate(
filter,
{},
options,
(error, institution) => {
this._id = institution._id
callback(error)
}
)
}
setManagerIds(managerIds, callback) {
return InstitutionModel.findOneAndUpdate(
{ _id: ObjectId(this._id) },
{ managerIds: managerIds },
callback
)
}
}
module.exports = Institution
| overleaf/web/test/acceptance/src/helpers/Institution.js/0 | {
"file_path": "overleaf/web/test/acceptance/src/helpers/Institution.js",
"repo_id": "overleaf",
"token_count": 334
} | 585 |
const AbstractMockApi = require('./AbstractMockApi')
class MockClsiApi extends AbstractMockApi {
static compile(req, res) {
res.status(200).send({
compile: {
status: 'success',
error: null,
outputFiles: [
{
url: `/project/${req.params.project_id}/build/1234/output/project.pdf`,
path: 'project.pdf',
type: 'pdf',
build: 1234,
},
{
url: `/project/${req.params.project_id}/build/1234/output/project.log`,
path: 'project.log',
type: 'log',
build: 1234,
},
],
},
})
}
applyRoutes() {
this.app.post('/project/:project_id/compile', MockClsiApi.compile)
this.app.post(
'/project/:project_id/user/:user_id/compile',
MockClsiApi.compile
)
this.app.get(
'/project/:project_id/build/:build_id/output/*',
(req, res) => {
const filename = req.params[0]
if (filename === 'project.pdf') {
res.status(200).send('mock-pdf')
} else if (filename === 'project.log') {
res.status(200).send('mock-log')
} else {
res.sendStatus(404)
}
}
)
this.app.get(
'/project/:project_id/user/:user_id/build/:build_id/output/:output_path',
(req, res) => {
res.status(200).send('hello')
}
)
this.app.get('/project/:project_id/status', (req, res) => {
res.status(200).send()
})
}
}
module.exports = MockClsiApi
// type hint for the inherited `instance` method
/**
* @function instance
* @memberOf MockClsiApi
* @static
* @returns {MockClsiApi}
*/
| overleaf/web/test/acceptance/src/mocks/MockClsiApi.js/0 | {
"file_path": "overleaf/web/test/acceptance/src/mocks/MockClsiApi.js",
"repo_id": "overleaf",
"token_count": 840
} | 586 |
// Disable prop type checks for test harnesses
/* eslint-disable react/prop-types */
import { renderHook, act } from '@testing-library/react-hooks/dom'
import { expect } from 'chai'
import fetchMock from 'fetch-mock'
import EventEmitter from 'events'
import { useChatContext } from '../../../../../frontend/js/features/chat/context/chat-context'
import {
ChatProviders,
cleanUpContext,
} from '../../../helpers/render-with-context'
import { stubMathJax, tearDownMathJaxStubs } from '../components/stubs'
describe('ChatContext', function () {
const user = {
id: 'fake_user',
first_name: 'fake_user_first_name',
email: 'fake@example.com',
}
beforeEach(function () {
fetchMock.reset()
cleanUpContext()
stubMathJax()
})
afterEach(function () {
tearDownMathJaxStubs()
})
describe('socket connection', function () {
beforeEach(function () {
// Mock GET messages to return no messages
fetchMock.get('express:/project/:projectId/messages', [])
// Mock POST new message to return 200
fetchMock.post('express:/project/:projectId/messages', 200)
})
it('subscribes when mounted', function () {
const socket = new EventEmitter()
renderChatContextHook({ user, socket })
// Assert that there is 1 listener
expect(socket.rawListeners('new-chat-message').length).to.equal(1)
})
it('unsubscribes when unmounted', function () {
const socket = new EventEmitter()
const { unmount } = renderChatContextHook({ user, socket })
unmount()
// Assert that there is 0 listeners
expect(socket.rawListeners('new-chat-message').length).to.equal(0)
})
it('adds received messages to the list', async function () {
// Mock socket: we only need to emit events, not mock actual connections
const socket = new EventEmitter()
const { result, waitForNextUpdate } = renderChatContextHook({
user,
socket,
})
// Wait until initial messages have loaded
result.current.loadInitialMessages()
await waitForNextUpdate()
// No messages shown at first
expect(result.current.messages).to.deep.equal([])
// Mock message being received from another user
socket.emit('new-chat-message', {
id: 'msg_1',
content: 'new message',
timestamp: Date.now(),
user: {
id: 'another_fake_user',
first_name: 'another_fake_user_first_name',
email: 'another_fake@example.com',
},
})
const message = result.current.messages[0]
expect(message.id).to.equal('msg_1')
expect(message.contents).to.deep.equal(['new message'])
})
it("doesn't add received messages from the current user if a message was just sent", async function () {
const socket = new EventEmitter()
const { result, waitForNextUpdate } = renderChatContextHook({
user,
socket,
})
// Wait until initial messages have loaded
result.current.loadInitialMessages()
await waitForNextUpdate()
// Send a message from the current user
result.current.sendMessage('sent message')
// Receive a message from the current user
socket.emit('new-chat-message', {
id: 'msg_1',
content: 'received message',
timestamp: Date.now(),
user,
})
// Expect that the sent message is shown, but the new message is not
const messageContents = result.current.messages.map(
({ contents }) => contents[0]
)
expect(messageContents).to.include('sent message')
expect(messageContents).to.not.include('received message')
})
it('adds the new message from the current user if another message was received after sending', async function () {
const socket = new EventEmitter()
const { result, waitForNextUpdate } = renderChatContextHook({
user,
socket,
})
// Wait until initial messages have loaded
result.current.loadInitialMessages()
await waitForNextUpdate()
// Send a message from the current user
result.current.sendMessage('sent message from current user')
const [sentMessageFromCurrentUser] = result.current.messages
expect(sentMessageFromCurrentUser.contents).to.deep.equal([
'sent message from current user',
])
act(() => {
// Receive a message from another user.
socket.emit('new-chat-message', {
id: 'msg_1',
content: 'new message from other user',
timestamp: Date.now(),
user: {
id: 'another_fake_user',
first_name: 'another_fake_user_first_name',
email: 'another_fake@example.com',
},
})
})
const [, messageFromOtherUser] = result.current.messages
expect(messageFromOtherUser.contents).to.deep.equal([
'new message from other user',
])
// Receive a message from the current user
socket.emit('new-chat-message', {
id: 'msg_2',
content: 'received message from current user',
timestamp: Date.now(),
user,
})
// Since the current user didn't just send a message, it is now shown
const [, , receivedMessageFromCurrentUser] = result.current.messages
expect(receivedMessageFromCurrentUser.contents).to.deep.equal([
'received message from current user',
])
})
})
describe('loadInitialMessages', function () {
beforeEach(function () {
fetchMock.get('express:/project/:projectId/messages', [
{
id: 'msg_1',
content: 'a message',
user,
timestamp: Date.now(),
},
])
})
it('adds messages to the list', async function () {
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadInitialMessages()
await waitForNextUpdate()
expect(result.current.messages[0].contents).to.deep.equal(['a message'])
})
it("won't load messages a second time", async function () {
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadInitialMessages()
await waitForNextUpdate()
expect(result.current.initialMessagesLoaded).to.equal(true)
// Calling a second time won't do anything
result.current.loadInitialMessages()
expect(fetchMock.calls()).to.have.lengthOf(1)
})
it('provides an error on failure', async function () {
fetchMock.reset()
fetchMock.get('express:/project/:projectId/messages', 500)
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadInitialMessages()
await waitForNextUpdate()
expect(result.current.error).to.exist
expect(result.current.status).to.equal('error')
})
})
describe('loadMoreMessages', function () {
it('adds messages to the list', async function () {
// Mock a GET request for an initial message
fetchMock.getOnce('express:/project/:projectId/messages', [
{
id: 'msg_1',
content: 'first message',
user,
timestamp: new Date('2021-03-04T10:00:00').getTime(),
},
])
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadMoreMessages()
await waitForNextUpdate()
expect(result.current.messages[0].contents).to.deep.equal([
'first message',
])
// The before query param is not set
expect(getLastFetchMockQueryParam('before')).to.be.null
})
it('adds more messages if called a second time', async function () {
// Mock 2 GET requests, with different content
fetchMock
.getOnce(
'express:/project/:projectId/messages',
// Resolve a full "page" of messages (50)
createMessages(50, user, new Date('2021-03-04T10:00:00').getTime())
)
.getOnce(
'express:/project/:projectId/messages',
[
{
id: 'msg_51',
content: 'message from second page',
user,
timestamp: new Date('2021-03-04T11:00:00').getTime(),
},
],
{ overwriteRoutes: false }
)
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadMoreMessages()
await waitForNextUpdate()
// Call a second time
result.current.loadMoreMessages()
await waitForNextUpdate()
// The second request is added to the list
// Since both messages from the same user, they are collapsed into the
// same "message"
expect(result.current.messages[0].contents).to.include(
'message from second page'
)
// The before query param for the second request matches the timestamp
// of the first message
const beforeParam = parseInt(getLastFetchMockQueryParam('before'), 10)
expect(beforeParam).to.equal(new Date('2021-03-04T10:00:00').getTime())
})
it("won't load more messages if there are no more messages", async function () {
// Mock a GET request for 49 messages. This is less the the full page size
// (50 messages), meaning that there are no further messages to be loaded
fetchMock.getOnce(
'express:/project/:projectId/messages',
createMessages(49, user)
)
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadMoreMessages()
await waitForNextUpdate()
expect(result.current.messages[0].contents).to.have.length(49)
result.current.loadMoreMessages()
expect(result.current.atEnd).to.be.true
expect(fetchMock.calls()).to.have.lengthOf(1)
})
it('handles socket messages while loading', async function () {
// Mock GET messages so that we can control when the promise is resolved
let resolveLoadingMessages
fetchMock.get(
'express:/project/:projectId/messages',
new Promise(resolve => {
resolveLoadingMessages = resolve
})
)
const socket = new EventEmitter()
const { result, waitForNextUpdate } = renderChatContextHook({
user,
socket,
})
// Start loading messages
result.current.loadMoreMessages()
// Mock message being received from the socket while the request is in
// flight
socket.emit('new-chat-message', {
id: 'socket_msg',
content: 'socket message',
timestamp: Date.now(),
user: {
id: 'another_fake_user',
first_name: 'another_fake_user_first_name',
email: 'another_fake@example.com',
},
})
// Resolve messages being loaded
resolveLoadingMessages([
{
id: 'fetched_msg',
content: 'loaded message',
user,
timestamp: Date.now(),
},
])
await waitForNextUpdate()
// Although the loaded message was resolved last, it appears first (since
// requested messages must have come first)
const messageContents = result.current.messages.map(
({ contents }) => contents[0]
)
expect(messageContents).to.deep.equal([
'loaded message',
'socket message',
])
})
it('provides an error on failures', async function () {
fetchMock.reset()
fetchMock.get('express:/project/:projectId/messages', 500)
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.loadMoreMessages()
await waitForNextUpdate()
expect(result.current.error).to.exist
expect(result.current.status).to.equal('error')
})
})
describe('sendMessage', function () {
beforeEach(function () {
// Mock GET messages to return no messages and POST new message to be
// successful
fetchMock
.get('express:/project/:projectId/messages', [])
.postOnce('express:/project/:projectId/messages', 200)
})
it('optimistically adds the message to the list', function () {
const { result } = renderChatContextHook({ user })
result.current.sendMessage('sent message')
expect(result.current.messages[0].contents).to.deep.equal([
'sent message',
])
})
it('POSTs the message to the backend', function () {
const { result } = renderChatContextHook({ user })
result.current.sendMessage('sent message')
const [, { body }] = fetchMock.lastCall(
'express:/project/:projectId/messages',
'POST'
)
expect(JSON.parse(body)).to.deep.equal({ content: 'sent message' })
})
it("doesn't send if the content is empty", function () {
const { result } = renderChatContextHook({ user })
result.current.sendMessage('')
expect(result.current.messages).to.be.empty
expect(
fetchMock.called('express:/project/:projectId/messages', {
method: 'post',
})
).to.be.false
})
it('provides an error on failure', async function () {
fetchMock.reset()
fetchMock
.get('express:/project/:projectId/messages', [])
.postOnce('express:/project/:projectId/messages', 500)
const { result, waitForNextUpdate } = renderChatContextHook({ user })
result.current.sendMessage('sent message')
await waitForNextUpdate()
expect(result.current.error).to.exist
expect(result.current.status).to.equal('error')
})
})
describe('unread messages', function () {
beforeEach(function () {
// Mock GET messages to return no messages
fetchMock.get('express:/project/:projectId/messages', [])
})
it('increments unreadMessageCount when a new message is received', function () {
const socket = new EventEmitter()
const { result } = renderChatContextHook({ user, socket })
// Receive a new message from the socket
socket.emit('new-chat-message', {
id: 'msg_1',
content: 'new message',
timestamp: Date.now(),
user,
})
expect(result.current.unreadMessageCount).to.equal(1)
})
it('resets unreadMessageCount when markMessagesAsRead is called', function () {
const socket = new EventEmitter()
const { result } = renderChatContextHook({ user, socket })
// Receive a new message from the socket, incrementing unreadMessageCount
// by 1
socket.emit('new-chat-message', {
id: 'msg_1',
content: 'new message',
timestamp: Date.now(),
user,
})
result.current.markMessagesAsRead()
expect(result.current.unreadMessageCount).to.equal(0)
})
})
})
function renderChatContextHook(props) {
return renderHook(() => useChatContext(), {
// Wrap with ChatContext.Provider (and the other editor context providers)
// eslint-disable-next-line react/display-name
wrapper: ({ children }) => (
<ChatProviders {...props}>{children}</ChatProviders>
),
})
}
function createMessages(number, user, timestamp = Date.now()) {
return Array.from({ length: number }, (_m, idx) => ({
id: `msg_${idx + 1}`,
content: `message ${idx + 1}`,
user,
timestamp,
}))
}
/*
* Get query param by key from the last fetchMock response
*/
function getLastFetchMockQueryParam(key) {
const { url } = fetchMock.lastResponse()
const { searchParams } = new URL(url, 'https://www.overleaf.com')
return searchParams.get(key)
}
| overleaf/web/test/frontend/features/chat/context/chat-context.test.js/0 | {
"file_path": "overleaf/web/test/frontend/features/chat/context/chat-context.test.js",
"repo_id": "overleaf",
"token_count": 6027
} | 587 |
import { expect } from 'chai'
import sinon from 'sinon'
import { screen, fireEvent, waitFor } from '@testing-library/react'
import fetchMock from 'fetch-mock'
import {
renderWithEditorContext,
cleanUpContext,
} from '../../../helpers/render-with-context'
import FileTreeRoot from '../../../../../frontend/js/features/file-tree/components/file-tree-root'
describe('<FileTreeRoot/>', function () {
const onSelect = sinon.stub()
const onInit = sinon.stub()
beforeEach(function () {
global.requestAnimationFrame = sinon.stub()
})
afterEach(function () {
delete global.requestAnimationFrame
fetchMock.restore()
onSelect.reset()
onInit.reset()
cleanUpContext()
global.localStorage.clear()
})
it('renders', function () {
const rootFolder = [
{
_id: 'root-folder-id',
docs: [{ _id: '456def', name: 'main.tex' }],
folders: [],
fileRefs: [],
},
]
const { container } = renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
hasWritePermissions={false}
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
rootDocId="456def"
onSelect={onSelect}
onInit={onInit}
isConnected
/>
)
screen.queryByRole('tree')
screen.getByRole('treeitem')
screen.getByRole('treeitem', { name: 'main.tex', selected: true })
expect(container.querySelector('.disconnected-overlay')).to.not.exist
})
it('renders with invalid selected doc in local storage', async function () {
global.localStorage.setItem(
'doc.open_id.123abc',
JSON.stringify('not-a-valid-id')
)
const rootFolder = [
{
_id: 'root-folder-id',
docs: [{ _id: '456def', name: 'main.tex' }],
folders: [],
fileRefs: [],
},
]
renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
hasWritePermissions
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
rootDocId="456def"
onSelect={onSelect}
onInit={onInit}
isConnected
/>
)
// as a proxy to check that the invalid entity ha not been select we start
// a delete and ensure the modal is displayed (the cancel button can be
// selected) This is needed to make sure the test fail.
const treeitemFile = screen.getByRole('treeitem', { name: 'main.tex' })
fireEvent.click(treeitemFile, { ctrlKey: true })
const toggleButton = screen.getByRole('button', { name: 'Menu' })
fireEvent.click(toggleButton)
const deleteButton = screen.getByRole('menuitem', { name: 'Delete' })
fireEvent.click(deleteButton)
await waitFor(() => screen.getByRole('button', { name: 'Cancel' }))
})
it('renders disconnected overlay', function () {
const rootFolder = [
{
_id: 'root-folder-id',
docs: [{ _id: '456def', name: 'main.tex' }],
folders: [],
fileRefs: [],
},
]
const { container } = renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
hasWritePermissions={false}
rootDocId="456def"
onSelect={onSelect}
onInit={onInit}
isConnected={false}
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
/>
)
expect(container.querySelector('.disconnected-overlay')).to.exist
})
it('fire onSelect', function () {
const rootFolder = [
{
_id: 'root-folder-id',
docs: [
{ _id: '456def', name: 'main.tex' },
{ _id: '789ghi', name: 'other.tex' },
],
folders: [],
fileRefs: [],
},
]
renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
rootDocId="456def"
hasWritePermissions={false}
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
onSelect={onSelect}
onInit={onInit}
isConnected
/>
)
sinon.assert.calledOnce(onSelect)
sinon.assert.calledWithMatch(onSelect, [
sinon.match({
entity: {
_id: '456def',
name: 'main.tex',
},
}),
])
onSelect.reset()
screen.queryByRole('tree')
const treeitem = screen.getByRole('treeitem', { name: 'other.tex' })
fireEvent.click(treeitem)
sinon.assert.calledOnce(onSelect)
sinon.assert.calledWithMatch(onSelect, [
sinon.match({
entity: {
_id: '789ghi',
name: 'other.tex',
},
}),
])
})
it('listen to editor.openDoc', function () {
const rootFolder = [
{
_id: 'root-folder-id',
docs: [
{ _id: '456def', name: 'main.tex' },
{ _id: '789ghi', name: 'other.tex' },
],
folders: [],
fileRefs: [],
},
]
renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
rootDocId="456def"
hasWritePermissions={false}
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
onSelect={onSelect}
onInit={onInit}
isConnected
/>
)
screen.getByRole('treeitem', { name: 'main.tex', selected: true })
// entities not found should be ignored
window.dispatchEvent(
new CustomEvent('editor.openDoc', { detail: 'not-an-id' })
)
screen.getByRole('treeitem', { name: 'main.tex', selected: true })
window.dispatchEvent(
new CustomEvent('editor.openDoc', { detail: '789ghi' })
)
screen.getByRole('treeitem', { name: 'main.tex', selected: false })
screen.getByRole('treeitem', { name: 'other.tex', selected: true })
})
it('only shows a menu button when a single item is selected', function () {
const rootFolder = [
{
_id: 'root-folder-id',
docs: [
{ _id: '456def', name: 'main.tex' },
{ _id: '789ghi', name: 'other.tex' },
],
folders: [],
fileRefs: [],
},
]
renderWithEditorContext(
<FileTreeRoot
rootFolder={rootFolder}
projectId="123abc"
rootDocId="456def"
hasWritePermissions
userHasFeature={() => true}
refProviders={{}}
reindexReferences={() => null}
setRefProviderEnabled={() => null}
setStartedFreeTrial={() => null}
onSelect={onSelect}
onInit={onInit}
isConnected
/>
)
const main = screen.getByRole('treeitem', {
name: 'main.tex',
selected: true,
})
const other = screen.getByRole('treeitem', {
name: 'other.tex',
selected: false,
})
// single item selected: menu button is visible
expect(screen.queryAllByRole('button', { name: 'Menu' })).to.have.length(1)
// select the other item
fireEvent.click(other)
screen.getByRole('treeitem', { name: 'main.tex', selected: false })
screen.getByRole('treeitem', { name: 'other.tex', selected: true })
// single item selected: menu button is visible
expect(screen.queryAllByRole('button', { name: 'Menu' })).to.have.length(1)
// multi-select the main item
fireEvent.click(main, { ctrlKey: true })
screen.getByRole('treeitem', { name: 'main.tex', selected: true })
screen.getByRole('treeitem', { name: 'other.tex', selected: true })
// multiple items selected: no menu button is visible
expect(screen.queryAllByRole('button', { name: 'Menu' })).to.have.length(0)
})
})
| overleaf/web/test/frontend/features/file-tree/components/file-tree-root.test.js/0 | {
"file_path": "overleaf/web/test/frontend/features/file-tree/components/file-tree-root.test.js",
"repo_id": "overleaf",
"token_count": 3554
} | 588 |
import { expect } from 'chai'
import { screen, render } from '@testing-library/react'
import OutlineRoot from '../../../../../frontend/js/features/outline/components/outline-root'
describe('<OutlineRoot />', function () {
const jumpToLine = () => {}
it('renders outline', function () {
const outline = [
{
title: 'Section',
line: 1,
level: 10,
},
]
render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
screen.getByRole('tree')
expect(screen.queryByRole('link')).to.be.null
})
it('renders placeholder', function () {
const outline = []
render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
expect(screen.queryByRole('tree')).to.be.null
screen.getByRole('link')
})
})
| overleaf/web/test/frontend/features/outline/components/outline-root.test.js/0 | {
"file_path": "overleaf/web/test/frontend/features/outline/components/outline-root.test.js",
"repo_id": "overleaf",
"token_count": 297
} | 589 |
import { expect } from 'chai'
import sinon from 'sinon'
import customLocalStorage from '../../../frontend/js/infrastructure/local-storage'
describe('localStorage', function () {
let originalLocalStorage
before(function () {
originalLocalStorage = global.localStorage
})
after(function () {
Object.defineProperty(global, 'localStorage', {
value: originalLocalStorage,
})
})
beforeEach(function () {
Object.defineProperty(global, 'localStorage', {
value: {
getItem: sinon.stub().returns(null),
setItem: sinon.stub(),
clear: sinon.stub(),
removeItem: sinon.stub(),
},
})
global.console.error = sinon.stub()
})
afterEach(function () {
global.console.error.reset()
Object.defineProperty(global, 'localStorage', { value: undefined })
})
it('getItem', function () {
expect(customLocalStorage.getItem('foo')).to.be.null
global.localStorage.getItem.returns('false')
expect(customLocalStorage.getItem('foo')).to.equal(false)
global.localStorage.getItem.returns('{"foo":"bar"}')
expect(customLocalStorage.getItem('foo')).to.deep.equal({ foo: 'bar' })
global.localStorage.getItem.throws(new Error('Nope'))
expect(customLocalStorage.getItem('foo')).to.be.null
expect(global.console.error).to.be.calledOnce
})
it('setItem', function () {
customLocalStorage.setItem('foo', 'bar')
expect(global.localStorage.setItem).to.be.calledOnceWith('foo', '"bar"')
global.localStorage.setItem.reset()
customLocalStorage.setItem('foo', true)
expect(global.localStorage.setItem).to.be.calledOnceWith('foo', 'true')
global.localStorage.setItem.reset()
customLocalStorage.setItem('foo', { bar: 1 })
expect(global.localStorage.setItem).to.be.calledOnceWith('foo', '{"bar":1}')
global.localStorage.setItem.reset()
global.localStorage.setItem.throws(new Error('Nope'))
expect(customLocalStorage.setItem('foo', 'bar')).to.be.null
expect(global.console.error).to.be.calledOnce
})
it('clear', function () {
customLocalStorage.clear()
expect(global.localStorage.clear).to.be.calledOnce
global.localStorage.clear.throws(new Error('Nope'))
expect(customLocalStorage.clear()).to.be.null
expect(global.console.error).to.be.calledOnce
})
it('removeItem', function () {
customLocalStorage.removeItem('foo')
expect(global.localStorage.removeItem).to.be.calledOnceWith('foo')
global.localStorage.removeItem.reset()
global.localStorage.removeItem.throws(new Error('Nope'))
expect(customLocalStorage.removeItem('foo')).to.be.null
expect(global.console.error).to.be.calledOnce
})
})
| overleaf/web/test/frontend/infrastructure/local-storage.test.js/0 | {
"file_path": "overleaf/web/test/frontend/infrastructure/local-storage.test.js",
"repo_id": "overleaf",
"token_count": 966
} | 590 |
const OError = require('@overleaf/o-error')
const Settings = require('@overleaf/settings')
const RateLimiter = require('../../../../app/src/infrastructure/RateLimiter')
async function clearRateLimit(endpointName, subject) {
try {
await RateLimiter.promises.clearRateLimit(endpointName, subject)
} catch (err) {
throw new OError(
'error clearing rate limit',
{ endpointName, subject },
err
)
}
}
async function clearLoginRateLimit() {
await clearRateLimit('login', Settings.smokeTest.user)
}
async function clearOverleafLoginRateLimit() {
if (!Settings.overleaf) return
await clearRateLimit('overleaf-login', Settings.smokeTest.rateLimitSubject)
}
async function clearOpenProjectRateLimit() {
await clearRateLimit(
'open-project',
`${Settings.smokeTest.projectId}:${Settings.smokeTest.userId}`
)
}
async function run({ processWithTimeout, timeout }) {
await processWithTimeout({
work: Promise.all([
clearLoginRateLimit(),
clearOverleafLoginRateLimit(),
clearOpenProjectRateLimit(),
]),
timeout,
message: 'cleanupRateLimits timed out',
})
}
module.exports = { run }
| overleaf/web/test/smoke/src/steps/001_clearRateLimits.js/0 | {
"file_path": "overleaf/web/test/smoke/src/steps/001_clearRateLimits.js",
"repo_id": "overleaf",
"token_count": 395
} | 591 |
const SandboxedModule = require('sandboxed-module')
const path = require('path')
const sinon = require('sinon')
const modulePath = path.join(
__dirname,
'../../../../app/src/Features/BetaProgram/BetaProgramController'
)
describe('BetaProgramController', function () {
beforeEach(function () {
this.user = {
_id: (this.user_id = 'a_simple_id'),
email: 'user@example.com',
features: {},
betaProgram: false,
}
this.req = {
query: {},
session: {
user: this.user,
},
}
this.BetaProgramController = SandboxedModule.require(modulePath, {
requires: {
'./BetaProgramHandler': (this.BetaProgramHandler = {
optIn: sinon.stub(),
optOut: sinon.stub(),
}),
'../User/UserGetter': (this.UserGetter = {
getUser: sinon.stub(),
}),
'@overleaf/settings': (this.settings = {
languages: {},
}),
'../Authentication/AuthenticationController': (this.AuthenticationController = {
getLoggedInUserId: sinon.stub().returns(this.user._id),
}),
},
})
this.res = {
send: sinon.stub(),
redirect: sinon.stub(),
render: sinon.stub(),
}
this.next = sinon.stub()
})
describe('optIn', function () {
beforeEach(function () {
this.BetaProgramHandler.optIn.callsArgWith(1, null)
})
it("should redirect to '/beta/participate'", function () {
this.BetaProgramController.optIn(this.req, this.res, this.next)
this.res.redirect.callCount.should.equal(1)
this.res.redirect.firstCall.args[0].should.equal('/beta/participate')
})
it('should not call next with an error', function () {
this.BetaProgramController.optIn(this.req, this.res, this.next)
this.next.callCount.should.equal(0)
})
it('should call BetaProgramHandler.optIn', function () {
this.BetaProgramController.optIn(this.req, this.res, this.next)
this.BetaProgramHandler.optIn.callCount.should.equal(1)
})
describe('when BetaProgramHandler.opIn produces an error', function () {
beforeEach(function () {
this.BetaProgramHandler.optIn.callsArgWith(1, new Error('woops'))
})
it("should not redirect to '/beta/participate'", function () {
this.BetaProgramController.optIn(this.req, this.res, this.next)
this.res.redirect.callCount.should.equal(0)
})
it('should produce an error', function () {
this.BetaProgramController.optIn(this.req, this.res, this.next)
this.next.callCount.should.equal(1)
this.next.firstCall.args[0].should.be.instanceof(Error)
})
})
})
describe('optOut', function () {
beforeEach(function () {
this.BetaProgramHandler.optOut.callsArgWith(1, null)
})
it("should redirect to '/beta/participate'", function () {
this.BetaProgramController.optOut(this.req, this.res, this.next)
this.res.redirect.callCount.should.equal(1)
this.res.redirect.firstCall.args[0].should.equal('/beta/participate')
})
it('should not call next with an error', function () {
this.BetaProgramController.optOut(this.req, this.res, this.next)
this.next.callCount.should.equal(0)
})
it('should call BetaProgramHandler.optOut', function () {
this.BetaProgramController.optOut(this.req, this.res, this.next)
this.BetaProgramHandler.optOut.callCount.should.equal(1)
})
describe('when BetaProgramHandler.optOut produces an error', function () {
beforeEach(function () {
this.BetaProgramHandler.optOut.callsArgWith(1, new Error('woops'))
})
it("should not redirect to '/beta/participate'", function () {
this.BetaProgramController.optOut(this.req, this.res, this.next)
this.res.redirect.callCount.should.equal(0)
})
it('should produce an error', function () {
this.BetaProgramController.optOut(this.req, this.res, this.next)
this.next.callCount.should.equal(1)
this.next.firstCall.args[0].should.be.instanceof(Error)
})
})
})
describe('optInPage', function () {
beforeEach(function () {
this.UserGetter.getUser.callsArgWith(1, null, this.user)
})
it('should render the opt-in page', function () {
this.BetaProgramController.optInPage(this.req, this.res, this.next)
this.res.render.callCount.should.equal(1)
const { args } = this.res.render.firstCall
args[0].should.equal('beta_program/opt_in')
})
describe('when UserGetter.getUser produces an error', function () {
beforeEach(function () {
this.UserGetter.getUser.callsArgWith(1, new Error('woops'))
})
it('should not render the opt-in page', function () {
this.BetaProgramController.optInPage(this.req, this.res, this.next)
this.res.render.callCount.should.equal(0)
})
it('should produce an error', function () {
this.BetaProgramController.optInPage(this.req, this.res, this.next)
this.next.callCount.should.equal(1)
this.next.firstCall.args[0].should.be.instanceof(Error)
})
})
})
})
| overleaf/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js",
"repo_id": "overleaf",
"token_count": 2106
} | 592 |
/* 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
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const { assert, expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/CompileManager.js'
const SandboxedModule = require('sandboxed-module')
describe('CompileManager', function () {
beforeEach(function () {
let Timer
this.rateLimitGetStub = sinon.stub()
const { rateLimitGetStub } = this
this.ratelimiter = { addCount: sinon.stub() }
this.CompileManager = SandboxedModule.require(modulePath, {
requires: {
'@overleaf/settings': (this.settings = {
redis: { web: { host: 'localhost', port: 42 } },
rateLimit: { autoCompile: {} },
}),
'../../infrastructure/RedisWrapper': {
client: () => {
return (this.rclient = { auth() {} })
},
},
'../Project/ProjectRootDocManager': (this.ProjectRootDocManager = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'../User/UserGetter': (this.UserGetter = {}),
'./ClsiManager': (this.ClsiManager = {}),
'../../infrastructure/RateLimiter': this.ratelimiter,
'@overleaf/metrics': (this.Metrics = {
Timer: (Timer = (function () {
Timer = class Timer {
static initClass() {
this.prototype.done = sinon.stub()
}
}
Timer.initClass()
return Timer
})()),
inc: sinon.stub(),
}),
},
})
this.project_id = 'mock-project-id-123'
this.user_id = 'mock-user-id-123'
this.callback = sinon.stub()
return (this.limits = {
timeout: 42,
})
})
describe('compile', function () {
beforeEach(function () {
this.CompileManager._checkIfRecentlyCompiled = sinon
.stub()
.callsArgWith(2, null, false)
this.ProjectRootDocManager.ensureRootDocumentIsSet = sinon
.stub()
.callsArgWith(1, null)
this.CompileManager.getProjectCompileLimits = sinon
.stub()
.callsArgWith(1, null, this.limits)
return (this.ClsiManager.sendRequest = sinon
.stub()
.callsArgWith(
3,
null,
(this.status = 'mock-status'),
(this.outputFiles = 'mock output files'),
(this.output = 'mock output')
))
})
describe('succesfully', function () {
beforeEach(function () {
this.CompileManager._checkIfAutoCompileLimitHasBeenHit = (
isAutoCompile,
compileGroup,
cb
) => cb(null, true)
return this.CompileManager.compile(
this.project_id,
this.user_id,
{},
this.callback
)
})
it('should check the project has not been recently compiled', function () {
return this.CompileManager._checkIfRecentlyCompiled
.calledWith(this.project_id, this.user_id)
.should.equal(true)
})
it('should ensure that the root document is set', function () {
return this.ProjectRootDocManager.ensureRootDocumentIsSet
.calledWith(this.project_id)
.should.equal(true)
})
it('should get the project compile limits', function () {
return this.CompileManager.getProjectCompileLimits
.calledWith(this.project_id)
.should.equal(true)
})
it('should run the compile with the compile limits', function () {
return this.ClsiManager.sendRequest
.calledWith(this.project_id, this.user_id, {
timeout: this.limits.timeout,
})
.should.equal(true)
})
it('should call the callback with the output', function () {
return this.callback
.calledWith(null, this.status, this.outputFiles, this.output)
.should.equal(true)
})
it('should time the compile', function () {
return this.Metrics.Timer.prototype.done.called.should.equal(true)
})
})
describe('when the project has been recently compiled', function () {
it('should return', function (done) {
this.CompileManager._checkIfAutoCompileLimitHasBeenHit = (
isAutoCompile,
compileGroup,
cb
) => cb(null, true)
this.CompileManager._checkIfRecentlyCompiled = sinon
.stub()
.callsArgWith(2, null, true)
return this.CompileManager.compile(
this.project_id,
this.user_id,
{},
(err, status) => {
status.should.equal('too-recently-compiled')
return done()
}
)
})
})
describe('should check the rate limit', function () {
it('should return', function (done) {
this.CompileManager._checkIfAutoCompileLimitHasBeenHit = sinon
.stub()
.callsArgWith(2, null, false)
return this.CompileManager.compile(
this.project_id,
this.user_id,
{},
(err, status) => {
status.should.equal('autocompile-backoff')
return done()
}
)
})
})
})
describe('getProjectCompileLimits', function () {
beforeEach(function () {
this.features = {
compileTimeout: (this.timeout = 42),
compileGroup: (this.group = 'priority'),
}
this.ProjectGetter.getProject = sinon
.stub()
.callsArgWith(
2,
null,
(this.project = { owner_ref: (this.owner_id = 'owner-id-123') })
)
this.UserGetter.getUser = sinon
.stub()
.callsArgWith(2, null, (this.user = { features: this.features }))
return this.CompileManager.getProjectCompileLimits(
this.project_id,
this.callback
)
})
it('should look up the owner of the project', function () {
return this.ProjectGetter.getProject
.calledWith(this.project_id, { owner_ref: 1 })
.should.equal(true)
})
it("should look up the owner's features", function () {
return this.UserGetter.getUser
.calledWith(this.project.owner_ref, {
alphaProgram: 1,
betaProgram: 1,
features: 1,
})
.should.equal(true)
})
it('should return the limits', function () {
return this.callback
.calledWith(null, {
timeout: this.timeout,
compileGroup: this.group,
})
.should.equal(true)
})
})
describe('deleteAuxFiles', function () {
beforeEach(function () {
this.CompileManager.getProjectCompileLimits = sinon
.stub()
.callsArgWith(
1,
null,
(this.limits = { compileGroup: 'mock-compile-group' })
)
this.ClsiManager.deleteAuxFiles = sinon.stub().callsArg(3)
return this.CompileManager.deleteAuxFiles(
this.project_id,
this.user_id,
this.callback
)
})
it('should look up the compile group to use', function () {
return this.CompileManager.getProjectCompileLimits
.calledWith(this.project_id)
.should.equal(true)
})
it('should delete the aux files', function () {
return this.ClsiManager.deleteAuxFiles
.calledWith(this.project_id, this.user_id, this.limits)
.should.equal(true)
})
it('should call the callback', function () {
return this.callback.called.should.equal(true)
})
})
describe('_checkIfRecentlyCompiled', function () {
describe('when the key exists in redis', function () {
beforeEach(function () {
this.rclient.set = sinon.stub().callsArgWith(5, null, null)
return this.CompileManager._checkIfRecentlyCompiled(
this.project_id,
this.user_id,
this.callback
)
})
it('should try to set the key', function () {
return this.rclient.set
.calledWith(
`compile:${this.project_id}:${this.user_id}`,
true,
'EX',
this.CompileManager.COMPILE_DELAY,
'NX'
)
.should.equal(true)
})
it('should call the callback with true', function () {
return this.callback.calledWith(null, true).should.equal(true)
})
})
describe('when the key does not exist in redis', function () {
beforeEach(function () {
this.rclient.set = sinon.stub().callsArgWith(5, null, 'OK')
return this.CompileManager._checkIfRecentlyCompiled(
this.project_id,
this.user_id,
this.callback
)
})
it('should try to set the key', function () {
return this.rclient.set
.calledWith(
`compile:${this.project_id}:${this.user_id}`,
true,
'EX',
this.CompileManager.COMPILE_DELAY,
'NX'
)
.should.equal(true)
})
it('should call the callback with false', function () {
return this.callback.calledWith(null, false).should.equal(true)
})
})
})
describe('_checkIfAutoCompileLimitHasBeenHit', function () {
it('should be able to compile if it is not an autocompile', function (done) {
this.ratelimiter.addCount.callsArgWith(2, null, true)
return this.CompileManager._checkIfAutoCompileLimitHasBeenHit(
false,
'everyone',
(err, canCompile) => {
canCompile.should.equal(true)
return done()
}
)
})
it('should be able to compile if rate limit has remianing', function (done) {
this.ratelimiter.addCount.callsArgWith(1, null, true)
return this.CompileManager._checkIfAutoCompileLimitHasBeenHit(
true,
'everyone',
(err, canCompile) => {
const args = this.ratelimiter.addCount.args[0][0]
args.throttle.should.equal(25)
args.subjectName.should.equal('everyone')
args.timeInterval.should.equal(20)
args.endpointName.should.equal('auto_compile')
canCompile.should.equal(true)
return done()
}
)
})
it('should be not able to compile if rate limit has no remianing', function (done) {
this.ratelimiter.addCount.callsArgWith(1, null, false)
return this.CompileManager._checkIfAutoCompileLimitHasBeenHit(
true,
'everyone',
(err, canCompile) => {
canCompile.should.equal(false)
return done()
}
)
})
it('should return false if there is an error in the rate limit', function (done) {
this.ratelimiter.addCount.callsArgWith(1, 'error')
return this.CompileManager._checkIfAutoCompileLimitHasBeenHit(
true,
'everyone',
(err, canCompile) => {
canCompile.should.equal(false)
return done()
}
)
})
})
describe('wordCount', function () {
beforeEach(function () {
this.CompileManager.getProjectCompileLimits = sinon
.stub()
.callsArgWith(
1,
null,
(this.limits = { compileGroup: 'mock-compile-group' })
)
this.ClsiManager.wordCount = sinon.stub().callsArg(4)
return this.CompileManager.wordCount(
this.project_id,
this.user_id,
false,
this.callback
)
})
it('should look up the compile group to use', function () {
return this.CompileManager.getProjectCompileLimits
.calledWith(this.project_id)
.should.equal(true)
})
it('should call wordCount for project', function () {
return this.ClsiManager.wordCount
.calledWith(this.project_id, this.user_id, false, this.limits)
.should.equal(true)
})
it('should call the callback', function () {
return this.callback.called.should.equal(true)
})
})
})
| overleaf/web/test/unit/src/Compile/CompileManagerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Compile/CompileManagerTests.js",
"repo_id": "overleaf",
"token_count": 5591
} | 593 |
const SandboxedModule = require('sandboxed-module')
const path = require('path')
const { expect } = require('chai')
const MODULE_PATH = path.join(
__dirname,
'../../../../app/src/Features/Email/EmailMessageHelper'
)
describe('EmailMessageHelper', function () {
beforeEach(function () {
this.EmailMessageHelper = SandboxedModule.require(MODULE_PATH, {})
})
describe('cleanHTML', function () {
beforeEach(function () {
this.text = 'a message'
this.span = `<span style="text-align:center">${this.text}</span>`
this.fullMessage = `${this.span}<div></div>`
})
it('should remove HTML for plainText version', function () {
const processed = this.EmailMessageHelper.cleanHTML(
this.fullMessage,
true
)
expect(processed).to.equal(this.text)
})
it('should keep HTML for HTML version but remove tags not allowed', function () {
const processed = this.EmailMessageHelper.cleanHTML(
this.fullMessage,
false
)
expect(processed).to.equal(this.span)
})
})
})
| overleaf/web/test/unit/src/Email/EmailMessageHelperTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Email/EmailMessageHelperTests.js",
"repo_id": "overleaf",
"token_count": 396
} | 594 |
/* 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 modulePath = path.join(
__dirname,
'../../../../app/src/Features/InactiveData/InactiveProjectManager'
)
const { expect } = require('chai')
const { ObjectId } = require('mongodb')
describe('InactiveProjectManager', function () {
beforeEach(function () {
this.settings = {}
this.DocstoreManager = {
unarchiveProject: sinon.stub(),
archiveProject: sinon.stub(),
}
this.ProjectUpdateHandler = {
markAsActive: sinon.stub(),
markAsInactive: sinon.stub(),
}
this.ProjectGetter = { getProject: sinon.stub() }
this.InactiveProjectManager = SandboxedModule.require(modulePath, {
requires: {
mongodb: { ObjectId },
'@overleaf/settings': this.settings,
'../Docstore/DocstoreManager': this.DocstoreManager,
'../Project/ProjectUpdateHandler': this.ProjectUpdateHandler,
'../Project/ProjectGetter': this.ProjectGetter,
'../../models/Project': {},
},
})
return (this.project_id = '1234')
})
describe('reactivateProjectIfRequired', function () {
beforeEach(function () {
this.project = { active: false }
this.ProjectGetter.getProject.callsArgWith(2, null, this.project)
return this.ProjectUpdateHandler.markAsActive.callsArgWith(1)
})
it('should call unarchiveProject', function (done) {
this.DocstoreManager.unarchiveProject.callsArgWith(1)
return this.InactiveProjectManager.reactivateProjectIfRequired(
this.project_id,
err => {
this.DocstoreManager.unarchiveProject
.calledWith(this.project_id)
.should.equal(true)
this.ProjectUpdateHandler.markAsActive
.calledWith(this.project_id)
.should.equal(true)
return done()
}
)
})
it('should not mark project as active if error with unarchiving', function (done) {
const error = new Error('error')
this.DocstoreManager.unarchiveProject.callsArgWith(1, error)
return this.InactiveProjectManager.reactivateProjectIfRequired(
this.project_id,
err => {
err.should.equal(error)
this.DocstoreManager.unarchiveProject
.calledWith(this.project_id)
.should.equal(true)
this.ProjectUpdateHandler.markAsActive
.calledWith(this.project_id)
.should.equal(false)
return done()
}
)
})
it('should not call unarchiveProject if it is active', function (done) {
this.project.active = true
this.DocstoreManager.unarchiveProject.callsArgWith(1)
return this.InactiveProjectManager.reactivateProjectIfRequired(
this.project_id,
err => {
this.DocstoreManager.unarchiveProject
.calledWith(this.project_id)
.should.equal(false)
this.ProjectUpdateHandler.markAsActive
.calledWith(this.project_id)
.should.equal(false)
return done()
}
)
})
})
describe('deactivateProject', function () {
it('should call unarchiveProject and markAsInactive', function (done) {
this.DocstoreManager.archiveProject.callsArgWith(1)
this.ProjectUpdateHandler.markAsInactive.callsArgWith(1)
return this.InactiveProjectManager.deactivateProject(
this.project_id,
err => {
this.DocstoreManager.archiveProject
.calledWith(this.project_id)
.should.equal(true)
this.ProjectUpdateHandler.markAsInactive
.calledWith(this.project_id)
.should.equal(true)
return done()
}
)
})
it('should not call markAsInactive if there was a problem archiving in docstore', function (done) {
this.DocstoreManager.archiveProject.callsArgWith(1, 'errorrr')
this.ProjectUpdateHandler.markAsInactive.callsArgWith(1)
return this.InactiveProjectManager.deactivateProject(
this.project_id,
err => {
err.should.equal('errorrr')
this.DocstoreManager.archiveProject
.calledWith(this.project_id)
.should.equal(true)
this.ProjectUpdateHandler.markAsInactive
.calledWith(this.project_id)
.should.equal(false)
return done()
}
)
})
})
})
| overleaf/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js",
"repo_id": "overleaf",
"token_count": 2018
} | 595 |
const { expect } = require('chai')
const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module')
const MODULE_PATH =
'../../../../app/src/Features/Project/FolderStructureBuilder'
const MOCK_OBJECT_ID = 'MOCK_OBJECT_ID'
describe('FolderStructureBuilder', function () {
beforeEach(function () {
this.ObjectId = sinon.stub().returns(MOCK_OBJECT_ID)
this.FolderStructureBuilder = SandboxedModule.require(MODULE_PATH, {
requires: {
mongodb: { ObjectId: this.ObjectId },
},
})
})
describe('buildFolderStructure', function () {
describe('when given no documents at all', function () {
beforeEach(function () {
this.result = this.FolderStructureBuilder.buildFolderStructure([], [])
})
it('returns an empty root folder', function () {
expect(this.result).to.deep.equal({
_id: MOCK_OBJECT_ID,
name: 'rootFolder',
folders: [],
docs: [],
fileRefs: [],
})
})
})
describe('when given documents and files', function () {
beforeEach(function () {
const docUploads = [
{ path: '/main.tex', doc: { _id: 'doc-1', name: 'main.tex' } },
{ path: '/foo/other.tex', doc: { _id: 'doc-2', name: 'other.tex' } },
{ path: '/foo/other.bib', doc: { _id: 'doc-3', name: 'other.bib' } },
{
path: '/foo/foo1/foo2/another.tex',
doc: { _id: 'doc-4', name: 'another.tex' },
},
]
const fileUploads = [
{ path: '/aaa.jpg', file: { _id: 'file-1', name: 'aaa.jpg' } },
{ path: '/foo/bbb.jpg', file: { _id: 'file-2', name: 'bbb.jpg' } },
{ path: '/bar/ccc.jpg', file: { _id: 'file-3', name: 'ccc.jpg' } },
]
this.result = this.FolderStructureBuilder.buildFolderStructure(
docUploads,
fileUploads
)
})
it('returns a full folder structure', function () {
expect(this.result).to.deep.equal({
_id: MOCK_OBJECT_ID,
name: 'rootFolder',
docs: [{ _id: 'doc-1', name: 'main.tex' }],
fileRefs: [{ _id: 'file-1', name: 'aaa.jpg' }],
folders: [
{
_id: MOCK_OBJECT_ID,
name: 'foo',
docs: [
{ _id: 'doc-2', name: 'other.tex' },
{ _id: 'doc-3', name: 'other.bib' },
],
fileRefs: [{ _id: 'file-2', name: 'bbb.jpg' }],
folders: [
{
_id: MOCK_OBJECT_ID,
name: 'foo1',
docs: [],
fileRefs: [],
folders: [
{
_id: MOCK_OBJECT_ID,
name: 'foo2',
docs: [{ _id: 'doc-4', name: 'another.tex' }],
fileRefs: [],
folders: [],
},
],
},
],
},
{
_id: MOCK_OBJECT_ID,
name: 'bar',
docs: [],
fileRefs: [{ _id: 'file-3', name: 'ccc.jpg' }],
folders: [],
},
],
})
})
})
describe('when given duplicate files', function () {
it('throws an error', function () {
const docUploads = [
{ path: '/foo/doc.tex', doc: { _id: 'doc-1', name: 'doc.tex' } },
{ path: '/foo/doc.tex', doc: { _id: 'doc-2', name: 'doc.tex' } },
]
expect(() =>
this.FolderStructureBuilder.buildFolderStructure(docUploads, [])
).to.throw()
})
})
})
})
| overleaf/web/test/unit/src/Project/FolderStructureBuilderTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Project/FolderStructureBuilderTests.js",
"repo_id": "overleaf",
"token_count": 2018
} | 596 |
/* eslint-disable
camelcase,
node/handle-callback-err,
max-len,
no-return-assign,
no-unused-vars,
no-useless-constructor,
*/
// 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/Project/ProjectOptionsHandler.js'
const SandboxedModule = require('sandboxed-module')
describe('ProjectOptionsHandler', function () {
const project_id = '4eecaffcbffa66588e000008'
beforeEach(function () {
let Project
this.projectModel = Project = class Project {
constructor(options) {}
}
this.projectModel.updateOne = sinon.stub().yields()
this.handler = SandboxedModule.require(modulePath, {
requires: {
'../../models/Project': { Project: this.projectModel },
'@overleaf/settings': {
languages: [
{ name: 'English', code: 'en' },
{ name: 'French', code: 'fr' },
],
imageRoot: 'docker-repo/subdir',
allowedImageNames: [
{ imageName: 'texlive-0000.0', imageDesc: 'test image 0' },
{ imageName: 'texlive-1234.5', imageDesc: 'test image 1' },
],
},
},
})
})
describe('Setting the compiler', function () {
it('should perform and update on mongo', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[1].compiler.should.equal('xelatex')
done()
})
})
it('should not perform and update on mongo if it is not a recognised compiler', function (done) {
this.handler.setCompiler(project_id, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setCompiler(project_id, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
done()
})
})
})
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
err.should.equal('error')
done()
})
})
})
})
describe('Setting the imageName', function () {
it('should perform and update on mongo', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[1].imageName.should.equal('docker-repo/subdir/texlive-1234.5')
done()
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setImageName(project_id, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setImageName(project_id, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
done()
})
})
})
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
err.should.equal('error')
done()
})
})
})
})
describe('setting the spellCheckLanguage', function () {
it('should perform and update on mongo', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[1].spellCheckLanguage.should.equal('fr')
done()
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'no a lang', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should perform and update on mongo if the language is blank (means turn it off)', function (done) {
this.handler.setSpellCheckLanguage(project_id, '', err => {
this.projectModel.updateOne.called.should.equal(true)
done()
})
})
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
err.should.equal('error')
done()
})
})
})
})
describe('setting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[1].brandVariationId.should.equal('123')
done()
})
})
it('should not perform and update on mongo if there is no brand variation', function (done) {
this.handler.setBrandVariationId(project_id, null, err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should not perform and update on mongo if brand variation is an empty string', function (done) {
this.handler.setBrandVariationId(project_id, '', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
err.should.equal('error')
done()
})
})
})
})
describe('unsetting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
expect(args[1]).to.deep.equal({ $unset: { brandVariationId: 1 } })
done()
})
})
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
err.should.equal('error')
done()
})
})
})
})
})
| overleaf/web/test/unit/src/Project/ProjectOptionsHandlerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Project/ProjectOptionsHandlerTests.js",
"repo_id": "overleaf",
"token_count": 3045
} | 597 |
const sinon = require('sinon')
const { expect } = require('chai')
const modulePath =
'../../../../app/src/infrastructure/SessionAutostartMiddleware.js'
const SandboxedModule = require('sandboxed-module')
describe('SessionAutostartMiddleware', function () {
let SessionAutostartMiddleware, middleware, Settings
const cookieName = 'coookieee'
const excludedRoute = '/wombat/potato'
const excludedMethod = 'POST'
const excludedCallback = () => 'call me'
beforeEach(function () {
Settings = {
cookieName: cookieName,
}
SessionAutostartMiddleware = SandboxedModule.require(modulePath, {
requires: {
'@overleaf/settings': Settings,
},
})
middleware = new SessionAutostartMiddleware()
middleware.disableSessionAutostartForRoute(
excludedRoute,
excludedMethod,
excludedCallback
)
})
describe('middleware', function () {
let req, next
beforeEach(function () {
req = {
path: excludedRoute,
method: excludedMethod,
signedCookies: {},
headers: {},
}
next = sinon.stub()
})
it('executes the callback for the excluded route', function () {
middleware.middleware(req, {}, next)
expect(req.session.noSessionCallback).to.equal(excludedCallback)
})
it('does not execute the callback if the method is not excluded', function () {
req.method = 'GET'
middleware.middleware(req, {}, next)
expect(req.session).not.to.exist
})
it('does not execute the callback if the path is not excluded', function () {
req.path = '/giraffe'
middleware.middleware(req, {}, next)
expect(req.session).not.to.exist
})
it('does not execute the callback if there is a cookie', function () {
req.signedCookies[cookieName] = 'a very useful session cookie'
middleware.middleware(req, {}, next)
expect(req.session).not.to.exist
})
})
describe('bot middlewear', function () {
let req, next
beforeEach(function () {
req = {
signedCookies: {},
headers: {},
}
next = sinon.stub()
})
it('GoogleHC user agent should have an empty session', function () {
req.headers['user-agent'] = 'GoogleHC'
middleware.middleware(req, {}, next)
expect(req.session.noSessionCallback).to.deep.exist
})
it('should not add empty session with a firefox useragent', function () {
req.headers['user-agent'] = 'firefox'
middleware.middleware(req, {}, next)
expect(req.session).not.to.exist
})
it('should not add empty session with a empty useragent', function () {
middleware.middleware(req, {}, next)
expect(req.session).not.to.exist
})
})
})
| overleaf/web/test/unit/src/Security/SessionAutostartMiddlewareTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Security/SessionAutostartMiddlewareTests.js",
"repo_id": "overleaf",
"token_count": 1028
} | 598 |
/* 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 sinon = require('sinon')
const modulePath =
'../../../../app/src/Features/Subscription/SubscriptionLocator'
const { assert } = require('chai')
describe('Subscription Locator Tests', function () {
beforeEach(function () {
this.user = { _id: '5208dd34438842e2db333333' }
this.subscription = { hello: 'world' }
this.Subscription = {
findOne: sinon.stub(),
find: sinon.stub(),
}
this.DeletedSubscription = {
findOne: sinon.stub().yields(),
find: sinon.stub().yields(),
}
return (this.SubscriptionLocator = SandboxedModule.require(modulePath, {
requires: {
'./GroupPlansData': {},
'../../models/Subscription': {
Subscription: this.Subscription,
},
'../../models/DeletedSubscription': {
DeletedSubscription: this.DeletedSubscription,
},
},
}))
})
describe('finding users subscription', function () {
it('should send the users features', function (done) {
this.Subscription.findOne.callsArgWith(1, null, this.subscription)
return this.SubscriptionLocator.getUsersSubscription(
this.user,
(err, subscription) => {
this.Subscription.findOne
.calledWith({ admin_id: this.user._id })
.should.equal(true)
subscription.should.equal(this.subscription)
return done()
}
)
})
it('should error if not found', function (done) {
this.Subscription.findOne.callsArgWith(1, 'not found')
return this.SubscriptionLocator.getUsersSubscription(
this.user,
(err, subscription) => {
err.should.exist
return done()
}
)
})
it('should take a user id rather than the user object', function (done) {
this.Subscription.findOne.callsArgWith(1, null, this.subscription)
return this.SubscriptionLocator.getUsersSubscription(
this.user._id,
(err, subscription) => {
this.Subscription.findOne
.calledWith({ admin_id: this.user._id })
.should.equal(true)
subscription.should.equal(this.subscription)
return done()
}
)
})
})
})
| overleaf/web/test/unit/src/Subscription/SubscriptionLocatorTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Subscription/SubscriptionLocatorTests.js",
"repo_id": "overleaf",
"token_count": 1095
} | 599 |
/* 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
* DS206: Consider reworking classes to avoid initClass
* 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/Uploads/ArchiveManager.js'
const ArchiveErrors = require('../../../../app/src/Features/Uploads/ArchiveErrors')
const SandboxedModule = require('sandboxed-module')
const events = require('events')
describe('ArchiveManager', function () {
beforeEach(function () {
let Timer
this.metrics = {
Timer: (Timer = (function () {
Timer = class Timer {
static initClass() {
this.prototype.done = sinon.stub()
}
}
Timer.initClass()
return Timer
})()),
}
this.zipfile = new events.EventEmitter()
this.zipfile.readEntry = sinon.stub()
this.zipfile.close = sinon.stub()
this.ArchiveManager = SandboxedModule.require(modulePath, {
requires: {
'@overleaf/settings': {},
yauzl: (this.yauzl = {
open: sinon.stub().callsArgWith(2, null, this.zipfile),
}),
'@overleaf/metrics': this.metrics,
fs: (this.fs = {}),
'fs-extra': (this.fse = {}),
'./ArchiveErrors': ArchiveErrors,
},
})
return (this.callback = sinon.stub())
})
describe('extractZipArchive', function () {
beforeEach(function () {
this.source = '/path/to/zip/source.zip'
this.destination = '/path/to/zip/destination'
return (this.ArchiveManager._isZipTooLarge = sinon
.stub()
.callsArgWith(1, null, false))
})
describe('successfully', function () {
beforeEach(function (done) {
this.readStream = new events.EventEmitter()
this.readStream.pipe = sinon.stub()
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, null, this.readStream)
this.writeStream = new events.EventEmitter()
this.fs.createWriteStream = sinon.stub().returns(this.writeStream)
this.fse.ensureDir = sinon.stub().callsArg(1)
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
done
)
// entry contains a single file
this.zipfile.emit('entry', { fileName: 'testfile.txt' })
this.readStream.emit('end')
return this.zipfile.emit('end')
})
it('should run yauzl', function () {
return this.yauzl.open.calledWith(this.source).should.equal(true)
})
it('should time the unzip', function () {
return this.metrics.Timer.prototype.done.called.should.equal(true)
})
})
describe('with a zipfile containing an empty directory', function () {
beforeEach(function (done) {
this.readStream = new events.EventEmitter()
this.readStream.pipe = sinon.stub()
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, null, this.readStream)
this.writeStream = new events.EventEmitter()
this.fs.createWriteStream = sinon.stub().returns(this.writeStream)
this.fse.ensureDir = sinon.stub().callsArg(1)
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
done()
}
)
// entry contains a single, empty directory
this.zipfile.emit('entry', { fileName: 'testdir/' })
this.readStream.emit('end')
return this.zipfile.emit('end')
})
it('should return the callback with an error', function () {
return sinon.assert.calledWithExactly(
this.callback,
sinon.match.instanceOf(ArchiveErrors.EmptyZipFileError)
)
})
})
describe('with an empty zipfile', function () {
beforeEach(function (done) {
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
return this.zipfile.emit('end')
})
it('should return the callback with an error', function () {
return sinon.assert.calledWithExactly(
this.callback,
sinon.match.instanceOf(ArchiveErrors.EmptyZipFileError)
)
})
})
describe('with an error in the zip file header', function () {
beforeEach(function (done) {
this.yauzl.open = sinon
.stub()
.callsArgWith(2, new ArchiveErrors.InvalidZipFileError())
return this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
})
it('should return the callback with an error', function () {
return sinon.assert.calledWithExactly(
this.callback,
sinon.match.instanceOf(ArchiveErrors.InvalidZipFileError)
)
})
})
describe('with a zip that is too large', function () {
beforeEach(function (done) {
this.ArchiveManager._isZipTooLarge = sinon
.stub()
.callsArgWith(1, null, true)
return this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
})
it('should return the callback with an error', function () {
return sinon.assert.calledWithExactly(
this.callback,
sinon.match.instanceOf(ArchiveErrors.ZipContentsTooLargeError)
)
})
it('should not call yauzl.open', function () {
return this.yauzl.open.called.should.equal(false)
})
})
describe('with an error in the extracted files', function () {
beforeEach(function (done) {
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
return this.zipfile.emit('error', new Error('Something went wrong'))
})
it('should return the callback with an error', function () {
return this.callback.should.have.been.calledWithExactly(
sinon.match
.instanceOf(Error)
.and(sinon.match.has('message', 'Something went wrong'))
)
})
})
describe('with a relative extracted file path', function () {
beforeEach(function (done) {
this.zipfile.openReadStream = sinon.stub()
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: '../testfile.txt' })
return this.zipfile.emit('end')
})
it('should not write try to read the file entry', function () {
return this.zipfile.openReadStream.called.should.equal(false)
})
})
describe('with an unnormalized extracted file path', function () {
beforeEach(function (done) {
this.zipfile.openReadStream = sinon.stub()
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'foo/./testfile.txt' })
return this.zipfile.emit('end')
})
it('should not try to read the file entry', function () {
return this.zipfile.openReadStream.called.should.equal(false)
})
})
describe('with backslashes in the path', function () {
beforeEach(function (done) {
this.readStream = new events.EventEmitter()
this.readStream.pipe = sinon.stub()
this.writeStream = new events.EventEmitter()
this.fs.createWriteStream = sinon.stub().returns(this.writeStream)
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, null, this.readStream)
this.fse.ensureDir = sinon.stub().callsArg(1)
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'wombat\\foo.tex' })
this.zipfile.emit('entry', { fileName: 'potato\\bar.tex' })
return this.zipfile.emit('end')
})
it('should read the file entry with its original path', function () {
this.zipfile.openReadStream.should.be.calledWith({
fileName: 'wombat\\foo.tex',
})
return this.zipfile.openReadStream.should.be.calledWith({
fileName: 'potato\\bar.tex',
})
})
it('should treat the backslashes as a directory separator when creating the directory', function () {
this.fse.ensureDir.should.be.calledWith(`${this.destination}/wombat`)
return this.fse.ensureDir.should.be.calledWith(
`${this.destination}/potato`
)
})
it('should treat the backslashes as a directory separator when creating the file', function () {
this.fs.createWriteStream.should.be.calledWith(
`${this.destination}/wombat/foo.tex`
)
return this.fs.createWriteStream.should.be.calledWith(
`${this.destination}/potato/bar.tex`
)
})
})
describe('with a directory entry', function () {
beforeEach(function (done) {
this.zipfile.openReadStream = sinon.stub()
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'testdir/' })
return this.zipfile.emit('end')
})
it('should not try to read the entry', function () {
return this.zipfile.openReadStream.called.should.equal(false)
})
})
describe('with an error opening the file read stream', function () {
beforeEach(function (done) {
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, new Error('Something went wrong'))
this.writeStream = new events.EventEmitter()
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'testfile.txt' })
return this.zipfile.emit('end')
})
it('should return the callback with an error', function () {
return this.callback.should.have.been.calledWithExactly(
sinon.match
.instanceOf(Error)
.and(sinon.match.has('message', 'Something went wrong'))
)
})
it('should close the zipfile', function () {
return this.zipfile.close.called.should.equal(true)
})
})
describe('with an error in the file read stream', function () {
beforeEach(function (done) {
this.readStream = new events.EventEmitter()
this.readStream.pipe = sinon.stub()
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, null, this.readStream)
this.writeStream = new events.EventEmitter()
this.fs.createWriteStream = sinon.stub().returns(this.writeStream)
this.fse.ensureDir = sinon.stub().callsArg(1)
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'testfile.txt' })
this.readStream.emit('error', new Error('Something went wrong'))
return this.zipfile.emit('end')
})
it('should return the callback with an error', function () {
return this.callback.should.have.been.calledWithExactly(
sinon.match
.instanceOf(Error)
.and(sinon.match.has('message', 'Something went wrong'))
)
})
it('should close the zipfile', function () {
return this.zipfile.close.called.should.equal(true)
})
})
describe('with an error in the file write stream', function () {
beforeEach(function (done) {
this.readStream = new events.EventEmitter()
this.readStream.pipe = sinon.stub()
this.readStream.unpipe = sinon.stub()
this.readStream.destroy = sinon.stub()
this.zipfile.openReadStream = sinon
.stub()
.callsArgWith(1, null, this.readStream)
this.writeStream = new events.EventEmitter()
this.fs.createWriteStream = sinon.stub().returns(this.writeStream)
this.fse.ensureDir = sinon.stub().callsArg(1)
this.ArchiveManager.extractZipArchive(
this.source,
this.destination,
error => {
this.callback(error)
return done()
}
)
this.zipfile.emit('entry', { fileName: 'testfile.txt' })
this.writeStream.emit('error', new Error('Something went wrong'))
return this.zipfile.emit('end')
})
it('should return the callback with an error', function () {
return this.callback.should.have.been.calledWithExactly(
sinon.match
.instanceOf(Error)
.and(sinon.match.has('message', 'Something went wrong'))
)
})
it('should unpipe from the readstream', function () {
return this.readStream.unpipe.called.should.equal(true)
})
it('should destroy the readstream', function () {
return this.readStream.destroy.called.should.equal(true)
})
it('should close the zipfile', function () {
return this.zipfile.close.called.should.equal(true)
})
})
})
describe('_isZipTooLarge', function () {
it('should return false with small output', function (done) {
this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => {
isTooLarge.should.equal(false)
return done()
})
this.zipfile.emit('entry', { uncompressedSize: 109042 })
return this.zipfile.emit('end')
})
it('should return true with large bytes', function (done) {
this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => {
isTooLarge.should.equal(true)
return done()
})
this.zipfile.emit('entry', { uncompressedSize: 109e16 })
return this.zipfile.emit('end')
})
it('should return error on no data', function (done) {
this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => {
expect(error).to.exist
return done()
})
this.zipfile.emit('entry', {})
return this.zipfile.emit('end')
})
it("should return error if it didn't get a number", function (done) {
this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => {
expect(error).to.exist
return done()
})
this.zipfile.emit('entry', { uncompressedSize: 'random-error' })
return this.zipfile.emit('end')
})
it('should return error if there is no data', function (done) {
this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => {
expect(error).to.exist
return done()
})
return this.zipfile.emit('end')
})
})
describe('findTopLevelDirectory', function () {
beforeEach(function () {
this.fs.readdir = sinon.stub()
this.fs.stat = sinon.stub()
return (this.directory = 'test/directory')
})
describe('with multiple files', function () {
beforeEach(function () {
this.fs.readdir.callsArgWith(1, null, ['multiple', 'files'])
return this.ArchiveManager.findTopLevelDirectory(
this.directory,
this.callback
)
})
it('should find the files in the directory', function () {
return this.fs.readdir.calledWith(this.directory).should.equal(true)
})
it('should return the original directory', function () {
return this.callback.calledWith(null, this.directory).should.equal(true)
})
})
describe('with a single file (not folder)', function () {
beforeEach(function () {
this.fs.readdir.callsArgWith(1, null, ['foo.tex'])
this.fs.stat.callsArgWith(1, null, {
isDirectory() {
return false
},
})
return this.ArchiveManager.findTopLevelDirectory(
this.directory,
this.callback
)
})
it('should check if the file is a directory', function () {
return this.fs.stat
.calledWith(this.directory + '/foo.tex')
.should.equal(true)
})
it('should return the original directory', function () {
return this.callback.calledWith(null, this.directory).should.equal(true)
})
})
describe('with a single top-level folder', function () {
beforeEach(function () {
this.fs.readdir.callsArgWith(1, null, ['folder'])
this.fs.stat.callsArgWith(1, null, {
isDirectory() {
return true
},
})
return this.ArchiveManager.findTopLevelDirectory(
this.directory,
this.callback
)
})
it('should check if the file is a directory', function () {
return this.fs.stat
.calledWith(this.directory + '/folder')
.should.equal(true)
})
it('should return the child directory', function () {
return this.callback
.calledWith(null, this.directory + '/folder')
.should.equal(true)
})
})
})
})
| overleaf/web/test/unit/src/Uploads/ArchiveManagerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/Uploads/ArchiveManagerTests.js",
"repo_id": "overleaf",
"token_count": 8108
} | 600 |
const SandboxedModule = require('sandboxed-module')
const path = require('path')
const sinon = require('sinon')
const { expect } = require('chai')
const MODULE_PATH = path.join(
__dirname,
'../../../../app/src/Features/User/UserOnboardingEmailManager'
)
describe('UserOnboardingEmailManager', function () {
beforeEach(function () {
this.fakeUserId = '123abc'
this.fakeUserEmail = 'frog@overleaf.com'
this.onboardingEmailsQueue = {
add: sinon.stub().resolves(),
process: callback => {
this.queueProcessFunction = callback
},
}
this.Queues = {
getOnboardingEmailsQueue: sinon
.stub()
.returns(this.onboardingEmailsQueue),
}
this.UserGetter = {
promises: {
getUser: sinon.stub().resolves({
_id: this.fakeUserId,
email: this.fakeUserEmail,
}),
},
}
this.EmailHandler = {
promises: {
sendEmail: sinon.stub().resolves(),
},
}
this.UserUpdater = {
promises: {
updateUser: sinon.stub().resolves(),
},
}
this.Features = {
hasFeature: sinon.stub(),
}
this.request = sinon.stub().yields()
this.init = isSAAS => {
this.Features.hasFeature.withArgs('saas').returns(isSAAS)
this.UserOnboardingEmailManager = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console,
},
requires: {
'../../infrastructure/Features': this.Features,
'../../infrastructure/Queues': this.Queues,
'../Email/EmailHandler': this.EmailHandler,
'./UserGetter': this.UserGetter,
'./UserUpdater': this.UserUpdater,
},
})
}
})
describe('in Server CE/Pro', function () {
beforeEach(function () {
this.init(false)
})
it('should not create any queue', function () {
expect(this.Queues.getOnboardingEmailsQueue).to.not.have.been.called
})
it('should not schedule any email', function () {
this.UserOnboardingEmailManager.scheduleOnboardingEmail({
_id: this.fakeUserId,
})
expect(this.onboardingEmailsQueue.add).to.not.have.been.called
})
})
describe('schedule email in SAAS', function () {
beforeEach(function () {
this.init(true)
})
it('should schedule delayed job on queue', function () {
this.UserOnboardingEmailManager.scheduleOnboardingEmail({
_id: this.fakeUserId,
})
sinon.assert.calledWith(
this.onboardingEmailsQueue.add,
{ userId: this.fakeUserId },
{ delay: 24 * 60 * 60 * 1000 }
)
})
it('queue process callback should send onboarding email and update user', async function () {
await this.queueProcessFunction({ data: { userId: this.fakeUserId } })
sinon.assert.calledWith(
this.UserGetter.promises.getUser,
{ _id: this.fakeUserId },
{ email: 1 }
)
sinon.assert.calledWith(
this.EmailHandler.promises.sendEmail,
'userOnboardingEmail',
{
to: this.fakeUserEmail,
}
)
sinon.assert.calledWith(
this.UserUpdater.promises.updateUser,
this.fakeUserId,
{
$set: { onboardingEmailSentAt: sinon.match.date },
}
)
})
it('queue process callback should stop if user is not found', async function () {
this.UserGetter.promises.getUser = sinon.stub().resolves()
await this.queueProcessFunction({ data: { userId: 'deleted-user' } })
sinon.assert.calledWith(
this.UserGetter.promises.getUser,
{ _id: 'deleted-user' },
{ email: 1 }
)
sinon.assert.notCalled(this.EmailHandler.promises.sendEmail)
sinon.assert.notCalled(this.UserUpdater.promises.updateUser)
})
})
})
| overleaf/web/test/unit/src/User/UserOnboardingEmailManagerTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/User/UserOnboardingEmailManagerTests.js",
"repo_id": "overleaf",
"token_count": 1661
} | 601 |
const mockModel = require('../MockModel')
module.exports = mockModel('DeletedUser', {
'./User': require('./User'),
})
| overleaf/web/test/unit/src/helpers/models/DeletedUser.js/0 | {
"file_path": "overleaf/web/test/unit/src/helpers/models/DeletedUser.js",
"repo_id": "overleaf",
"token_count": 41
} | 602 |
const { expect } = require('chai')
const {
promisifyAll,
callbackifyMultiResult,
} = require('../../../../app/src/util/promises')
describe('promisifyAll', function () {
describe('basic functionality', function () {
before(function () {
this.module = {
SOME_CONSTANT: 1,
asyncAdd(a, b, callback) {
callback(null, a + b)
},
asyncDouble(x, callback) {
this.asyncAdd(x, x, callback)
},
}
this.promisified = promisifyAll(this.module)
})
it('promisifies functions in the module', async function () {
const sum = await this.promisified.asyncAdd(29, 33)
expect(sum).to.equal(62)
})
it('binds this to the original module', async function () {
const sum = await this.promisified.asyncDouble(38)
expect(sum).to.equal(76)
})
it('does not copy over non-functions', async function () {
expect(this.promisified).not.to.have.property('SOME_CONSTANT')
})
it('does not modify the prototype of the module', async function () {
expect(this.promisified.toString()).to.equal('[object Object]')
})
})
describe('without option', function () {
before(function () {
this.module = {
asyncAdd(a, b, callback) {
callback(null, a + b)
},
syncAdd(a, b) {
return a + b
},
}
this.promisified = promisifyAll(this.module, { without: 'syncAdd' })
})
it('does not promisify excluded functions', function () {
expect(this.promisified.syncAdd).not.to.exist
})
it('promisifies other functions', async function () {
const sum = await this.promisified.asyncAdd(12, 89)
expect(sum).to.equal(101)
})
})
describe('multiResult option', function () {
before(function () {
this.module = {
asyncAdd(a, b, callback) {
callback(null, a + b)
},
asyncArithmetic(a, b, callback) {
callback(null, a + b, a * b)
},
}
this.promisified = promisifyAll(this.module, {
multiResult: { asyncArithmetic: ['sum', 'product'] },
})
})
it('promisifies multi-result functions', async function () {
const result = await this.promisified.asyncArithmetic(3, 6)
expect(result).to.deep.equal({ sum: 9, product: 18 })
})
it('promisifies other functions normally', async function () {
const sum = await this.promisified.asyncAdd(6, 1)
expect(sum).to.equal(7)
})
})
})
describe('callbackifyMultiResult', function () {
it('callbackifies a multi-result function', function (done) {
async function asyncArithmetic(a, b) {
return { sum: a + b, product: a * b }
}
const callbackified = callbackifyMultiResult(asyncArithmetic, [
'sum',
'product',
])
callbackified(3, 11, (err, sum, product) => {
if (err != null) {
return done(err)
}
expect(sum).to.equal(14)
expect(product).to.equal(33)
done()
})
})
it('propagates errors', function (done) {
async function asyncBomb() {
throw new Error('BOOM!')
}
const callbackified = callbackifyMultiResult(asyncBomb, [
'explosives',
'dynamite',
])
callbackified(err => {
expect(err).to.exist
done()
})
})
})
| overleaf/web/test/unit/src/util/promisesTests.js/0 | {
"file_path": "overleaf/web/test/unit/src/util/promisesTests.js",
"repo_id": "overleaf",
"token_count": 1395
} | 603 |
Change: Use language setting
We've changed web to make use of the language the authenticated user has chosen in the settings.
https://github.com/owncloud/web/pull/3484
| owncloud/web/changelog/0.10.0_2020-05-26/3484-2/0 | {
"file_path": "owncloud/web/changelog/0.10.0_2020-05-26/3484-2",
"repo_id": "owncloud",
"token_count": 44
} | 604 |
Bugfix: Set expiration date only if it is supported
We've stopped setting expiration date in collaborators panel if it is not supported.
https://github.com/owncloud/web/issues/3674
https://github.com/owncloud/web/pull/3679 | owncloud/web/changelog/0.11.0_2020-06-26/set-expiration-date-only-if-supported/0 | {
"file_path": "owncloud/web/changelog/0.11.0_2020-06-26/set-expiration-date-only-if-supported",
"repo_id": "owncloud",
"token_count": 61
} | 605 |
Bugfix: Fix translations string
Allow better translations of various strings.
https://github.com/owncloud/web/pull/3766
https://github.com/owncloud/web/pull/3769
| owncloud/web/changelog/0.13.0_2020-07-17/3769/0 | {
"file_path": "owncloud/web/changelog/0.13.0_2020-07-17/3769",
"repo_id": "owncloud",
"token_count": 49
} | 606 |
Bugfix: Added missing tooltips
We've added tooltips for the following:
- top bar: notifications button and application switcher
- file list: share indicators and quick actions
- sharing in sidebar: action icons like edit, delete, copy
https://github.com/owncloud/web/pull/4081
https://github.com/owncloud/product/issues/231
| owncloud/web/changelog/0.17.0_2020-09-25/add-missing-tooltips/0 | {
"file_path": "owncloud/web/changelog/0.17.0_2020-09-25/add-missing-tooltips",
"repo_id": "owncloud",
"token_count": 87
} | 607 |
Bugfix: Display files list only if there is at least one item
Vue virtual scroll was throwing an error in console in case that the files list was empty. We prevent this error by displaying the files list only if there is at least one item.
https://github.com/owncloud/web/issues/2745
| owncloud/web/changelog/0.2.7_2020-01-14/2745/0 | {
"file_path": "owncloud/web/changelog/0.2.7_2020-01-14/2745",
"repo_id": "owncloud",
"token_count": 71
} | 608 |
Bugfix: Fix loginAsUser
loginAsUser wasn't waiting until the loading finished. Added an additional check
https://github.com/owncloud/web/pull/4297
| owncloud/web/changelog/0.25.0_2020-11-16/fix-login-as-user/0 | {
"file_path": "owncloud/web/changelog/0.25.0_2020-11-16/fix-login-as-user",
"repo_id": "owncloud",
"token_count": 42
} | 609 |
Enhancement: Display full public and private links
Below the names of public and private links we've added the respective full URL so that users can copy it without the copy to clipboard button.
https://github.com/owncloud/web/pull/4410
| owncloud/web/changelog/0.29.0_2020-12-07/visible-links/0 | {
"file_path": "owncloud/web/changelog/0.29.0_2020-12-07/visible-links",
"repo_id": "owncloud",
"token_count": 58
} | 610 |
Bugfix: Prevent loader in sidebar on add/remove
When adding or removing a public link or collaborator, the respective list view sidebar panels briefly hid the panel and showed a loader instead.
The UI is supposed to show a visual transition of a new list item into the list on adding, as well as a visual transition out of the list on deletion.
This is fixed now by not triggering the loading state on add and remove actions anymore. A loading state is only meant to appear when the user
navigates to the shares of another file/folder.
https://github.com/owncloud/web/issues/2937
https://github.com/owncloud/web/pull/2952
| owncloud/web/changelog/0.4.0_2020-02-14/2937/0 | {
"file_path": "owncloud/web/changelog/0.4.0_2020-02-14/2937",
"repo_id": "owncloud",
"token_count": 149
} | 611 |
Bugfix: Moved resharers to the top of owner collaborator entry
For received shares, the resharers user display names are now shown
on top of the owner entry in the collaborators list, with a reshare
icon, instead of having their own entry in the collaborators list.
This makes the reshare situation more clear and removes the ambiguity
about the formerly displayed "resharer" role which doesn't exist.
https://github.com/owncloud/web/issues/3850
| owncloud/web/changelog/0.5.0_2020-03-02/3850/0 | {
"file_path": "owncloud/web/changelog/0.5.0_2020-03-02/3850",
"repo_id": "owncloud",
"token_count": 106
} | 612 |
Bugfix: Fix file actions menu when using OCIS backend
When using OCIS as backend, the ids of resources is a string instead of
integer. So we cannot embed those into DOM node ids and need to use
another alternative. This fix introduces a unique viewId which is only
there to provide uniqueness across the current list and should not be
used for any data related operation.
This fixes the file actions menu when using OCIS as backend.
https://github.com/owncloud/web/issues/3214
https://github.com/owncloud/ocis-web/issues/51
| owncloud/web/changelog/0.7.0_2020-03-30/3214/0 | {
"file_path": "owncloud/web/changelog/0.7.0_2020-03-30/3214",
"repo_id": "owncloud",
"token_count": 134
} | 613 |
Enhancement: add the option to decline accepted shares
Declined shares could be accepted retroactively but accepted shares could not be declined.
https://github.com/owncloud/ocis/issues/985
| owncloud/web/changelog/1.0.0_2020-12-16/accepted-shares-decline.md/0 | {
"file_path": "owncloud/web/changelog/1.0.0_2020-12-16/accepted-shares-decline.md",
"repo_id": "owncloud",
"token_count": 47
} | 614 |
Change: Allow to disable previews in file lists
We introduced a new config option to disable previews. To do so, set `"disablePreviews": true` to the config.json file.
https://github.com/owncloud/web/pull/4513
| owncloud/web/changelog/1.0.1_2021-01-08/disable-previews/0 | {
"file_path": "owncloud/web/changelog/1.0.1_2021-01-08/disable-previews",
"repo_id": "owncloud",
"token_count": 59
} | 615 |
Bugfix: Avatar url without double slash
The avatar url added another superfluous slash
after the instance url which resulted in the avatar
not being able to load.
https://github.com/owncloud/web/issues/4610
https://github.com/owncloud/web/pull/4849
| owncloud/web/changelog/3.0.0_2021-04-21/bugfix-avatar-url/0 | {
"file_path": "owncloud/web/changelog/3.0.0_2021-04-21/bugfix-avatar-url",
"repo_id": "owncloud",
"token_count": 69
} | 616 |
Bugfix: Display navigation for resolved private link
We've fixed that the navigation in the left sidebar is visible for a resolved private link as well
https://github.com/owncloud/web/pull/5023 | owncloud/web/changelog/3.1.0_2021-05-12/bugfix-navigation-in-private-links/0 | {
"file_path": "owncloud/web/changelog/3.1.0_2021-05-12/bugfix-navigation-in-private-links",
"repo_id": "owncloud",
"token_count": 47
} | 617 |
Enhancement: Configure previews
We introduced a new config option to configure which file will be previewed.
To do so, add `"options.previewFileExtensions": ["jpg", "txt"]` in the config.json file.
https://github.com/owncloud/web/pull/5159
https://github.com/owncloud/web/issues/5079
| owncloud/web/changelog/3.2.0_2021-05-31/enhancement-file-previews/0 | {
"file_path": "owncloud/web/changelog/3.2.0_2021-05-31/enhancement-file-previews",
"repo_id": "owncloud",
"token_count": 88
} | 618 |
Bugfix: prevent `fileTypeIcon` to throw a TypeError
The function would die with `TypeError: file.extension.toLowerCase is not a function` if `file.extension` was set to something that is not a string.
https://github.com/owncloud/web/pull/5253
| owncloud/web/changelog/3.3.0_2021-06-23/bugfix-typeerror-fileTypeIcon/0 | {
"file_path": "owncloud/web/changelog/3.3.0_2021-06-23/bugfix-typeerror-fileTypeIcon",
"repo_id": "owncloud",
"token_count": 73
} | 619 |
Enhancement: Enable focus trap in oc-modal
After the recent changes in ODS, the oc-modal can now use
a focus-trap which is a feature needed for accessibility-reasons.
https://github.com/owncloud/web/pull/5013
| owncloud/web/changelog/3.3.0_2021-06-23/enhancement-focustrap-in-modal/0 | {
"file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-focustrap-in-modal",
"repo_id": "owncloud",
"token_count": 67
} | 620 |
Enhancement: Update ownCloud Design System to v7.4.2
We've updated ownCloud Design System to version 7.4.2 to bring the new pagination component.
https://github.com/owncloud/owncloud-design-system/releases/tag/v7.4.1
https://github.com/owncloud/owncloud-design-system/releases/tag/v7.4.2
https://github.com/owncloud/web/pull/5224
https://github.com/owncloud/web/pull/5292
https://github.com/owncloud/web/pull/5319
| owncloud/web/changelog/3.3.0_2021-06-23/enhancement-update-ods-7.4.2/0 | {
"file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-update-ods-7.4.2",
"repo_id": "owncloud",
"token_count": 146
} | 621 |
Bugfix: Check names also for folders or files that currently are not visible
We've changed the way how web checks if a file or folder exists.
From now on it also include files from the current folder that actually are not visible.
This was problematic in situations like the pagination, where a file or folder was not
available in the current set of resources and the user tried to create a folder with the same name.
https://github.com/owncloud/web/pull/5583
| owncloud/web/changelog/4.0.0_2021-08-04/bugfix-name-checks-with-pagination/0 | {
"file_path": "owncloud/web/changelog/4.0.0_2021-08-04/bugfix-name-checks-with-pagination",
"repo_id": "owncloud",
"token_count": 108
} | 622 |
Bugfix: load folder in Media viewer
We've fixed the loading of a folder in the Media viewer extension.
If a user reloads the Media viewer now, it load all the medias both in private and public context.
https://github.com/owncloud/web/issues/5427
https://github.com/owncloud/web/pull/5585
https://github.com/owncloud/web/pull/5710
| owncloud/web/changelog/4.1.0_2021-08-20/bugfix-load-folder-in-media-viewer/0 | {
"file_path": "owncloud/web/changelog/4.1.0_2021-08-20/bugfix-load-folder-in-media-viewer",
"repo_id": "owncloud",
"token_count": 98
} | 623 |
Enhancement: Update ODS to 10.0.0
We updated the ownCloud Design System to version 10.0.0. Please refer to the full changelog in the ODS release (linked) for more details. Summary:
- Bugfix - Fix search for options provided as objects: https://github.com/owncloud/owncloud-design-system/pull/1602
- Bugfix - Contextmenu button triggered wrong event: https://github.com/owncloud/owncloud-design-system/pull/1610
- Bugfix - Use pointer cursor for OcSelect actions: https://github.com/owncloud/owncloud-design-system/pull/1604
- Bugfix - Reset droptarget background color in OcTableFiles: https://github.com/owncloud/owncloud-design-system/pull/1625
- Enhancement - OcTableFiles Contextmenu Tooltip: https://github.com/owncloud/owncloud-design-system/pull/1610
- Enhancement - Highlight droptarget in OcTableFiles: https://github.com/owncloud/owncloud-design-system/pull/1610
- Enhancement - Remove "Showdetails" button in OcTableFiles: https://github.com/owncloud/owncloud-design-system/pull/1610
- Enhancement - Switch filesize calculation base: https://github.com/owncloud/owncloud-design-system/pull/1598
- Change - Use route query to store active page: https://github.com/owncloud/owncloud-design-system/pull/1626
- Change - Refactor OcAvatarGroup and rename to OcAvatars: https://github.com/owncloud/owncloud-design-system/pull/5736
- Change - Add label prop to OcSelect: https://github.com/owncloud/owncloud-design-system/pull/1633
https://github.com/owncloud/web/pull/5725
https://github.com/owncloud/web/pull/5769
https://github.com/owncloud/owncloud-design-system/releases/tag/v9.3.0
https://github.com/owncloud/owncloud-design-system/releases/tag/v10.0.0
| owncloud/web/changelog/4.2.0_2021-09-14/enhancement-update-ods/0 | {
"file_path": "owncloud/web/changelog/4.2.0_2021-09-14/enhancement-update-ods",
"repo_id": "owncloud",
"token_count": 515
} | 624 |
Enhancement: Datepicker in Dropdown
We have moved the datepicker for share expiration in the right sidebar into
a dropdown to align it with the other elements when creating/editing shares.
https://github.com/owncloud/web/pull/5806
| owncloud/web/changelog/4.4.0_2021-10-26/enhancement-datepicker-dropdown/0 | {
"file_path": "owncloud/web/changelog/4.4.0_2021-10-26/enhancement-datepicker-dropdown",
"repo_id": "owncloud",
"token_count": 64
} | 625 |
Enhancement: Implement breadcrumb context menu
The last element of the breadcrumb now has a context menu which gives the user the possibility to perform actions on the current folder.
https://github.com/owncloud/web/pull/6044
https://github.com/owncloud/web/issues/6030
| owncloud/web/changelog/4.6.0_2021-12-07/enhancement-breadcrumb-context-menu/0 | {
"file_path": "owncloud/web/changelog/4.6.0_2021-12-07/enhancement-breadcrumb-context-menu",
"repo_id": "owncloud",
"token_count": 73
} | 626 |
Bugfix: Context for dates in SideBar
We fixed dates in sidebar file info having no context.
The sidebar is either showing the last modification date or the deletion date.
Before this change it wasn't obvious what kind of date was showing. Especially
when the file list was showing a completely different date (e.g., a share date)
it was confusing to the user to see a possibly different date here without explanation.
https://github.com/owncloud/web/issues/5068
https://github.com/owncloud/web/pull/6119
| owncloud/web/changelog/4.7.0_2021-12-16/bugfix-sidebar-dates/0 | {
"file_path": "owncloud/web/changelog/4.7.0_2021-12-16/bugfix-sidebar-dates",
"repo_id": "owncloud",
"token_count": 124
} | 627 |
Bugfix: Add and remove to/from favorites
We've fixed bugs related to adding and removing files to/from favorites:
- "favorite" star button in the right sidebar of the files app was not being updated when the favorite-state was modified through a click on the star icon
- toggling the favorites state of the current folder was broken (via both context menu on current folder and right sidebar without a file selection)
https://github.com/owncloud/web/issues/6328
https://github.com/owncloud/web/pull/6330
| owncloud/web/changelog/5.0.0_2022-02-14/bugfix-favorite-action/0 | {
"file_path": "owncloud/web/changelog/5.0.0_2022-02-14/bugfix-favorite-action",
"repo_id": "owncloud",
"token_count": 124
} | 628 |
Enhancement: Darkmode theme switcher
We've added a theme switcher and now initialize the user interface theme based on the user's browser preferences.
It also gets saved to the localstorage of the browser so the user's preference gets saved locally.
https://github.com/owncloud/web/issues/6242
https://github.com/owncloud/web/pull/6240
https://github.com/owncloud/web/pull/6350
| owncloud/web/changelog/5.0.0_2022-02-14/enhancement-darkmode-themeswitcher/0 | {
"file_path": "owncloud/web/changelog/5.0.0_2022-02-14/enhancement-darkmode-themeswitcher",
"repo_id": "owncloud",
"token_count": 104
} | 629 |
Enhancement: Update SDK
We've updated the ownCloud SDK to version 2.0.0.
- Change - Drop Internet Explorer support: https://github.com/owncloud/owncloud-sdk/pull/966
- Change - Pass full file or directory path to methods of Files class: https://github.com/owncloud/owncloud-sdk/pull/971
- Change - Remove webdav v1 api support: https://github.com/owncloud/owncloud-sdk/pull/962
- Change - Use peerDependencies instead of dependencies: https://github.com/owncloud/owncloud-sdk/pull/979
- Bugfix - Graceful reject for failing network request in OCS: https://github.com/owncloud/owncloud-sdk/pull/977
https://github.com/owncloud/web/pull/6309
https://github.com/owncloud/web/pull/6287
https://github.com/owncloud/owncloud-sdk/releases/tag/v1.1.2
https://github.com/owncloud/owncloud-sdk/releases/tag/v2.0.0
| owncloud/web/changelog/5.0.0_2022-02-14/enhancement-update-sdk/0 | {
"file_path": "owncloud/web/changelog/5.0.0_2022-02-14/enhancement-update-sdk",
"repo_id": "owncloud",
"token_count": 274
} | 630 |
Enhancement: Run web as oc10 sidecar
We've added the option to run web in oc10 sidecar mode.
Copy `config/config.json.sample-oc10` to `config/config.json`, run `yarn server` and then `docker compose up oc10`.
https://github.com/owncloud/web/issues/6363
| owncloud/web/changelog/5.2.0_2022-03-03/enhancement-sidecar-mode/0 | {
"file_path": "owncloud/web/changelog/5.2.0_2022-03-03/enhancement-sidecar-mode",
"repo_id": "owncloud",
"token_count": 86
} | 631 |
Bugfix: Prevent cross-site scripting attack while displaying space description
We've added a new package that strips out possible XSS attack code while displaying the space description
https://github.com/owncloud/web/pull/6523
https://github.com/owncloud/web/issues/6526
| owncloud/web/changelog/5.3.0_2022-03-23/bugfix-space-description-xss-vulnerabilities/0 | {
"file_path": "owncloud/web/changelog/5.3.0_2022-03-23/bugfix-space-description-xss-vulnerabilities",
"repo_id": "owncloud",
"token_count": 68
} | 632 |
Enhancement: Share inheritance indicators
We've implemented the share inheritance indicators in the share sidebar panel. They indicate whether a resource is shared indirectly via one of its parent folders.
https://github.com/owncloud/web/pull/6613
https://github.com/owncloud/web/issues/6528
| owncloud/web/changelog/5.3.0_2022-03-23/enhancement-share-inheritance-indicators/0 | {
"file_path": "owncloud/web/changelog/5.3.0_2022-03-23/enhancement-share-inheritance-indicators",
"repo_id": "owncloud",
"token_count": 71
} | 633 |
Bugfix: Hide sidebar toggle button on spaces projects page
We have hidden the sidebar toggle button on the spaces projects page to avoid user confusion.
https://github.com/owncloud/web/pull/6690
| owncloud/web/changelog/5.4.0_2022-04-11/bugfix-hide-sidebartoggle-spaces-projects-page/0 | {
"file_path": "owncloud/web/changelog/5.4.0_2022-04-11/bugfix-hide-sidebartoggle-spaces-projects-page",
"repo_id": "owncloud",
"token_count": 48
} | 634 |
Enhancement: Rename mediaviewer to preview
We've renamed the media-viewer app to preview because that describes the purpose of the app better and doesn't mislead users into thinking that it's a full blown media viewer.
For the time being we've added an app alias handling to ownCloud Web which prints a deprecation warning if the preview app is tried to be loaded as `media-viewer`.
https://github.com/owncloud/web/pull/6514
| owncloud/web/changelog/5.4.0_2022-04-11/enhancement-rename-mediaviewer/0 | {
"file_path": "owncloud/web/changelog/5.4.0_2022-04-11/enhancement-rename-mediaviewer",
"repo_id": "owncloud",
"token_count": 107
} | 635 |
Bugfix: Enable optional chaining on configuration options access
We've optional chaining on configuration options access to prevent unwanted access on
undefined properties which might cause errors.
https://github.com/owncloud/web/pull/6891
| owncloud/web/changelog/5.5.0_2022-06-20/bugfix-configuration-options-optional-chaining/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-configuration-options-optional-chaining",
"repo_id": "owncloud",
"token_count": 54
} | 636 |
Bugfix: Search mess up spaces overview
We've fixed a bug where searching for a file in the search bar messes up the spaces overview and instead of listing
the spaces, and found files according to the search term were shown.
https://github.com/owncloud/web/pull/7014
https://github.com/owncloud/web/issues/6995
| owncloud/web/changelog/5.5.0_2022-06-20/bugfix-search-mess-up-spaces-overview/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-search-mess-up-spaces-overview",
"repo_id": "owncloud",
"token_count": 83
} | 637 |
Bugfix: Complete-state of the upload overlay
We've fixed a bug where the complete-state of the upload overlay would show before the upload even started.
https://github.com/owncloud/web/pull/7100
https://github.com/owncloud/web/issues/7097
| owncloud/web/changelog/5.5.0_2022-06-20/bugfix-upload-overlay-complete-state/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-upload-overlay-complete-state",
"repo_id": "owncloud",
"token_count": 68
} | 638 |
Enhancement: Enable Drag&Drop and keyboard shortcuts for all views
We've enabled drag&drop move and keyboard shortcut copy/cut/paste
for publicFiles, sharedResource and spaces.
https://github.com/owncloud/web/issues/7122
https://github.com/owncloud/web/pull/7126 | owncloud/web/changelog/5.5.0_2022-06-20/enhancement-enable-drag-drop-shortcuts-all-views/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-enable-drag-drop-shortcuts-all-views",
"repo_id": "owncloud",
"token_count": 74
} | 639 |
Enhancement: Get rid of the integration tests
We've decided to get rid of our integration test suite.
Our unit and e2e tests get better and better with each release and have now reached the point where they can replace the integration tests.
https://github.com/owncloud/web/pull/6863
| owncloud/web/changelog/5.5.0_2022-06-20/enhancement-remove-integration-tests/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-remove-integration-tests",
"repo_id": "owncloud",
"token_count": 71
} | 640 |
Enhancement: Indeterminate progress bar in upload overlay
We've added an indeterminate state to the progress bar in the upload overlay as long as the upload is preparing.
https://github.com/owncloud/web/pull/7123
https://github.com/owncloud/web/issues/7105
| owncloud/web/changelog/5.5.0_2022-06-20/enhancement-upload-overlay-indeterminate-progress/0 | {
"file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-upload-overlay-indeterminate-progress",
"repo_id": "owncloud",
"token_count": 72
} | 641 |
Bugfix: Expiration date picker with long language codes
We've fixed a bug where the expiration date picker in the sharing sidebar wouldn't open if the user selected a language with long language code, e.g. de_DE.
https://github.com/owncloud/web/issues/7622
https://github.com/owncloud/web/pull/7623
| owncloud/web/changelog/5.7.0_2022-09-09/bugfix-expiration-date-de_DE/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-expiration-date-de_DE",
"repo_id": "owncloud",
"token_count": 85
} | 642 |
Bugfix: Logout deleted user on page reload
A user that gets disabled or deleted in the backend now sees an authentication error page upon page reload.
From there they can now properly reach the login page to log in again via a different user (or leave the page entirely).
https://github.com/owncloud/web/issues/4677
https://github.com/owncloud/web/issues/4564
https://github.com/owncloud/web/issues/4795
https://github.com/owncloud/web/pull/7072
| owncloud/web/changelog/5.7.0_2022-09-09/bugfix-logout-deleted-user/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-logout-deleted-user",
"repo_id": "owncloud",
"token_count": 124
} | 643 |
Bugfix: Redirect after removing self from space members
When a user removes themselves from the members of a project space we now properly redirect to the project spaces overviewe page instead of showing an error message.
https://github.com/owncloud/web/issues/7534
https://github.com/owncloud/web/pull/7576
| owncloud/web/changelog/5.7.0_2022-09-09/bugfix-redirect-space-access-removal/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-redirect-space-access-removal",
"repo_id": "owncloud",
"token_count": 77
} | 644 |
Bugfix: Stuck After Session Expired
We've fixed exit link to redirect to login once session expires
We've removed the logout click handler and created a new logout component
https://github.com/owncloud/web/issues/7453
https://github.com/owncloud/web/pull/7491
| owncloud/web/changelog/5.7.0_2022-09-09/bugfix-stuck-after-session-expired/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-stuck-after-session-expired",
"repo_id": "owncloud",
"token_count": 74
} | 645 |
Enhancement: Add change own password dialog to the account info page
We have added a new change own password dialog to the account info page,
so the user has the possibility to change their own password.
https://github.com/owncloud/web/pull/7206
https://github.com/owncloud/web/issues/7183
| owncloud/web/changelog/5.7.0_2022-09-09/enhancement-change-own-password/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-change-own-password",
"repo_id": "owncloud",
"token_count": 78
} | 646 |
Enhancement: Reposition notifications
We've repositioned the notifications to no longer block the searchbar - they are now in the bottom right corner, above the (possibly visible) upload information.
It has also been redesigned to better fit the overall design.
https://github.com/owncloud/web/pull/7139
https://github.com/owncloud/web/issues/7082
| owncloud/web/changelog/5.7.0_2022-09-09/enhancement-reposition-notifications/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-reposition-notifications",
"repo_id": "owncloud",
"token_count": 89
} | 647 |
Enhancement: Introduce group assignments
We have added a new quick action in the user management where the user can be assigned to groups.
https://github.com/owncloud/web/pull/7176
https://github.com/owncloud/web/issues/6678
| owncloud/web/changelog/5.7.0_2022-09-09/enhancement-user-management-group-assignments/0 | {
"file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-user-management-group-assignments",
"repo_id": "owncloud",
"token_count": 64
} | 648 |
Bugfix: Hide share indicators on public page
Share indicators are now being hidden on public link pages.
https://github.com/owncloud/web/pull/7889
https://github.com/owncloud/web/issues/7888
| owncloud/web/changelog/6.0.0_2022-11-29/bugfix-hide-share-indicators-on-public-page/0 | {
"file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-hide-share-indicators-on-public-page",
"repo_id": "owncloud",
"token_count": 56
} | 649 |
Bugfix: Search bar on small screens
We've fixed the display of the search bar on small screens.
https://github.com/owncloud/web/pull/7675
https://github.com/owncloud/web/issues/7617
| owncloud/web/changelog/6.0.0_2022-11-29/bugfix-search-bar-on-small-screens/0 | {
"file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-search-bar-on-small-screens",
"repo_id": "owncloud",
"token_count": 57
} | 650 |
Bugfix: Prevent unnecessary request when saving a user
We've fixed a bug where changing the role of a user without changing any other data would cause an unnecessary request.
https://github.com/owncloud/web/issues/8011
https://github.com/owncloud/web/pull/8013
| owncloud/web/changelog/6.0.0_2022-11-29/bugfix-user-save-without-change/0 | {
"file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-user-save-without-change",
"repo_id": "owncloud",
"token_count": 69
} | 651 |
Enhancement: Id based routing
We now include fileIds in the URL query to be able to
- resolve files and spaces correctly and
- resolve the correct relative path of a file if it was changed (this might be the case for bookmarks)
The fileIds in the URL can be disabled by setting `options.routing.idBased` to `false` in the `config.json`.
Note: It's recommended to keep the default of fileIds being used in routing. Otherwise it's not possible
to resolve spaces with name clashes correctly.
https://github.com/owncloud/web/issues/6247
https://github.com/owncloud/web/pull/7725
https://github.com/owncloud/web/issues/7714
https://github.com/owncloud/web/issues/7715
https://github.com/owncloud/web/pull/7797
| owncloud/web/changelog/6.0.0_2022-11-29/enhancement-id-based-routing/0 | {
"file_path": "owncloud/web/changelog/6.0.0_2022-11-29/enhancement-id-based-routing",
"repo_id": "owncloud",
"token_count": 204
} | 652 |
Bugfix: Calendar popup position in right sidebar
The position of the calendar popup in the right sidebar has been fixed when using small screens.
https://github.com/owncloud/web/issues/7513
https://github.com/owncloud/web/pull/8909
| owncloud/web/changelog/7.0.0_2023-06-02/bugfix-calendar-popup-position-in-sidebar/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-calendar-popup-position-in-sidebar",
"repo_id": "owncloud",
"token_count": 63
} | 653 |
Bugfix: Infinite login redirect
We've fixed a bug where a user would fall into an infinite redirect between login and accessDenied page if a) the user had valid IdP credentials but was not permitted in ocis, b) the user has authenticated successfully but then got deleted in the meantime.
https://github.com/owncloud/web/issues/8928
https://github.com/owncloud/web/issues/7354
https://github.com/owncloud/web/issues/4677
https://github.com/owncloud/web/pull/8947
| owncloud/web/changelog/7.0.0_2023-06-02/bugfix-infinite-login-redirect/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-infinite-login-redirect",
"repo_id": "owncloud",
"token_count": 129
} | 654 |
Bugfix: Accessing route in admin-settings with insufficient permissions
Each route in the admin-settings app now has a dedicated permission check. This fixes an issue where accessing such route with insufficient permissions would break the page.
https://github.com/owncloud/web/issues/8434
https://github.com/owncloud/web/pull/8672
| owncloud/web/changelog/7.0.0_2023-06-02/bugfix-permission-check-admin-settings-routes/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-permission-check-admin-settings-routes",
"repo_id": "owncloud",
"token_count": 80
} | 655 |
Bugfix: Share indicator loading after pasting resources
Share indicators are now being displayed correctly after pasting resources into shared folders.
https://github.com/owncloud/web/issues/9030
https://github.com/owncloud/web/pull/9110
| owncloud/web/changelog/7.0.0_2023-06-02/bugfix-share-indicator-after-pasting/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-share-indicator-after-pasting",
"repo_id": "owncloud",
"token_count": 61
} | 656 |
Change: Remove permission manager
BREAKING CHANGE for developers: The `PermissionManager` has been removed. Permission management is now being handled by `CASL`. For more details on how it works please see the linked PR down below.
https://github.com/owncloud/web/pull/8431
https://github.com/owncloud/web/pull/8488
https://github.com/owncloud/web/pull/8509
| owncloud/web/changelog/7.0.0_2023-06-02/change-remove-permission-manager/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/change-remove-permission-manager",
"repo_id": "owncloud",
"token_count": 102
} | 657 |
Enhancement: Admin settings groups members panel
We've added the members panel to the groups page in admin settings.
https://github.com/owncloud/web/pull/8826
https://github.com/owncloud/web/issues/8596
| owncloud/web/changelog/7.0.0_2023-06-02/enhancement-admin-settings-groups-add-members-panel/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-admin-settings-groups-add-members-panel",
"repo_id": "owncloud",
"token_count": 59
} | 658 |
Enhancement: Disable change password capability
We've added the functionality to disable the change password button in the account page via capability,
this can be set via env variable FRONTEND_LDAP_SERVER_WRITE_ENABLED.
https://github.com/owncloud/web/pull/9070
https://github.com/owncloud/web/issues/9060
| owncloud/web/changelog/7.0.0_2023-06-02/enhancement-disable-change-password-via-capability/0 | {
"file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-disable-change-password-via-capability",
"repo_id": "owncloud",
"token_count": 87
} | 659 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.