text
stringlengths
1
2.83M
id
stringlengths
16
152
metadata
dict
__index_level_0__
int64
0
949
import SymbolPalette from '../js/features/symbol-palette/components/symbol-palette' export const Interactive = args => { return ( <div style={{ maxWidth: 700, marginTop: 120 }}> <SymbolPalette {...args} /> </div> ) } export default { title: 'Symbol Palette', component: SymbolPalette, args: { show: true, }, argTypes: { handleSelect: { action: 'handleSelect' }, }, }
overleaf/web/frontend/stories/symbol-palette.stories.js/0
{ "file_path": "overleaf/web/frontend/stories/symbol-palette.stories.js", "repo_id": "overleaf", "token_count": 153 }
538
/* v2 CMS Generated Pages, including About and Blog */ .cms-page { padding-bottom: 0; img { height: auto; max-width: 100%; } .btn-description { margin-right: @margin-sm; } /* Tabs */ .tab-content { padding: 0; width: 100%; } /* When on preview mode */ .cms-preview { background-color: @blue; color: white; font-weight: bold; height: @navbar-padding-vertical; left: 0; line-height: @navbar-padding-vertical; opacity: 0.8; position: fixed; text-align: center; top: 0; width: 100%; z-index: 1; &:after { content: 'Preview'; width: 100%; top: 0; left: 0; } } .tab-pane { .row:first-child { margin-top: 0; } } /* quotes */ blockquote { margin: 0; /* type.less sets <p> inline, so that quotation mark is inline but sometimes we have multiple <p>, so hide quotation mark from type.less and add one here */ &:before { /* hide quotation from type.less */ display: none; } p { display: block; } p:first-child { /* below copied from type.less */ &:before { content: open-quote; font-size: @blockquote-font-size * 3; color: @blockquote-border-color; margin-right: 0.25em; vertical-align: -0.4em; line-height: 0.1em; } } } .quote-full-width { img { margin-right: @margin-sm; margin-bottom: @margin-sm; } } /* Tables */ .table-styled { overflow: hidden; overflow-x: auto; table { background: white; max-width: none; th, td { border: 1px solid @gray-lighter; padding: @padding-sm; text-align: center; word-break: normal; } } } .table-styled, .features-table { .fa-check-square, .fa-check { color: @ol-green; } } .features-table { max-width: none; th, td { border: 1px solid @gray-lighter; hyphens: auto; padding: @padding-sm; text-align: center; } th, td { width: 20%; } .btn { max-width: 100%; white-space: pre-wrap; word-wrap: break-word; } &.left-align-first-col { td, th { text-align: left; } td + td, th + th { text-align: center; } } .hidden-row-above-xs { display: none; } @media screen and (max-width: @screen-xs-max) { tbody, thead { display: block; } tr { display: flex; flex-flow: row wrap; justify-content: space-around; } td, th { display: block; width: 25%; } tr:first-child { th { width: 50%; } th:first-child { width: 100%; } } td:first-child { text-align: center; width: 100%; } .hidden-row-xs { display: none; } .hidden-row-above-xs { display: flex; } .table-header { text-align: center; } } } /* universities page */ #universities-container { padding: @padding-md; width: 100%; .row { border-bottom: 1px solid @gray-lightest; div { padding: @padding-md; vertical-align: middle; } } .row:first-child { // parent container contains padding div { padding-top: 0; } } .row:last-child { border: 0; // parent container contains padding div { border: 0; padding-bottom: 0; } } p { margin: 0 auto; width: 100%; } // Logos .uni-logo { margin: 0 auto; max-height: 55px; min-width: 55px; } .university-claim-btn { text-align: center; } @media only screen and (min-width: @screen-xs-min) { display: table; table-layout: fixed; .row { display: table-row; div { border-bottom: 1px solid @gray-lightest; display: table-cell; float: none; } } } } /* videos */ video { height: auto; max-width: 100%; } }
overleaf/web/frontend/stylesheets/app/cms-page.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/cms-page.less", "repo_id": "overleaf", "token_count": 2185 }
539
.publishedDetails { color: @gray; }
overleaf/web/frontend/stylesheets/app/editor/publish-template.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/editor/publish-template.less", "repo_id": "overleaf", "token_count": 14 }
540
#metrics { max-width: none; padding: 0 30px; width: auto; svg.nvd3-svg { width: 100%; } .overbox { margin: 0; padding: 40px 20px; background: #fff; border: 1px solid #dfdfdf; .box { padding-bottom: 30px; overflow: hidden; margin-bottom: 40px; border-bottom: 1px solid rgb(216, 216, 216); .header { margin-bottom: 20px; h4 { font-size: 19px; margin: 0; } } } } .print-button { margin-right: 10px; font-size: 20px; } .title-button { margin-right: 5px; font-size: 20px; } .metric-col { padding: 15px; } .metric-header-container { h4 { margin-bottom: 0; } } svg { display: block; height: 250px; text { font-family: 'Open Sans', sans-serif; } &:not(:root) { overflow: visible; } &.hidden-legend-margin-fix { margin-top: 15px; height: 235px; } &.no-fill-opacity { .nvd3 { .nv-area { fill-opacity: 1; } } } } .nvtooltip { z-index: 10; } // BEGIN: Metrics header .metric-header-container { > h4 { margin-top: 0; margin-bottom: 0; } .metric-tooltip { top: -1em; font-size: 0.5em; } } // END: Metrics header // BEGIN: Metrics footer .metric-footer-container { text-align: center; } // END: Metrics footer // BEGIN: Metrics overlays .metric-overlay-loading, .metric-overlay-error, .metric-overlay-backdrop { position: absolute; top: 0; left: 0; height: 100%; width: 100%; padding: 16px; /* 15px of .metric-col padding + 1px border */ padding-top: 56px; /* Same as above + 30px for title + 10px overbox padding*/ } .metric-overlay-loading { padding: 175px 20%; } .metric-overlay-error { display: none; text-align: center; padding-top: 175px; } .metric-overlay-backdrop { opacity: 0.5; } .metric-overlay-backdrop-inner { background-color: #fff; width: 100%; height: 100%; } // END: Metrics overlays } #metrics-header { @media (min-width: 1200px) { margin-bottom: 30px; } #csv { padding-right: 10px; } h3 { display: inline-block; } .section_header { margin-bottom: 0; } #filters-container { text-align: right; .by { color: #989898; font-style: italic; } } #lags-container { .dropdown-menu { min-width: 0; } } #dates-container { display: inline-block; .daterangepicker { margin-right: 15px; } #metrics-dates { padding: 0; } } } #metrics-footer { margin-top: 30px; text-align: center; } body.print-loading { #metrics { .metric-col { opacity: 0.5; } } }
overleaf/web/frontend/stylesheets/app/metrics.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/metrics.less", "repo_id": "overleaf", "token_count": 1371 }
541
.template-page-header { padding-top: unit(@line-height-base, rem); h1, h2 { margin-top: 6px; margin-right: @line-height-base * 5; line-height: 1; } } .template-thumbnail { .thumbnail { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); img { width: 100%; } } a { padding: 0px; h3 { color: @link-color; margin: 10px 0px 10px 20px; } } .caption { background: lighten(@gray-lightest, 3%); border-top: 1px solid #ddd; } } .template-section-header:extend(.page-header) { margin-top: 0px; } .download-buttons, .social_buttons { padding-top: 20px; } .sample-template { -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); } .template-details-section { padding-bottom: 20px; .btn { margin-left: 6px; } } .searchResult { h1 { color: @link-color; } img { max-width: 100%; height: auto; } } .template-large-pdf-preview { img { max-width: 100%; } }
overleaf/web/frontend/stylesheets/app/templates.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/app/templates.less", "repo_id": "overleaf", "token_count": 509 }
542
.embed-responsive { display: block; height: 0; overflow: hidden; padding: 0; position: relative; } .embed-responsive .embed-responsive-item, .embed-responsive iframe, .embed-responsive embed, .embed-responsive object, .embed-responsive video { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; height: 100%; border: 0; } .embed-responsive-16by9 { padding-bottom: 56.25% !important; } .embed-responsive-4by3 { padding-bottom: 75% !important; }
overleaf/web/frontend/stylesheets/components/embed-responsive.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/embed-responsive.less", "repo_id": "overleaf", "token_count": 171 }
543
// // Modals // -------------------------------------------------- // .modal-open - body class for killing the scroll // .modal - container to scroll within // .modal-dialog - positioning shell for the actual modal // .modal-content - actual modal w/ bg and corners and shit // Kill the scroll on the body .modal-open { overflow: hidden; } // Container that the modal scrolls within .modal { display: none; overflow: auto; overflow-y: scroll; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: @zindex-modal; -webkit-overflow-scrolling: touch; // Prevent Chrome on Windows from adding a focus outline. For details, see // https://github.com/twbs/bootstrap/pull/10951. outline: 0; // When fading in the modal, animate it to slide down &.fade .modal-dialog { .translate(0, -25%); .transition-transform(~'0.3s ease-out'); } &.in .modal-dialog { // prettier-ignore .translate(0, 0); } } // Shell div to position the modal with bottom padding .modal-dialog { position: relative; width: auto; margin: 10px; } // Actual modal .modal-content { position: relative; background-color: @modal-content-bg; border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc) border: 1px solid @modal-content-border-color; border-radius: @border-radius-large; .box-shadow(0 3px 9px rgba(0, 0, 0, 0.5)); background-clip: padding-box; // Remove focus outline from opened modal outline: none; } // Modal background .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: @zindex-modal-background; background-color: @modal-backdrop-bg; // Fade for backdrop &.fade { .opacity(0); } &.in { .opacity(@modal-backdrop-opacity); } } // Modal header // Top section of the modal w/ title and dismiss .modal-header { padding: @modal-title-padding; border-bottom: 1px solid @modal-header-border-color; min-height: (@modal-title-padding + @modal-title-line-height); } // Close icon .modal-header .close { margin-top: -2px; } .modal-header { h1, h2, h3, h4, h5 { margin: 0; font-family: @font-family-sans-serif; font-weight: 700; } } // Title text within header .modal-title { margin: 0; line-height: @modal-title-line-height; } // Modal body // Where all modal content resides (sibling of .modal-header and .modal-footer) .modal-body { position: relative; padding: @modal-inner-padding; } // Footer (for actions) .modal-footer { //margin-top: 15px; padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding; text-align: right; // right align buttons border-top: 1px solid @modal-footer-border-color; background-color: @modal-footer-background-color; border-radius: 0 0 @border-radius-large @border-radius-large; &:extend(.clearfix all); // clear it in case folks use .pull-* classes on buttons // Properly space out buttons .btn + .btn { margin-left: 5px; margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs } // but override that for button groups .btn-group .btn + .btn { margin-left: -1px; } // and override it for block buttons as well .btn-block + .btn-block { margin-left: 0; } .modal-footer-left { float: left; } } // Scale up the modal @media (min-width: @screen-sm-min) { // Automatically set modal's width for larger viewports .modal-dialog { width: @modal-md; margin: 30px auto; } .modal-content { .box-shadow(0 5px 15px rgba(0, 0, 0, 0.5)); } // Modal sizes .modal-sm { width: @modal-sm; } } @media (min-width: @screen-md-min) { .modal-lg { width: @modal-lg; } }
overleaf/web/frontend/stylesheets/components/modals.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/modals.less", "repo_id": "overleaf", "token_count": 1442 }
544
// // Load core variables and mixins // -------------------------------------------------- @import 'variables.less'; @import 'mixins.less'; // // Buttons // -------------------------------------------------- // Common styles .btn-default, .btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger { text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); @shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); .box-shadow(@shadow); // Reset the shadow &:active, &.active { .box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.125)); } } // Mixin for generating new styles .btn-styles(@btn-color: #555) { // prettier-ignore #gradient > .vertical(@start-color: @btn-color; @end-color: darken(@btn-color, 12%)); .reset-filter( ); // Disable gradients for IE9 because filter bleeds through rounded corners background-repeat: repeat-x; border-color: darken(@btn-color, 14%); &:hover, &:focus { background-color: darken(@btn-color, 12%); background-position: 0 -15px; } &:active, &.active { background-color: darken(@btn-color, 12%); border-color: darken(@btn-color, 14%); } } // Common styles .btn { // Remove the gradient for the pressed/active state &:active, &.active { background-image: none; } } // Apply the mixin to the buttons .btn-default { .btn-styles(@btn-default-bg); text-shadow: 0 1px 0 #fff; border-color: #ccc; } .btn-primary { .btn-styles(@btn-primary-bg); } .btn-success { .btn-styles(@btn-success-bg); } .btn-info { .btn-styles(@btn-info-bg); } .btn-warning { .btn-styles(@btn-warning-bg); } .btn-danger { .btn-styles(@btn-danger-bg); } // // Images // -------------------------------------------------- .thumbnail, .img-thumbnail { .box-shadow(0 1px 2px rgba(0, 0, 0, 0.075)); } // // Dropdowns // -------------------------------------------------- .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { // prettier-ignore #gradient > .vertical( @start-color: @dropdown-link-hover-bg; @end-color: darken(@dropdown-link-hover-bg, 5%) ); background-color: darken(@dropdown-link-hover-bg, 5%); } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { // prettier-ignore #gradient > .vertical( @start-color: @dropdown-link-active-bg; @end-color: darken(@dropdown-link-active-bg, 5%) ); background-color: darken(@dropdown-link-active-bg, 5%); } // // Navbar // -------------------------------------------------- // Default navbar .navbar-default { // prettier-ignore #gradient > .vertical( @start-color: lighten(@navbar-default-bg, 10%) ; @end-color: @navbar-default-bg ); .reset-filter( ); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered border-radius: @navbar-border-radius; @shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); .box-shadow(@shadow); .navbar-nav > .active > a { // prettier-ignore #gradient > .vertical( @start-color: darken(@navbar-default-bg, 5%) ; @end-color: darken(@navbar-default-bg, 2%) ); .box-shadow(inset 0 3px 9px rgba(0, 0, 0, 0.075)); } } .navbar-brand, .navbar-nav > li > a { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); } // Inverted navbar .navbar-inverse { // prettier-ignore #gradient > .vertical( @start-color: lighten(@navbar-inverse-bg, 10%) ; @end-color: @navbar-inverse-bg ); .reset-filter( ); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered .navbar-nav > .active > a { // prettier-ignore #gradient > .vertical( @start-color: @navbar-inverse-bg; @end-color: lighten(@navbar-inverse-bg, 2.5%) ); .box-shadow(inset 0 3px 9px rgba(0, 0, 0, 0.25)); } .navbar-brand, .navbar-nav > li > a { text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } } // Undo rounded corners in static and fixed navbars .navbar-static-top, .navbar-fixed-top, .navbar-fixed-bottom { border-radius: 0; } // // Alerts // -------------------------------------------------- // Common styles .alert { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); @shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); .box-shadow(@shadow); } // Mixin for generating new styles .alert-styles(@color) { // prettier-ignore #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 7.5%)); border-color: darken(@color, 15%); } // Apply the mixin to the alerts .alert-success { .alert-styles(@alert-success-bg); } .alert-info { .alert-styles(@alert-info-bg); } .alert-warning { .alert-styles(@alert-warning-bg); } .alert-danger { .alert-styles(@alert-danger-bg); } // // Progress bars // -------------------------------------------------- // Give the progress background some depth .progress { // prettier-ignore #gradient > .vertical(@start-color: darken(@progress-bg, 4%) ; @end-color: @progress-bg); } // Mixin for generating new styles .progress-bar-styles(@color) { // prettier-ignore #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 10%)); } // Apply the mixin to the progress bars .progress-bar { .progress-bar-styles(@progress-bar-bg); } .progress-bar-success { .progress-bar-styles(@progress-bar-success-bg); } .progress-bar-info { .progress-bar-styles(@progress-bar-info-bg); } .progress-bar-warning { .progress-bar-styles(@progress-bar-warning-bg); } .progress-bar-danger { .progress-bar-styles(@progress-bar-danger-bg); } // // List groups // -------------------------------------------------- .list-group { border-radius: @border-radius-base; .box-shadow(0 1px 2px rgba(0, 0, 0, 0.075)); } .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { text-shadow: 0 -1px 0 darken(@list-group-active-bg, 10%); // prettier-ignore #gradient > .vertical( @start-color: @list-group-active-bg; @end-color: darken(@list-group-active-bg, 7.5%) ); border-color: darken(@list-group-active-border, 7.5%); } // // Panels // -------------------------------------------------- // Common styles .panel { .box-shadow(0 1px 2px rgba(0, 0, 0, 0.05)); } // Mixin for generating new styles .panel-heading-styles(@color) { // prettier-ignore #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 5%)); } // Apply the mixin to the panel headings only .panel-default > .panel-heading { .panel-heading-styles(@panel-default-heading-bg); } .panel-primary > .panel-heading { .panel-heading-styles(@panel-primary-heading-bg); } .panel-success > .panel-heading { .panel-heading-styles(@panel-success-heading-bg); } .panel-info > .panel-heading { .panel-heading-styles(@panel-info-heading-bg); } .panel-warning > .panel-heading { .panel-heading-styles(@panel-warning-heading-bg); } .panel-danger > .panel-heading { .panel-heading-styles(@panel-danger-heading-bg); } // // Wells // -------------------------------------------------- .well { // prettier-ignore #gradient > .vertical(@start-color: darken(@well-bg, 5%) ; @end-color: @well-bg); border-color: darken(@well-bg, 10%); @shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); .box-shadow(@shadow); }
overleaf/web/frontend/stylesheets/components/theme.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/components/theme.less", "repo_id": "overleaf", "token_count": 2903 }
545
// // Utility classes // -------------------------------------------------- // Floats // ------------------------- .clearfix { .clearfix(); } .center-block { .center-block(); } .pull-right { float: right !important; } .pull-left { float: left !important; } // Toggling content // ------------------------- // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { .text-hide(); } // Hide from screenreaders and browsers // // Credit: HTML5 Boilerplate .hidden { display: none !important; visibility: hidden !important; } // For Affix plugin // ------------------------- .affix { position: fixed; }
overleaf/web/frontend/stylesheets/core/utilities.less/0
{ "file_path": "overleaf/web/frontend/stylesheets/core/utilities.less", "repo_id": "overleaf", "token_count": 250 }
546
Locales ======= These files are not to be edited by hand. [OneSky](https://sharelatex.oneskyapp.com/) is used to manage the locales. Please contact us via support@overleaf.com if you want to contribute any changes.
overleaf/web/locales/README.md/0
{ "file_path": "overleaf/web/locales/README.md", "repo_id": "overleaf", "token_count": 64 }
547
{ "address_line_1": "Adress", "address_line_2": "Adress (rad 2, frivilligt)", "postal_code": "Postnummer", "compile_error_description": "Detta projekt kompilerade ej på grund av ett fel", "validation_issue_description": "Detta projekt kompilerade ej på grund av ett valideringsproblem", "compile_error_entry_description": "Ett fel som förhindrade kompilering av detta projekt", "validation_issue_entry_description": "Ett valideringsproblem som förhindrade kompilering av detta projekt", "github_file_name_error": "Ditt projekt innehåller fil(er) med ogiltigt/-a filnamn. Vänligen kontrollera ditt kodförråd och försök igen.", "raw_logs_description": "Ursprungliga loggar från LaTeX-kompilatorn", "raw_logs": "Ursprungliga loggar", "first_error_popup_label": "Detta projekt har fel. Detta är det första.", "dismiss_error_popup": "Avfärda varning om första fel", "go_to_error_location": "Gå till platsen för fel", "other_output_files": "Ladda ner andra utdatafiler", "refresh": "Uppdatera", "toggle_output_files_list": "Visa/Göm listan med utdatafiler", "n_warnings": "__count__ varning", "n_warnings_plural": "__count__ varningar", "n_errors": "__count__ fel", "n_errors_plural": "__count__ fel", "view_pdf": "Visa PDF", "view_logs": "Visa loggar", "recompile_from_scratch": "Återkompilera från början", "tagline_free": "Perfekt för att komma igång", "collabs_per_proj_single": "__collabcount__ medarbetare per projekt", "premium_features": "Premiumfunktioner", "hide_outline": "Göm filstruktur", "show_outline": "Visa filstruktur", "expand": "Expandera", "collapse": "Kontrahera", "file_outline": "Filstruktur", "we_cant_find_any_sections_or_subsections_in_this_file": "Vi kan ej finna några avsnitt eller underavsnitt i denna fil", "wed_love_you_to_stay": "Vi önskar att du stannar", "last_login": "Senaste inloggning", "thank_you_for_being_part_of_our_beta_program": "Tack för att du deltar i vårt betaprogram, där du kan få tidig tillgång till nya funktioner och hjälpa oss att bättre förstå dina behov", "you_will_be_able_to_contact_us_any_time_to_share_your_feedback": "Du kan kontakta oss när som helst för att ge respons", "we_may_also_contact_you_from_time_to_time_by_email_with_a_survey": "Vi kan också kontakta dig då och då via e-post med en undersökning, eller för att se om du vill delta i andra användarundersökningsinitiativ", "you_can_opt_in_and_out_of_the_program_at_any_time_on_this_page": "Du kan när som helst gå med/ur programmet på denna sida", "give_feedback": "Ge respons", "invalid_filename": "Uppladdningen misslyckades: kontrollera att filnamnet inte innehåller specialtecken eller inledande/efterföljande blanksteg", "clsi_unavailable": "Tyvärr var kompileringsservern för ditt projekt tillfälligt otillgänglig. Vänligen försök igen om ett litet tag.", "x_price_per_month": "<0>__price__</0> per månad", "x_price_per_year": "<0>__price__</0> per år", "x_price_for_first_month": "<0>__price__</0> för din första månad", "x_price_for_first_year": "<0>__price__</0> för ditt första år", "x_price_per_month_tax": "<0>__total__</0> (__subtotal__ + __tax__ moms) per månad", "x_price_per_year_tax": "<0>__total__</0> (__subtotal__ + __tax__ moms) per år", "x_price_for_first_month_tax": "<0>__total__</0> (__subtotal__ + __tax__ moms) för din första månad", "x_price_for_first_year_tax": "<0>__total__</0> (__subtotal__ + __tax__ moms) för ditt första år", "normally_x_price_per_month": "Normalt __price__ per månad", "normally_x_price_per_year": "Normalt __price__ per år", "then_x_price_per_month": "Därefter __price__ per månad", "then_x_price_per_year": "Därefter __price__ per år", "template_gallery": "Mallgalleri", "template_not_found_description": "Detta sätt att skapa projekt från mallar har tagits bort. Vänligen besök vårt mallgalleri för att hitta fler mallar.", "dropbox_sync_in": "Uppdaterar Overleaf", "dropbox_sync_out": "Uppdaterar Dropbox", "dropbox_sync_both": "Uppdaterar Overleaf och Dropbox", "dropbox_synced": "Overleaf och Dropbox är aktuella", "dropbox_sync_status_error": "Ett fel har inträffat avseende integrationen med Dropbox", "requesting_password_reset": "Begär återställning av lösenord", "tex_live_version": "TeX Live-version", "company_name": "Företagsnamn", "no_history_available": "Detta projekt har ingen historik än. Gör några ändringar i projektet och försök igen.", "project_approaching_file_limit": "Detta projekt närmar sig gränsen för antalet filer", "recurly_email_updated": "Din e-postadress för fakturering har uppdaterats", "project_has_too_many_files": "Detta projekt har nått gränsen på 2000 filer", "processing_your_request": "Vänligen vänta medan vi behandlar din begäran.", "confirmation_link_broken": "Tyvärr, något är fel med din bekräftelselänk. Vänligen försök kopiera och klistra in länken given längst ner i bekräftelse-e-brevet.", "duplicate_file": "Duplicera fil", "blocked_filename": "Detta filnamn är blockerat", "group_full": "Gruppen är redan full", "no_selection_select_file": "För närvarande är ingen fil vald. Vänligen välj en fil från filträdet.", "no_selection_create_new_file": "Ditt projekt är för närvarande tomt. Vänligen skapa en ny fil.", "files_selected": "filer valda", "this_action_cannot_be_undone": "Denna åtgärd kan inte ångras.", "token_access_success": "Åtkomst beviljad", "token_access_failure": "Kan ej bevilja åtkomst; kontakta projektägaren för hjälp", "trashed_projects": "Kastade projekt", "trash": "Papperskorg", "untrash": "Återskapa", "delete_and_leave": "Radera / Lämna", "trash_projects": "Kasta projekt", "about_to_trash_projects": "Du kommer att kasta följande projekt:", "trashed_projects_info_note": "Overleaf har nu en papperskorg för projekt du vill kasta. Att kasta ett projekt påverkar inte dina medarbetare.", "continue_to": "Fortsätt till __appName__", "project_ownership_transfer_confirmation_1": "Är du säker på att du vill göra <0>__user__</0> till ägaren av <1>__project__</1>?", "change_owner": "Ändra ägare", "change_project_owner": "Ändra projektägare", "password_too_long_please_reset": "Maximal lösenordslängd har överskridits. Vänligen återställ ditt lösenord.", "view_other_options_to_log_in": "Visa andra alternativ för att logga in", "we_logged_you_in": "Vi har loggat in dig.", "will_need_to_log_out_from_and_in_with": "Du måste <b>logga ut</b> från ditt <b>__email1__</b>-konto och sedan logga in med <b>__email2__</b>.", "resubmit_institutional_email": "Vänligen skicka din institutionella e-post-adress igen.", "security_reasons_linked_accts": "Av säkerhetsskäl, eftersom din institutionella e-post-adress redan är kopplat till <b>__email__</b> <b>__appName__</b>, kan vi bara tillåta kontolänkning med det specifika kontot.", "this_grants_access_to_features": "Detta ger dig tillgång till <b>__appName__</b> <b>__featureType__</b>-funktioner.", "to_add_email_accounts_need_to_be_linked": "För att lägga till den här e-post-adressen måste kontona <b>__appName__</b> och <b>__institutionName__</b> länkas.", "tried_to_log_in_with_email": "Du har försökt logga in med <b>__email__</b>.", "tried_to_register_with_email": "Du har försökt att registrera dig med <b>__email__</b> som redan är registrerat med <b>__appName__</b> som ett institutionellt konto.", "log_in_with_email": "Logga in med __email__", "log_in_with_existing_institution_email": "Vänligen logga in med ditt befintliga <b>__appName__</b>-konto för att länka kontot <b>__appName__</b> och det institutionella kontot <b>__institutionName__ </b>.", "log_out_from": "Logga ut från __email__", "logged_in_with_acct_that_cannot_be_linked": "Du har loggat in med ett <b>__appName__</b>-konto som inte kan länkas till ditt institutionskonto.", "logged_in_with_email": "Du är för närvarande inloggad i <b>__appName__</b> med e-postadressen <b>__email__</b>.", "looks_like_logged_in_with_email": "Det ser ut som att du redan är inloggad i <b>__appName__</b> med e-postadressen <b>__email__</b>.", "make_primary_to_log_in_through_institution": "Gör din <b>__email__</b> e-post-adress till primär för att logga in via din institutionsportal. ", "make_primary_which_will_allow_log_in_through_institution": "Att göra det till din <b>primära __appName__</b> e-post-adress gör att du kan logga in via din institutionsportal.", "institutional_login_not_supported": "Ditt universitet stöder ännu inte <b>institutionell inloggning</b>, men du kan fortfarande registrera dig med din institutionella e-post-adress.", "link_account": "Länka konto", "link_accounts": "Länka konton", "link_accounts_and_add_email": "Länka konton och lägg till e-post", "link_your_accounts": "Länka dina konton", "log_in_and_link": "Logga in och länka", "log_in_and_link_accounts": "Logga in och länka konton", "log_in_first_to_proceed": "Du måste först <b>logga in</b> för att fortsätta.", "log_in_through_institution": "Logga in via din institution", "if_have_existing_can_link": "Om du har ett befintligt <b>__appName__</b>-konto för en annan e-post-adress kan du länka det till ditt <b>__institutionName__</b>-konto genom att klicka på <b>__clickText__</b>.", "in_order_to_match_institutional_metadata": "För att matcha dina institutionella metadata har vi länkat ditt konto genom att använda <b>__email__</b>.", "in_order_to_match_institutional_metadata_associated": "För att matcha dina institutionella metadata är ditt konto kopplat till e-post-adressen <b>__email__</b>.", "institution_account_tried_to_add_already_registered": "Det e-post-konto/institutionella konto som du försökte lägga till är <b>redan registrerat</b> i __appName__.", "institution_account_tried_to_add_already_linked": "Denna institution är <b>redan länkad</b> till ditt konto via en annan e-post-adress.", "institution_account_tried_to_add_affiliated_with_another_institution": "Den här e-post-adressen är <b>redan kopplad</b> till ditt konto men anslutet till en annan institution.", "institution_acct_successfully_linked": "Ditt <b>__appName__</b>-konto länkades framgångsrikt till ditt institutionella konto <b>__institutionName__</b>.", "institutional": "Institutionell", "doing_this_allow_log_in_through_institution": "Genom att göra detta kan du logga in på <b>__appName__</b> via din institutionsportal.", "doing_this_will_verify_affiliation_and_allow_log_in": "Genom att göra detta kommer du att verifiera din anslutning till <b>__institutionName__</b> vilket låter dig logga in i <b>__appName__</b> via din institution.", "enter_institution_email_to_log_in": "Ange din institutionella e-postadress för att logga in via din institution.", "find_out_more_about_institution_login": "Läs mer om institutionell inloggning", "get_in_touch_having_problems": "<a href=\"__link__\">Kontakta support</a> om du har problem", "go_back_and_link_accts": "<a href=\"__link__\">Gå tillbaka</a> och länka dina konton", "go_back_and_log_in": "<a href=\"__link__\">Gå tillbaka</a> och logga in igen", "go_back_to_institution": "Gå tillbaka till din institution", "can_link_your_institution_acct": "Du kan nu <b>länka</b> ditt konto <b>__appName__</b> till ditt institutionella konto <b> __institutionName__ </b>.", "can_now_link_to_institution_acct": "Du kan länka ditt <b>__appName__</b>-konto <b>__email__</b> till ditt institutionella konto <b>__institutionName__</b>.", "click_link_to_proceed": "Klicka på <b>__clickText__</b> nedan för att fortsätta.", "continue_with_email": "<a href=\"__link__\">Fortsätt till __appName__</a> med ditt <b>__email__</b>-konto", "create_new_account": "Skapa ett nytt konto", "do_not_have_acct_or_do_not_want_to_link": "Om du inte har ett <b>__appName__</b>-konto, eller om du inte vill länka till ditt <b>__institutionName__</b>-konto, vänligen klicka på <b>__clickText__</b>.", "do_not_link_accounts": "Länka ej konton", "account_has_been_link_to_institution_account": "Ditt __appName__-konto för <b>__email__</b> har länkats till ditt institutionella konto <b>__institutionName__</b>.", "account_with_email_exists": "Det verkar som om ett <b>__appName__</b>-konto med e-post-adressen <b>__email__</b> redan finns.", "acct_linked_to_institution_acct": "Detta kontot är <b>länkat</b> till ditt institutionella konto <b>__institutionName__</b>.", "alternatively_create_new_institution_account": "Alternativt kan du skapa ett <b>nytt konto</b> med din institutions-e-post-adress (<b>__email__</b>) genom att klicka på <b>__clickText__</b>.", "as_a_member_of_sso": "Som medlem i <b>__institutionName__</b> kan du logga in till <b>__appName__</b> via din institutionsportal.", "as_a_member_of_sso_required": "Som medlem i <b>__institutionName__</b> måste du logga in på <b>__appName__</b> via din institutionsportal.", "can_link_institution_email_acct_to_institution_acct": "Du kan nu länka ditt <b>__email__</b> <b>__appName__</b>-konto till ditt <b>__institutionName__</b> institutionella konto.", "can_link_institution_email_acct_to_institution_acct_alt": "Du kan länka ditt <b>__appName__</b>-konto <b>__email__</b> till ditt institutionella konto <b>__institutionName__</b>.", "user_deletion_error": "Tyvärr, något gick fel vid raderingen av ditt konto. Vänligen försök igen om en minut.", "view_your_invoices": "Visa dina fakturor", "payment_provider_unreachable_error": "Tyvärr uppstod ett fel när vi kommunicerade med vår betalningsleverantör. Vänligen försök igen om ett tag.\nOm du använder några annons- eller skriptblockeringstillägg i din webbläsare kan du behöva inaktivera dem tillfälligt.", "plus_upgraded_accounts_receive": "Plus med ett uppgraderat konto får du", "empty_zip_file": "Zip-filen innehåller ingen fil", "you_can_now_login_through_overleaf_sl": "Du kan nu logga in på ditt ShareLaTeX-konto via Overleaf.", "register_error": "Registreringsfel", "login_error": "Inloggningsfel", "more_info": "Mer info", "synctex_failed": "Kunde ej finna motsvarande källfil", "reset_from_sl": "Vänligen återställ ditt lösenord från ShareLaTeX och logga in där för att flytta ditt konto till Overleaf", "dropbox_already_linked_error": "Ditt Dropbox-konto kan inte länkas eftersom det redan är länkat till ett annat Overleaf-konto.", "linked_accounts": "Länkade konton", "linked_accounts_explained": "Du kan länka dina __appName__ konton med andra tjänster för att aktivera funktioner beskrivna nedan", "no_existing_password": "Vänligen använd formuläret för att återställa lösenord för att ange ditt lösenord", " to_reactivate_your_subscription_go_to": "För att återaktivera din prenumeration gå till", "subscription_canceled": "Prenumeration avslutad", "coupons_not_included": "Detta inkluderar ej dina nuvarande rabatter vilka kommer att tillämpas automatiskt före din nästa betalning", "email_already_registered_secondary": "Denna e-postadress är redan registrerad som sekundär e-postadress", "secondary_email_password_reset": "Denna e-postadress är registrerad som sekundär e-postadress. Vänligen ange primär e-postadress för ditt konto.", "if_registered_email_sent": "Om du har ett konto har vi skickat dig ett e-postmeddelande.", "reconfirm_explained": "Vi måste bekräfta ditt konto igen. Vänligen begär en länk för återställning av lösenord via formuläret nedan för att bekräfta ditt konto igen. Om du har några problem med att bekräfta ditt konto, vänligen kontakta oss på", "upload_failed": "Uppladdning misslyckades", "file_too_large": "Fil för stor", "zip_contents_too_large": "Zip-filens innehåll är för stort", "invalid_zip_file": "Ogiltig zip-fil", "make_primary": "Gör primär", "make_email_primary_description": "Gör denna till den primära e-post-adressen som används för att logga in", "unarchive": "Återskapa", "something_went_wrong_canceling_your_subscription": "Något gick fel när vi avslutade din prenumeration. Vänligen kontakta support.", "department": "Avdelning", "notification_features_upgraded_by_affiliation": "Goda nyheter! Din anslutna organisation __institutionName__ har ett partnerskap med Overleaf och du har nu tillgång till alla Overleafs professionella funktioner.", "notification_personal_subscription_not_required_due_to_affiliation": "Goda nyheter! Din anslutna organisation __institutionName__ har ett partnerskap med Overleaf och du har nu tillgång till Overleafs professionella funktioner genom din anslutning. Du kan säga upp din personliga prenumeration utan att förlora åtkomst till någon av dina förmåner.", "github_private_description": "Du kan välja vem som kan se och checka in till detta kodförråd.", "notification_project_invite_accepted_message": "Du har anslutit dig till <b>__projectName__</b>", "subject_to_additional_vat": "Moms kan tillkomma till priser beroende på ditt land.", "select_country_vat": "Vänligen välj ditt land på betalningssidan för att se ditt totala pris, inklusive eventuell moms.", "to_change_access_permissions": "För att ändra åtkomsträttigheter, vänligen fråga projektägaren", "new_snippet_project": "Namnlös", "loading_content": "Skapar projekt", "there_was_an_error_opening_your_content": "Ett fel uppstod när ditt projekt skulle skapas", "sorry_something_went_wrong_opening_the_document_please_try_again": "Tyvärr inträffade ett oväntat fel när du försökte öppna innehållet i Overleaf. Vänligen försök igen.", "the_required_parameters_were_not_supplied": "Länken för att öppna detta innehåll i Overleaf saknade några nödvändiga parametrar. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "more_than_one_kind_of_snippet_was_requested": "Länken för att öppna detta innehåll i Overleaf innehöll några ogiltiga parametrar. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "the_supplied_parameters_were_invalid": "Länken för att öppna detta innehåll i Overleaf innehöll några ogiltiga parametrar. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "unable_to_extract_the_supplied_zip_file": "Det gick inte att öppna detta innehåll i Overleaf eftersom zip-filen inte kunde extraheras. Vänligen se till att det är en giltig zip-fil. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "the_file_supplied_is_of_an_unsupported_type ": "Länken för att öppna detta innehåll i Overleaf pekade på fel typ av fil. Giltiga filtyper är .tex-dokument och .zip-filer. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "the_requested_publisher_was_not_found": "Länken för att öppna detta innehåll i Overleaf angav en utgivare som inte kunde hittas. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "the_supplied_uri_is_invalid": "Länken för att öppna detta innehåll i Overleaf innehöll en ogiltig URI. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "the_requested_conversion_job_was_not_found": "Länken för att öppna detta innehåll i Overleaf angav ett konverteringsjobb som inte kunde hittas. Det är möjligt att jobbet har löpt ut och måste köras igen. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "not_found_error_from_the_supplied_url": "Länken för att öppna detta innehåll i Overleaf pekade på en fil som inte kunde hittas. Om detta fortsätter att hända för länkar på en viss webbplats, vänligen rapportera detta till dem.", "too_many_requests": "Alltför många förfrågningar mottogs på kort tid. Vänligen vänta ett tag och försök igen.", "password_change_passwords_do_not_match": "Lösenorden matchar ej", "history_label_project_current_state": "Nuvarande status", "download_project_at_this_version": "Ladda ner projekt i denna version", "submit": "Skicka", "clear_search": "rensa sökning", "export_csv": "Exportera CSV", "add_comma_separated_emails_help": "Separera flera e-postadresser med kommatecken (,).", "institution_account": "Institutionellt konto", "managers_cannot_remove_admin": "Administratörer kan inte tas bort", "user_not_found": "Användare ej funnen", "user_already_added": "Användare redan tillagd", "bonus_facebook_caption": "Gratis obegränsade projekt och kompileringar", "password_change_failed_attempt": "Ändring av lösenord misslyckades", "password_change_successful": "Lösenord har ändrats", "not_registered": "Ej registrerad", "try_again": "Vänligen försök igen", "email_required": "E-post krävs", "registration_error": "Registreringsfel", "resending_confirmation_email": "Skickar e-postmeddelande med bekräftelse igen", "please_confirm_email": "Vänligen bekräfta din e-postadress __emailAddress__ genom att klicka på länken i bekräftelse-e-posten", "register_using_service": "Registrera via __service__", "login_to_overleaf": "Logga in i Overleaf", "login_with_email": "Logga in med din e-post", "login_with_service": "Logga in med __service__", "first_time_sl_user": "Första gången här som en ShareLaTeX-användare", "migrate_from_sl": "Migrera från ShareLaTeX", "dont_have_account": "Har du inget konto?", "sl_extra_info_tooltip": "Logga in på ShareLaTeX för att flytta ditt konto till Overleaf. Det tar bara några sekunder. Om du har en ShareLaTeX-prenumeration överförs den automatiskt till Overleaf.", "register_using_email": "Registrera med din e-post", "login_register_or": "eller", "to_add_more_collaborators": "För att lägga till fler medarbetare eller aktivera delning av länk, vänligen fråga projektägaren", "by": "av", "editor_theme": "Tema för textredigerare", "overall_theme": "Övergripande tema", "thousands_templates": "Tusentals mallar", "get_instant_access_to": "Få direktåtkomst till", "ask_proj_owner_to_upgrade_for_full_history": "Vänligen fråga projektägaren om uppgradering för att få åtkomst till detta projekts kompletta historik.", "currently_seeing_only_24_hrs_history": "För närvarande ser du ändringar under de senaste 24 timmarnas i detta projekt.", "archive_projects": "Arkiverade projekt", "archive_and_leave_projects": "Arkivera och lämna projekt", "about_to_archive_projects": "Du kommer att arkivera följande projekt:", "please_confirm_your_email_before_making_it_default": "Vänligen bekräfta din e-postadress före du gör den till förinställd e-postadress", "back_to_editor": "Tillbaka till textredigeraren", "generic_history_error": "Något gick fel när du försökte hämta projektets historia. Om felet kvarstår, vänligen kontakta oss via:", "unconfirmed": "Obekräftad", "please_check_your_inbox": "Vänligen kontrollera din inkorg", "resend_confirmation_email": "Skicka om e-postbekräftelse", "history_label_created_by": "Skapad av", "history_label_this_version": "Etikera denna version", "history_add_label": "Lägg till etikett", "history_adding_label": "Lägger till etikett", "history_new_label_name": "Nytt etikettnamn", "history_delete_label": "Radera etikett", "history_deleting_label": "Raderar etikett", "history_are_you_sure_delete_label": "Är du säker på att du vill ta bort följande etikett", "history_view_all": "All historik", "history_view_labels": "Etiketter", "add_another_email": "Lägg till en annan e-post", "start_by_adding_your_email": "Börja med att lägga till din e-postadress.", "is_email_affiliated": "Är du ansluten till en institution?", "let_us_know": "Låt oss veta", "add_new_email": "Lägg till ny e-postadress", "error_performing_request": "Ett fel har uppstått vid behandling av din begäran.", "emails_and_affiliations_title": "E-post och anslutningar", "emails_and_affiliations_explanation": "Lägg till ytterligare e-postadresser till ditt konto för att få tillgång till uppgraderingar som ditt universitet eller din institution har, för att göra det lättare för medarbetare att hitta dig och för att säkerställa att du kan återställa ditt konto.", "institution_and_role": "Institution och befattning", "add_role_and_department": "Lägg till befattning och avdelning", "save_or_cancel-save": "Spara", "save_or_cancel-or": "eller", "save_or_cancel-cancel": "Avbryt", "make_default": "Gör till förinställd", "remove": "ta bort", "confirm_email": "Bekräfta e-postadress", "invited_to_join_team": "Du har blivit inbjuden till att gå med i ett team", "join_team": "Gå med i ett team", "accepted_invite": "Accepterat inbjudan", "invited_to_group": "__inviterName__ har bjudit in dig till ett team på __appName__", "join_team_explanation": "Klicka på knappen nedan för att gå med i teamet och njut av fördelarna med ett uppgraderat __appName__ konto", "accept_invitation": "Acceptera inbjudan", "joined_team": "Du har gått med i ett team som hanteras av __inviterName__", "compare_to_another_version": "Jämför med en annan version", "file_action_edited": "Redigerade", "file_action_renamed": "Döpte om", "file_action_created": "Skapade", "file_action_deleted": "Tog bort", "browsing_project_as_of": "Bläddrar projekt från och med", "view_single_version": "Visa enkel version", "font_family": "Typsnittsfamilj", "line_height": "Radavstånd", "compact": "Kompakt", "wide": "Bred", "default": "Standard", "leave": "Lämna", "archived_projects": "Arkiverade projekt", "archive": "Arkiv", "student_disclaimer": "Studentrabatten gäller för alla studenter på gymnasienivå eller högre. Vi kan komma att kontakta dig för att bekräfta din behörighet för rabatten.", "billed_after_x_days": "Du kommer inte att betala förrän efter din __len__ dagars prövoperiod löper ut.", "looking_multiple_licenses": "Letar du efter flera licenser?", "reduce_costs_group_licenses": "Du kan dra ner på pappersarbete och minska kostnader med våra rabatterade grupplicenser.", "find_out_more": "Få reda på mer", "compare_plan_features": "Jämför abonnemangsfunktioner", "in_good_company": "Du är i gott sällskap", "unlimited": "Obegränsat", "priority_support": "Prioriterad support", "dropbox_integration_lowercase": "Dropboxintegrering", "github_integration_lowercase": "GitHubintegration", "discounted_group_accounts": "rabatterade gruppkonto", "referring_your_friends": "värva dina vänner", "still_have_questions": "Har du fortfarande frågor?", "quote_erdogmus": "Möjligheten att spåra ändringar och realtids samarbete är det som skiljer ShareLaTeX från andra.", "quote_henderson": "ShareLaTeX har visat sig vara ett kraftfullt och robust samarbetsverktyg som används av många i vår skola.", "best_value": "Bästa värde", "faq_how_free_trial_works_question": "Hur fungerar din gratis prövoperiod?", "faq_change_plans_question": "Kan jag byta abonnemang senare?", "faq_do_collab_need_premium_question": "Behöver mina samarbetspartners också premium konto?", "faq_need_more_collab_question": "Om jag behöver fler samarbetspartners?", "faq_purchase_more_licenses_question": "Kan jag köpa ytterligare licenser för mina kollegor?", "faq_monthly_or_annual_question": "Ska jag använda månatlig eller årlig betalning?", "faq_how_to_pay_question": "Kan jag betala online med kredit-/betalkort eller PayPal?", "faq_pay_by_invoice_question": "Kan jag betala med faktura?", "reference_search": "Avancerad referenssökning", "reference_search_info": "Du kan alltid söka efter citationsnycklar, och avancerad referenssök låter dig söka efter författare, titel, år eller tidsskrift.", "reference_sync": "Referenshanterare synk", "reference_sync_info": "Hantera ditt referensebibliotek i Mendeley och länka det direkt till en .bib fil i __appName__, så att du enkelt kan citera något från ditt Mendeley bibliotek.", "faq_how_free_trial_works_answer": "Du får full tillgång till din valda ShareLaTeX plan under din __len__-dagars gratis prövoperiod. Det finns inget skyldighet att fortsätta efter din prövoperiod. Ditt kort kommer att belastas vid slutet av din __len__ dagars prövoperiod om du inte avbryter innan dess. Du avbryter ditt abonnemang under abonnemangsinställningar.", "faq_change_plans_answer": "Ja, du kan när som helst byta din abonnemangsplan under abonnemangsinställningar. Detta inkluderar möjligheten att byta till en annan plan, växla mellan månatlig eller årsbetalning, eller säga upp och nedgradera ditt konto.", "faq_do_collab_need_premium_answer": "Premiumfunktioner, som t.ex. ändringsspårning, kommer att vara tillgängliga på projekt du skapat, även om eventuella samarbetspartners har gratiskonton.", "faq_need_more_collab_answer": "Du kan uppgradera till ett av våra betalda konto, vilket stödjer fler samarbetspartners. Du kan också tjäna fler samarbetspartners med våra gratiskonto genom __referFriendsLink__.", "faq_purchase_more_licenses_answer": "Ja, vi erbjuder __groupLink__, vilket är enkelt att hantera, sparar in på pappersarbetet och reducerar kostnaderna vid köp av flera licenser.", "faq_monthly_or_annual_answer": "Årlig betalning gör det möjligt att minska administration och pappersarbete. Om du heller vill betala med en betalning om året, istället för tolv, är årlig betalning för dig.", "faq_how_to_pay_answer": "Ja det kan du. Alla stora kredit- och betalkort samt Paypal stöds. Välj vilken plan du vill använda ovan, du kommer sedan att få välja att betala med kort eller via Paypal när det att dax att ställa in betalningsinställningarna.", "powerful_latex_editor": "Kraftfull LaTeX editor", "realtime_track_changes": "Realtidsspåra ändringar", "realtime_track_changes_info": "Nu behöver du inte välja mellan att spåra ändringar och typsättning i LaTeX. Lämna kommentarer, håll koll på Att Göra markeringar och acceptera eller neka andras förändringar.", "full_doc_history_info": "Åk tillbaka i tiden för att se vilken version som helst och vem som har gjort ändringar. Oavsett vad som händer så har vi din rygg.", "dropbox_integration_info": "Arbeta smidigt både online och offline med två-vägs Dropbox synk. Ändringar du gör lokalt kommer automatiskt skickas till din __appName__ version och vice versa.", "github_integration_info": "Hämta och tryck upp ändringar till och från GitHub, så att dina samarbetspartners kan jobba offline med git och online med __appName__.", "latex_editor_info": "All du behöver i en modern LaTeX editor --- stavningskontroll, intelligent autocomplete, syntaxmarkering, massor av färgteman, vim och emacs kortkommandon, hjälp med LaTeX varningar och felmeddelanden, och mycket mer.", "change_plans_any_time": "Du kan byta abbonemang eller ändra ditt konto när som helst. ", "number_collab": "Antal samarbetspartners", "unlimited_private_info": "Alla dina projekt är privata som standard. Bjud in samarbetspartners för att läsa eller redigera med e-postadress eller genom en hemlig länk.", "unlimited_private": "Obegränsat med privata projekt", "realtime_collab": "Samarbete i realtid", "realtime_collab_info": "När ni jobbar tillsammans kan du se dina samarbetpartners markörer och ändringar i realtid, så alla har alltid den senaste versionen.", "hundreds_templates": "Hundratals med mallar", "hundreds_templates_info": "Producera vackra dokument med hjälp av vårt gallery av LaTeX mallar för tidsskrifter, konferenser, uppsatser, rapporter, CV och mycket mer.", "instant_access": "Få direkt tillgång till __appName__", "tagline_personal": "Perfekt när du jobbar ensam", "tagline_collaborator": "Bäst för delade projekt", "tagline_professional": "För de som jobbar med många", "tagline_student_annual": "Spara ännu mer", "tagline_student_monthly": "Perfekt för en termin", "all_premium_features": "Alla premiumfunktioner", "sync_dropbox_github": "Synka med Dropbox och GitHub", "track_changes": "Spåra ändringar", "tooltip_hide_pdf": "Klicka för att gömma PDF:en", "tooltip_show_pdf": "Klicka för att visa PDF:en", "tooltip_hide_filetree": "Klicka för att gömma filträdet", "tooltip_show_filetree": "Klicka för att visa filträdet", "cannot_verify_user_not_robot": "Tyvärr kunde vi inte verifiera att du inte är en robot. Vänligen kontrollera så att Google reCAPTCHA inte blockeras av en ad blocker eller brandvägg.", "uncompiled_changes": "Okompilerade ändringar", "code_check_failed": "Kodkontroll misslyckades", "code_check_failed_explanation": "Din kod har fel som behöver åtgärdas innan auto-kompileringen kan köras", "tags_slash_folders": "Taggar/Mappar", "file_already_exists": "En fil eller mapp med det namnet finns redan", "import_project_to_v2": "Importera Projekt till V2", "open_in_v1": "Öppna i V1", "import_to_v2": "Importera till V2", "never_mind_open_in_v1": "Glöm det, öppna i V1", "yes_im_sure": "Ja, jag är säker", "drop_files_here_to_upload": "Släpp filer här för att ladda upp", "drag_here": "dra här", "creating_project": "Skapa projekt", "select_a_zip_file": "Välj en .zip fil", "drag_a_zip_file": "dra en .zip fil", "v1_badge": "V1 Bricka", "v1_projects": "V1 Projekt", "open_your_billing_details_page": "Öppna sidan för dina Betalningsdetaljer", "try_out_link_sharing": "Testa den nya länkdelningen!", "try_link_sharing": "Testa Länkdelning", "try_link_sharing_description": "Ge tillgång till ditt projekt genom att dela en länk.", "learn_more_about_link_sharing": "Läs mer om Länkdelning", "link_sharing": "Länkdelning", "tc_switch_everyone_tip": "Aktivera spårningsändringar för alla", "tc_switch_user_tip": "Aktivera spårningsändringar för denna användare", "tc_switch_guests_tip": "Aktivera spårningsändringar för alla länkdelade gäster", "tc_guests": "Gäster", "select_all_projects": "Välj alla", "select_project": "Välj", "main_file_not_found": "Okänt huvuddokument", "please_set_main_file": "Välj en huvudfil för detta projekt i projektmenyn. ", "link_sharing_is_off": "Länkdelning är inaktiverat, endast inbjudna användare kan se detta projekt.", "turn_on_link_sharing": "Aktivera länkdelning", "link_sharing_is_on": "Länkdelning är aktiverat", "turn_off_link_sharing": "Inaktivera länkdelning", "anyone_with_link_can_edit": "Vem som helst med denna länk kan redigera detta projekt", "anyone_with_link_can_view": "Vem som helst med denna länk kan se detta projekt", "turn_on_link_sharing_consequences": "När länkdelning är aktiverat, kan vem som helst med länken komma åt eller redigera projektet", "turn_off_link_sharing_consequences": "När länkdelning är inaktiverat, har endast användare som är inbjudna tillgång till projektet", "autocompile_disabled": "Autokompilering inaktiverat", "autocompile_disabled_reason": "På grund av hög serverbelastning har bakgrundskompilering tillfälligt inaktiverats. Vänligen kompilera genom att klicka på knappen ovan.", "auto_compile_onboarding_description": "När aktiverad, kommer ditt projekt att kompilera efterhand som du skriver.", "try_out_auto_compile_setting": "Testa den nya inställningen för autokompilering!", "got_it": "Jag förstår", "pdf_compile_in_progress_error": "Kompilering körs redan i ett annat fönster", "pdf_compile_try_again": "Vänligen vänta tills din andra kompilering är klar innan du försöker igen.", "invalid_email": "En e-postadress är inte giltig", "auto_compile": "Kompilera automatiskt", "on": "På", "tc_everyone": "Alla", "per_user_tc_title": "Ändringshistorik per användare", "you_can_use_per_user_tc": "Nu kan du se ändringshistorik per användare", "turn_tc_on_individuals": "Aktivera ändringshistorik för individuella användare", "keep_tc_on_like_before": "Eller behåll det aktivt för alla, som tidigare", "auto_close_brackets": "Auto stäng paranteser", "auto_pair_delimiters": "Auto para avgränsare", "successfull_dropbox_link": "Dropbox har länkats, omdirigerar till inställningssidan.", "show_link": "Visa länk", "hide_link": "Göm länk", "aggregate_changed": "Ändrade", "aggregate_to": "till", "confirm_password_to_continue": "Bekräfta lösenord för att fortsätta", "confirm_password_footer": "Vi kommer inte att fråga efter ditt lösenord igen på ett tag.", "accept_all": "Acceptera alla", "reject_all": "Avvisa alla", "bulk_accept_confirm": "Är du säker på att du vill acceptera de __nChanges__ valda ändringarna?", "bulk_reject_confirm": "Är du säker på att du vill avvisa de __nChanges__ valda ändringarna?", "uncategorized": "Okategoriserat", "pdf_compile_rate_limit_hit": "Kompilerings gräns nådd", "project_flagged_too_many_compiles": "Detta projekt har kompilerats för ofta. Begränsningen kommer snart tas bort igen.", "reauthorize_github_account": "Återauktorisera ditt GitHub konto", "github_credentials_expired": "Din auktorisering för GitHub har löpt ut", "hit_enter_to_reply": "Tryck Enter för att svara", "add_your_comment_here": "Skriv din kommentar här", "resolved_comments": "Åtgärdade kommentarer", "try_it_for_free": "Prova gratis", "please_ask_the_project_owner_to_upgrade_to_track_changes": "Vänligen be projektägaren att uppgradera för att kunna spåra ändringar", "mark_as_resolved": "Markera som löst", "reopen": "Återöppna", "add_comment": "Lägg till kommentar", "no_resolved_threads": "Inga lösta trådar", "upgrade_to_track_changes": "Uppgradera för att spåra ändringar", "see_changes_in_your_documents_live": "Se ändringar i dina dokument, i realtid", "track_any_change_in_real_time": "Spåra alla ändringar, i realtid", "review_your_peers_work": "Granska dina medarbetares bidrag", "accept_or_reject_each_changes_individually": "Acceptera eller neka varje förändring för sig", "accept": "Acceptera", "reject": "Neka", "no_comments": "Inga kommentarer", "edit": "Redigera", "are_you_sure": "Är du säker?", "resolve": "Lös", "reply": "Svara", "quoted_text_in": "Citerad text i", "review": "Granska", "track_changes_is_on": "Spåra ändringar är <strong>på</strong>", "track_changes_is_off": "Spåra ändringar är <strong>av</strong>", "current_file": "Nuvarande fil", "overview": "Översikt", "tracked_change_added": "Tillagd", "tracked_change_deleted": "Raderad", "show_all": "visa alla", "show_less": "visa mindre", "dropbox_sync_error": "Fel vid Dropbox-synkning", "send": "Skicka", "sending": "Skickar", "invalid_password": "Felaktigt lösenord", "error": "Fel", "other_actions": "Andra åtgärder", "send_test_email": "Skicka ett test-mail", "email_sent": "E-mail skickat", "create_first_admin_account": "Skapa ett första Admin-konto", "ldap": "LDAP", "ldap_create_admin_instructions": "Välj en e-mailadress för ditt första admin-konto på __appName__. Den bör matcha ett konto i LDAP-systemet. När du valt kommer du ombes logga in med detta konto.", "saml": "SAML", "saml_create_admin_instructions": "Välj en e-mailadress för ditt första admin-konto på __appName__. Den bör matcha ett konto i SAML-systemet. När du valt kommer du ombes logga in med detta konto.", "admin_user_created_message": "Admin-konto skapat, <a href=\"__link__\">Logga in här</a> för att fortsätta", "status_checks": "Rutinkontroller", "editor_resources": "Editor-resurser", "checking": "Kontrollerar", "cannot_invite_self": "Du kan inte skicka en inbjudan till dig själv", "cannot_invite_non_user": "Kunde inte skicka inbjudan. Mottagaren har redan ett __appName__-konto", "log_in_with": "Logga in med __provider__", "return_to_login_page": "Tillbaka till inloggningssidan", "login_failed": "Inloggning misslyckades", "delete_account_warning_message_3": "Du håller på att permanent <strong>ta bort all din konto data</strong>, inklusive dina projekt och inställningar. Vänligen skriv in e-postadressen ditt konto använder samt ditt lösenord i fälten nedan för att fortsätta.", "delete_account_warning_message_2": "Du håller på att permanent <strong>ta bort all din konto data</strong>, inklusive dina projekt och inställningar. Vänligen skriv in e-postadressen ditt konto använder i fältet nedan för att fortsätta.", "your_sessions": "Dina sessioner", "clear_sessions_description": "Detta är en lista med sessioner (inloggningar) som är aktiva på ditt konto, inte medräknat din nuvarande session. Klick på \"Töm sessioner\" knappen nedan för att logga ut dem.", "no_other_sessions": "Inga andra aktiva sessioner", "ip_address": "IP-adress", "session_created_at": "Session skapad den", "clear_sessions": "Töm sessioner", "clear_sessions_success": "Sessioner tömda", "sessions": "Sessioner", "manage_sessions": "Hantera dina sessioner", "syntax_validation": "Kodkontroll", "history": "Historik", "joining": "Går med", "open_project": "Öppna projekt", "files_cannot_include_invalid_characters": "Filnamnet är tomt eller innehåller otillåtna tecken", "invalid_file_name": "Ogiltigt filnamn", "autocomplete_references": "Autokomplettering av referenser (inuti <code>\\cite{}</code>)", "autocomplete": "Autokomplettering", "failed_compile_check": "Det verkar som att ditt projekt har allvarliga syntaxfel som du måste åtgärda innan vi kan kompilera det", "failed_compile_check_try": "Försök att kompilera ändå", "failed_compile_option_or": "eller", "failed_compile_check_ignore": "stäng av syntaxkontroll", "compile_time_checks": "Syntaxkontroll", "stop_on_validation_error": "Kontrollera syntax innan kompilering", "ignore_validation_errors": "Kontrollera inte syntax", "run_syntax_check_now": "Kör syntaxkontroll nu", "your_billing_details_were_saved": "Dina betalningsuppgifter har sparats", "security_code": "Säkerhetskod", "paypal_upgrade": "För att uppgradera, klicka på knappen nedanför och logga in på PayPal med e-post och lösenord.", "upgrade_cc_btn": "Uppgradera nu, betala efter 7 dagar", "upgrade_paypal_btn": "Fortsätt", "notification_project_invite": "<b>__userName__</b> vill att du går med i <b>__projectName__</b>, <a class=\"btn btn-sm btn-info pull-right\" href=\"/project/__projectId__/invite/token/__token__\">Gå med i projektet</a>", "file_restored": "Din fil (__filename__) har återställts.", "file_restored_back_to_editor": "Du kan gå tillbaka till editorn och jobba vidare med det igen.", "file_restored_back_to_editor_btn": "Tillbaka till editorn", "view_project": "Visa projekt", "join_project": "Gå med i projekt", "invite_not_accepted": "Inbjudan ännu inte accepterad", "resend": "Skicka igen", "syntax_check": "Syntaxkontroll", "revoke_invite": "Återkalla inbjudan", "pending": "Inväntar", "invite_not_valid": "Detta är inte en giltig inbjudan till ett projekt", "invite_not_valid_description": "Inbjudan kan ha utgått. Vänligen kontakta ägaren till projektet", "accepting_invite_as": "Du accepterar inbjudan som", "accept_invite": "Acceptera inbjudan", "log_hint_ask_extra_feedback": "Kan du hjälpa oss att förstå varför tipset inte var till någon nytta?", "log_hint_extra_feedback_didnt_understand": "Jag förstod inte tipset", "log_hint_extra_feedback_not_applicable": "Jag kan inte genomföra detta i mitt dokument", "log_hint_extra_feedback_incorrect": "Det löste inte problemet", "log_hint_extra_feedback_other": "Annat:", "log_hint_extra_feedback_submit": "Skicka", "if_you_are_registered": "Om du redan är registrerad", "stop_compile": "Stoppa kompilering", "terminated": "Kompilering avbruten", "compile_terminated_by_user": "Kompileringen avbröts med 'Stoppa kompilering'-knappen. Du kan titta i råloggarna för att se var kompileringen avbröts.", "site_description": "En online-LaTeX-editor som är enkel att använda. Samarbeta i realtid, utan installation, med versionshantering, hundratals LaTeX-mallar, med mera.", "knowledge_base": "kunskapsbank", "contact_message_label": "Meddelande", "kb_suggestions_enquiry": "Har du kollat i vår <0>__kbLink__</0>?", "answer_yes": "Ja", "answer_no": "Nej", "log_hint_extra_info": "Läs mer", "log_hint_feedback_label": "Var det här tipset till hjälp?", "log_hint_feedback_gratitude": "Tack för din feedback!", "recompile_pdf": "Kompilera om PDF:en", "about_paulo_reis": "är en front-end mjukvaruutvecklare och user experience-forskare som bor i Aveiro, Portugal. Paulo har en doktorsgrad i user experience och brinner för att forma teknologi utefter människor - oavsett om det gäller koncept eller testning/validering, design eller implementation.", "login_or_password_wrong_try_again": "Ditt inlogg eller lösenord är felaktigt. Vänligen försök igen", "manage_beta_program_membership": "Hantera beta-medlemskap", "beta_program_opt_out_action": "Hoppa av beta-programmet", "disable_beta": "Avaktivera beta", "beta_program_badge_description": "När du använder __appName__ kommer du att se beta-funktioner markerade med denna ikon:", "beta_program_current_beta_features_description": "Just nu testar vi följande funktioner i beta:", "enable_beta": "Aktivera beta", "user_in_beta_program": "Användaren deltar i beta-programmet", "beta_program_already_participating": "Du är ansluten till beta-programmet.", "sharelatex_beta_program": "__appName__ Beta-program", "beta_program_benefits": "Vi förbättrar ständigt __appName__. Genom att gå med i vårt beta-program får du tidig tillgång till nya funktioner och kan hjälpa oss att förstå dina behov bättre.", "beta_program_opt_in_action": "Gå med i beta-programmet", "conflicting_paths_found": "Motstridiga sökvägar hittade", "following_paths_conflict": "Följande filer &amp; mappar har samma sökvägar", "open_a_file_on_the_left": "Öppna en fil till vänster", "reference_error_relink_hint": "Om felet kvarstår, testa att återkoppla ditt konto här:", "pdf_rendering_error": "PDF renderingsfel", "something_went_wrong_rendering_pdf": "Något gick fel under renderingen av denna PDF:en.", "mendeley_reference_loading_error_expired": "Medeley token har utgått, vänligen återkoppla ditt konto", "zotero_reference_loading_error_expired": "Zotero token har utgått, vänligen återkoppla ditt konto", "mendeley_reference_loading_error_forbidden": "Kunde inte ladda referenser från Mendeley, vänligen återkoppla ditt konto och försök igen", "zotero_reference_loading_error_forbidden": "Kunde inte ladda referenser från Zotero, vänligen återkoppla ditt konto och försök igen", "mendeley_integration": "Mendeleyintegrering", "mendeley_sync_description": "Med Mendeleyintegrering kan du importera dina referenser direkt från Mendeley till ditt __appName__ projekt", "mendeley_is_premium": "Mendeley integrering är en premium funktion", "link_to_mendeley": "Koppla till Mendeley", "unlink_to_mendeley": "Koppla bort från Mendeley", "mendeley_reference_loading": "Laddar referenser från Mendeley", "mendeley_reference_loading_success": "Laddade references från Mendeley", "mendeley_reference_loading_error": "Fel, kunde inte ladda referenser från Mendeley", "zotero_integration": "Zotero integrering", "zotero_sync_description": "Med Zotero integrering kan du importera dina referenser direkt från Zotero till ditt __appName__ projekt.", "zotero_is_premium": "Zotero integrering är en premium funktion", "link_to_zotero": "Koppla till Zotero", "unlink_to_zotero": "Koppla bort från Zotero", "zotero_reference_loading": "Ladda referenser från Zotero", "zotero_reference_loading_success": "Laddade referenser från Zotero", "zotero_reference_loading_error": "Fel, kunde inte ladda referenser från Zotero", "reference_import_button": "Importera referenser till", "unlink_reference": "Ta bort referens koppling", "unlink_warning_reference": "Varning: När du tar bort kopplingen från ditt konto kommer du inte längre att kunna importera referenser till ditt projekt.", "mendeley": "Mendeley", "zotero": "Zotero", "suggest_new_doc": "Föreslå nytt dokument", "request_sent_thank_you": "Meddelandet har skickats! Vårt team kommer att granska det och svara via e-post.", "suggestion": "Förslag", "project_url": "Påverkad projekt URL", "subject": "Ämne", "confirm": "Bekräfta", "cancel_personal_subscription_first": "Du har redan en personlig prenumeration, vill du avbryta denna innan du går med i grupp licensen?", "delete_projects": "Ta bort projekt", "leave_projects": "Lämna projekt", "delete_and_leave_projects": "Ta bort och lämna projekt", "too_recently_compiled": "Det här projektet har nyligen kompilerats, en ny kompilering har därför inte gjorts.", "clsi_maintenance": "Kompileringsservrarna är nere för underhåll och kommer snart upp igen.", "references_search_hint": "Tryck CTRL+mellanslag för att söka", "ask_proj_owner_to_upgrade_for_references_search": "Vänligen be projekt ägaren att uppgradera för att använda Referens sök funktionen.", "ask_proj_owner_to_upgrade_for_faster_compiles": "Vänligen be projekt ägaren att uppgradera för få snabbare kompilering och utökade timeout begränsning.", "search_bib_files": "Sök efter författare, titel, år", "leave_group": "Lämna grupp", "leave_now": "Lämna nu", "sure_you_want_to_leave_group": "Är du säker på att du vill lämna denna gruppen?", "notification_group_invite": "Du har blivit inbjuden till __groupName__, <a href=\"/user/subscription/__subscription_id__/group/invited\">Gå med här</a>.", "search_references": "Sök i .bib filerna för det här projektet", "no_search_results": "Inga sök resultat", "email_already_registered": "Den här e-postadressen är redan registrerad", "compile_mode": "Kompileringsläge", "normal": "Normal", "fast": "Snabb", "rename_folder": "Döp om mappen", "delete_folder": "Ta bort mappen", "about_to_delete_folder": "Du håller på att ta bort följande mappar (eventuella projekt i mapparna kommer att tas bort):", "to_modify_your_subscription_go_to": "För att förändra din prenumeration gå till", "manage_subscription": "Hantera prenumeration", "activate_account": "Aktivera ditt konto", "yes_please": "Ja tack!", "nearly_activated": "Du är ett steg från att aktivera ditt __appName__ konto!", "please_set_a_password": "Vänligen välj ett lösenord", "activation_token_expired": "Din aktiveringstoken har utgått, du behöver få en ny skickad till dig.", "activate": "Aktivera", "activating": "Aktiverar", "ill_take_it": "Jag tar det!", "cancel_your_subscription": "Avsluta din prenumeration", "no_thanks_cancel_now": "Nej tack, jag vill fortfarande avsluta", "cancel_my_account": "Avsluta min prenumeration", "sure_you_want_to_cancel": "Är du säker på att du vill avsluta?", "i_want_to_stay": "Jag vill stanna", "have_more_days_to_try": "Få ytterligare <strong>__days__ dagar</strong> till dit test konto!", "interested_in_cheaper_plan": "Är du intresserad av den billigare <strong>__price__</strong> student prenumerationen?", "session_expired_redirecting_to_login": "Sessionen har utgått. Dirigerar om till login sidan om __seconds__ sekunder", "maximum_files_uploaded_together": "Högst __max__ filer laddas upp samtidigt", "too_many_files_uploaded_throttled_short_period": "För många filer har laddats upp, dina uppladdningar har tillfälligt begränsats.", "compile_larger_projects": "Kompilera större projekt", "upgrade_to_get_feature": "Uppgradera för att få __feature__, plus:", "new_group": "Ny grupp", "about_to_delete_groups": "Du håller på att ta bort följande grupper:", "removing": "Tar bort", "adding": "Lägger till", "groups": "Grupper", "rename_group": "Döp om grupp", "renaming": "Döper om", "create_group": "Skapa grupp", "delete_group": "Ta bort grupp", "delete_groups": "Ta bort grupper", "your_groups": "Dina grupper", "group_name": "Grupp namn", "no_groups": "Inga grupper", "Subscription": "Prenumeration", "Documentation": "Dokumentation", "Universities": "Universitet", "Account Settings": "Kontoinställningar", "Projects": "Projekt", "Account": "Konto", "global": "global", "Terms": "Villkor", "Security": "Säkerhet", "About": "Om", "editor_disconected_click_to_reconnect": "Editorn tappade anslutningen, klicka varsomhelst för att återansluta.", "word_count": "Ordräknare", "please_compile_pdf_before_word_count": "Vänligen kompilera ditt projekt innan du gör en ord räkning", "total_words": "Totalt antal ord", "headers": "Rubriker", "math_inline": "Inline matteformler", "math_display": "Display matteformler", "connected_users": "Anslutna användare", "projects": "Projekt", "upload_project": "Ladda upp projekt", "all_projects": "Alla projekt", "your_projects": "Dina Projekt", "shared_with_you": "Delade med dig", "deleted_projects": "Raderade Projekt", "templates": "Mallar", "new_folder": "Ny Mapp", "create_your_first_project": "Skapa ditt första projekt!", "complete": "Färdigt", "on_free_sl": "Du använder gratisversionen av __appName__", "upgrade": "Uppgradera", "or_unlock_features_bonus": "eller lås upp bonusfunktioner genom att", "sharing_sl": "dela __appName__", "add_to_folder": "Lägg till i mapp", "create_new_folder": "Skapa ny mapp", "more": "Mer", "rename": "Ändra namn", "make_copy": "Gör en kopia", "restore": "Återställ", "title": "Titel", "last_modified": "Senast ändrad", "no_projects": "Inga projekt", "welcome_to_sl": "Välkommen till __appName__!", "new_to_latex_look_at": "Nybörjare på LaTeX? Börja med att titta på", "or": "eller", "or_create_project_left": "eller skapa ditt första projekt till vänster.", "thanks_settings_updated": "Tack, dina inställningar har uppdateras.", "update_account_info": "Uppdatera kontoinformation", "must_be_email_address": "Måste vara en e-postadress", "first_name": "Förnamn", "last_name": "Efternamn", "update": "Uppdatera", "change_password": "Byt lösenord", "current_password": "Nuvarande lösenord", "new_password": "Nytt lösenord", "confirm_new_password": "Bekräfta nytt lösenord", "required": "Obligatorisk", "doesnt_match": "Matchar inte", "dropbox_integration": "Dropbox integrering", "learn_more": "Läs mer", "dropbox_is_premium": "Dropbox synkronisering är en premium funktion", "account_is_linked": "Konton är länkat", "unlink_dropbox": "Avlänka Dropbox", "link_to_dropbox": "Länka till Dropbox", "newsletter_info_and_unsubscribe": "Med några månaders mellanrum skickar vi ut ett nyhetsbrev med en summering av de nyaste funktionerna. Om du inte vill ta emot dessa nyhetsbrev kan du välja avsluta prenumerationen på dessa när som helst:", "unsubscribed": "Prenumeration avslutad", "unsubscribing": "Avslutar prenumeration", "unsubscribe": "Avsluta prenumeration", "need_to_leave": "Vill du lämna?", "delete_your_account": "Ta bort ditt konto", "delete_account": "Ta bort konto", "delete_account_warning_message": "Du håller på att permanent <strong>ta bort ditt konto och all din data</strong>, inklusive dina projekt och inställningar. Vänligen skriv in ditt konto e-postadress i rutan nedan för att fortsätta.", "deleting": "Tar bort", "delete": "Radera", "sl_benefits_plans": "__appName__ är världens enklaste LaTeX-editor. Samarbeta direkt med dina medarbetare, håll koll på alla förändringar i dokumenten, och använd vår LaTeX-miljö från varsomhelst världen.", "monthly": "Månatlig", "personal": "Privat", "free": "Gratis", "one_collaborator": "Endast en samarbetare", "collaborator": "Samarbetare", "collabs_per_proj": "__collabcount__ samarbetare per projekt", "full_doc_history": "Full dokumenthistorik", "sync_to_dropbox": "Synka till Dropbox", "start_free_trial": "Starta utvärderingsperiod!", "professional": "Professionell", "unlimited_collabs": "Obegränsat med samarbetare", "name": "Namn", "student": "Student", "university": "Universitet", "position": "Position", "choose_plan_works_for_you": "Välj en kontotyp som fungerar för dig, testa med vår __len__-dagars gratisperiod. Avbryt när som helst.", "interested_in_group_licence": "Intresserad av att använda __appName__ i ett grupp-, team- eller avdelningskonto?", "get_in_touch_for_details": "Hör av dig för mer information!", "group_plan_enquiry": "Grupplansförfrågan", "enjoy_these_features": "Njut av alla dessa underbara funktioner", "create_unlimited_projects": "Skapa så många projekt som du behöver.", "never_loose_work": "Tappa aldrig bort något, we've got your back.", "access_projects_anywhere": "Få åtkomst till din projekt överallt.", "log_in": "Logga in", "login": "Logga in", "logging_in": "Loggar in", "forgot_your_password": "Glömt ditt lösenord", "password_reset": "Återställ lösenord", "password_reset_email_sent": "Ett e-postmeddelande har skickats till dig för att slutföra lösenordsåterställningen.", "please_enter_email": "Vänligen ange din e-postadress", "request_password_reset": "Begär lösenordsåterställning", "reset_your_password": "Återställ ditt lösenord", "password_has_been_reset": "Ditt lösenord har återställts", "login_here": "Logga in här", "set_new_password": "Ange nytt lösenord", "user_wants_you_to_see_project": "__username__ vill att du ska gå med i __projectname__", "join_sl_to_view_project": "Gå med i __appName__ för att se detta projekt", "register_to_edit_template": "Vänligen registrera dig för att redigera __templateName__ mallen", "already_have_sl_account": "Har du redan ett __appName__ konto?", "register": "Registrera", "password": "Lösenord", "registering": "Registrerar", "planned_maintenance": "Planerat underhåll", "no_planned_maintenance": "Det finns för närvarande inget planerat underhållsarbete", "cant_find_page": "Tyvärr kan vi inte hitta sidan du letar efter.", "take_me_home": "Ta mig härifrån!", "no_preview_available": "Tyvärr, det finns inte någon förhandsvisning tillgänglig.", "no_messages": "Inga meddelanden", "send_first_message": "Skicka ditt första meddelande till dina medarbetare", "account_not_linked_to_dropbox": "Ditt konto är inte länkat till Dropbox", "update_dropbox_settings": "Uppdatera Dropbox inställningar", "refresh_page_after_starting_free_trial": "Vänligen uppdatera denna sida efter att du startat din gratis provapå period.", "checking_dropbox_status": "kontrollerar Dropbox status", "dismiss": "Avfärda", "new_file": "Ny fil", "upload_file": "Ladda upp fil", "create": "Skapa", "creating": "Skapar", "upload_files": "Uppladdade fil(er)", "sure_you_want_to_delete": "Är du säker på att du vill permanent radera följande filer?", "common": "Vanliga", "navigation": "Navigation", "editing": "Redigering", "ok": "OK", "source": "Källfiler", "actions": "Åtgärder", "copy_project": "Klona projekt", "publish_as_template": "Publicera som mall", "sync": "Synka", "settings": "Inställningar", "main_document": "Huvuddokument", "off": "Av", "auto_complete": "Komplettera automatisk", "theme": "Tema", "font_size": "Teckenstorlek", "pdf_viewer": "PDF läsare", "built_in": "Inbyggd", "native": "native", "show_hotkeys": "Visa tangentbordsgenvägar", "new_name": "Nytt namn", "copying": "kopierar", "copy": "Kopiera", "compiling": "Kompilerar", "click_here_to_preview_pdf": "Klicka här för att förhandsvis ditt arbete som PDF.", "server_error": "Serverfel", "somthing_went_wrong_compiling": "Ursäkta, något blev fel och ditt projekt kunde inte kompileras. Vänligen försök igen om en liten stund.", "timedout": "Timed out", "proj_timed_out_reason": "Ursäkta, din kompilering tog för lång tid och avbröts. Detta kan bero på för många högupplösta bilder eller komplicerade diagram.", "no_errors_good_job": "Inga fel, bra jobbat!", "compile_error": "Kompileringsfel", "generic_failed_compile_message": "Ursäkta, din LaTexkod kunde inte kompileras av någon anledning. Vänligen kontrollera felen nedan, du kan också kontrollera loggen för fler detaljer.", "other_logs_and_files": "Andra loggar och filer", "view_raw_logs": "Visa loggen", "hide_raw_logs": "Göm loggen", "clear_cache": "Töm cache", "clear_cache_explanation": "Detta kommer att radera alla dina dolda LaTeX filer (.aux, .bbl, etc) från vår kompileringsserver. Normalt behöver du inte göra detta såvida du inte har problem med referenser.", "clear_cache_is_safe": "Dina projektfiler kommer inte att tas bort eller förändras.", "clearing": "Tömmer", "template_description": "Mallbeskrivning", "project_last_published_at": "Ditt projekt blev publicerat senast den", "problem_talking_to_publishing_service": "Det har uppstått ett problem på vår publiceringsserver, vänligen försök igen om några minuter", "unpublishing": "Avpublicera", "republish": "Återpublicera", "publishing": "Publicerar", "share_project": "Dela projekt", "this_project_is_private": "Detta projekt är privat och endast personerna nedan har åtkomst.", "make_public": "Gör publikt", "this_project_is_public": "Detta projekt är publikt och kan redigeras av vem som helst med länken.", "make_private": "Gör privat", "can_edit": "Kan redigera", "share_with_your_collabs": "Dela med dina samarbetspartners", "share": "Dela", "need_to_upgrade_for_more_collabs": "Du måste uppgradera ditt konto för att lägga till fler samarbetspartners", "make_project_public": "Gör projekt publikt", "make_project_public_consequences": "Om du gör ditt projekt publikt kan vem som helst med länken få åtkomst till det.", "allow_public_editing": "Tillåt publik redigering", "allow_public_read_only": "Tillåt endast publik läsåtkomst", "make_project_private": "Inaktivera länkdelning", "make_project_private_consequences": "Om du gör ditt projekt privat har endast de du väljer att dela projektet med åtkomst.", "need_to_upgrade_for_history": "Du måste uppgradera ditt konto för att använda historikfunktionen.", "ask_proj_owner_to_upgrade_for_history": "Vänligen be projektets ägare att uppgradera för att använda historikfunktionen.", "anonymous": "Anonym", "generic_something_went_wrong": "Ursäkta, något gick snett", "restoring": "Återställer", "restore_to_before_these_changes": "Återställ till innan dessa förändringar", "profile_complete_percentage": "Din profil är __percentval__% färdig", "file_has_been_deleted": "__filename__ har raderats", "sure_you_want_to_restore_before": "Är du säker på att du vill återställa <0>__filename__</0> till innan den __date__?", "rename_project": "Ändra namn på projekt", "about_to_delete_projects": "Du håller på att ta bort följande projekt:", "about_to_leave_projects": "Du håller på att lämna följande projekt:", "upload_zipped_project": "Ladda upp zippat projekt", "upload_a_zipped_project": "Ladda upp ett zippat projekt", "your_profile": "Din profil", "institution": "Instution", "role": "Roll", "folders": "Mappar", "disconnected": "Frånkopplad", "please_refresh": "Vänligen uppdatera sidan för att fortsätta.", "lost_connection": "Förlorat anslutningen", "reconnecting_in_x_secs": "Återansluter om __seconds__ sekunder", "try_now": "Testa Nu", "reconnecting": "Återansluter", "saving_notification_with_seconds": "Sparar __docname__... (__seconds__ sekunder av osparade ändringar)", "help_us_spread_word": "Hjälp oss sprida __appName__", "share_sl_to_get_rewards": "Dela __appName__ med dina vänner och kollegor för att låsa upp belöningarna nedan", "post_on_facebook": "Posta på Facebook", "share_us_on_googleplus": "Dela oss på Google+", "email_us_to_your_friends": "E-posta oss till dina vänner", "link_to_us": "Länka till oss från din hemsida", "direct_link": "Direktlänk", "sl_gives_you_free_stuff_see_progress_below": "När någon börjar använda __appName__ från din rekommendation kommer vi att ge dig några <strong>gratis funktioner</strong> som tack! Spana in din utveckling nedan.", "spread_the_word_and_fill_bar": "Sprid ordet och fyll upp denna mätaren", "one_free_collab": "En gratis samarbetsparnter", "three_free_collab": "Tre gratis samarbetspartners", "free_dropbox_and_history": "Gratis Dropbox och förändringshistorik", "you_not_introed_anyone_to_sl": "Du har inte introducerat någon till __appName__ ännu. Börja dela!", "you_introed_small_number": " Du har introducerat <0>__numberOfPeople__</0> personer till __appName__. Bra jobbat, men kan du fixa fler?", "you_introed_high_number": " Du har introducerat <0>__numberOfPeople__</0> personer till __appName__. Bra jobbat!", "link_to_sl": "Länk till __appName__", "can_link_to_sl_with_html": "Du kan länka till __appName__ med följande HTML:", "year": "år", "month": "månad", "subscribe_to_this_plan": "Prenumerera på denna betalningsplan", "your_plan": "Din betalningsplan", "your_subscription": "Din prenumeration", "on_free_trial_expiring_at": "Du använder för nuvarande en gratis provapå period som kommer att löpa ut den __expiresAt__.", "choose_a_plan_below": "Välj en betalningsplan nedan.", "currently_subscribed_to_plan": "Du använder för närvarande en <0>__planName__</0> betalningsplan.", "change_plan": "Byta betalningsplan", "next_payment_of_x_collectected_on_y": "Nästa betalning på <0>__paymentAmmount__</0> kommer att genomföras den <1>__collectionDate__</1>", "update_your_billing_details": "Uppdatera din betalningsinformation", "subscription_canceled_and_terminate_on_x": " Din prenumeration har avbrutits och kommer att upphöra den <0>__terminateDate__</0>. Inga framtida betalningar kommer att genomföras.", "your_subscription_has_expired": "Din prenumeration har gått ut.", "create_new_subscription": "Skapa en ny prenumeration", "problem_with_subscription_contact_us": "Det har uppstått ett problem med din prenumeration. Vänligen kontakta oss för mer information.", "manage_group": "Hantera grupp", "loading_billing_form": "Ladda betalningsinformationsformulär", "you_have_added_x_of_group_size_y": "Du har lagt till <0>__addedUsersSize__</0> av <1>__groupSize__</1> tillgängliga medlemmar", "remove_from_group": "Ta bort från grupp", "group_account": "Gruppkonto", "registered": "Registrerad", "no_members": "Inga medlemmar", "add_more_members": "Lägg till fler medlemmar", "add": "Lägg till", "thanks_for_subscribing": "Tack för din prenumeration!", "your_card_will_be_charged_soon": "En dragning på ditt kort kommer att genomföras snart.", "if_you_dont_want_to_be_charged": "Om du inte vill att en betalning ska genomföras igen ", "add_your_first_group_member_now": "Lägg till dina första gruppmedlemmar nu", "thanks_for_subscribing_you_help_sl": "Tack för att du prenumererar på en __planName__ betalningsplan. Det är stöd från personer som dig som gör att __appName__ kan fortsätta växa och förbättras.", "back_to_your_projects": "Tillbaka till dina projekt", "goes_straight_to_our_inboxes": "Det går direkt till båda våra inkorgar.", "need_anything_contact_us_at": "Om det är något du undrar över kan du alltid höra av dig till oss på", "regards": "Vänliga Hälsningar", "about": "Om", "comment": "Kommentar", "restricted_no_permission": "Ursäkta, du har inte tillåtelse att visa denna sida.", "online_latex_editor": "Online-LaTeX-editor", "meet_team_behind_latex_editor": "Möt teamet bakom din favorit-online-LaTeX-editor.", "follow_me_on_twitter": "Följ mig på Twitter", "motivation": "Motivation", "evolved": "har utvecklats", "the_easy_online_collab_latex_editor": "Den enkla, samarbetsvänliga LaTeX-editorn på nätet", "get_started_now": "Börja redan nu", "sl_used_over_x_people_at": "__appName__ används av över __numberOfUsers__ studenter och akademiker på:", "collaboration": "Samarbete", "work_on_single_version": "Arbeta tillsammans på en enda version", "view_collab_edits": "Visa samarbetspartners förändringar ", "ease_of_use": " Användbarhet", "no_complicated_latex_install": "Ingen komplicerad LaTeX installation", "all_packages_and_templates": "Alla paket och <0>__templatesLink__</0> du behöver", "document_history": "Dokumenthistorik", "see_what_has_been": "Se vad som har ", "added": "lagst till", "and": "och", "removed": "tagits bort", "restore_to_any_older_version": "Återställ till en äldre version", "work_from_anywhere": "Arbeta var som helst", "acces_work_from_anywhere": "Få tillgång till ditt arbete var som helst i världen", "work_offline_and_sync_with_dropbox": "Arbeta offline och synka dina filer via Dropbox och GitHub", "over": "över", "view_templates": "Visa mallar", "nothing_to_install_ready_to_go": "Det finns inget komplicerat eller svårt för dig att installera, och du kan <0>__start_now__</0>, även om du aldrig sett det förrut. __appName__ kommer med en komplett, färdig att använda LaTeX miljö som körs direkt på våra servrar.", "start_using_latex_now": "börja använda LaTeX redan nu", "get_same_latex_setup": "Med __appName__ får du samma LaTeX uppsättning oavsett var du befinner dig. Genom att direkt samarbeta med kollegor eller studenter via __appName__ vet du att ni inte kommer att stöta på några versions inkonsekvenser eller paketkonflikter.", "support_lots_of_features": "Vi stödjer nästan alla LaTeX funktioner, inklusive lägga till bilder, bibliografi, ekvationer, och mycket mer! Läs om alla intressanta finesser på __appName__ i vår <0>__help_guides_link__</0>", "latex_guides": "LaTeX guider", "reset_password": "Återställ lösenord", "set_password": "Ange lösenord", "updating_site": "Uppdaterar webbsidan", "bonus_please_recommend_us": "Bonus - Rekommendera oss", "admin": "admin", "subscribe": "Prenumerera", "update_billing_details": "Uppdatera betalningsinformation", "group_admin": "Gruppadministratör", "all_templates": "Alla mallar", "your_settings": "Dina inställningar", "maintenance": "Underhållning", "to_many_login_requests_2_mins": "Detta konto har haft för många inloggningsförsök. Vänligen vänta 2 minuter innan nästa försök.", "email_or_password_wrong_try_again": "E-postadressen eller lösenordet är felaktigt.", "rate_limit_hit_wait": "För många försök. Vänligen vänta en liten stund innan du försöker igen", "problem_changing_email_address": "Det gick inte att byta din e-postadress. Vänligen försök igen om en liten stund. Kvarstår problemet så får du gärna kontakta oss.", "single_version_easy_collab_blurb": "__appName__ ser till att du alltid är uppdaterad med vad dina samarbetspartners har gjort. Det finns endast en huvudversion av varje dokument som alla har tillgång till. Det är omöjligt att göra ändringar som skapar konflikter och du behöver inte vänta på att dina kollegor ska skicka den senaste kopian innan du kan påbörja ditt arbete.", "can_see_collabs_type_blurb": "Om flera personer vill jobba på samma dokument samtidigt är det inget problem. Du kan direkt se var dina kollegor skriver och deras ändringar dyker direkt upp på din skärm.", "work_directly_with_collabs": "Arbeta direkt med dina samarbetspartners", "work_with_word_users": "Arbeta med Word användare", "work_with_word_users_blurb": "__appName__ är enkelt att börja med, du kan direkt bjuda in dina icke-LaTeX kollegor att börja medverka i dina LaTeX dokument. De kommer att vara produktiva redan från första dagen och kommer att lära sig en del LaTeX under tiden som de skriver.", "view_which_changes": "Visa vilka förändringar som har", "sl_included_history_of_changes_blurb": "__appName__ inkluderar förändringshistorik av alla ändringar som gjorts. Du kan se exakt vem som ändrat vad och när. Detta gör det extremt lätt att hålla sig uppdaterad med alla framsteg i arbetet, oavsett om de är gjorda av dig eller någon av dina samarbetspartners.", "can_revert_back_blurb": "Oavsett samarbetspartners eller ej så sker ibland misstag. Att återställa till en äldre version är enkelt och risken att förlora arbete eller ångra en förändring tas helt bort.", "start_using_sl_now": "Börja använda __appName__ nu", "over_x_templates_easy_getting_started": "Det finns __over__ 400 __templates__ i vårt mallgalleri, så det är verkligen enkelt att komma igång. Oavsett om du skriver en vetenskaplig artikel, uppsats, cv eller något annat.", "done": "Färdigt", "change": "Ändra", "page_not_found": "Sidan kunde inte hittas", "please_see_help_for_more_info": "Vänligen läs våra hjälp guider för mer information", "this_project_will_appear_in_your_dropbox_folder_at": "Detta projekt kommer att synas i din Dropbox mapp på ", "member_of_group_subscription": "Du är medlem i en grupprenumeration som hanteras av __admin_email__. Vänligen kontakta denne för att hantera din prenumeration.\n", "about_henry_oswald": "är en mjukvaruingenjör bosatt i London. Han byggde den första prototypen av __appName__ och har haft ansvaret för att bygga en stabil och skalbar plattform. Henry är en stor förespråkare av testdriven utveckling och ser till att vi håller __appName__ koden ren och enkel att underhålla.", "about_james_allen": "har en Doktorsexamen i teoretisk fysik och är en passionerad LaTeX användare. Han skapade en av de första online LaTeX-editorerna, ScribTeX, och har spelat en stor roll i utvecklingen av de teknologier som gör __appName__ möjligt.", "two_strong_principles_behind_sl": "Det finns två starka drivande principer bakom vårt arbete på __appName__:", "want_to_improve_workflow_of_as_many_people_as_possible": "Vi vill förbättra arbetsflödet för så många som möjligt.", "detail_on_improve_peoples_workflow": "LaTeX är väldigt svårt att använda och samarbete är alltid svårt att koordinera. Vi tror att vi har utvecklat bra verktyg för att hjälpa andra med dessa problem och vi vill se till så att __appName__ är tillgängligt för så många andra som möjligt. Vi har försökt att hålla våra prenumerationspriser på en rimlig nivå, och vi har också släppt mycket av __appName__ som open source så att vem som helst kan sätta upp sin egen server.", "want_to_create_sustainable_lasting_legacy": "Vi vill skapa ett hållbart och varaktigt arv.", "details_on_legacy": "Utvecklingen och underhållet av en produkt som __appName__ tar upp väldigt mycket tid och arbete, så det är viktigt att vi kan hitta en affärsmodell som stödjer det både nu och i framtiden. Vi vill inte att __appName__ ska vara beroende av extern finansiering eller försvinna på grund av en havererad affärsmodell. Jag är stolt över att kunna säga att vi i nuläget kan köra __appName__ både lönsamt och hållbart, vi förväntar oss också att kunna göra detta på längre sikt.", "get_in_touch": "Kom i kontakt", "want_to_hear_from_you_email_us_at": "Vi vill gärna få feedback från er som använder __appName__, eller om du bara vill snacka lite om vad som är på gång. Kontakta oss gärna på ", "cant_find_email": "Den e-postadressen är tyvärr inte registrerad.", "plans_amper_pricing": "Betalningsplaner och avgifter", "documentation": "Dokumentation", "account": "Konto", "subscription": "Prenumeration", "log_out": "Logga ut", "en": "Engelska", "pt": "Portugisiska", "es": "Spanska", "fr": "Franska", "de": "Tyska", "it": "Italienska", "da": "Danska", "sv": "Svenska", "no": "Norska", "nl": "Holländska", "pl": "Polska", "ru": "Ryska", "uk": "Ukrainska", "ro": "Rumänska", "click_here_to_view_sl_in_lng": "Klicka här för att använda __appName__ på <0>__lngName__</0>", "language": "Språk", "upload": "Ladda upp", "menu": "Meny", "full_screen": "Helskärm", "logs_and_output_files": "Loggar och output filer", "download_pdf": "Ladda ner PDF", "split_screen": "Delad skärm", "clear_cached_files": "Rensa cachade filer", "go_to_code_location_in_pdf": "Gå till kodplats i PDF", "please_compile_pdf_before_download": "Vänligen kompilera ditt projekt innan du laddar ner PDF filen", "remove_collaborator": "Ta bort samarbetspartner", "add_to_folders": "Lägg till i mappar", "download_zip_file": "Ladda ner .zip fil", "download_file": "Ladda ner <0>__type__</0>-fil", "price": "Pris", "close": "Stäng", "keybindings": "Tangentbordsgenvägar", "restricted": "Begränsad", "start_x_day_trial": "Påbörjar din __len__-dagars gratis provapå period idag!", "buy_now": "Köp nu!", "cs": "Tjeckiska", "view_all": "Visa alla", "terms": "Villkor", "privacy": "Integritet", "contact": "Kontakt", "change_to_this_plan": "Ändra till denna betalningsplan", "processing": "behandlar", "sure_you_want_to_change_plan": "Är du säker på att du vill ändra till betalningsplan <0>__planName__</0>?", "move_to_annual_billing": "Ändra till Årlig betalning", "annual_billing_enabled": "Årlig betalning aktiverat", "move_to_annual_billing_now": "Ändra till årlig betalning nu", "change_to_annual_billing_and_save": "Tjäna <0>__percentage__</0> med årlig betalning. Om du byter nu sparar du <1>__yearlySaving__</1> per år.", "missing_template_question": "Saknas en mall?", "tell_us_about_the_template": "Om du saknar en mall vänligen: Skicka oss en kopia av mallen antingen via en __appName__ länk eller tala om för oss var vi kan hitta den. Skicka också med en kort beskrivning av mallen.", "email_us": "E-posta oss", "this_project_is_public_read_only": "Det här projektet är publikt och kan visas, men inte redigeras, av vem som helst med länken.", "tr": "Turkiska", "select_files": "Välj fil(er)", "drag_files": "dra fil(er)", "upload_failed_sorry": "Uppladdningen misslyckades :(", "inserting_files": "Importerar fil...", "password_reset_token_expired": "Lösenordsåterställningen är för gammal. Vänligen begär en ny lösenordsåterställning och följ länken i e-postmeddelandet.", "merge_project_with_github": "Sammanfoga projekt med GitHub", "pull_github_changes_into_sharelatex": "Dra GitHub ändringar till __appName__", "push_sharelatex_changes_to_github": "Tryck __appName__ ändringar till GitHub", "features": "Funktioner", "commit": "Commita", "commiting": "Commitar", "importing_and_merging_changes_in_github": "Importerar och slår samman ändringar i GitHub", "upgrade_for_faster_compiles": "Uppgradera för att få snabbare kompileringar och utöka din timeout gräns", "free_accounts_have_timeout_upgrade_to_increase": "Gratiskonton har en minuts timeoutgräns. Uppgradera för att utöka din timeoutgräns.", "learn_how_to_make_documents_compile_quickly": "Lär dig att åtgärda kompileringspauser", "zh-CN": "Kinesiska", "cn": "Kinesiska (Förenklad)", "sync_to_github": "Synka till GitHub", "sync_to_dropbox_and_github": "Synka till Dropbox och GitHub", "project_too_large": "Projektet är för stort", "project_too_large_please_reduce": "Detta projekt har för mycket redigerbar text, försök att minska ner det. De största filerna är:", "please_ask_the_project_owner_to_link_to_github": "Vänligen be projektägaren att länka detta projekt till GitHub", "go_to_pdf_location_in_code": "Gå till PDF platsen i koden", "ko": "Koreanska", "ja": "Japanska", "about_brian_gough": "är mjukvarutvecklare och före detta teoretisk hög energi fysiker på Fermilab och Los Alamos. Under flera år har han publicerat gratis mjukvarumanualer kommerciellt med hjälp av TeX och LaTeX och var också ansvarig för GNU Scientific Library.", "first_few_days_free": "Första __trialLen__ dagarna gratis", "every": "varje", "credit_card": "Kreditkort", "credit_card_number": "Kreditkortsnummer", "invalid": "Ogiltigt", "expiry": "Utgångsdatum", "january": "Januari", "february": "Februari", "march": "Mars", "april": "April", "may": "Maj", "june": "Juni", "july": "Juli", "august": "Augusti", "september": "September", "october": "Oktober", "november": "November", "december": "December", "zip_post_code": "Postnummer", "city": "Stad", "address": "Adress", "coupon_code": "Kupongkod", "country": "Land", "billing_address": "Fakturaadress", "upgrade_now": "Uppgradera Nu", "state": "Status", "vat_number": "Moms nummer", "you_have_joined": "Du har gått med i __groupName__", "claim_premium_account": "Du har aktiverat din premium prenumeration via __groupName__.", "you_are_invited_to_group": "Du har blivit inbjuden till __groupName__", "you_can_claim_premium_account": "Du kan aktivera en premium prenumeration via __groupName__ genom att verfiera dina e-postadress", "not_now": "Inte nu", "verify_email_join_group": "Verfiera e-postadress och gå med i grupp", "check_email_to_complete_group": "Vänligen kontrollera din e-post för att gå med i gruppen", "verify_email_address": "Verfiera e-postadress", "group_provides_you_with_premium_account": "__groupName__ ger dig ett premium konto. Verfiera din e-postadress för att uppgradera ditt konto.", "check_email_to_complete_the_upgrade": "Vänligen kontrollera din e-post för att uppgradera", "email_link_expired": "E-post länk har utgått, vänligen begär en ny.", "services": "Tjänster", "about_shane_kilkelly": "är en mjukvaruutvecklare som bor i Edinburgh. Shane är en stark förespråkare av Funktionell Programmering, Testdriven utveckling och tar stolthet vid att bygga kvalitativ mjukvara.", "this_is_your_template": "Detta är din mall från ditt projekt", "links": "Länkar", "account_settings": "Kontoinställningar", "search_projects": "Sök projekt", "clone_project": "Klona projekt", "delete_project": "Radera projekt", "download_zip": "Ladda ner Zip", "new_project": "Nytt projekt", "blank_project": "Tomt projekt", "example_project": "Exempelprojekt", "from_template": "Från mall", "cv_or_resume": "CV eller Resume", "cover_letter": "Personligt brev", "journal_article": "Vetenskaplig artikel", "presentation": "Presentation", "thesis": "Uppsats", "bibliographies": "Bibliografi", "terms_of_service": "Användarvillkor", "privacy_policy": "Användarvillkor", "plans_and_pricing": "Betalningsplaner och Priser", "university_licences": "Universitetslicens", "security": "Säkerhet", "contact_us": "Kontakta oss", "thanks": "Tack", "blog": "Blogg", "latex_editor": "LaTex-editor", "get_free_stuff": "Få gratis funktioner", "chat": "Chatt", "your_message": "Ditt meddelande", "loading": "Laddar", "connecting": "Ansluter", "recompile": "Kompilera", "download": "Ladda ner", "email": "E-post", "owner": "Ägare", "read_and_write": "Läs och Skriv", "read_only": "Endast läs", "publish": "Publicera", "view_in_template_gallery": "Visa i mallgalleri", "unpublish": "Avpublicera", "hotkeys": "Snabbkommandon", "saving": "Spara", "cancel": "Avbryt", "project_name": "Projekt namn", "root_document": "Huvud dokument", "spell_check": "Stavningskontroll", "compiler": "Kompilator", "private": "Privat", "public": "Publik", "delete_forever": "Radera för evigt", "support_and_feedback": "Support och feedback", "help": "Hjälp", "latex_templates": "LaTeX mallar", "info": "Info", "latex_help_guide": "LaTeX hjälpguide", "choose_your_plan": "Välj din betalningsplan", "indvidual_plans": "Individuella betalningsplaner", "free_forever": "Gratis för alltid", "low_priority_compile": "Låg prioritering vid kompilering", "unlimited_projects": "Obegränsat med projekt", "unlimited_compiles": "Obegränsat med kompileringar", "full_history_of_changes": "Full ändringshistorik", "highest_priority_compiling": "Högsta kompileringsprioritet", "dropbox_sync": "Dropbox synkronisering", "beta": "Beta", "sign_up_now": "Registrera dig nu", "annual": "Årlig", "half_price_student": "Halva priset för studenter", "about_us": "Om oss", "loading_recent_github_commits": "Laddar senaste commits", "no_new_commits_in_github": "Inga nya commits i GitHub sedan senaste sammanslagning.", "dropbox_sync_description": "Synkronisera dina __appName__ projekt med Dropbox. Ändringar du gör i __appName__ skickas automatiskt till din Dropbox, och vice versa.", "github_sync_description": "Med GitHub synk kan du koppla dina __appName__ projekt till GitHub repon. Skapa nya commits från __appName__ och slå samman commits som har gjorts i offlineläge eller i GitHub.", "github_import_description": "Med GitHub synk kan du importera dina GitHub repon till __appName__. Skapa nya commits från __appName__ och slå samman dessa med commits som gjorts offline eller i GitHub.", "link_to_github_description": "Du måste ge __appName__ åtkomst till ditt GitHub konto för att kunna synkronisera dina projekt.", "unlink": "Koppla bort", "unlink_github_warning": "Projekt som du har synkat med GitHub kommer att kopplas bort och inte längre synkroniseras med GitHub. Är du säker på att du vill koppla bort ditt GitHub konto?", "github_account_successfully_linked": "GitHub konto har kopplats!", "github_successfully_linked_description": "Tack, vi har länkat ditt GitHub konto till __appName__. Du kan du exportera dina __appName__ projekt till GitHub, eller importera projekt från dina GitHub repon.", "import_from_github": "Importera från GitHub", "github_sync_error": "Ett fel uppstod vid kommunikationen med GitHub. Vänligen försök igen om en stund.", "loading_github_repositories": "Laddar dina GitHub repon", "select_github_repository": "Välj ett GitHub repo att importera till __appName__.", "import_to_sharelatex": "Importera till __appName__", "importing": "Importerar", "github_sync": "GitHub Synk", "checking_project_github_status": "Kontrollerar projektstatus på GitHub", "account_not_linked_to_github": "Ditt konto är inte länkat till GitHub", "project_not_linked_to_github": "Detta projekt är inte länkat till ett GitHub repo. Du kan skapa ett repo för det på GitHub:", "create_project_in_github": "Skapa ett GitHub repo", "project_synced_with_git_repo_at": "Detta projekt är synkat med GitHub repot på", "recent_commits_in_github": "Senaste commits på GitHub", "sync_project_to_github": "Synka projekt till GitHub", "sync_project_to_github_explanation": "Alla ändringar du gör i __appName__ kommer att commitas och slås samman med uppdateringar i GitHub.", "github_merge_failed": "Dina ändringar i __appName__ och GitHub kunde inte automatiskt slås samman. Vänligen gör en manuell sammanslagning av <0>__sharelatex_branch__</0>branch och <1>__master_branch__</1>branch i git. Klicka sedan nedan för att fortsätta.", "continue_github_merge": "Jag har gjort en manuell sammanslagning. Fortsätt", "export_project_to_github": "Exportera Projekt till GitHub", "github_validation_check": "Vänligen kontrollera att repots namn är giltigt samt att du har tillåtelse att skapa nya repon.", "repository_name": "Namn på Repo", "optional": "Valfritt", "github_public_description": "Alla kan se detta repo. Du bestämmer vem som kan commita.", "github_commit_message_placeholder": "Commit meddelande för ändringar gjorda i __appName__...", "merge": "Slå samman", "merging": "Slår samman", "github_account_is_linked": "Ditt GitHub konto är länkat.", "unlink_github": "Koppla bort ditt GitHub konto", "link_to_github": "Länk till ditt GitHub konto", "github_integration": "GitHub Integration", "github_is_premium": "GitHub synk är en premium funktion", "linked_file": "Importerad fil", "n_items": "__count__ objekt", "link_institutional_email_get_started": "Länka en institutionell e-postadress till ditt konto för att komma igång.", "looks_like_youre_at": "Det ser ut som att du är vid <0>__institutionName__</0>!", "add_affiliation": "Lägg till anslutning", "add_email_to_claim_features": "Lägg till en institutionell e-postadress för att erhålla dina funktioner.", "please_change_primary_to_remove": "Vänligen ändra din primära e-post-adress för att ta bort", "please_reconfirm_institutional_email": "Vänligen bekräfta din institutionella e-post-adress eller <0>ta bort den</0> från ditt konto.", "need_to_add_new_primary_before_remove": "Du måste lägga till en ny primär e-post-adress innan du kan ta bort den här.", "are_you_still_at": "Är du fortfarande vid <0>__institutionName__</0>?", "thank_you": "Tack!" }
overleaf/web/locales/sv.json/0
{ "file_path": "overleaf/web/locales/sv.json", "repo_id": "overleaf", "token_count": 35774 }
548
/* eslint-disable no-unused-vars */ const Helpers = require('./lib/helpers') exports.tags = ['saas'] const indexes = [ { unique: true, key: { v1Id: 1, }, name: 'v1Id_1', }, ] exports.migrate = async client => { const { db } = client await Helpers.addIndexesToCollection(db.institutions, indexes) } exports.rollback = async client => { const { db } = client try { await Helpers.dropIndexesFromCollection(db.institutions, indexes) } catch (err) { console.error('Something went wrong rolling back the migrations', err) } }
overleaf/web/migrations/20190912145012_create_institutions_indexes.js/0
{ "file_path": "overleaf/web/migrations/20190912145012_create_institutions_indexes.js", "repo_id": "overleaf", "token_count": 220 }
549
/* eslint-disable no-unused-vars */ const Helpers = require('./lib/helpers') exports.tags = ['saas'] const indexes = [ { key: { 'teamInvites.token': 1, }, name: 'teamInvites.token_1', partialFilterExpression: { 'teamInvites.token': { $exists: true, }, }, }, { unique: true, key: { manager_ids: 1, }, name: 'manager_ids_1', partialFilterExpression: { manager_ids: { $exists: true, }, }, }, { unique: true, key: { admin_id: 1, }, name: 'admin_id_1', }, { key: { 'freeTrial.downgraded': 1, 'freeTrial.expiresAt': 1, }, name: 'free_trial', }, { key: { member_ids: 1, }, name: 'member_ids_1', }, { key: { invited_emails: 1, }, name: 'invited_emails_1', }, { unique: true, key: { 'overleaf.id': 1, }, name: 'overleaf.id_1', partialFilterExpression: { 'overleaf.id': { $exists: true, }, }, }, ] exports.migrate = async client => { const { db } = client await Helpers.addIndexesToCollection(db.subscriptions, indexes) } exports.rollback = async client => { const { db } = client try { await Helpers.dropIndexesFromCollection(db.subscriptions, indexes) } catch (err) { console.error('Something went wrong rolling back the migrations', err) } }
overleaf/web/migrations/20190912145028_create_subscriptions_indexes.js/0
{ "file_path": "overleaf/web/migrations/20190912145028_create_subscriptions_indexes.js", "repo_id": "overleaf", "token_count": 670 }
550
/* eslint-disable no-unused-vars */ const Helpers = require('./lib/helpers') exports.tags = ['saas'] const oldIndex = { unique: true, key: { manager_ids: 1, }, name: 'manager_ids_1', partialFilterExpression: { manager_ids: { $exists: true, }, }, } const newIndex = { key: { manager_ids: 1, }, name: 'manager_ids_1', sparse: true, } exports.migrate = async client => { const { db } = client await Helpers.dropIndexesFromCollection(db.subscriptions, [oldIndex]) await Helpers.addIndexesToCollection(db.subscriptions, [newIndex]) } exports.rollback = async client => { const { db } = client try { await Helpers.dropIndexesFromCollection(db.subscriptions, [newIndex]) await Helpers.addIndexesToCollection(db.subscriptions, [oldIndex]) } catch (err) { console.error('Something went wrong rolling back the migrations', err) } }
overleaf/web/migrations/20200729120824_update_subscriptions_manager_ids_index.js/0
{ "file_path": "overleaf/web/migrations/20200729120824_update_subscriptions_manager_ids_index.js", "repo_id": "overleaf", "token_count": 336 }
551
extends ../../../../app/views/layout block append meta meta(name="ol-adminUserExists" data-type="boolean" content=adminUserExists) meta(name="ol-ideJsPath" content=buildJsPath('ide.js')) meta(name="ol-authMethod" content=authMethod) block content script(type="text/javascript", nonce=scriptNonce, src=(wsUrl || '/socket.io') + '/socket.io.js') style. hr { margin-bottom: 5px; } .status-check { margin-bottom: 15px; } .alert { margin-top: 15px; margin-bottom: 15px; } a small { cursor: pointer; color: #a93529; } .launchpad-body img { width: 150px; margin-top: 15px; } .content.content-alt(ng-controller="LaunchpadController") .container(ng-cloak) .row .col-md-8.col-md-offset-2 .card.launchpad-body .row .col-md-12 .text-center h1 #{translate('welcome_to_sl')} p img(src=buildImgPath('/ol-brand/overleaf-o.svg')) <!-- wrapper --> .row .col-md-8.col-md-offset-2 <!-- create first admin form --> .row(ng-if="shouldShowAdminForm()") .col-md-12 h2 #{translate('create_first_admin_account')} // Local Auth Form div(ng-if="authMethod == 'local'") form(async-form="register", name="registerForm", on-success="onCreateAdminSuccess" on-error="onCreateAdminError" action="/launchpad/register_admin", method="POST", ng-cloak) input(name='_csrf', type='hidden', value=csrfToken) form-messages(for="registerForm") .form-group label(for='email') #{translate("email")} input.form-control( type='email', name='email', placeholder="email@example.com" required, ng-model="email", ng-model-options="{ updateOn: 'blur' }", focus="true" ) span.small.text-primary(ng-show="registerForm.email.$invalid && registerForm.email.$dirty") | #{translate("must_be_email_address")} .form-group label(for='password') #{translate("password")} input.form-control#passwordField( type='password', name='password', placeholder="********", required, ng-model="password", complex-password ) span.small.text-primary(ng-show="registerForm.password.$error.complexPassword", ng-bind-html="complexPasswordErrorMessage") .actions button.btn-primary.btn( type='submit' ng-disabled="registerForm.inflight || registerForm.password.$error.required|| registerForm.password.$error.complexPassword || createAdminSuccess" ) span(ng-show="!registerForm.inflight") #{translate("register")} span(ng-show="registerForm.inflight") #{translate("registering")}… // Ldap Form div(ng-if="authMethod == 'ldap'") h3 #{translate('ldap')} p | #{translate('ldap_create_admin_instructions')} form(async-form="register", name="registerLdapForm", on-success="onCreateAdminSuccess" on-error="onCreateAdminError" action="/launchpad/register_ldap_admin", method="POST", ng-cloak) input(name='_csrf', type='hidden', value=csrfToken) form-messages(for="registerLdapForm") .form-group label(for='email') #{translate("email")} input.form-control( type='email', name='email', placeholder="email@example.com" required, ng-model="email", ng-model-options="{ updateOn: 'blur' }", focus="true" ) span.small.text-primary(ng-show="registerLdapForm.email.$invalid && registerLdapForm.email.$dirty") | #{translate("must_be_email_address")} .actions button.btn-primary.btn( type='submit' ng-disabled="registerLdapForm.inflight || registerLdapForm.password.$error.required|| registerLdapForm.password.$error.complexPassword || createAdminSuccess" ) span(ng-show="!registerLdapForm.inflight") #{translate("register")} span(ng-show="registerLdapForm.inflight") #{translate("registering")}… // Saml Form div(ng-if="authMethod == 'saml'") h3 #{translate('saml')} p | #{translate('saml_create_admin_instructions')} form(async-form="register", name="registerSamlForm", on-success="onCreateAdminSuccess" on-error="onCreateAdminError" action="/launchpad/register_saml_admin", method="POST", ng-cloak) input(name='_csrf', type='hidden', value=csrfToken) form-messages(for="registerSamlForm") .form-group label(for='email') #{translate("email")} input.form-control( type='email', name='email', placeholder="email@example.com" required, ng-model="email", ng-model-options="{ updateOn: 'blur' }", focus="true" ) span.small.text-primary(ng-show="registerSamlForm.email.$invalid && registerSamlForm.email.$dirty") | #{translate("must_be_email_address")} .actions button.btn-primary.btn( type='submit' ng-disabled="registerSamlForm.inflight || registerSamlForm.password.$error.required|| registerSamlForm.password.$error.complexPassword || createAdminSuccess" ) span(ng-show="!registerSamlForm.inflight") #{translate("register")} span(ng-show="registerSamlForm.inflight") #{translate("registering")}… <!-- success message --> .row(ng-if="createAdminSuccess") .col-md-12.text-center .alert.alert-success | !{translate('admin_user_created_message', {link: '/login?redir=/launchpad'})} <!-- error message --> .row(ng-if="createAdminError") .col-md-12.text-center .alert.alert-danger | #{translate('generic_something_went_wrong')} br <!-- status indicators --> div(ng-if="!shouldShowAdminForm()") .row .col-md-12.status-indicators h2 #{translate('status_checks')} <!-- ide js --> .row.status-check .col-sm-5 | #{translate('editor_resources')} .col-sm-7 div(ng-switch="statusChecks.ideJs.status") span(ng-switch-when="inflight") i.fa.fa-fw.fa-spinner.fa-spin span &nbsp;#{translate('checking')} span(ng-switch-when="ok") i.fa.fa-check span &nbsp;#{translate('ok')} a(ng-click="tryFetchIdeJs()") small &nbsp;#{translate('retry')} span(ng-switch-when="error") i.fa.fa-exclamation span &nbsp;#{translate('error')} a(ng-click="tryFetchIdeJs()") small &nbsp;#{translate('retry')} div.alert.alert-danger | {{ statusChecks.ideJs.error }} <!-- websocket --> .row.status-check .col-sm-5 | #{translate('websockets')} .col-sm-7 div(ng-switch="statusChecks.websocket.status") span(ng-switch-when="inflight") i.fa.fa-fw.fa-spinner.fa-spin span &nbsp;#{translate('checking')} span(ng-switch-when="ok") i.fa.fa-check span &nbsp;#{translate('ok')} a(ng-click="tryOpenWebSocket()") small &nbsp;#{translate('retry')} span(ng-switch-when="error") i.fa.fa-exclamation span &nbsp;#{translate('error')} a(ng-click="tryOpenWebSocket()") small &nbsp;#{translate('retry')} div.alert.alert-danger | {{ statusChecks.websocket.error }} <!-- break --> hr <!-- other actions --> .row .col-md-12 h2 #{translate('other_actions')} h3 #{translate('send_test_email')} form.form .form-group label(for="emailInput") Email input(type="text", name="emailInput" ng-model="testEmail.emailAddress").form-control button(ng-click="sendTestEmail()", ng-disabled="testEmail.inflight").btn.btn-primary span(ng-show="!testEmail.inflight") #{translate("send")} span(ng-show="testEmail.inflight") #{translate("sending")}… div(ng-if="testEmail.status == 'ok'") .alert.alert-success | #{translate('email_sent')} div(ng-if="testEmail.status == 'error'") .alert.alert-danger | #{translate('generic_something_went_wrong')} <!-- break --> hr <!-- Go to app --> .row .col-md-12 .text-center br p a(href="/admin").btn.btn-info | Go To Admin Panel | &nbsp; a(href="/project").btn.btn-primary | Start Using #{settings.appName} br
overleaf/web/modules/launchpad/app/views/launchpad.pug/0
{ "file_path": "overleaf/web/modules/launchpad/app/views/launchpad.pug", "repo_id": "overleaf", "token_count": 5141 }
552
require(`../../../../../test/acceptance/src/helpers/InitApp`)
overleaf/web/modules/server-ce-scripts/test/acceptance/src/Init.js/0
{ "file_path": "overleaf/web/modules/server-ce-scripts/test/acceptance/src/Init.js", "repo_id": "overleaf", "token_count": 23 }
553
<svg xmlns="http://www.w3.org/2000/svg" width="777.5" height="820.52" viewBox="0 0 777.5 820.52"> <g> <g> <circle cx="388.75" cy="388.75" r="388.75" fill="#798ed2" opacity="0.05"/> <rect x="182.22" y="230.37" width="413.04" height="295.03" fill="#a93529"/> <path d="M389.5,229.95s9.34-15.08,42.47-13.25,133.77,14.17,133.77,14.17V492.25s-91.3-16.45-141.84-11.88c-22.82,2.06-35.25,11.88-35.25,11.88S390.13,230.63,389.5,229.95Z" fill="#fff"/> <path d="M389.18,230.52s-10.59-15.5-43.72-13.67S211.7,231,211.7,231V492.41S303,476,353.53,480.52c22.82,2.06,35.25,11.88,35.25,11.88S388.54,231.2,389.18,230.52Z" fill="#fff"/> <path d="M388.78,487.15v5.26s0-1.88,0-5.26Z" fill="#e9e6d9"/> <g> <circle cx="195.09" cy="656.25" r="12.92" fill="#a93529"/> <path d="M194.85,696.16c2.64,5.28,23.77,6.3,46.21,6.16,22.66-.14,43.81-.66,46.53-5.94,6.85-13.27-34.66-41.88-46.42-41.88C227.16,654.5,187.73,681.91,194.85,696.16Z" fill="#a93529"/> <circle cx="220.92" cy="630.4" r="12.92" fill="#a93529"/> <circle cx="261.54" cy="630.4" r="12.92" fill="#a93529"/> <circle cx="287.38" cy="656.25" r="12.92" fill="#a93529"/> </g> <g> <circle cx="490.12" cy="774.44" r="12.92" fill="#a93529"/> <path d="M489.89,814.35c2.64,5.28,23.77,6.3,46.21,6.16,22.66-.14,43.81-.66,46.53-5.94,6.85-13.27-34.66-41.88-46.42-41.88C522.19,772.69,482.76,800.11,489.89,814.35Z" fill="#a93529"/> <circle cx="515.96" cy="748.6" r="12.92" fill="#a93529"/> <circle cx="556.58" cy="748.6" r="12.92" fill="#a93529"/> <circle cx="582.41" cy="774.44" r="12.92" fill="#a93529"/> </g> <rect x="211.7" y="406.39" width="354.03" height="88.87" fill="#fff"/> <path d="M502.94,451.45c-58.5-14.55-114.29-5-114.29,40.8L386.37,228s.41-11.71,16.15-24.17l-3.15,27.79L442.13,218l-25.65,30.49L427.12,257l-14.5,20.45,31.82,54.39L422.55,370.5l21.88,42.19-20.3,17.14Z" fill="#cfcfcf"/> <path d="M353.53,480.52c22.82,2.06,35.25,11.88,35.25,11.88v2.86H211.7v-2.86S303,476,353.53,480.52Z" fill="#e7e6e6"/> <path d="M423.89,480.38c-22.82,2.08-35.25,12-35.25,12v2.88H565.73v-2.88S474.43,475.76,423.89,480.38Z" fill="#e7e6e6"/> </g> </g> </svg>
overleaf/web/public/img/brand/404-visual.svg/0
{ "file_path": "overleaf/web/public/img/brand/404-visual.svg", "repo_id": "overleaf", "token_count": 1317 }
554
const _ = require('lodash') const WRITE_CONCURRENCY = parseInt(process.env.WRITE_CONCURRENCY, 10) || 10 const { batchedUpdate } = require('./helpers/batchedUpdate') const { promiseMapWithLimit } = require('../app/src/util/promises') // $ node scripts/convert_archived_state.js FIRST,SECOND const STAGE = process.argv.pop() async function main() { if (STAGE.includes('FIRST')) { await batchedUpdate( 'projects', { archived: false }, { $set: { archived: [] }, } ) console.error('Done, with first part') } if (STAGE.includes('SECOND')) { await batchedUpdate('projects', { archived: true }, performUpdate, { _id: 1, owner_ref: 1, collaberator_refs: 1, readOnly_refs: 1, tokenAccessReadAndWrite_refs: 1, tokenAccessReadOnly_refs: 1, }) console.error('Done, with second part') } } main() .then(() => { process.exit(0) }) .catch(error => { console.error({ error }) process.exit(1) }) async function performUpdate(collection, nextBatch) { await promiseMapWithLimit(WRITE_CONCURRENCY, nextBatch, project => setArchived(collection, project) ) } async function setArchived(collection, project) { const archived = calculateArchivedArray(project) return collection.updateOne( { _id: project._id }, { $set: { archived: archived }, } ) } function calculateArchivedArray(project) { return _.unionWith( [project.owner_ref], project.collaberator_refs, project.readOnly_refs, project.tokenAccessReadAndWrite_refs, project.tokenAccessReadOnly_refs, _objectIdEquals ) } function _objectIdEquals(firstVal, secondVal) { // For use as a comparator for unionWith return firstVal.toString() === secondVal.toString() }
overleaf/web/scripts/convert_archived_state.js/0
{ "file_path": "overleaf/web/scripts/convert_archived_state.js", "repo_id": "overleaf", "token_count": 687 }
555
const crypto = require('crypto') const fs = require('fs') const Path = require('path') const cheerio = require('cheerio') const prettier = require('prettier') const sanitizeHtml = require('sanitize-html') const { sanitizeOptions, } = require('../../../modules/learn/app/src/sanitizeOptions') const EXTRACT_STYLE = process.env.EXTRACT_STYLES === 'true' const OMIT_STYLE = process.env.OMIT_STYLE !== 'false' const DUMP_CSS_IN = Path.join( Path.dirname(Path.dirname(Path.dirname(__dirname))), 'data', 'dumpFolder' ) function hash(blob) { return crypto.createHash('sha1').update(blob).digest('hex') } function normalize(blob, title) { // styles are dropped in web and kept in wiki pages for previewing there. blob = blob.replace(/<style>(.+?)<\/style>/gs, (_, match) => { if (EXTRACT_STYLE) { // normalize css with prettier const css = prettier.format(match, { parser: 'css' }) fs.writeFileSync( Path.join(DUMP_CSS_IN, `${hash(css)}-${encodeURIComponent(title)}.css`), `/* title: ${title} */\n\n${css}` ) } if (OMIT_STYLE) { return '' } return match }) // strip comments: // - comment at the bottom of each page blob = blob.replace(/<!-- \nNewPP limit report.+/s, '') // - annotation of math characters blob = blob.replace(/<!-- . -->/g, '') // wrap for consistent rendering if (blob.indexOf('<html><head>') !== 0) { blob = `<html><head>${blob}</head></html>` } // normalize inline style: // - drop trailing ; blob = blob.replace(/style="([^"]+);"/g, (_, style) => `style="${style}"`) // - normalize whitespace blob = blob.replace( /style="([^"]+)"/g, (_, style) => `style="${style.trim().replace(/([:;])\s+/g, '$1')}"` ) // let cherrio do another pass return cheerio.load(blob).html() } function toText(blob) { return cheerio.load(blob).text() } const zoomOut = 50 function peak(content, offset) { // show some more content before/after the mismatch if (offset > zoomOut) { offset -= zoomOut } // wrap in JSON to escape new line characters return JSON.stringify(content.slice(offset, offset + chunkSize + 2 * zoomOut)) } const chunkSize = 100 function findFirstMismatch(a, b) { if (a === b) return a.length let i = 0 while ( a.length > chunkSize && b.length > chunkSize && a.slice(0, chunkSize) === b.slice(0, chunkSize) ) { i++ a = a.slice(chunkSize) b = b.slice(chunkSize) } return i * chunkSize } function checkSanitizeOptions(page, title, text) { text = normalize(text, title) const sanitized = normalize(sanitizeHtml(text, sanitizeOptions)) if (text === sanitized) return const offset = findFirstMismatch(text, sanitized) const textToText = toText(text) const sanitizedToText = toText(sanitized) const offsetText = findFirstMismatch(textToText, sanitizedToText) console.error('---') console.error('page :', page) console.error('title :', title) console.error('match :', text === sanitized) console.error('toText :', toText(text) === toText(sanitized)) console.error('text :', peak(text, offset)) console.error('sanitized :', peak(sanitized, offset)) console.error('textToText :', peak(textToText, offsetText)) console.error('sanitizedToText:', peak(sanitizedToText, offsetText)) } module.exports = { checkSanitizeOptions, }
overleaf/web/scripts/learn/checkSanitize/checkSanitizeOptions.js/0
{ "file_path": "overleaf/web/scripts/learn/checkSanitize/checkSanitizeOptions.js", "repo_id": "overleaf", "token_count": 1309 }
556
'use strict' const fs = require('fs') const minimist = require('minimist') const InstitutionsAPI = require('../../app/src/Features/Institutions/InstitutionsAPI') .promises const argv = minimist(process.argv.slice(2)) const commit = argv.commit !== undefined const ignoreNulls = !!argv['ignore-nulls'] if (!commit) { console.log('DOING DRY RUN. TO SAVE CHANGES PASS --commit') } const userEntitlements = loadUserEntitlements(argv['user-entitlements']) const cachedEntitlements = loadCachedEntitlements(argv['cached-entitlements']) syncUserEntitlements(userEntitlements, cachedEntitlements) .catch(err => console.error(err.stack)) .then(() => process.exit()) async function syncUserEntitlements(userEntitlements, cachedEntitlements) { // check for user entitlements in mongo but not in postgres for (const key of Object.keys(userEntitlements)) { const userEntitlement = userEntitlements[key] if (!userEntitlement) { continue } // find any email(s) that are linked through sso for (const email of userEntitlement.emails) { if (!email.samlProviderId) { continue } // get samlIdentifiers entry for email const samlIdentifier = userEntitlement.samlIdentifiers.find( samlIdentifier => samlIdentifier.providerId === email.samlProviderId ) // validate that entitlement is cached if (samlIdentifier) { const cachedEntitlment = cachedEntitlements[email.email] // validate that record is correct if (cachedEntitlment) { if ( cachedEntitlment.hasEntitlement !== samlIdentifier.hasEntitlement ) { console.log( `cached entitlement mismatch for user ${userEntitlement.userId} mongo(${samlIdentifier.hasEntitlement}) postgres(${cachedEntitlment.hasEntitlement})` ) await syncUserEntitlement( userEntitlement.userId, email.email, samlIdentifier.hasEntitlement ) } } // there is not record in postgres at all else { console.log( `missing cached entitlement for user ${userEntitlement.userId}` ) await syncUserEntitlement( userEntitlement.userId, email.email, samlIdentifier.hasEntitlement ) } } // if identifier is missing for email this is internal inconsistency in mongo else { console.log(`missing samlIdentifier for user ${userEntitlement.userId}`) } } // find any samlIdentifier records missing email entry for (const samlIdentifier of userEntitlement.samlIdentifiers) { const email = userEntitlement.emails.find( email => email.samlProviderId === samlIdentifier.providerId ) if (!email) { console.log( `missing email entry for samlIdentifier for user ${userEntitlement.userId}` ) } } } // check for user entitlements in postgres but not in mongo for (const key of Object.keys(cachedEntitlements)) { const cachedEntitlment = cachedEntitlements[key] if (!cachedEntitlment) { continue } if (!cachedEntitlment.hasEntitlement) { continue } const userEntitlement = userEntitlements[cachedEntitlment.userId] // validate that mongo has correct entitlement if (userEntitlement) { // find samlIdentifier for provider const samlIdentifier = userEntitlement.samlIdentifiers.find( samlIdentifier => samlIdentifier.providerId === cachedEntitlment.providerId ) if (!samlIdentifier || !samlIdentifier.hasEntitlement) { console.log( `cached entitlement mismatch for user ${userEntitlement.userId} mongo(false) postgres(true)` ) await syncUserEntitlement( userEntitlement.userId, cachedEntitlment.email, false ) } } // if the record does not exist it is probably because users without // entitlements were not exported else { console.log( `missing cached entitlement in mongo for user ${cachedEntitlment.userId}` ) } } } async function syncUserEntitlement(userId, email, hasEntitlement) { if (!commit) { return } try { if (hasEntitlement) { await InstitutionsAPI.addEntitlement(userId, email) } else { await InstitutionsAPI.removeEntitlement(userId, email) } } catch (err) { console.error( `error setting entitlement: ${userId}, ${email}, ${hasEntitlement} - ${err.message}` ) } } function loadUserEntitlements(userEntitlementsFilename) { const userEntitlementsData = fs .readFileSync(userEntitlementsFilename, { encoding: 'utf8', }) .split('\n') const userEntitlements = {} for (const userEntitlementLine of userEntitlementsData) { if (!userEntitlementLine) { continue } const userEntitlementExport = JSON.parse(userEntitlementLine) const userId = userEntitlementExport._id.$oid delete userEntitlementExport._id userEntitlementExport.userId = userId userEntitlements[userId] = userEntitlementExport } return userEntitlements } function loadCachedEntitlements(cachedEntitlementsFilename) { const cachedEntitlementsData = fs .readFileSync(cachedEntitlementsFilename, { encoding: 'utf8', }) .split('\n') const cachedEntitlements = {} for (const cachedEntitlementLine of cachedEntitlementsData) { // this is safe because comma is not an allowed value for any column const [ userId, email, hasEntitlement, providerId, ] = cachedEntitlementLine.split(',') let hasEntitlementBoolean if (ignoreNulls) { hasEntitlementBoolean = hasEntitlement === 't' } else { hasEntitlementBoolean = hasEntitlement === 't' ? true : hasEntitlement === 'f' ? false : null } cachedEntitlements[email] = { email, hasEntitlement: hasEntitlementBoolean, providerId, userId, } } return cachedEntitlements }
overleaf/web/scripts/sync-user-entitlements/sync-user-entitlements.js/0
{ "file_path": "overleaf/web/scripts/sync-user-entitlements/sync-user-entitlements.js", "repo_id": "overleaf", "token_count": 2453 }
557
'use strict' const _ = require('lodash') class UKAMFEntity { constructor(data) { this.data = data } getSamlConfig() { let hiddenIdP = false const idp = this.data.IDPSSODescriptor[0] const idpMetaData = _.get(this.data, [ 'Extensions', 0, 'mdattr:EntityAttributes', 0, 'saml:Attribute', ]) || [] idpMetaData.forEach(data => { const value = _.get(data, ['saml:AttributeValue', 0]) if ( value === 'http://refeds.org/category/hide-from-discovery' || value === 'https://refeds.org/category/hide-from-discovery' ) { hiddenIdP = true } }) const keys = idp.KeyDescriptor const signingKey = keys.length === 1 ? keys[0] : keys.find(key => _.get(key, ['$', 'use']) === 'signing') const entityId = this.data.$.entityID let cert = _.get(signingKey, [ 'ds:KeyInfo', 0, 'ds:X509Data', 0, 'ds:X509Certificate', 0, ]) if (!cert) { throw new Error('no cert') } cert = cert.replace(/\s/g, '') let entryPoint = idp.SingleSignOnService.find( sso => _.get(sso, ['$', 'Binding']) === 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' ) entryPoint = _.get(entryPoint, ['$', 'Location']) if (!entryPoint) { throw new Error('no entryPoint') } return { cert, entityId, entryPoint, hiddenIdP, } } } module.exports = UKAMFEntity
overleaf/web/scripts/ukamf/ukamf-entity.js/0
{ "file_path": "overleaf/web/scripts/ukamf/ukamf-entity.js", "repo_id": "overleaf", "token_count": 738 }
558
const Settings = require('@overleaf/settings') const request = require('./helpers/request') // create a string that is longer than the max allowed (as defined in Server.js) const wayTooLongString = 'a'.repeat(Settings.max_json_request_size + 1) describe('BodyParserErrors', function () { describe('when request is too large', function () { describe('json', function () { it('return 413', function (done) { request.post( { url: '/login', body: { password: wayTooLongString }, json: true, }, (error, response, body) => { if (error) { return done(error) } response.statusCode.should.equal(413) body.should.deep.equal({}) done() } ) }) }) describe('urlencoded', function () { it('return 413', function (done) { request.post( { url: '/login', form: { password: wayTooLongString }, }, (error, response, body) => { if (error) { return done(error) } response.statusCode.should.equal(413) body.should.match(/I'm afraid I can't do that./) done() } ) }) }) }) describe('when request is not too large', function () { describe('json', function () { it('return normal status code', function (done) { request.post( { url: '/login', body: { password: 'foo' }, json: true, }, (error, response, body) => { if (error) { return done(error) } response.statusCode.should.equal(403) done() } ) }) }) describe('urlencoded', function () { it('return normal status code', function (done) { request.post( { url: '/login', form: { password: 'foo' }, }, (error, response, body) => { if (error) { return done(error) } response.statusCode.should.equal(403) done() } ) }) }) }) })
overleaf/web/test/acceptance/src/BodyParserErrorsTest.js/0
{ "file_path": "overleaf/web/test/acceptance/src/BodyParserErrorsTest.js", "repo_id": "overleaf", "token_count": 1154 }
559
/* eslint-disable camelcase, node/handle-callback-err, max-len, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const { expect } = require('chai') const async = require('async') const User = require('./helpers/User') const request = require('./helpers/request') const settings = require('@overleaf/settings') const joinProject = (user_id, project_id, callback) => request.post( { url: `/project/${project_id}/join`, qs: { user_id }, auth: { user: settings.apis.web.user, pass: settings.apis.web.pass, sendImmediately: true, }, json: true, jar: false, }, callback ) describe('ProjectFeatures', function () { beforeEach(function (done) { this.timeout(90000) this.owner = new User() return async.series([cb => this.owner.login(cb)], done) }) describe('with private project', function () { beforeEach(function (done) { return this.owner.createProject( 'private-project', (error, project_id) => { if (error != null) { return done(error) } this.project_id = project_id return done() } ) }) describe('with an upgraded account', function () { beforeEach(function (done) { return this.owner.upgradeFeatures(done) }) after(function (done) { return this.owner.defaultFeatures(done) }) it('should have premium features', function (done) { return joinProject( this.owner._id, this.project_id, (error, response, body) => { expect(body.project.features.compileGroup).to.equal('priority') expect(body.project.features.versioning).to.equal(true) expect(body.project.features.templates).to.equal(true) expect(body.project.features.dropbox).to.equal(true) return done() } ) }) }) describe('with an basic account', function () { beforeEach(function (done) { return this.owner.downgradeFeatures(done) }) after(function (done) { return this.owner.defaultFeatures(done) }) it('should have basic features', function (done) { return joinProject( this.owner._id, this.project_id, (error, response, body) => { expect(body.project.features.compileGroup).to.equal('standard') expect(body.project.features.versioning).to.equal(false) expect(body.project.features.templates).to.equal(false) expect(body.project.features.dropbox).to.equal(false) return done() } ) }) }) }) })
overleaf/web/test/acceptance/src/ProjectFeaturesTests.js/0
{ "file_path": "overleaf/web/test/acceptance/src/ProjectFeaturesTests.js", "repo_id": "overleaf", "token_count": 1264 }
560
const { expect } = require('chai') const User = require('./helpers/User') describe('UnsupportedBrowsers', function () { beforeEach(function (done) { this.user = new User() this.user.login(done) }) it('allows bots', function (done) { this.user.request( { url: '/project', headers: { // Googlebot user agent 'user-agent': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', }, }, (error, response) => { expect(error).to.not.exist expect(response.statusCode).to.equal(200) done() } ) }) it('allows supported browsers', function (done) { this.user.request( { url: '/project', headers: { // Chrome 90 user agent 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36', }, }, (error, response) => { expect(error).to.not.exist expect(response.statusCode).to.equal(200) done() } ) }) it('redirects unsupported browsers to unsupported page', function (done) { const url = '/project' this.user.request( { url, headers: { // IE11 user agent 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko', }, }, (error, response) => { expect(error).to.not.exist expect(response.statusCode).to.equal(302) expect(response.headers.location).to.equal( '/unsupported-browser?fromURL=' + encodeURIComponent(url) ) done() } ) }) it('shows the previous URL', function (done) { const url = '/project/60867f47174dfd13f1e00000' this.user.request( { url: '/unsupported-browser?fromURL=' + encodeURIComponent(url), headers: { // IE11 user agent 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko', }, }, (error, response, body) => { expect(error).to.not.exist expect(response.statusCode).to.equal(200) expect(body).to.include('URL:') expect(body).to.include(url) done() } ) }) it('shows a sanitized URL', function (done) { const url = 'https://evil.com/the/pathname' this.user.request( { url: '/unsupported-browser?fromURL=' + encodeURIComponent(url), headers: { // IE11 user agent 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko', }, }, (error, response, body) => { expect(error).to.not.exist expect(response.statusCode).to.equal(200) expect(body).to.include('URL:') expect(body).to.not.include('evil.com') expect(body).to.include('/the/pathname') done() } ) }) })
overleaf/web/test/acceptance/src/UnsupportedBrowserTests.js/0
{ "file_path": "overleaf/web/test/acceptance/src/UnsupportedBrowserTests.js", "repo_id": "overleaf", "token_count": 1443 }
561
/* eslint-disable node/handle-callback-err, max-len, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const Settings = require('@overleaf/settings') const logger = require('logger-sharelatex') const Async = require('async') const UserSessionsRedis = require('../../../../app/src/Features/User/UserSessionsRedis') // rclient = redis.createClient(Settings.redis.web) const rclient = UserSessionsRedis.client() module.exports = { getUserSessions(user, callback) { if (callback == null) { callback = function (err, sessionsSet) {} } return rclient.smembers( UserSessionsRedis.sessionSetKey(user), (err, result) => callback(err, result) ) }, clearUserSessions(user, callback) { if (callback == null) { callback = function (err) {} } const sessionSetKey = UserSessionsRedis.sessionSetKey(user) return rclient.smembers(sessionSetKey, (err, sessionKeys) => { if (err) { return callback(err) } if (sessionKeys.length === 0) { return callback(null) } const actions = sessionKeys.map(k => cb => rclient.del(k, err => cb(err))) return Async.series(actions, (err, results) => rclient.srem(sessionSetKey, sessionKeys, err => { if (err) { return callback(err) } return callback(null) }) ) }) }, }
overleaf/web/test/acceptance/src/helpers/redis.js/0
{ "file_path": "overleaf/web/test/acceptance/src/helpers/redis.js", "repo_id": "overleaf", "token_count": 653 }
562
// Run babel on tests to allow support for import/export statements in Node require('@babel/register') // Load JSDOM to mock the DOM in Node // Set pretendToBeVisual to enable requestAnimationFrame require('jsdom-global')(undefined, { pretendToBeVisual: true, url: 'https://www.test-overleaf.com/', }) // workaround for "keys.js in jsdom-global doesn't include AbortController" global.AbortController = window.AbortController const path = require('path') process.env.SHARELATEX_CONFIG = path.resolve( __dirname, '../../config/settings.webpack.js' ) // Load sinon-chai assertions so expect(stubFn).to.have.been.calledWith('abc') // has a nicer failure messages const chai = require('chai') chai.use(require('sinon-chai')) chai.use(require('chai-as-promised')) // Mock global settings window.ExposedSettings = { appName: 'Overleaf', maxEntitiesPerProject: 10, maxUploadSize: 5 * 1024 * 1024, siteUrl: 'https://www.dev-overleaf.com', hasLinkUrlFeature: true, hasLinkedProjectFileFeature: true, hasLinkedProjectOutputFileFeature: true, textExtensions: [ 'tex', 'latex', 'sty', 'cls', 'bst', 'bib', 'bibtex', 'txt', 'tikz', 'mtx', 'rtex', 'md', 'asy', 'latexmkrc', 'lbx', 'bbx', 'cbx', 'm', 'lco', 'dtx', 'ins', 'ist', 'def', 'clo', 'ldf', 'rmd', 'lua', 'gv', 'mf', ], } window.i18n = { currentLangCode: 'en' } require('../../frontend/js/i18n') const moment = require('moment') moment.updateLocale('en', { calendar: { lastDay: '[Yesterday]', sameDay: '[Today]', nextDay: '[Tomorrow]', lastWeek: 'ddd, Do MMM YY', nextWeek: 'ddd, Do MMM YY', sameElse: 'ddd, Do MMM YY', }, }) let inMemoryLocalStorage = {} Object.defineProperty(global, 'localStorage', { value: { // localStorage returns `null` when the item does not exist getItem: key => inMemoryLocalStorage[key] !== undefined ? inMemoryLocalStorage[key] : null, setItem: (key, value) => (inMemoryLocalStorage[key] = value), clear: () => (inMemoryLocalStorage = {}), removeItem: key => delete inMemoryLocalStorage[key], }, writable: true, }) // node-fetch doesn't accept relative URL's: https://github.com/node-fetch/node-fetch/blob/master/docs/v2-LIMITS.md#known-differences const fetch = require('node-fetch') global.fetch = window.fetch = (url, ...options) => fetch(new URL(url, 'http://localhost'), ...options) // ignore CSS files const { addHook } = require('pirates') addHook(() => '', { exts: ['.css'], ignoreNodeModules: false })
overleaf/web/test/frontend/bootstrap.js/0
{ "file_path": "overleaf/web/test/frontend/bootstrap.js", "repo_id": "overleaf", "token_count": 1037 }
563
import { expect } from 'chai' import { screen, fireEvent } from '@testing-library/react' import renderWithContext from '../helpers/render-with-context' import FileTreeDoc from '../../../../../frontend/js/features/file-tree/components/file-tree-doc' describe('<FileTreeDoc/>', function () { it('renders unselected', function () { const { container } = renderWithContext( <FileTreeDoc name="foo.tex" id="123abc" isLinkedFile={false} /> ) screen.getByRole('treeitem', { selected: false }) expect(container.querySelector('i.linked-file-highlight')).to.not.exist }) it('renders selected', function () { renderWithContext( <FileTreeDoc name="foo.tex" id="123abc" isLinkedFile={false} />, { contextProps: { rootFolder: [ { docs: [{ _id: '123abc' }], fileRefs: [], folders: [], }, ], }, } ) const treeitem = screen.getByRole('treeitem', { selected: false }) fireEvent.click(treeitem) screen.getByRole('treeitem', { selected: true }) }) it('renders as linked file', function () { const { container } = renderWithContext( <FileTreeDoc name="foo.tex" id="123abc" isLinkedFile /> ) screen.getByRole('treeitem') expect(container.querySelector('i.linked-file-highlight')).to.exist }) it('selects', function () { renderWithContext(<FileTreeDoc name="foo.tex" id="123abc" expanded />, { contextProps: { rootFolder: [ { docs: [{ _id: '123abc' }], fileRefs: [], folders: [], }, ], }, }) const treeitem = screen.getByRole('treeitem', { selected: false }) fireEvent.click(treeitem) screen.getByRole('treeitem', { selected: true }) }) it('multi-selects', function () { renderWithContext(<FileTreeDoc name="foo.tex" id="123abc" expanded />, { contextProps: { rootFolder: [ { docs: [{ _id: '123abc' }], fileRefs: [], folders: [], }, ], }, }) const treeitem = screen.getByRole('treeitem') fireEvent.click(treeitem, { ctrlKey: true }) screen.getByRole('treeitem', { selected: true }) }) })
overleaf/web/test/frontend/features/file-tree/components/file-tree-doc.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/file-tree/components/file-tree-doc.test.js", "repo_id": "overleaf", "token_count": 997 }
564
import { screen } from '@testing-library/react' import fetchMock from 'fetch-mock' import { renderWithEditorContext } from '../../../helpers/render-with-context' import FileViewText from '../../../../../frontend/js/features/file-view/components/file-view-text.js' describe('<FileViewText/>', function () { const file = { name: 'example.tex', linkedFileData: { v1_source_doc_id: 'v1-source-id', source_project_id: 'source-project-id', source_entity_path: '/source-entity-path.ext', provider: 'project_file', }, created: new Date(2021, 1, 17, 3, 24).toISOString(), } beforeEach(function () { fetchMock.reset() }) it('renders a text view', async function () { fetchMock.head('express:/project/:project_id/file/:file_id', { status: 201, headers: { 'Content-Length': 10000 }, }) fetchMock.get( 'express:/project/:project_id/file/:file_id', 'Text file content' ) renderWithEditorContext( <FileViewText file={file} onError={() => {}} onLoad={() => {}} /> ) await screen.findByText('Text file content', { exact: false }) }) })
overleaf/web/test/frontend/features/file-view/components/file-view-text.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/file-view/components/file-view-text.test.js", "repo_id": "overleaf", "token_count": 442 }
565
import { expect } from 'chai' import sinon from 'sinon' import { screen, fireEvent, render, waitFor, waitForElementToBeRemoved, } from '@testing-library/react' import fetchMock from 'fetch-mock' import ShareProjectModal from '../../../../../frontend/js/features/share-project-modal/components/share-project-modal' import { renderWithEditorContext, cleanUpContext, EditorProviders, } from '../../../helpers/render-with-context' import * as locationModule from '../../../../../frontend/js/features/share-project-modal/utils/location' describe('<ShareProjectModal/>', function () { const project = { _id: 'test-project', name: 'Test Project', features: { collaborators: 10, compileGroup: 'standard', }, owner: { _id: 'member_author', email: 'project-owner@example.com', }, members: [], invites: [], } const contacts = [ // user with edited name { type: 'user', email: 'test-user@example.com', first_name: 'Test', last_name: 'User', name: 'Test User', }, // user with default name (email prefix) { type: 'user', email: 'test@example.com', first_name: 'test', }, // no last name { type: 'user', first_name: 'Eratosthenes', email: 'eratosthenes@example.com', }, // more users { type: 'user', first_name: 'Claudius', last_name: 'Ptolemy', email: 'ptolemy@example.com', }, { type: 'user', first_name: 'Abd al-Rahman', last_name: 'Al-Sufi', email: 'al-sufi@example.com', }, { type: 'user', first_name: 'Nicolaus', last_name: 'Copernicus', email: 'copernicus@example.com', }, ] const modalProps = { show: true, isAdmin: true, handleHide: sinon.stub(), } beforeEach(function () { fetchMock.get('/user/contacts', { contacts }) }) afterEach(function () { fetchMock.restore() cleanUpContext() }) it('renders the modal', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project }, }) await screen.findByText('Share Project') }) it('calls handleHide when a Close button is pressed', async function () { const handleHide = sinon.stub() renderWithEditorContext( <ShareProjectModal {...modalProps} handleHide={handleHide} />, { scope: { project } } ) const [ headerCloseButton, footerCloseButton, ] = await screen.findAllByRole('button', { name: 'Close' }) fireEvent.click(headerCloseButton) fireEvent.click(footerCloseButton) expect(handleHide.callCount).to.equal(2) }) it('handles access level "private"', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'private' } }, }) await screen.findByText( 'Link sharing is off, only invited users can view this project.' ) await screen.findByRole('button', { name: 'Turn on link sharing' }) expect(screen.queryByText('Anyone with this link can view this project')).to .be.null expect(screen.queryByText('Anyone with this link can edit this project')).to .be.null }) it('handles access level "tokenBased"', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'tokenBased' } }, }) await screen.findByText('Link sharing is on') await screen.findByRole('button', { name: 'Turn off link sharing' }) expect(screen.queryByText('Anyone with this link can view this project')) .not.to.be.null expect(screen.queryByText('Anyone with this link can edit this project')) .not.to.be.null }) it('handles legacy access level "readAndWrite"', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'readAndWrite' } }, }) await screen.findByText( 'This project is public and can be edited by anyone with the URL.' ) await screen.findByRole('button', { name: 'Make Private' }) }) it('handles legacy access level "readOnly"', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'readOnly' } }, }) await screen.findByText( 'This project is public and can be viewed but not edited by anyone with the URL' ) await screen.findByRole('button', { name: 'Make Private' }) }) it('hides actions from non-admins', async function () { const invites = [ { _id: 'invited-author', email: 'invited-author@example.com', privileges: 'readAndWrite', }, ] // render as admin: actions should be present const { rerender } = render( <EditorProviders scope={{ project: { ...project, invites, publicAccesLevel: 'tokenBased', }, }} > <ShareProjectModal {...modalProps} isAdmin /> </EditorProviders> ) await screen.findByRole('button', { name: 'Turn off link sharing' }) await screen.findByRole('button', { name: 'Resend' }) // render as non-admin (non-owner), link sharing on: actions should be missing and message should be present rerender( <EditorProviders scope={{ project: { ...project, invites, publicAccesLevel: 'tokenBased', }, }} > <ShareProjectModal {...modalProps} isAdmin={false} /> </EditorProviders> ) await screen.findByText( 'To change access permissions, please ask the project owner' ) expect(screen.queryByRole('button', { name: 'Turn off link sharing' })).to .be.null expect(screen.queryByRole('button', { name: 'Turn on link sharing' })).to.be .null expect(screen.queryByRole('button', { name: 'Resend' })).to.be.null // render as non-admin (non-owner), link sharing off: actions should be missing and message should be present rerender( <EditorProviders scope={{ project: { ...project, invites, publicAccesLevel: 'private', }, }} > <ShareProjectModal {...modalProps} isAdmin={false} /> </EditorProviders> ) await screen.findByText( 'To add more collaborators or turn on link sharing, please ask the project owner' ) expect(screen.queryByRole('button', { name: 'Turn off link sharing' })).to .be.null expect(screen.queryByRole('button', { name: 'Turn on link sharing' })).to.be .null expect(screen.queryByRole('button', { name: 'Resend' })).to.be.null }) it('only shows read-only token link to restricted token members', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { isRestrictedTokenMember: true, scope: { project: { ...project, publicAccesLevel: 'tokenBased' } }, }) // no buttons expect(screen.queryByRole('button', { name: 'Turn on link sharing' })).to.be .null expect(screen.queryByRole('button', { name: 'Turn off link sharing' })).to .be.null // only read-only token link await screen.findByText('Anyone with this link can view this project') expect(screen.queryByText('Anyone with this link can edit this project')).to .be.null }) it('displays project members and invites', async function () { const members = [ { _id: 'member-author', email: 'member-author@example.com', privileges: 'readAndWrite', }, { _id: 'member-viewer', email: 'member-viewer@example.com', privileges: 'readOnly', }, ] const invites = [ { _id: 'invited-author', email: 'invited-author@example.com', privileges: 'readAndWrite', }, { _id: 'invited-viewer', email: 'invited-viewer@example.com', privileges: 'readOnly', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, members, invites, publicAccesLevel: 'tokenBased', }, }, }) expect(screen.queryAllByText('project-owner@example.com')).to.have.length(1) expect(screen.queryAllByText('member-author@example.com')).to.have.length(1) expect(screen.queryAllByText('member-viewer@example.com')).to.have.length(1) expect(screen.queryAllByText('invited-author@example.com')).to.have.length( 1 ) expect(screen.queryAllByText('invited-viewer@example.com')).to.have.length( 1 ) expect(screen.queryAllByText('Invite not yet accepted.')).to.have.length( invites.length ) expect(screen.queryAllByRole('button', { name: 'Resend' })).to.have.length( invites.length ) }) it('resends an invite', async function () { fetchMock.postOnce( 'express:/project/:projectId/invite/:inviteId/resend', 204 ) const invites = [ { _id: 'invited-author', email: 'invited-author@example.com', privileges: 'readAndWrite', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, invites, publicAccesLevel: 'tokenBased', }, }, }) const [, closeButton] = screen.getAllByRole('button', { name: 'Close', }) const resendButton = screen.getByRole('button', { name: 'Resend' }) fireEvent.click(resendButton) await waitFor(() => expect(closeButton.disabled).to.be.true) expect(fetchMock.done()).to.be.true expect(closeButton.disabled).to.be.false }) it('revokes an invite', async function () { fetchMock.deleteOnce('express:/project/:projectId/invite/:inviteId', 204) const invites = [ { _id: 'invited-author', email: 'invited-author@example.com', privileges: 'readAndWrite', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, invites, publicAccesLevel: 'tokenBased', }, }, }) const [, closeButton] = screen.getAllByRole('button', { name: 'Close', }) const revokeButton = screen.getByRole('button', { name: 'Revoke' }) fireEvent.click(revokeButton) await waitFor(() => expect(closeButton.disabled).to.be.true) expect(fetchMock.done()).to.be.true expect(closeButton.disabled).to.be.false }) it('changes member privileges to read + write', async function () { fetchMock.putOnce('express:/project/:projectId/users/:userId', 204) const members = [ { _id: 'member-viewer', email: 'member-viewer@example.com', privileges: 'readOnly', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, members, publicAccesLevel: 'tokenBased', }, }, }) const [, closeButton] = await screen.getAllByRole('button', { name: 'Close', }) expect(screen.queryAllByText('member-viewer@example.com')).to.have.length(1) const select = screen.getByDisplayValue('Read Only') await fireEvent.change(select, { target: { value: 'readAndWrite' } }) const changeButton = screen.getByRole('button', { name: 'Change' }) fireEvent.click(changeButton) await waitFor(() => expect(closeButton.disabled).to.be.true) const { body } = fetchMock.lastOptions() expect(JSON.parse(body)).to.deep.equal({ privilegeLevel: 'readAndWrite' }) expect(fetchMock.done()).to.be.true expect(closeButton.disabled).to.be.false }) it('removes a member from the project', async function () { fetchMock.deleteOnce('express:/project/:projectId/users/:userId', 204) const members = [ { _id: 'member-viewer', email: 'member-viewer@example.com', privileges: 'readOnly', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, members, publicAccesLevel: 'tokenBased', }, }, }) expect(screen.queryAllByText('member-viewer@example.com')).to.have.length(1) const removeButton = screen.getByRole('button', { name: 'Remove collaborator', }) fireEvent.click(removeButton) const url = fetchMock.lastUrl() expect(url).to.equal('/project/test-project/users/member-viewer') expect(fetchMock.done()).to.be.true await waitForElementToBeRemoved(() => screen.queryByText('member-viewer@example.com') ) }) it('changes member privileges to owner with confirmation', async function () { fetchMock.postOnce('express:/project/:projectId/transfer-ownership', 204) const members = [ { _id: 'member-viewer', email: 'member-viewer@example.com', privileges: 'readOnly', }, ] renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, members, publicAccesLevel: 'tokenBased', }, }, }) expect(screen.queryAllByText('member-viewer@example.com')).to.have.length(1) const select = screen.getByDisplayValue('Read Only') fireEvent.change(select, { target: { value: 'owner' } }) const changeButton = screen.getByRole('button', { name: 'Change' }) await fireEvent.click(changeButton) screen.getByText((_, node) => { return ( node.textContent === 'Are you sure you want to make member-viewer@example.com the owner of Test Project?' ) }) const reloadStub = sinon.stub(locationModule, 'reload') const confirmButton = screen.getByRole('button', { name: 'Change owner', }) fireEvent.click(confirmButton) await waitFor(() => expect(confirmButton.disabled).to.be.true) const { body } = fetchMock.lastOptions() expect(JSON.parse(body)).to.deep.equal({ user_id: 'member-viewer' }) expect(fetchMock.done()).to.be.true expect(reloadStub.calledOnce).to.be.true reloadStub.restore() }) it('sends invites to input email addresses', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'tokenBased', }, }, }) const [inputElement] = await screen.findAllByLabelText( 'Share with your collaborators' ) // loading contacts await waitFor(() => { expect(fetchMock.called('express:/user/contacts')).to.be.true }) // displaying a list of matching contacts inputElement.focus() fireEvent.change(inputElement, { target: { value: 'ptolemy' } }) await screen.findByText(/ptolemy@example.com/) // sending invitations fetchMock.post('express:/project/:projectId/invite', (url, req) => { const data = JSON.parse(req.body) if (data.email === 'a@b.c') { return { status: 400, body: { errorReason: 'invalid_email' }, } } return { status: 200, body: { invite: { ...data, _id: data.email, }, }, } }) fireEvent.paste(inputElement, { clipboardData: { getData: () => 'test@example.com, foo@example.com, bar@example.com, a@b.c', }, }) const privilegesElement = screen.getByDisplayValue('Can Edit') fireEvent.change(privilegesElement, { target: { value: 'readOnly' } }) const submitButton = screen.getByRole('button', { name: 'Share' }) submitButton.click() let calls await waitFor( () => { calls = fetchMock.calls('express:/project/:projectId/invite') expect(calls).to.have.length(4) }, { timeout: 5000 } // allow time for delay between each request ) expect(calls[0][1].body).to.equal( JSON.stringify({ email: 'test@example.com', privileges: 'readOnly' }) ) expect(calls[1][1].body).to.equal( JSON.stringify({ email: 'foo@example.com', privileges: 'readOnly' }) ) expect(calls[2][1].body).to.equal( JSON.stringify({ email: 'bar@example.com', privileges: 'readOnly' }) ) expect(calls[3][1].body).to.equal( JSON.stringify({ email: 'a@b.c', privileges: 'readOnly' }) ) // error from the last invite screen.getByText('An email address is invalid') }) it('displays a message when the collaborator limit is reached', async function () { fetchMock.post('/event/project-sharing-paywall-prompt', {}) renderWithEditorContext(<ShareProjectModal {...modalProps} />, { user: { id: '123abd', allowedFreeTrial: true, }, scope: { project: { ...project, publicAccesLevel: 'tokenBased', features: { collaborators: 0, compileGroup: 'standard', }, }, }, }) expect(screen.queryByLabelText('Share with your collaborators')).to.be.null screen.getByText( /You need to upgrade your account to add more collaborators/ ) }) it('handles server error responses', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project: { ...project, publicAccesLevel: 'tokenBased', }, }, }) // loading contacts await waitFor(() => { expect(fetchMock.called('express:/user/contacts')).to.be.true }) const [inputElement] = await screen.findAllByLabelText( 'Share with your collaborators' ) const submitButton = screen.getByRole('button', { name: 'Share' }) const respondWithError = async function (errorReason) { fireEvent.focus(inputElement) fireEvent.change(inputElement, { target: { value: 'invited-author-1@example.com' }, }) fireEvent.blur(inputElement) fetchMock.postOnce( 'express:/project/:projectId/invite', { status: 400, body: { errorReason }, }, { overwriteRoutes: true } ) expect(submitButton.disabled).to.be.false submitButton.click() await fetchMock.flush(true) expect(fetchMock.done()).to.be.true } await respondWithError('cannot_invite_non_user') await screen.findByText( `Can't send invite. Recipient must already have a Overleaf account` ) await respondWithError('cannot_verify_user_not_robot') await screen.findByText( `Sorry, we could not verify that you are not a robot. Please check that Google reCAPTCHA is not being blocked by an ad blocker or firewall.` ) await respondWithError('cannot_invite_self') await screen.findByText(`Can't send invite to yourself`) await respondWithError('invalid_email') await screen.findByText(`An email address is invalid`) await respondWithError('too_many_requests') await screen.findByText( `Too many requests were received in a short space of time. Please wait for a few moments and try again.` ) }) it('handles switching between access levels', async function () { fetchMock.post('express:/project/:projectId/settings/admin', 204) const watchCallbacks = {} const scopeWithProject = project => { return { $watch: (path, callback) => { watchCallbacks[path] = callback return () => {} }, project, } } renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: scopeWithProject({ ...project, publicAccesLevel: 'private' }), }) await screen.findByText( 'Link sharing is off, only invited users can view this project.' ) const enableButton = await screen.findByRole('button', { name: 'Turn on link sharing', }) fireEvent.click(enableButton) await waitFor(() => expect(enableButton.disabled).to.be.true) const { body: tokenBody } = fetchMock.lastOptions() expect(JSON.parse(tokenBody)).to.deep.equal({ publicAccessLevel: 'tokenBased', }) // NOTE: updating the scoped project data manually, // as the project data is usually updated via the websocket connection watchCallbacks.project({ ...project, publicAccesLevel: 'tokenBased' }) await screen.findByText('Link sharing is on') const disableButton = await screen.findByRole('button', { name: 'Turn off link sharing', }) fireEvent.click(disableButton) await waitFor(() => expect(disableButton.disabled).to.be.true) const { body: privateBody } = fetchMock.lastOptions() expect(JSON.parse(privateBody)).to.deep.equal({ publicAccessLevel: 'private', }) // NOTE: updating the scoped project data manually, // as the project data is usually updated via the websocket connection watchCallbacks.project({ ...project, publicAccesLevel: 'private' }) await screen.findByText( 'Link sharing is off, only invited users can view this project.' ) }) it('avoids selecting unmatched contact', async function () { renderWithEditorContext(<ShareProjectModal {...modalProps} />, { scope: { project }, }) const [inputElement] = await screen.findAllByLabelText( 'Share with your collaborators' ) // Wait for contacts to load await waitFor(() => { expect(fetchMock.called('express:/user/contacts')).to.be.true }) // Enter a prefix that matches a contact inputElement.focus() fireEvent.change(inputElement, { target: { value: 'ptolemy' } }) // The matching contact should now be present and selected await screen.findByRole('option', { name: `Claudius Ptolemy <ptolemy@example.com>`, selected: true, }) // Keep entering text so the contact no longer matches fireEvent.change(inputElement, { target: { value: 'ptolemy.new@example.com' }, }) // The matching contact should no longer be present expect( screen.queryByRole('option', { name: `Claudius Ptolemy <ptolemy@example.com>`, }) ).to.be.null // No items should be added yet expect(screen.queryByRole('button', { name: 'Remove' })).to.be.null // Pressing Tab should add the entered item fireEvent.keyDown(inputElement, { key: 'Tab', code: 'Tab' }) await waitFor(() => { expect(screen.getAllByRole('button', { name: 'Remove' })).to.have.length( 1 ) }) // Blurring the input should not add another contact fireEvent.blur(inputElement) await waitFor(() => { expect(screen.getAllByRole('button', { name: 'Remove' })).to.have.length( 1 ) }) }) })
overleaf/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js/0
{ "file_path": "overleaf/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js", "repo_id": "overleaf", "token_count": 9258 }
566
/* eslint-disable max-len, no-return-assign, */ /* global inject, sinon */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import HistoryV2Manager from '../../../../frontend/js/ide/history/HistoryV2Manager' export default describe('HistoryV2Manager', function () { beforeEach(function (done) { this.defaultHistoryScope = { isV2: true, updates: [], viewMode: 'point_in_time', nextBeforeTimestamp: null, loading: false, atEnd: false, userHasFullFeature: undefined, freeHistoryLimitHit: false, selection: { docs: {}, pathname: null, range: { fromV: null, toV: null, }, hoveredRange: { fromV: null, toV: null, }, diff: null, files: [], file: null, }, error: null, showOnlyLabels: false, labels: null, loadingFileTree: true, } this.sampleUpdates = [ { fromV: 4, toV: 5, meta: { users: [ { first_name: 'john.doe', last_name: '', email: 'john.doe@domain.tld', id: '5b57299087712202fb599ab4', hue: 200, }, ], start_ts: 1544021278346, end_ts: 1544021278346, }, labels: [ { id: '5c07e822042e67003b448f18', comment: 'My first label', version: 5, user_id: '5b57299087712202fb599ab4', created_at: '2018-12-05T15:00:50.688Z', }, ], pathnames: [], project_ops: [ { add: { pathname: 'chapters/chapter1.tex', }, atV: 4, }, ], }, { fromV: 3, toV: 4, meta: { users: [ { first_name: 'john.doe', last_name: '', email: 'john.doe@domain.tld', id: '5b57299087712202fb599ab4', hue: 200, }, ], start_ts: 1544021262622, end_ts: 1544021262622, }, labels: [], pathnames: ['main.tex'], project_ops: [], }, { fromV: 0, toV: 3, meta: { users: [ { first_name: 'john.doe', last_name: '', email: 'john.doe@domain.tld', id: '5b57299087712202fb599ab4', hue: 200, }, ], start_ts: 1544021213540, end_ts: 1544021213618, }, labels: [], pathnames: [], project_ops: [ { add: { pathname: 'universe.jpg', }, atV: 2, }, { add: { pathname: 'references.bib', }, atV: 1, }, { add: { pathname: 'main.tex', }, atV: 0, }, ], }, ] inject(($q, $http, $filter, $rootScope) => { this.$scope = $rootScope.$new() this.$scope.project = { features: { versioning: true, }, } this.$scope.user = { isAdmin: false, } this.ide = { globalEditorWatchdogManager: { attachToEditor() {} }, $q: $q, $http: $http, $filter: $filter, } this.eventTracking = { sendMB: () => {}, } this.localStorage = sinon.stub().returns(null) this.historyManager = new HistoryV2Manager( this.ide, this.$scope, this.localStorage, this.eventTracking ) done() }) }) it('should setup the history scope on initialization', function () { expect(this.$scope.history).to.deep.equal(this.defaultHistoryScope) }) it('should keep history updates after performing a soft reset', function () { const historyScopeWithUpdates = Object.assign( {}, this.defaultHistoryScope, { updates: this.sampleUpdates, } ) this.$scope.history.updates = this.sampleUpdates this.historyManager.softReset() expect(this.$scope.history).to.deep.equal(historyScopeWithUpdates) }) it('should discard history updates after performing a hard reset', function () { this.$scope.history.updates = this.sampleUpdates this.historyManager.hardReset() expect(this.$scope.history).to.deep.equal(this.defaultHistoryScope) }) it('should setup history with full access to the feature if the project has versioning', function () { this.$scope.$digest() expect(this.$scope.history.userHasFullFeature).to.equal(true) }) it('should setup history without full access to the feature if the project does not have versioning', function () { this.$scope.project.features.versioning = false this.historyManager = new HistoryV2Manager( this.ide, this.$scope, this.localStorage ) this.$scope.$digest() expect(this.$scope.history.userHasFullFeature).to.equal(false) }) it('should setup history with full access to the feature for admin users even if the project does not have versioning', function () { this.$scope.project.features.versioning = false this.$scope.user.isAdmin = true this.historyManager = new HistoryV2Manager( this.ide, this.$scope, this.localStorage ) this.$scope.$digest() expect(this.$scope.history.userHasFullFeature).to.equal(true) }) describe('autoSelectFile', function () { describe('for compare mode', function () { beforeEach(function () { this.mockedFilesList = [ { pathname: 'main.tex', }, { pathname: 'references.bib', }, { pathname: 'universe.jpg', }, { pathname: 'chapters/chapter2.tex', }, { pathname: 'chapters/draft.tex', operation: 'removed', deletedAtV: 47, }, { pathname: 'chapters/chapter3.tex', operation: 'added', }, { pathname: 'chapters/chapter1.tex', operation: 'edited', }, { pathname: 'chapters/foo.tex', oldPathname: 'chapters/bar.tex', operation: 'renamed', }, ] this.mockedMainTex = this.mockedFilesList[0] this.mockedReferencesFile = this.mockedFilesList[1] this.mockedRemovedFile = this.mockedFilesList[4] this.mockedAddedFile = this.mockedFilesList[5] this.mockedEditedFile = this.mockedFilesList[6] this.mockedRenamedFile = this.mockedFilesList[7] this.$scope.history.viewMode = 'compare' this.$scope.history.selection.files = this.mockedFilesList }) describe('with a previously selected file', function () { it('should prefer the previously selected file if it is available and has operations', function () { this.historyManager._previouslySelectedPathname = this.mockedAddedFile.pathname this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedAddedFile ) }) it('should prefer a file with ops if the previously selected file is available but has no operations', function () { this.historyManager._previouslySelectedPathname = this.mockedReferencesFile.pathname this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.operation).to.exist }) it('should ignore the previously selected file if it is not available', function () { this.historyManager._previouslySelectedPathname = 'non/existent.file' this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.not.equal( 'non/existent.file' ) }) }) describe('without a previously selected file, with a list of files containing operations', function () { it('should prefer edited files', function () { this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedEditedFile ) }) it('should prefer added files if no edited files are present', function () { const indexOfEditedFile = this.$scope.history.selection.files.indexOf( this.mockedEditedFile ) this.$scope.history.selection.files.splice(indexOfEditedFile, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedAddedFile ) }) it('should prefer renamed files if no edited or added files are present', function () { const indexOfEditedFile = this.$scope.history.selection.files.indexOf( this.mockedEditedFile ) this.$scope.history.selection.files.splice(indexOfEditedFile, 1) const indexOfAddedFile = this.$scope.history.selection.files.indexOf( this.mockedAddedFile ) this.$scope.history.selection.files.splice(indexOfAddedFile, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedRenamedFile ) }) it('should prefer removed files if no edited, added or renamed files are present', function () { const indexOfEditedFile = this.$scope.history.selection.files.indexOf( this.mockedEditedFile ) this.$scope.history.selection.files.splice(indexOfEditedFile, 1) const indexOfAddedFile = this.$scope.history.selection.files.indexOf( this.mockedAddedFile ) this.$scope.history.selection.files.splice(indexOfAddedFile, 1) const indexOfRenamedFile = this.$scope.history.selection.files.indexOf( this.mockedRenamedFile ) this.$scope.history.selection.files.splice(indexOfRenamedFile, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedRemovedFile ) }) }) describe('without a previously selected file, with a list of files without operations', function () { beforeEach(function () { this.mockedFilesListWithNoOps = [ { pathname: 'main.tex', }, { pathname: 'references.bib', }, { pathname: 'other.tex', }, { pathname: 'universe.jpg', }, ] this.mockedMainTex = this.mockedFilesListWithNoOps[0] this.mockedReferencesFile = this.mockedFilesListWithNoOps[1] this.mockedOtherTexFile = this.mockedFilesListWithNoOps[2] this.$scope.history.selection.files = this.mockedFilesListWithNoOps }) it('should prefer main.tex if it exists', function () { this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedMainTex ) }) it('should prefer another tex file if main.tex does not exist', function () { const indexOfMainTex = this.$scope.history.selection.files.indexOf( this.mockedMainTex ) this.$scope.history.selection.files.splice(indexOfMainTex, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedOtherTexFile ) }) it('should pick the first available file if no tex files are available', function () { const indexOfMainTex = this.$scope.history.selection.files.indexOf( this.mockedMainTex ) this.$scope.history.selection.files.splice(indexOfMainTex, 1) const indexOfOtherTexFile = this.$scope.history.selection.files.indexOf( this.mockedOtherTexFile ) this.$scope.history.selection.files.splice(indexOfOtherTexFile, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file).to.deep.equal( this.mockedReferencesFile ) }) }) }) describe('for point-in-time mode', function () { beforeEach(function () { this.$scope.history.viewMode = 'point_in_time' this.sampleUpdates[0] = { fromV: 4, toV: 5, meta: { users: [ { first_name: 'john.doe', last_name: '', email: 'john.doe@domain.tld', id: '5b57299087712202fb599ab4', hue: 200, }, ], start_ts: 1544021278346, end_ts: 1544021278346, }, pathnames: ['main.tex'], project_ops: [ { add: { pathname: 'chapters/chapter1.tex', }, atV: 4, }, { rename: { pathname: 'foo.tex', newPathname: 'bar.tex', }, }, ], } this.sampleUpdateEditedFile = this.sampleUpdates[0].pathnames[0] this.sampleUpdateAddedFile = this.sampleUpdates[0].project_ops[0].add.pathname this.sampleUpdateRenamedFile = this.sampleUpdates[0].project_ops[1].rename.newPathname this.$scope.history.updates = this.sampleUpdates this.$scope.history.selection.range = { fromV: this.sampleUpdates[0].toV, toV: this.sampleUpdates[0].toV, } this.mockedFilesList = [ { pathname: 'main.tex', }, { pathname: 'references.bib', }, { pathname: 'universe.jpg', }, { pathname: 'chapters/chapter2.tex', }, { pathname: 'chapters/draft.tex', }, { pathname: 'chapters/chapter3.tex', }, { pathname: 'chapters/chapter1.tex', }, { pathname: 'bar.tex', }, ] this.$scope.history.selection.files = this.mockedFilesList }) describe('with a previously selected file', function () { it('should prefer the previously selected file if it is available and has operations', function () { this.historyManager._previouslySelectedPathname = 'main.tex' this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.sampleUpdateEditedFile ) }) it('should prefer a file with ops if the previously selected file is available but has no operations', function () { this.historyManager._previouslySelectedPathname = 'main.tex' this.sampleUpdates[0].pathnames = [] this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.sampleUpdateAddedFile ) }) it('should ignore the previously selected file if it is not available', function () { this.historyManager._previouslySelectedPathname = 'non/existent.file' this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.not.equal( 'non/existent.file' ) }) }) describe('without a previously selected file, with a list of files containing operations', function () { it('should prefer edited files', function () { this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.sampleUpdateEditedFile ) }) it('should prefer added files if no edited files are present', function () { this.sampleUpdates[0].pathnames = [] this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.sampleUpdateAddedFile ) }) it('should prefer renamed files if no edited or added files are present', function () { this.sampleUpdates[0].pathnames = [] this.sampleUpdates[0].project_ops.shift() this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.sampleUpdateRenamedFile ) }) }) describe('without a previously selected file, with a list of files without operations', function () { beforeEach(function () { this.sampleUpdates[0].pathnames = [] this.sampleUpdates[0].project_ops = [] this.mockedMainTex = this.mockedFilesList[0] this.mockedReferencesFile = this.mockedFilesList[1] }) it('should prefer main.tex if it exists', function () { this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.equal( this.mockedMainTex.pathname ) }) it('should prefer another tex file if main.tex does not exist', function () { const indexOfMainTex = this.$scope.history.selection.files.indexOf( this.mockedMainTex ) this.$scope.history.selection.files.splice(indexOfMainTex, 1) this.historyManager.autoSelectFile() expect(this.$scope.history.selection.file.pathname).to.match(/.tex$/) }) }) }) describe('_loadLabels', function () { it('should return labels list as is if there is a label for the last version', function () { const labels = [ { id: '1', version: 1, comment: 'foo', created_at: new Date().toISOString(), }, { id: '2', version: 2, comment: 'bar', created_at: new Date().toISOString(), }, { id: '3', version: 3, comment: 'baz', created_at: new Date().toISOString(), }, ] const lastUpdate = 3 const labelsResult = this.historyManager._loadLabels(labels, lastUpdate) expect(labelsResult).to.have.members(labels) }) it('should return a labels list with a pseudo current state label if there is no label for the last version', function () { const labels = [ { id: '1', version: 1, comment: 'foo', created_at: new Date().toISOString(), }, { id: '2', version: 2, comment: 'bar', created_at: new Date().toISOString(), }, { id: '3', version: 3, comment: 'baz', created_at: new Date().toISOString(), }, ] const lastUpdate = 5 const labelsResult = this.historyManager._loadLabels(labels, lastUpdate) expect(labelsResult).to.include.members(labels) expect(labelsResult[0].isPseudoCurrentStateLabel).to.equal(true) expect(labelsResult[0].version).to.equal(5) }) it('should keep pseudo label when deleting label', function () { this.historyManager.$scope.history.labels = [ { id: '1', version: 1, comment: 'foo', created_at: new Date().toISOString(), }, ] const lastUpdate = 5 this.historyManager.$scope.history.labels = this.historyManager._loadLabels( this.historyManager.$scope.history.labels, lastUpdate ) expect( this.historyManager.$scope.history.labels[0].isPseudoCurrentStateLabel ).to.equal(true) this.historyManager.$scope.history.labels = this.historyManager._loadLabels( [], lastUpdate ) expect( this.historyManager.$scope.history.labels[0].isPseudoCurrentStateLabel ).to.equal(true) expect(this.historyManager.$scope.history.labels[0].version).to.equal(5) }) }) }) })
overleaf/web/test/karma/ide/history/HistoryV2ManagerTests.js/0
{ "file_path": "overleaf/web/test/karma/ide/history/HistoryV2ManagerTests.js", "repo_id": "overleaf", "token_count": 9990 }
567
const SandboxedModule = require('sandboxed-module') const path = require('path') const sinon = require('sinon') const MODULE_PATH = path.join( __dirname, '../../../../app/src/Features/Analytics/AnalyticsManager' ) describe('AnalyticsManager', function () { beforeEach(function () { this.fakeUserId = '123abc' this.Settings = { analytics: { enabled: true }, } this.analyticsEventsQueue = { add: sinon.stub().resolves(), process: sinon.stub().resolves(), } this.analyticsEditingSessionQueue = { add: sinon.stub().resolves(), process: sinon.stub().resolves(), } this.onboardingEmailsQueue = { add: sinon.stub().resolves(), process: sinon.stub().resolves(), } this.analyticsUserPropertiesQueue = { add: sinon.stub().resolves(), process: sinon.stub().resolves(), } const self = this this.Queues = { getAnalyticsEventsQueue: () => { return self.analyticsEventsQueue }, getAnalyticsEditingSessionsQueue: () => { return self.analyticsEditingSessionQueue }, getOnboardingEmailsQueue: () => { return self.onboardingEmailsQueue }, getAnalyticsUserPropertiesQueue: () => { return self.analyticsUserPropertiesQueue }, } this.backgroundRequest = sinon.stub().yields() this.request = sinon.stub().yields() this.AnalyticsManager = SandboxedModule.require(MODULE_PATH, { requires: { '@overleaf/settings': this.Settings, '../../infrastructure/Queues': this.Queues, }, }) }) describe('ignores when', function () { it('user is smoke test user', function () { this.Settings.smokeTest = { userId: this.fakeUserId } this.AnalyticsManager.identifyUser(this.fakeUserId, '') sinon.assert.notCalled(this.analyticsEventsQueue.add) }) it('analytics service is disabled', function () { this.Settings.analytics.enabled = false this.AnalyticsManager.identifyUser(this.fakeUserId, '') sinon.assert.notCalled(this.analyticsEventsQueue.add) }) }) describe('queues the appropriate message for', function () { it('identifyUser', function () { const oldUserId = '456def' this.AnalyticsManager.identifyUser(this.fakeUserId, oldUserId) sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'identify', { userId: this.fakeUserId, oldUserId, }) }) it('recordEvent', function () { const event = 'fake-event' this.AnalyticsManager.recordEvent(this.fakeUserId, event, null) sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', { event, userId: this.fakeUserId, segmentation: null, }) }) it('updateEditingSession', function () { const projectId = '789ghi' const countryCode = 'fr' this.AnalyticsManager.updateEditingSession( this.fakeUserId, projectId, countryCode ) sinon.assert.calledWithMatch(this.analyticsEditingSessionQueue.add, { userId: this.fakeUserId, projectId, countryCode, }) }) }) })
overleaf/web/test/unit/src/Analytics/AnalyticsManagerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Analytics/AnalyticsManagerTests.js", "repo_id": "overleaf", "token_count": 1292 }
568
const SandboxedModule = require('sandboxed-module') const sinon = require('sinon') const { expect } = require('chai') const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels') const Errors = require('../../../../app/src/Features/Errors/Errors') const { ObjectId } = require('mongodb') const MODULE_PATH = '../../../../app/src/Features/Collaborators/OwnershipTransferHandler' describe('OwnershipTransferHandler', function () { beforeEach(function () { this.user = { _id: ObjectId(), email: 'owner@example.com' } this.collaborator = { _id: ObjectId(), email: 'collaborator@example.com' } this.project = { _id: ObjectId(), name: 'project', owner_ref: this.user._id, collaberator_refs: [this.collaborator._id], } this.ProjectGetter = { promises: { getProject: sinon.stub().resolves(this.project), }, } this.ProjectModel = { updateOne: sinon.stub().returns({ exec: sinon.stub().resolves(), }), } this.UserGetter = { promises: { getUser: sinon.stub().resolves(this.user), }, } this.TpdsUpdateSender = { promises: { moveEntity: sinon.stub().resolves(), }, } this.TpdsProjectFlusher = { promises: { flushProjectToTpds: sinon.stub().resolves(), }, } this.CollaboratorsHandler = { promises: { removeUserFromProject: sinon.stub().resolves(), addUserIdToProject: sinon.stub().resolves(), }, } this.EmailHandler = { promises: { sendEmail: sinon.stub().resolves(), }, } this.ProjectAuditLogHandler = { promises: { addEntry: sinon.stub().resolves(), }, } this.handler = SandboxedModule.require(MODULE_PATH, { requires: { '../Project/ProjectGetter': this.ProjectGetter, '../../models/Project': { Project: this.ProjectModel, }, '../User/UserGetter': this.UserGetter, '../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher, '../Project/ProjectAuditLogHandler': this.ProjectAuditLogHandler, '../Email/EmailHandler': this.EmailHandler, './CollaboratorsHandler': this.CollaboratorsHandler, }, }) }) describe('transferOwnership', function () { beforeEach(function () { this.UserGetter.promises.getUser .withArgs(this.user._id) .resolves(this.user) this.UserGetter.promises.getUser .withArgs(this.collaborator._id) .resolves(this.collaborator) }) it("should return a not found error if the project can't be found", async function () { this.ProjectGetter.promises.getProject.resolves(null) await expect( this.handler.promises.transferOwnership('abc', this.collaborator._id) ).to.be.rejectedWith(Errors.ProjectNotFoundError) }) it("should return a not found error if the user can't be found", async function () { this.UserGetter.promises.getUser .withArgs(this.collaborator._id) .resolves(null) await expect( this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) ).to.be.rejectedWith(Errors.UserNotFoundError) }) it('should return an error if user cannot be removed as collaborator ', async function () { this.CollaboratorsHandler.promises.removeUserFromProject.rejects( new Error('user-cannot-be-removed') ) await expect( this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) ).to.be.rejected }) it('should transfer ownership of the project', async function () { await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) expect(this.ProjectModel.updateOne).to.have.been.calledWith( { _id: this.project._id }, sinon.match({ $set: { owner_ref: this.collaborator._id } }) ) }) it('should do nothing if transferring back to the owner', async function () { await this.handler.promises.transferOwnership( this.project._id, this.user._id ) expect(this.ProjectModel.updateOne).not.to.have.been.called }) it("should remove the user from the project's collaborators", async function () { await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) expect( this.CollaboratorsHandler.promises.removeUserFromProject ).to.have.been.calledWith(this.project._id, this.collaborator._id) }) it('should add the former project owner as a read/write collaborator', async function () { await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) expect( this.CollaboratorsHandler.promises.addUserIdToProject ).to.have.been.calledWith( this.project._id, this.collaborator._id, this.user._id, PrivilegeLevels.READ_AND_WRITE ) }) it('should flush the project to tpds', async function () { await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) expect( this.TpdsProjectFlusher.promises.flushProjectToTpds ).to.have.been.calledWith(this.project._id) }) it('should send an email notification', async function () { await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) expect(this.EmailHandler.promises.sendEmail).to.have.been.calledWith( 'ownershipTransferConfirmationPreviousOwner', { to: this.user.email, project: this.project, newOwner: this.collaborator, } ) expect(this.EmailHandler.promises.sendEmail).to.have.been.calledWith( 'ownershipTransferConfirmationNewOwner', { to: this.collaborator.email, project: this.project, previousOwner: this.user, } ) }) it('should write an entry in the audit log', async function () { const sessionUserId = ObjectId() await this.handler.promises.transferOwnership( this.project._id, this.collaborator._id, { sessionUserId } ) expect( this.ProjectAuditLogHandler.promises.addEntry ).to.have.been.calledWith( this.project._id, 'transfer-ownership', sessionUserId, { previousOwnerId: this.user._id, newOwnerId: this.collaborator._id, } ) }) it('should decline to transfer ownership to a non-collaborator', async function () { this.project.collaberator_refs = [] await expect( this.handler.promises.transferOwnership( this.project._id, this.collaborator._id ) ).to.be.rejectedWith(Errors.UserNotCollaboratorError) }) }) })
overleaf/web/test/unit/src/Collaborators/OwnershipTransferHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Collaborators/OwnershipTransferHandlerTests.js", "repo_id": "overleaf", "token_count": 3012 }
569
/* eslint-disable camelcase, max-len, no-return-assign, no-unused-vars, one-var, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from * DS102: Remove unnecessary code created because of implicit returns * DS201: Simplify complex destructure assignments * DS205: Consider reworking code to avoid use of IIFEs * 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/Downloads/ProjectZipStreamManager.js' const SandboxedModule = require('sandboxed-module') const { EventEmitter } = require('events') describe('ProjectZipStreamManager', function () { beforeEach(function () { this.project_id = 'project-id-123' this.callback = sinon.stub() this.archive = { on() {}, append: sinon.stub(), } return (this.ProjectZipStreamManager = SandboxedModule.require(modulePath, { requires: { archiver: (this.archiver = sinon.stub().returns(this.archive)), '../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}), '../FileStore/FileStoreHandler': (this.FileStoreHandler = {}), '../Project/ProjectGetter': (this.ProjectGetter = {}), }, })) }) describe('createZipStreamForMultipleProjects', function () { describe('successfully', function () { beforeEach(function (done) { this.project_ids = ['project-1', 'project-2'] this.zip_streams = { 'project-1': new EventEmitter(), 'project-2': new EventEmitter(), } this.project_names = { 'project-1': 'Project One Name', 'project-2': 'Project Two Name', } this.ProjectZipStreamManager.createZipStreamForProject = ( project_id, callback ) => { callback(null, this.zip_streams[project_id]) setTimeout(() => { return this.zip_streams[project_id].emit('end') }) return 0 } sinon.spy(this.ProjectZipStreamManager, 'createZipStreamForProject') this.ProjectGetter.getProject = (project_id, fields, callback) => { return callback(null, { name: this.project_names[project_id] }) } sinon.spy(this.ProjectGetter, 'getProject') this.ProjectZipStreamManager.createZipStreamForMultipleProjects( this.project_ids, (...args) => { return this.callback(...Array.from(args || [])) } ) return (this.archive.finalize = () => done()) }) it('should create a zip archive', function () { return this.archiver.calledWith('zip').should.equal(true) }) it('should return a stream before any processing is done', function () { this.callback .calledWith(sinon.match.falsy, this.archive) .should.equal(true) return this.callback .calledBefore(this.ProjectZipStreamManager.createZipStreamForProject) .should.equal(true) }) it('should get a zip stream for all of the projects', function () { return Array.from(this.project_ids).map(project_id => this.ProjectZipStreamManager.createZipStreamForProject .calledWith(project_id) .should.equal(true) ) }) it('should get the names of each project', function () { return Array.from(this.project_ids).map(project_id => this.ProjectGetter.getProject .calledWith(project_id, { name: true }) .should.equal(true) ) }) it('should add all of the projects to the zip', function () { return Array.from(this.project_ids).map(project_id => this.archive.append .calledWith(this.zip_streams[project_id], { name: this.project_names[project_id] + '.zip', }) .should.equal(true) ) }) }) }) describe('createZipStreamForProject', function () { describe('successfully', function () { beforeEach(function () { this.ProjectZipStreamManager.addAllDocsToArchive = sinon .stub() .callsArg(2) this.ProjectZipStreamManager.addAllFilesToArchive = sinon .stub() .callsArg(2) this.archive.finalize = sinon.stub() return this.ProjectZipStreamManager.createZipStreamForProject( this.project_id, this.callback ) }) it('should create a zip archive', function () { return this.archiver.calledWith('zip').should.equal(true) }) it('should return a stream before any processing is done', function () { this.callback .calledWith(sinon.match.falsy, this.archive) .should.equal(true) this.callback .calledBefore(this.ProjectZipStreamManager.addAllDocsToArchive) .should.equal(true) return this.callback .calledBefore(this.ProjectZipStreamManager.addAllFilesToArchive) .should.equal(true) }) it('should add all of the project docs to the zip', function () { return this.ProjectZipStreamManager.addAllDocsToArchive .calledWith(this.project_id, this.archive) .should.equal(true) }) it('should add all of the project files to the zip', function () { return this.ProjectZipStreamManager.addAllFilesToArchive .calledWith(this.project_id, this.archive) .should.equal(true) }) it('should finalise the stream', function () { return this.archive.finalize.called.should.equal(true) }) }) describe('with an error adding docs', function () { beforeEach(function () { this.ProjectZipStreamManager.addAllDocsToArchive = sinon .stub() .callsArgWith(2, new Error('something went wrong')) this.ProjectZipStreamManager.addAllFilesToArchive = sinon .stub() .callsArg(2) this.archive.finalize = sinon.stub() return this.ProjectZipStreamManager.createZipStreamForProject( this.project_id, this.callback ) }) it('should log out an error', function () { return this.logger.error .calledWith(sinon.match.any, 'error adding docs to zip stream') .should.equal(true) }) it('should continue with the process', function () { this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal( true ) this.ProjectZipStreamManager.addAllFilesToArchive.called.should.equal( true ) return this.archive.finalize.called.should.equal(true) }) }) describe('with an error adding files', function () { beforeEach(function () { this.ProjectZipStreamManager.addAllDocsToArchive = sinon .stub() .callsArg(2) this.ProjectZipStreamManager.addAllFilesToArchive = sinon .stub() .callsArgWith(2, new Error('something went wrong')) this.archive.finalize = sinon.stub() return this.ProjectZipStreamManager.createZipStreamForProject( this.project_id, this.callback ) }) it('should log out an error', function () { return this.logger.error .calledWith(sinon.match.any, 'error adding files to zip stream') .should.equal(true) }) it('should continue with the process', function () { this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal( true ) this.ProjectZipStreamManager.addAllFilesToArchive.called.should.equal( true ) return this.archive.finalize.called.should.equal(true) }) }) }) describe('addAllDocsToArchive', function () { beforeEach(function (done) { this.docs = { '/main.tex': { lines: [ '\\documentclass{article}', '\\begin{document}', 'Hello world', '\\end{document}', ], }, '/chapters/chapter1.tex': { lines: ['chapter1', 'content'], }, } this.ProjectEntityHandler.getAllDocs = sinon .stub() .callsArgWith(1, null, this.docs) return this.ProjectZipStreamManager.addAllDocsToArchive( this.project_id, this.archive, error => { this.callback(error) return done() } ) }) it('should get the docs for the project', function () { return this.ProjectEntityHandler.getAllDocs .calledWith(this.project_id) .should.equal(true) }) it('should add each doc to the archive', function () { return (() => { const result = [] for (let path in this.docs) { const doc = this.docs[path] path = path.slice(1) // remove "/" result.push( this.archive.append .calledWith(doc.lines.join('\n'), { name: path }) .should.equal(true) ) } return result })() }) }) describe('addAllFilesToArchive', function () { beforeEach(function () { this.files = { '/image.png': { _id: 'file-id-1', }, '/folder/picture.png': { _id: 'file-id-2', }, } this.streams = { 'file-id-1': new EventEmitter(), 'file-id-2': new EventEmitter(), } this.ProjectEntityHandler.getAllFiles = sinon .stub() .callsArgWith(1, null, this.files) this.FileStoreHandler.getFileStream = (project_id, file_id, ...rest) => { const obj = rest[0], callback = rest[1] return callback(null, this.streams[file_id]) } sinon.spy(this.FileStoreHandler, 'getFileStream') this.ProjectZipStreamManager.addAllFilesToArchive( this.project_id, this.archive, this.callback ) return (() => { const result = [] for (const path in this.streams) { const stream = this.streams[path] result.push(stream.emit('end')) } return result })() }) it('should get the files for the project', function () { return this.ProjectEntityHandler.getAllFiles .calledWith(this.project_id) .should.equal(true) }) it('should get a stream for each file', function () { return (() => { const result = [] for (const path in this.files) { const file = this.files[path] result.push( this.FileStoreHandler.getFileStream .calledWith(this.project_id, file._id) .should.equal(true) ) } return result })() }) it('should add each file to the archive', function () { return (() => { const result = [] for (let path in this.files) { const file = this.files[path] path = path.slice(1) // remove "/" result.push( this.archive.append .calledWith(this.streams[file._id], { name: path }) .should.equal(true) ) } return result })() }) }) })
overleaf/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js", "repo_id": "overleaf", "token_count": 5085 }
570
const SandboxedModule = require('sandboxed-module') const { expect } = require('chai') const { ObjectId } = require('mongodb') const MODULE_PATH = require('path').join( __dirname, '../../../../app/src/Features/Helpers/NewLogsUI.js' ) describe('NewLogsUI helper', function () { let NewLogsUI function userIdFromTime(time) { return ObjectId.createFromTime(time).toString() } function isExistingUI(variant) { return !variant.newLogsUI && !variant.subvariant } function isNewUIWithPopup(variant) { return variant.newLogsUI && variant.subvariant === 'new-logs-ui-with-popup' } function isNewUIWithoutPopup(variant) { return ( variant.newLogsUI && variant.subvariant === 'new-logs-ui-without-popup' ) } function getTestInterval(lowerBoundary, upperBoundary) { const midpoint = Math.floor( lowerBoundary + (upperBoundary - lowerBoundary) / 2 ) return [lowerBoundary, midpoint, upperBoundary] } beforeEach(function () { this.user = { alphaProgram: false, _id: ObjectId('60085414b76eeb00737d93aa'), } this.settings = { overleaf: { foo: 'bar', }, } NewLogsUI = SandboxedModule.require(MODULE_PATH, { requires: { mongodb: { ObjectId }, '@overleaf/settings': this.settings, }, }) }) describe('In a non-SaaS context', function () { beforeEach(function () { delete this.settings.overleaf }) it('should always show the existing UI', function () { for (const percentile of [0, 20, 40, 60, 80]) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isExistingUI(variant)).to.be.true } }) }) describe('For alpha users', function () { beforeEach(function () { this.user.alphaProgram = true }) it('should always show the new UI with popup', function () { for (const percentile of [0, 20, 40, 60, 80]) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithPopup(variant)).to.be.true } }) }) describe('For regular users', function () { it('should show the new UI with popup when the id is in the [0, 5[ interval', function () { const testInterval = getTestInterval(0, 4) for (const percentile of testInterval) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithPopup(variant)).to.be.true } this.user._id = userIdFromTime(5) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithPopup(variant)).to.be.false }) it('should show the new UI without popup when the id is in the [5, 10[ interval', function () { const testInterval = getTestInterval(5, 9) for (const percentile of testInterval) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithoutPopup(variant)).to.be.true } this.user._id = userIdFromTime(10) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithoutPopup(variant)).to.be.false }) it('should show the new UI with popup when the id is in the [10, 38[ interval', function () { const testInterval = getTestInterval(10, 37) for (const percentile of testInterval) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithPopup(variant)).to.be.true } this.user._id = userIdFromTime(38) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithPopup(variant)).to.be.false }) it('should show the new UI without popup when the id is in the [38, 66[ interval', function () { const testInterval = getTestInterval(38, 65) for (const percentile of testInterval) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithoutPopup(variant)).to.be.true } this.user._id = userIdFromTime(66) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isNewUIWithoutPopup(variant)).to.be.false }) it('should show the existing UI when the id is in the [66, 99] interval', function () { const testInterval = getTestInterval(66, 99) for (const percentile of testInterval) { this.user._id = userIdFromTime(percentile) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isExistingUI(variant)).to.be.true } this.user._id = userIdFromTime(100) const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user) expect(isExistingUI(variant)).to.be.false }) }) })
overleaf/web/test/unit/src/HelperFiles/NewLogsUITests.js/0
{ "file_path": "overleaf/web/test/unit/src/HelperFiles/NewLogsUITests.js", "repo_id": "overleaf", "token_count": 2026 }
571
const SandboxedModule = require('sandboxed-module') const { expect } = require('chai') const sinon = require('sinon') const modulePath = require('path').join( __dirname, '../../../../app/src/Features/Notifications/NotificationsBuilder.js' ) describe('NotificationsBuilder', function () { const userId = '123nd3ijdks' beforeEach(function () { this.handler = { createNotification: sinon.stub().callsArgWith(6) } this.settings = { apis: { v1: { url: 'v1.url', user: '', pass: '' } } } this.request = sinon.stub() this.controller = SandboxedModule.require(modulePath, { requires: { './NotificationsHandler': this.handler, '@overleaf/settings': this.settings, request: this.request, }, }) }) describe('dropboxUnlinkedDueToLapsedReconfirmation', function (done) { it('should create the notification', function (done) { this.controller .dropboxUnlinkedDueToLapsedReconfirmation(userId) .create(error => { expect(error).to.not.exist expect(this.handler.createNotification).to.have.been.calledWith( userId, 'drobox-unlinked-due-to-lapsed-reconfirmation', 'notification_dropbox_unlinked_due_to_lapsed_reconfirmation', {}, null, true ) done() }) }) describe('NotificationsHandler error', function () { let anError beforeEach(function () { anError = new Error('oops') this.handler.createNotification.yields(anError) }) it('should return errors from NotificationsHandler', function (done) { this.controller .dropboxUnlinkedDueToLapsedReconfirmation(userId) .create(error => { expect(error).to.exist expect(error).to.deep.equal(anError) done() }) }) }) }) describe('ipMatcherAffiliation', function () { describe('with portal and with SSO', function () { beforeEach(function () { this.body = { id: 1, name: 'stanford', enrolment_ad_html: 'v1 ad content', is_university: true, portal_slug: null, sso_enabled: false, } this.request.callsArgWith(1, null, { statusCode: 200 }, this.body) }) it('should call v1 and create affiliation notifications', function (done) { const ip = '192.168.0.1' this.controller.ipMatcherAffiliation(userId).create(ip, callback => { this.request.calledOnce.should.equal(true) const expectedOpts = { institutionId: this.body.id, university_name: this.body.name, content: this.body.enrolment_ad_html, ssoEnabled: false, portalPath: undefined, } this.handler.createNotification .calledWith( userId, `ip-matched-affiliation-${this.body.id}`, 'notification_ip_matched_affiliation', expectedOpts ) .should.equal(true) done() }) }) }) describe('without portal and without SSO', function () { beforeEach(function () { this.body = { id: 1, name: 'stanford', enrolment_ad_html: 'v1 ad content', is_university: true, portal_slug: 'stanford', sso_enabled: true, } this.request.callsArgWith(1, null, { statusCode: 200 }, this.body) }) it('should call v1 and create affiliation notifications', function (done) { const ip = '192.168.0.1' this.controller.ipMatcherAffiliation(userId).create(ip, callback => { this.request.calledOnce.should.equal(true) const expectedOpts = { institutionId: this.body.id, university_name: this.body.name, content: this.body.enrolment_ad_html, ssoEnabled: true, portalPath: '/edu/stanford', } this.handler.createNotification .calledWith( userId, `ip-matched-affiliation-${this.body.id}`, 'notification_ip_matched_affiliation', expectedOpts ) .should.equal(true) done() }) }) }) }) })
overleaf/web/test/unit/src/Notifications/NotificationsBuilderTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Notifications/NotificationsBuilderTests.js", "repo_id": "overleaf", "token_count": 2041 }
572
const { expect } = require('chai') const sinon = require('sinon') const tk = require('timekeeper') const Errors = require('../../../../app/src/Features/Errors/Errors') const { ObjectId } = require('mongodb') const SandboxedModule = require('sandboxed-module') const { DeletedFile } = require('../helpers/models/DeletedFile') const { Project } = require('../helpers/models/Project') const MODULE_PATH = '../../../../app/src/Features/Project/ProjectEntityMongoUpdateHandler' describe('ProjectEntityMongoUpdateHandler', function () { beforeEach(function () { this.doc = { _id: ObjectId(), name: 'test-doc.txt', lines: ['hello', 'world'], rev: 1234, } this.docPath = { mongo: 'rootFolder.0.docs.0', fileSystem: '/test-doc.txt', } this.file = { _id: ObjectId(), name: 'something.jpg', linkedFileData: { provider: 'url' }, hash: 'some-hash', } this.filePath = { fileSystem: '/something.png', mongo: 'rootFolder.0.fileRefs.0', } this.subfolder = { _id: ObjectId(), name: 'test-subfolder' } this.subfolderPath = { fileSystem: '/test-folder/test-subfolder', mongo: 'rootFolder.0.folders.0.folders.0', } this.folder = { _id: ObjectId(), name: 'test-folder', folders: [this.subfolder], } this.folderPath = { fileSystem: '/test-folder', mongo: 'rootFolder.0.folders.0', } this.rootFolder = { _id: ObjectId(), folders: [this.folder], docs: [this.doc], fileRefs: [this.file], } this.rootFolderPath = { fileSystem: '/', mongo: 'rootFolder.0', } this.project = { _id: ObjectId(), name: 'project name', rootFolder: [this.rootFolder], } this.Settings = { maxEntitiesPerProject: 100 } this.CooldownManager = {} this.LockManager = { promises: { runWithLock: sinon.spy((namespace, id, runner) => runner()), }, } this.FolderModel = sinon.stub() this.DeletedFileMock = sinon.mock(DeletedFile) this.ProjectMock = sinon.mock(Project) this.ProjectEntityHandler = { promises: { getAllEntitiesFromProject: sinon.stub(), }, } this.ProjectLocator = { promises: { findElement: sinon.stub().rejects(new Error('not found')), findElementByPath: sinon.stub().rejects(new Error('not found')), }, } this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.rootFolder._id, type: 'folder', }) .resolves({ element: this.rootFolder, path: this.rootFolderPath, }) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.folder._id, type: 'folder', }) .resolves({ element: this.folder, path: this.folderPath, folder: this.rootFolder, }) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.subfolder._id, type: 'folder', }) .resolves({ element: this.subfolder, path: this.subfolderPath, folder: this.folder, }) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.file._id, type: 'file', }) .resolves({ element: this.file, path: this.filePath, folder: this.rootFolder, }) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.doc._id, type: 'doc', }) .resolves({ element: this.doc, path: this.docPath, folder: this.rootFolder, }) this.ProjectLocator.promises.findElementByPath .withArgs( sinon.match({ project: this.project, path: '/', }) ) .resolves({ element: this.rootFolder, type: 'folder' }) this.ProjectLocator.promises.findElementByPath .withArgs( sinon.match({ project: this.project, path: '/test-folder', }) ) .resolves({ element: this.folder, type: 'folder' }) this.ProjectLocator.promises.findElementByPath .withArgs( sinon.match({ project: this.project, path: '/test-folder/test-subfolder', }) ) .resolves({ element: this.subfolder, type: 'folder' }) this.ProjectGetter = { promises: { getProjectWithoutLock: sinon .stub() .withArgs(this.project._id) .resolves(this.project), getProjectWithOnlyFolders: sinon.stub().resolves(this.project), }, } this.FolderStructureBuilder = { buildFolderStructure: sinon.stub(), } this.subject = SandboxedModule.require(MODULE_PATH, { requires: { mongodb: { ObjectId }, '@overleaf/settings': this.Settings, '../Cooldown/CooldownManager': this.CooldownManager, '../../models/Folder': { Folder: this.FolderModel }, '../../infrastructure/LockManager': this.LockManager, '../../models/DeletedFile': { DeletedFile }, '../../models/Project': { Project }, './ProjectEntityHandler': this.ProjectEntityHandler, './ProjectLocator': this.ProjectLocator, './ProjectGetter': this.ProjectGetter, './FolderStructureBuilder': this.FolderStructureBuilder, }, }) }) afterEach(function () { this.DeletedFileMock.restore() this.ProjectMock.restore() }) beforeEach(function () { tk.freeze(Date.now()) }) afterEach(function () { tk.reset() }) describe('addDoc', function () { beforeEach(async function () { const doc = { _id: ObjectId(), name: 'other.txt' } this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.docs': doc }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.result = await this.subject.promises.addDoc( this.project._id, this.folder._id, doc ) }) it('adds the document in Mongo', function () { this.ProjectMock.verify() }) it('returns path info and the project', function () { expect(this.result).to.deep.equal({ result: { path: { mongo: 'rootFolder.0.folders.0', fileSystem: '/test-folder/other.txt', }, }, project: this.project, }) }) }) describe('addFile', function () { beforeEach(function () { this.newFile = { _id: ObjectId(), name: 'picture.jpg' } this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.fileRefs': this.newFile }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) }) describe('happy path', function () { beforeEach(async function () { this.result = await this.subject.promises.addFile( this.project._id, this.folder._id, this.newFile ) }) it('adds the file in Mongo', function () { this.ProjectMock.verify() }) it('returns path info and the project', function () { expect(this.result).to.deep.equal({ result: { path: { mongo: 'rootFolder.0.folders.0', fileSystem: '/test-folder/picture.jpg', }, }, project: this.project, }) }) }) describe('when entity limit is reached', function () { beforeEach(function () { this.savedMaxEntities = this.Settings.maxEntitiesPerProject this.Settings.maxEntitiesPerProject = 3 }) afterEach(function () { this.Settings.maxEntitiesPerProject = this.savedMaxEntities }) it('should throw an error', async function () { await expect( this.subject.promises.addFile( this.project._id, this.folder._id, this.newFile ) ).to.be.rejected }) }) }) describe('addFolder', function () { beforeEach(async function () { const folderName = 'New folder' this.FolderModel.withArgs({ name: folderName }).returns({ _id: ObjectId(), name: folderName, }) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.folders': sinon.match({ name: folderName, }), }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) await this.subject.promises.addFolder( this.project._id, this.folder._id, folderName ) }) it('adds the folder in Mongo', function () { this.ProjectMock.verify() }) }) describe('replaceFileWithNew', function () { beforeEach(async function () { const newFile = { _id: ObjectId(), name: 'some-other-file.png', linkedFileData: { some: 'data' }, hash: 'some-hash', } // Add a deleted file record this.DeletedFileMock.expects('create') .withArgs({ projectId: this.project._id, _id: this.file._id, name: this.file.name, linkedFileData: this.file.linkedFileData, hash: this.file.hash, deletedAt: sinon.match.date, }) .resolves() // Update the file in place this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $set: { 'rootFolder.0.fileRefs.0._id': newFile._id, 'rootFolder.0.fileRefs.0.created': sinon.match.date, 'rootFolder.0.fileRefs.0.linkedFileData': newFile.linkedFileData, 'rootFolder.0.fileRefs.0.hash': newFile.hash, }, $inc: { version: 1, 'rootFolder.0.fileRefs.0.rev': 1, }, } ) .chain('exec') .resolves(this.project) await this.subject.promises.replaceFileWithNew( this.project._id, this.file._id, newFile ) }) it('updates the database', function () { this.DeletedFileMock.verify() this.ProjectMock.verify() }) }) describe('mkdirp', function () { describe('when the path is just a slash', function () { beforeEach(async function () { this.result = await this.subject.promises.mkdirp(this.project._id, '/') }) it('should return the root folder', function () { expect(this.result.folder).to.deep.equal(this.rootFolder) }) it('should not report a parent folder', function () { expect(this.result.folder.parentFolder_id).not.to.exist }) it('should not return new folders', function () { expect(this.result.newFolders).to.have.length(0) }) }) describe('when the folder already exists', function () { beforeEach(async function () { this.result = await this.subject.promises.mkdirp( this.project._id, '/test-folder' ) }) it('should return the existing folder', function () { expect(this.result.folder).to.deep.equal(this.folder) }) it('should report the parent folder', function () { expect(this.result.folder.parentFolder_id).not.equal( this.rootFolder._id ) }) it('should not return new folders', function () { expect(this.result.newFolders).to.have.length(0) }) }) describe('when the path is a new folder at the top level', function () { beforeEach(async function () { this.newFolder = { _id: ObjectId(), name: 'new-folder' } this.FolderModel.returns(this.newFolder) this.exactCaseMatch = false this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders': this.newFolder }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.result = await this.subject.promises.mkdirp( this.project._id, '/new-folder/', { exactCaseMatch: this.exactCaseMatch } ) }) it('should update the database', function () { this.ProjectMock.verify() }) it('should make just one folder', function () { expect(this.result.newFolders).to.have.length(1) }) it('should return the new folder', function () { expect(this.result.folder.name).to.equal('new-folder') }) it('should return the parent folder', function () { expect(this.result.folder.parentFolder_id).to.equal(this.rootFolder._id) }) it('should pass the exactCaseMatch option to ProjectLocator', function () { expect( this.ProjectLocator.promises.findElementByPath ).to.have.been.calledWithMatch({ exactCaseMatch: this.exactCaseMatch }) }) }) describe('adding a subfolder', function () { beforeEach(async function () { this.newFolder = { _id: ObjectId(), name: 'new-folder' } this.FolderModel.returns(this.newFolder) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.folders': sinon.match({ name: 'new-folder', }), }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.result = await this.subject.promises.mkdirp( this.project._id, '/test-folder/new-folder' ) }) it('should update the database', function () { this.ProjectMock.verify() }) it('should create one folder', function () { expect(this.result.newFolders).to.have.length(1) }) it('should return the new folder', function () { expect(this.result.folder.name).to.equal('new-folder') }) it('should return the parent folder', function () { expect(this.result.folder.parentFolder_id).to.equal(this.folder._id) }) }) describe('when mutliple folders are missing', async function () { beforeEach(function () { this.folder1 = { _id: ObjectId(), name: 'folder1' } this.folder1Path = { fileSystem: '/test-folder/folder1', mongo: 'rootFolder.0.folders.0.folders.0', } this.folder2 = { _id: ObjectId(), name: 'folder2' } this.folder2Path = { fileSystem: '/test-folder/folder1/folder2', mongo: 'rootFolder.0.folders.0.folders.0.folders.0', } this.FolderModel.onFirstCall().returns(this.folder1) this.FolderModel.onSecondCall().returns(this.folder2) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.folder1._id, type: 'folder', }) .resolves({ element: this.folder1, path: this.folder1Path, }) this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.folder2._id, type: 'folder', }) .resolves({ element: this.folder2, path: this.folder2Path, }) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.folders': sinon.match({ name: 'folder1', }), }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.folders.0.folders': sinon.match({ name: 'folder2', }), }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) }) ;[ { description: 'without a trailing slash', path: '/test-folder/folder1/folder2', }, { description: 'with a trailing slash', path: '/test-folder/folder1/folder2/', }, ].forEach(({ description, path }) => { describe(description, function () { beforeEach(async function () { this.result = await this.subject.promises.mkdirp( this.project._id, path ) }) it('should update the database', function () { this.ProjectMock.verify() }) it('should add multiple folders', function () { const newFolders = this.result.newFolders expect(newFolders).to.have.length(2) expect(newFolders[0].name).to.equal('folder1') expect(newFolders[1].name).to.equal('folder2') }) it('should return the last folder', function () { expect(this.result.folder.name).to.equal('folder2') }) it('should return the parent folder', function () { expect(this.result.folder.parentFolder_id).to.equal( this.folder1._id ) }) }) }) }) }) describe('moveEntity', function () { describe('moving a doc into a different folder', function () { beforeEach(async function () { this.pathAfterMove = { fileSystem: '/somewhere/else.txt', } this.oldDocs = ['old-doc'] this.oldFiles = ['old-file'] this.newDocs = ['new-doc'] this.newFiles = ['new-file'] this.ProjectEntityHandler.promises.getAllEntitiesFromProject .onFirstCall() .resolves({ docs: this.oldDocs, files: this.oldFiles }) this.ProjectEntityHandler.promises.getAllEntitiesFromProject .onSecondCall() .resolves({ docs: this.newDocs, files: this.newFiles }) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.docs': this.doc }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $pull: { 'rootFolder.0.docs': { _id: this.doc._id } }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.result = await this.subject.promises.moveEntity( this.project._id, this.doc._id, this.folder._id, 'doc' ) }) it('should update the database', function () { this.ProjectMock.verify() }) it('should report what changed', function () { expect(this.result).to.deep.equal({ project: this.project, startPath: '/test-doc.txt', endPath: '/test-folder/test-doc.txt', rev: this.doc.rev, changes: { oldDocs: this.oldDocs, newDocs: this.newDocs, oldFiles: this.oldFiles, newFiles: this.newFiles, newProject: this.project, }, }) }) }) describe('when moving a folder inside itself', function () { it('throws an error', async function () { await expect( this.subject.promises.moveEntity( this.project._id, this.folder._id, this.folder._id, 'folder' ) ).to.be.rejectedWith(Errors.InvalidNameError) }) }) describe('when moving a folder to a subfolder of itself', function () { it('throws an error', async function () { await expect( this.subject.promises.moveEntity( this.project._id, this.folder._id, this.subfolder._id, 'folder' ) ).to.be.rejectedWith(Errors.InvalidNameError) }) }) }) describe('deleteEntity', function () { beforeEach(async function () { this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $pull: { 'rootFolder.0.docs': { _id: this.doc._id } }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) await this.subject.promises.deleteEntity( this.project._id, this.doc._id, 'doc' ) }) it('should update the database', function () { this.ProjectMock.verify() }) }) describe('renameEntity', function () { describe('happy path', function () { beforeEach(async function () { this.newName = 'new.tex' this.oldDocs = ['old-doc'] this.oldFiles = ['old-file'] this.newDocs = ['new-doc'] this.newFiles = ['new-file'] this.ProjectEntityHandler.promises.getAllEntitiesFromProject .onFirstCall() .resolves({ docs: this.oldDocs, files: this.oldFiles }) this.ProjectEntityHandler.promises.getAllEntitiesFromProject .onSecondCall() .resolves({ docs: this.newDocs, files: this.newFiles }) this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $set: { 'rootFolder.0.docs.0.name': this.newName }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) this.result = await this.subject.promises.renameEntity( this.project._id, this.doc._id, 'doc', this.newName ) }) it('should update the database', function () { this.ProjectMock.verify() }) it('returns info', function () { expect(this.result).to.deep.equal({ project: this.project, startPath: '/test-doc.txt', endPath: '/new.tex', rev: this.doc.rev, changes: { oldDocs: this.oldDocs, newDocs: this.newDocs, oldFiles: this.oldFiles, newFiles: this.newFiles, newProject: this.project, }, }) }) }) describe('name already exists', function () { it('should throw an error', async function () { await expect( this.subject.promises.renameEntity( this.project._id, this.doc._id, 'doc', this.folder.name ) ).to.be.rejectedWith(Errors.InvalidNameError) }) }) }) describe('_putElement', function () { describe('updating the project', function () { describe('when the parent folder is given', function () { beforeEach(function () { this.newFile = { _id: ObjectId(), name: 'new file.png' } this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.folders.0.fileRefs': this.newFile }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) }) it('should update the database', async function () { await this.subject.promises._putElement( this.project, this.folder._id, this.newFile, 'files' ) this.ProjectMock.verify() }) it('should add an s onto the type if not included', async function () { await this.subject.promises._putElement( this.project, this.folder._id, this.newFile, 'file' ) this.ProjectMock.verify() }) }) describe('error cases', function () { it('should throw an error if element is null', async function () { await expect( this.subject.promises._putElement( this.project, this.folder._id, null, 'file' ) ).to.be.rejected }) it('should error if the element has no _id', async function () { const file = { name: 'something' } await expect( this.subject.promises._putElement( this.project, this.folder._id, file, 'file' ) ).to.be.rejected }) it('should error if element name contains invalid characters', async function () { const file = { _id: ObjectId(), name: 'something*bad' } await expect( this.subject.promises._putElement( this.project, this.folder._id, file, 'file' ) ).to.be.rejected }) it('should error if element name is too long', async function () { const file = { _id: ObjectId(), name: 'long-'.repeat(1000) + 'something', } await expect( this.subject.promises._putElement( this.project, this.folder._id, file, 'file' ) ).to.be.rejectedWith(Errors.InvalidNameError) }) it('should error if the folder name is too long', async function () { const file = { _id: ObjectId(), name: 'something', } this.ProjectLocator.promises.findElement .withArgs({ project: this.project, element_id: this.folder._id, type: 'folder', }) .resolves({ element: this.folder, path: { fileSystem: 'subdir/'.repeat(1000) + 'foo' }, }) await expect( this.subject.promises._putElement( this.project, this.folder._id, file, 'file' ) ).to.be.rejectedWith(Errors.InvalidNameError) }) ;['file', 'doc', 'folder'].forEach(entityType => { it(`should error if a ${entityType} already exists with the same name`, async function () { const file = { _id: ObjectId(), name: this[entityType].name, } await expect( this.subject.promises._putElement( this.project, null, file, 'file' ) ).to.be.rejectedWith(Errors.InvalidNameError) }) }) }) }) describe('when the parent folder is not given', function () { it('should default to root folder insert', async function () { this.newFile = { _id: ObjectId(), name: 'new file.png' } this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $push: { 'rootFolder.0.fileRefs': this.newFile }, $inc: { version: 1 }, } ) .chain('exec') .resolves(this.project) await this.subject.promises._putElement( this.project, this.rootFolder._id, this.newFile, 'file' ) }) }) }) describe('_insertDeletedFileReference', function () { beforeEach(async function () { this.DeletedFileMock.expects('create') .withArgs({ projectId: this.project._id, _id: this.file._id, name: this.file.name, linkedFileData: this.file.linkedFileData, hash: this.file.hash, deletedAt: sinon.match.date, }) .resolves() await this.subject.promises._insertDeletedFileReference( this.project._id, this.file ) }) it('should update the database', function () { this.DeletedFileMock.verify() }) }) describe('createNewFolderStructure', function () { beforeEach(function () { this.mockRootFolder = 'MOCK_ROOT_FOLDER' this.docUploads = ['MOCK_DOC_UPLOAD'] this.fileUploads = ['MOCK_FILE_UPLOAD'] this.FolderStructureBuilder.buildFolderStructure .withArgs(this.docUploads, this.fileUploads) .returns(this.mockRootFolder) this.updateExpectation = this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id, 'rootFolder.0.folders.0': { $exists: false }, 'rootFolder.0.docs.0': { $exists: false }, 'rootFolder.0.files.0': { $exists: false }, }, { $set: { rootFolder: [this.mockRootFolder] }, $inc: { version: 1 } }, { new: true, lean: true, fields: { version: 1 } } ) .chain('exec') }) describe('happy path', function () { beforeEach(async function () { this.updateExpectation.resolves({ version: 1 }) await this.subject.promises.createNewFolderStructure( this.project._id, this.docUploads, this.fileUploads ) }) it('updates the database', function () { this.ProjectMock.verify() }) }) describe("when the update doesn't find a matching document", function () { beforeEach(async function () { this.updateExpectation.resolves(null) }) it('throws an error', async function () { await expect( this.subject.promises.createNewFolderStructure( this.project._id, this.docUploads, this.fileUploads ) ).to.be.rejected }) }) }) describe('replaceDocWithFile', function () { it('should simultaneously remove the doc and add the file', async function () { this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $pull: { 'rootFolder.0.docs': { _id: this.doc._id } }, $push: { 'rootFolder.0.fileRefs': this.file }, $inc: { version: 1 }, }, { new: true } ) .chain('exec') .resolves(this.project) await this.subject.promises.replaceDocWithFile( this.project._id, this.doc._id, this.file ) this.ProjectMock.verify() }) }) describe('replaceFileWithDoc', function () { it('should simultaneously remove the file and add the doc', async function () { this.ProjectMock.expects('findOneAndUpdate') .withArgs( { _id: this.project._id }, { $pull: { 'rootFolder.0.fileRefs': { _id: this.file._id } }, $push: { 'rootFolder.0.docs': this.doc }, $inc: { version: 1 }, }, { new: true } ) .chain('exec') .resolves(this.project) await this.subject.promises.replaceFileWithDoc( this.project._id, this.file._id, this.doc ) this.ProjectMock.verify() }) }) })
overleaf/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js", "repo_id": "overleaf", "token_count": 15694 }
573
/* eslint-disable max-len, no-return-assign, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const SandboxedModule = require('sandboxed-module') const sinon = require('sinon') const { assert } = require('chai') const modulePath = '../../../../app/src/Features/References/ReferencesController' const MockRequest = require('../helpers/MockRequest') const MockResponse = require('../helpers/MockResponse') describe('ReferencesController', function () { beforeEach(function () { this.projectId = '2222' this.controller = SandboxedModule.require(modulePath, { requires: { '@overleaf/settings': (this.settings = { apis: { web: { url: 'http://some.url' } }, }), './ReferencesHandler': (this.ReferencesHandler = { index: sinon.stub(), indexAll: sinon.stub(), }), '../Editor/EditorRealTimeController': (this.EditorRealTimeController = { emitToRoom: sinon.stub(), }), }, }) this.req = new MockRequest() this.req.params.Project_id = this.projectId this.req.body = { docIds: (this.docIds = ['aaa', 'bbb']), shouldBroadcast: false, } this.res = new MockResponse() this.res.json = sinon.stub() this.res.send = sinon.stub() this.res.sendStatus = sinon.stub() return (this.fakeResponseData = { projectId: this.projectId, keys: ['one', 'two', 'three'], }) }) describe('indexAll', function () { beforeEach(function () { this.req.body = { shouldBroadcast: false } this.ReferencesHandler.indexAll.callsArgWith( 1, null, this.fakeResponseData ) return (this.call = callback => { this.controller.indexAll(this.req, this.res) return callback() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should return data', function (done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) return done() }) }) it('should call ReferencesHandler.indexAll', function (done) { return this.call(() => { this.ReferencesHandler.indexAll.callCount.should.equal(1) this.ReferencesHandler.indexAll .calledWith(this.projectId) .should.equal(true) return done() }) }) describe('when shouldBroadcast is true', function () { beforeEach(function () { this.ReferencesHandler.index.callsArgWith( 2, null, this.fakeResponseData ) return (this.req.body.shouldBroadcast = true) }) it('should call EditorRealTimeController.emitToRoom', function (done) { return this.call(() => { this.EditorRealTimeController.emitToRoom.callCount.should.equal(1) return done() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should still return data', function (done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) return done() }) }) }) describe('when shouldBroadcast is false', function () { beforeEach(function () { this.ReferencesHandler.index.callsArgWith( 2, null, this.fakeResponseData ) return (this.req.body.shouldBroadcast = false) }) it('should not call EditorRealTimeController.emitToRoom', function (done) { return this.call(() => { this.EditorRealTimeController.emitToRoom.callCount.should.equal(0) return done() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should still return data', function (done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) return done() }) }) }) }) describe('there is no data', function () { beforeEach(function () { this.ReferencesHandler.indexAll.callsArgWith(1) return (this.call = callback => { this.controller.indexAll(this.req, this.res) return callback() }) }) it('should not call EditorRealTimeController.emitToRoom', function (done) { return this.call(() => { this.EditorRealTimeController.emitToRoom.callCount.should.equal(0) return done() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should send a response with an empty keys list', function (done) { return this.call(() => { this.res.json.called.should.equal(true) this.res.json .calledWith({ projectId: this.projectId, keys: [] }) .should.equal(true) return done() }) }) }) describe('index', function () { beforeEach(function () { return (this.call = callback => { this.controller.index(this.req, this.res) return callback() }) }) describe('with docIds as an array and shouldBroadcast as false', function () { beforeEach(function () { return this.ReferencesHandler.index.callsArgWith( 2, null, this.fakeResponseData ) }) it('should call ReferencesHandler.index', function (done) { return this.call(() => { this.ReferencesHandler.index.callCount.should.equal(1) this.ReferencesHandler.index .calledWith(this.projectId, this.docIds) .should.equal(true) return done() }) }) it('should return data', function (done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) return done() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should not call EditorRealTimController.emitToRoom', function (done) { return this.call(() => { this.EditorRealTimeController.emitToRoom.callCount.should.equal(0) return done() }) }) describe('when ReferencesHandler.index produces an error', function () { beforeEach(function () { return this.ReferencesHandler.index.callsArgWith( 2, new Error('woops'), null ) }) it('should produce an error response', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(1) this.res.sendStatus.calledWith(500).should.equal(true) return done() }) }) }) }) describe('when shouldBroadcast is true', function () { beforeEach(function () { this.ReferencesHandler.index.callsArgWith( 2, null, this.fakeResponseData ) return (this.req.body.shouldBroadcast = true) }) it('should call EditorRealTimeController.emitToRoom', function (done) { return this.call(() => { this.EditorRealTimeController.emitToRoom.callCount.should.equal(1) return done() }) }) it('should not produce an error', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(0) this.res.sendStatus.calledWith(500).should.equal(false) this.res.sendStatus.calledWith(400).should.equal(false) return done() }) }) it('should still return data', function (done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) return done() }) }) }) describe('with missing docIds', function () { beforeEach(function () { return delete this.req.body.docIds }) it('should produce an error response', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(1) this.res.sendStatus.calledWith(400).should.equal(true) return done() }) }) it('should not call ReferencesHandler.index', function (done) { return this.call(() => { this.ReferencesHandler.index.callCount.should.equal(0) return done() }) }) }) describe('with invalid docIds', function () { beforeEach(function () { return (this.req.body.docIds = 42) }) it('should produce an error response', function (done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(1) this.res.sendStatus.calledWith(400).should.equal(true) return done() }) }) it('should not call ReferencesHandler.index', function (done) { return this.call(() => { this.ReferencesHandler.index.callCount.should.equal(0) return done() }) }) }) }) })
overleaf/web/test/unit/src/References/ReferencesControllerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/References/ReferencesControllerTests.js", "repo_id": "overleaf", "token_count": 4662 }
574
/* eslint-disable camelcase, 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 { expect } = require('chai') const sinon = require('sinon') const crypto = require('crypto') const querystring = require('querystring') const modulePath = '../../../../app/src/Features/Subscription/RecurlyWrapper' const SandboxedModule = require('sandboxed-module') const tk = require('timekeeper') const Errors = require('../../../../app/src/Features/Errors/Errors') const SubscriptionErrors = require('../../../../app/src/Features/Subscription/Errors') const fixtures = { 'subscriptions/44f83d7cba354d5b84812419f923ea96': '<?xml version="1.0" encoding="UTF-8"?>' + '<subscription href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96">' + ' <account href="https://api.recurly.com/v2/accounts/104"/>' + ' <plan href="https://api.recurly.com/v2/plans/gold">' + ' <plan_code>gold</plan_code>' + ' <name>Gold plan</name>' + ' </plan>' + ' <uuid>44f83d7cba354d5b84812419f923ea96</uuid>' + ' <state>active</state>' + ' <unit_amount_in_cents type="integer">800</unit_amount_in_cents>' + ' <currency>EUR</currency>' + ' <quantity type="integer">1</quantity>' + ' <activated_at type="datetime">2011-05-27T07:00:00Z</activated_at>' + ' <canceled_at nil="nil"></canceled_at>' + ' <expires_at nil="nil"></expires_at>' + ' <current_period_started_at type="datetime">2011-06-27T07:00:00Z</current_period_started_at>' + ' <current_period_ends_at type="datetime">2011-07-27T07:00:00Z</current_period_ends_at>' + ' <trial_started_at nil="nil"></trial_started_at>' + ' <trial_ends_at nil="nil"></trial_ends_at>' + ' <subscription_add_ons type="array">' + ' <subscription_add_on>' + ' <add_on_code>ipaddresses</add_on_code>' + ' <quantity>10</quantity>' + ' <unit_amount_in_cents>150</unit_amount_in_cents>' + ' </subscription_add_on>' + ' </subscription_add_ons>' + ' <a name="cancel" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/cancel" method="put"/>' + ' <a name="terminate" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/terminate" method="put"/>' + ' <a name="postpone" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/postpone" method="put"/>' + '</subscription>', 'recurly_js/result/70db44b10f5f4b238669480c9903f6f5': '<?xml version="1.0" encoding="UTF-8"?>' + '<subscription href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96">' + ' <account href="https://api.recurly.com/v2/accounts/104"/>' + ' <plan href="https://api.recurly.com/v2/plans/gold">' + ' <plan_code>gold</plan_code>' + ' <name>Gold plan</name>' + ' </plan>' + ' <uuid>44f83d7cba354d5b84812419f923ea96</uuid>' + ' <state>active</state>' + ' <unit_amount_in_cents type="integer">800</unit_amount_in_cents>' + ' <currency>EUR</currency>' + ' <quantity type="integer">1</quantity>' + ' <activated_at type="datetime">2011-05-27T07:00:00Z</activated_at>' + ' <canceled_at nil="nil"></canceled_at>' + ' <expires_at nil="nil"></expires_at>' + ' <current_period_started_at type="datetime">2011-06-27T07:00:00Z</current_period_started_at>' + ' <current_period_ends_at type="datetime">2011-07-27T07:00:00Z</current_period_ends_at>' + ' <trial_started_at nil="nil"></trial_started_at>' + ' <trial_ends_at nil="nil"></trial_ends_at>' + ' <subscription_add_ons type="array">' + ' <subscription_add_on>' + ' <add_on_code>ipaddresses</add_on_code>' + ' <quantity>10</quantity>' + ' <unit_amount_in_cents>150</unit_amount_in_cents>' + ' </subscription_add_on>' + ' </subscription_add_ons>' + ' <a name="cancel" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/cancel" method="put"/>' + ' <a name="terminate" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/terminate" method="put"/>' + ' <a name="postpone" href="https://api.recurly.com/v2/subscriptions/44f83d7cba354d5b84812419f923ea96/postpone" method="put"/>' + '</subscription>', 'accounts/104': '<?xml version="1.0" encoding="UTF-8"?>' + '<account href="https://api.recurly.com/v2/accounts/104">' + ' <adjustments href="https://api.recurly.com/v2/accounts/1/adjustments"/>' + ' <billing_info href="https://api.recurly.com/v2/accounts/1/billing_info"/>' + ' <invoices href="https://api.recurly.com/v2/accounts/1/invoices"/>' + ' <redemption href="https://api.recurly.com/v2/accounts/1/redemption"/>' + ' <subscriptions href="https://api.recurly.com/v2/accounts/1/subscriptions"/>' + ' <transactions href="https://api.recurly.com/v2/accounts/1/transactions"/>' + ' <account_code>104</account_code>' + ' <state>active</state>' + ' <username nil="nil"></username>' + ' <email>verena@example.com</email>' + ' <first_name>Verena</first_name>' + ' <last_name>Example</last_name>' + ' <accept_language nil="nil"></accept_language>' + ' <hosted_login_token>a92468579e9c4231a6c0031c4716c01d</hosted_login_token>' + ' <created_at type="datetime">2011-10-25T12:00:00</created_at>' + '</account>', } const mockApiRequest = function (options, callback) { if (fixtures[options.url]) { return callback(null, { statusCode: 200 }, fixtures[options.url]) } else { return callback(new Error('Not found'), { statusCode: 404 }) } } describe('RecurlyWrapper', function () { beforeEach(function () { let RecurlyWrapper this.settings = { plans: [ { planCode: 'collaborator', name: 'Collaborator', features: { collaborators: -1, versioning: true, }, }, ], defaultPlanCode: { collaborators: 0, versioning: false, }, apis: { recurly: { apiKey: 'nonsense', privateKey: 'private_nonsense', }, }, } tk.freeze(Date.now()) // freeze the time for these tests return (this.RecurlyWrapper = RecurlyWrapper = SandboxedModule.require( modulePath, { requires: { '@overleaf/settings': this.settings, request: sinon.stub(), './Errors': SubscriptionErrors, }, } )) }) afterEach(function () { return tk.reset() }) describe('getSubscription', function () { describe('with proper subscription id', function () { beforeEach(function () { this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake(mockApiRequest) return this.RecurlyWrapper.getSubscription( '44f83d7cba354d5b84812419f923ea96', (error, recurlySubscription) => { return (this.recurlySubscription = recurlySubscription) } ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('should look up the subscription at the normal API end point', function () { return this.apiRequest.args[0][0].url.should.equal( 'subscriptions/44f83d7cba354d5b84812419f923ea96' ) }) it('should return the subscription', function () { return this.recurlySubscription.uuid.should.equal( '44f83d7cba354d5b84812419f923ea96' ) }) }) describe('with ReculyJS token', function () { beforeEach(function () { this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake(mockApiRequest) return this.RecurlyWrapper.getSubscription( '70db44b10f5f4b238669480c9903f6f5', { recurlyJsResult: true }, (error, recurlySubscription) => { return (this.recurlySubscription = recurlySubscription) } ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('should return the subscription', function () { return this.recurlySubscription.uuid.should.equal( '44f83d7cba354d5b84812419f923ea96' ) }) it('should look up the subscription at the RecurlyJS API end point', function () { return this.apiRequest.args[0][0].url.should.equal( 'recurly_js/result/70db44b10f5f4b238669480c9903f6f5' ) }) }) describe('with includeAccount', function () { beforeEach(function () { this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake(mockApiRequest) return this.RecurlyWrapper.getSubscription( '44f83d7cba354d5b84812419f923ea96', { includeAccount: true }, (error, recurlySubscription) => { return (this.recurlySubscription = recurlySubscription) } ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('should request the account from the API', function () { return this.apiRequest.args[1][0].url.should.equal('accounts/104') }) it('should populate the account attribute', function () { return this.recurlySubscription.account.account_code.should.equal('104') }) }) }) describe('updateAccountEmailAddress', function () { beforeEach(function (done) { this.recurlyAccountId = 'account-id-123' this.newEmail = 'example@overleaf.com' this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake((options, callback) => { this.requestOptions = options callback(null, {}, fixtures['accounts/104']) }) this.RecurlyWrapper.updateAccountEmailAddress( this.recurlyAccountId, this.newEmail, (error, recurlyAccount) => { this.recurlyAccount = recurlyAccount done() } ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('sends correct XML', function () { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <account> <email>example@overleaf.com</email> </account>\ `) this.requestOptions.url.should.equal(`accounts/${this.recurlyAccountId}`) this.requestOptions.method.should.equal('PUT') }) it('should return the updated account', function () { expect(this.recurlyAccount).to.exist this.recurlyAccount.account_code.should.equal('104') }) }) describe('updateSubscription', function () { beforeEach(function (done) { this.recurlySubscriptionId = 'subscription-id-123' this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake((options, callback) => { this.requestOptions = options return callback( null, {}, fixtures['subscriptions/44f83d7cba354d5b84812419f923ea96'] ) }) return this.RecurlyWrapper.updateSubscription( this.recurlySubscriptionId, { plan_code: 'silver', timeframe: 'now' }, (error, recurlySubscription) => { this.recurlySubscription = recurlySubscription return done() } ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('sends correct XML', function () { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <subscription> <plan_code>silver</plan_code> <timeframe>now</timeframe> </subscription>\ `) this.requestOptions.url.should.equal( `subscriptions/${this.recurlySubscriptionId}` ) return this.requestOptions.method.should.equal('put') }) it('should return the updated subscription', function () { expect(this.recurlySubscription).to.exist return this.recurlySubscription.plan.plan_code.should.equal('gold') }) }) describe('redeemCoupon', function () { beforeEach(function (done) { this.recurlyAccountId = 'account-id-123' this.coupon_code = '312321312' this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake((options, callback) => { options.url.should.equal(`coupons/${this.coupon_code}/redeem`) options.method.should.equal('post') return callback() }) return this.RecurlyWrapper.redeemCoupon( this.recurlyAccountId, this.coupon_code, done ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('sends correct XML', function () { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] return expect(body).to.equal(`\ <redemption> <account_code>account-id-123</account_code> <currency>USD</currency> </redemption>\ `) }) }) describe('createFixedAmmountCoupon', function () { beforeEach(function (done) { this.couponCode = 'a-coupon-code' this.couponName = 'a-coupon-name' this.currencyCode = 'EUR' this.discount = 1337 this.planCode = 'a-plan-code' this.apiRequest = sinon .stub(this.RecurlyWrapper, 'apiRequest') .callsFake((options, callback) => { return callback() }) return this.RecurlyWrapper.createFixedAmmountCoupon( this.couponCode, this.couponName, this.currencyCode, this.discount, this.planCode, done ) }) afterEach(function () { return this.RecurlyWrapper.apiRequest.restore() }) it('sends correct XML', function () { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] return expect(body).to.equal(`\ <coupon> <coupon_code>a-coupon-code</coupon_code> <name>a-coupon-name</name> <discount_type>dollars</discount_type> <discount_in_cents> <EUR>1337</EUR> </discount_in_cents> <plan_codes> <plan_code>a-plan-code</plan_code> </plan_codes> <applies_to_all_plans>false</applies_to_all_plans> </coupon>\ `) }) }) describe('createSubscription', function () { beforeEach(function () { this.user = { _id: 'some_id', email: 'user@example.com', } this.subscriptionDetails = { currencyCode: 'EUR', plan_code: 'some_plan_code', coupon_code: '', isPaypal: true, address: { address1: 'addr_one', address2: 'addr_two', country: 'some_country', state: 'some_state', zip: 'some_zip', }, } this.subscription = {} this.recurlyTokenIds = { billing: 'a-token-id', threeDSecureActionResult: 'a-3d-token-id', } return (this.call = callback => { return this.RecurlyWrapper.createSubscription( this.user, this.subscriptionDetails, this.recurlyTokenIds, callback ) }) }) describe('when paypal', function () { beforeEach(function () { this.subscriptionDetails.isPaypal = true this._createPaypalSubscription = sinon.stub( this.RecurlyWrapper, '_createPaypalSubscription' ) return this._createPaypalSubscription.callsArgWith( 3, null, this.subscription ) }) afterEach(function () { return this._createPaypalSubscription.restore() }) it('should not produce an error', function (done) { return this.call((err, sub) => { expect(err).to.equal(null) expect(err).to.not.be.instanceof(Error) return done() }) }) it('should produce a subscription object', function (done) { return this.call((err, sub) => { expect(sub).to.deep.equal(this.subscription) return done() }) }) it('should call _createPaypalSubscription', function (done) { return this.call((err, sub) => { this._createPaypalSubscription.callCount.should.equal(1) return done() }) }) describe('when _createPaypalSubscription produces an error', function () { beforeEach(function () { return this._createPaypalSubscription.callsArgWith( 3, new Error('woops') ) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) describe('when not paypal', function () { beforeEach(function () { this.subscriptionDetails.isPaypal = false this._createCreditCardSubscription = sinon.stub( this.RecurlyWrapper, '_createCreditCardSubscription' ) return this._createCreditCardSubscription.callsArgWith( 3, null, this.subscription ) }) afterEach(function () { return this._createCreditCardSubscription.restore() }) it('should not produce an error', function (done) { return this.call((err, sub) => { expect(err).to.equal(null) expect(err).to.not.be.instanceof(Error) return done() }) }) it('should produce a subscription object', function (done) { return this.call((err, sub) => { expect(sub).to.deep.equal(this.subscription) return done() }) }) it('should call _createCreditCardSubscription', function (done) { return this.call((err, sub) => { this._createCreditCardSubscription.callCount.should.equal(1) return done() }) }) describe('when _createCreditCardSubscription produces an error', function () { beforeEach(function () { return this._createCreditCardSubscription.callsArgWith( 3, new Error('woops') ) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) }) describe('_createCreditCardSubscription', function () { beforeEach(function () { this.user = { _id: 'some_id', email: 'user@example.com', first_name: 'Foo', last_name: 'Johnson', } this.subscriptionDetails = { currencyCode: 'EUR', plan_code: 'some_plan_code', coupon_code: '', isPaypal: true, first_name: 'Prairie', address: { address1: 'addr_one', address2: 'addr_two', country: 'some_country', state: 'some_state', zip: 'some_zip', }, ITMCampaign: 'itm-campaign-value', ITMContent: 'itm-content-value', } this.subscription = {} this.recurlyTokenIds = { billing: 'a-token-id', threeDSecureActionResult: 'a-3d-token-id', } this.apiRequest = sinon.stub(this.RecurlyWrapper, 'apiRequest') this.response = { statusCode: 200 } this.body = '<xml>is_bad</xml>' this.apiRequest.callsArgWith(1, null, this.response, this.body) this._parseSubscriptionXml = sinon.stub( this.RecurlyWrapper, '_parseSubscriptionXml' ) this._parseSubscriptionXml.callsArgWith(1, null, this.subscription) return (this.call = callback => { return this.RecurlyWrapper._createCreditCardSubscription( this.user, this.subscriptionDetails, this.recurlyTokenIds, callback ) }) }) afterEach(function () { this.apiRequest.restore() return this._parseSubscriptionXml.restore() }) it('sends correct XML', function (done) { return this.call((err, result) => { const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <subscription> <plan_code>some_plan_code</plan_code> <currency>EUR</currency> <coupon_code/> <account> <account_code>some_id</account_code> <email>user@example.com</email> <first_name>Prairie</first_name> <last_name>Johnson</last_name> <billing_info> <token_id>a-token-id</token_id> <three_d_secure_action_result_token_id>a-3d-token-id</three_d_secure_action_result_token_id> </billing_info> </account> <custom_fields> <custom_field> <name>itm_campaign</name> <value>itm-campaign-value</value> </custom_field> <custom_field> <name>itm_content</name> <value>itm-content-value</value> </custom_field> </custom_fields> </subscription>\ `) return done() }) }) it('should not produce an error', function (done) { return this.call((err, sub) => { expect(err).to.not.be.instanceof(Error) expect(err).to.equal(null) return done() }) }) it('should produce a subscription', function (done) { return this.call((err, sub) => { expect(sub).to.equal(this.subscription) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, sub) => { this.apiRequest.callCount.should.equal(1) return done() }) }) it('should call _parseSubscriptionXml', function (done) { return this.call((err, sub) => { this._parseSubscriptionXml.callCount.should.equal(1) return done() }) }) describe('when api request returns 422', function () { beforeEach(function () { const body = `\ <?xml version="1.0" encoding="UTF-8"?> <errors> <transaction_error> <error_code>three_d_secure_action_required</error_code> <error_category>3d_secure_action_required</error_category> <merchant_message>Your payment gateway is requesting that the transaction be completed with 3D Secure in accordance with PSD2.</merchant_message> <customer_message>Your card must be authenticated with 3D Secure before continuing.</customer_message> <gateway_error_code nil="nil"></gateway_error_code> <three_d_secure_action_token_id>mock_three_d_secure_action_token</three_d_secure_action_token_id> </transaction_error> <error field="subscription.account.base" symbol="three_d_secure_action_required">Your card must be authenticated with 3D Secure before continuing.</error> </errors> ` this.apiRequest.yields(null, { statusCode: 422 }, body) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof( SubscriptionErrors.RecurlyTransactionError ) expect(err.info.public.message).to.be.equal( 'Your card must be authenticated with 3D Secure before continuing.' ) expect(err.info.public.threeDSecureActionTokenId).to.be.equal( 'mock_three_d_secure_action_token' ) return done() }) }) }) describe('when api request produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops')) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, sub) => { this.apiRequest.callCount.should.equal(1) return done() }) }) it('should not _parseSubscriptionXml', function (done) { return this.call((err, sub) => { this._parseSubscriptionXml.callCount.should.equal(0) return done() }) }) }) describe('when parse xml produces an error', function () { beforeEach(function () { return this._parseSubscriptionXml.callsArgWith(1, new Error('woops')) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) describe('_createPaypalSubscription', function () { beforeEach(function () { this.checkAccountExists = sinon.stub( this.RecurlyWrapper._paypal, 'checkAccountExists' ) this.createAccount = sinon.stub( this.RecurlyWrapper._paypal, 'createAccount' ) this.createBillingInfo = sinon.stub( this.RecurlyWrapper._paypal, 'createBillingInfo' ) this.setAddressAndCompanyBillingInfo = sinon.stub( this.RecurlyWrapper._paypal, 'setAddressAndCompanyBillingInfo' ) this.createSubscription = sinon.stub( this.RecurlyWrapper._paypal, 'createSubscription' ) this.user = { _id: 'some_id', email: 'user@example.com', } this.subscriptionDetails = { currencyCode: 'EUR', plan_code: 'some_plan_code', coupon_code: '', isPaypal: true, address: { address1: 'addr_one', address2: 'addr_two', country: 'some_country', state: 'some_state', zip: 'some_zip', }, } this.subscription = {} this.recurlyTokenIds = { billing: 'a-token-id', threeDSecureActionResult: 'a-3d-token-id', } // set up data callbacks const { user } = this const { subscriptionDetails } = this const { recurlyTokenIds } = this this.checkAccountExists.callsArgWith(1, null, { user, subscriptionDetails, recurlyTokenIds, userExists: false, account: { accountCode: 'xx' }, }) this.createAccount.callsArgWith(1, null, { user, subscriptionDetails, recurlyTokenIds, userExists: false, account: { accountCode: 'xx' }, }) this.createBillingInfo.callsArgWith(1, null, { user, subscriptionDetails, recurlyTokenIds, userExists: false, account: { accountCode: 'xx' }, billingInfo: { token_id: 'abc' }, }) this.setAddressAndCompanyBillingInfo.callsArgWith(1, null, { user, subscriptionDetails, recurlyTokenIds, userExists: false, account: { accountCode: 'xx' }, billingInfo: { token_id: 'abc' }, }) this.createSubscription.callsArgWith(1, null, { user, subscriptionDetails, recurlyTokenIds, userExists: false, account: { accountCode: 'xx' }, billingInfo: { token_id: 'abc' }, subscription: this.subscription, }) return (this.call = callback => { return this.RecurlyWrapper._createPaypalSubscription( this.user, this.subscriptionDetails, this.recurlyTokenIds, callback ) }) }) afterEach(function () { this.checkAccountExists.restore() this.createAccount.restore() this.createBillingInfo.restore() this.setAddressAndCompanyBillingInfo.restore() return this.createSubscription.restore() }) it('should not produce an error', function (done) { return this.call((err, sub) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should produce a subscription object', function (done) { return this.call((err, sub) => { expect(sub).to.not.equal(null) expect(sub).to.equal(this.subscription) return done() }) }) it('should call each of the paypal stages', function (done) { return this.call((err, sub) => { this.checkAccountExists.callCount.should.equal(1) this.createAccount.callCount.should.equal(1) this.createBillingInfo.callCount.should.equal(1) this.setAddressAndCompanyBillingInfo.callCount.should.equal(1) this.createSubscription.callCount.should.equal(1) return done() }) }) describe('when one of the paypal stages produces an error', function () { beforeEach(function () { return this.createAccount.callsArgWith(1, new Error('woops')) }) it('should produce an error', function (done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() }) }) it('should stop calling the paypal stages after the error', function (done) { return this.call((err, sub) => { this.checkAccountExists.callCount.should.equal(1) this.createAccount.callCount.should.equal(1) this.createBillingInfo.callCount.should.equal(0) this.setAddressAndCompanyBillingInfo.callCount.should.equal(0) this.createSubscription.callCount.should.equal(0) return done() }) }) }) }) describe('paypal actions', function () { beforeEach(function () { this.apiRequest = sinon.stub(this.RecurlyWrapper, 'apiRequest') this._parseAccountXml = sinon.spy(this.RecurlyWrapper, '_parseAccountXml') this._parseBillingInfoXml = sinon.spy( this.RecurlyWrapper, '_parseBillingInfoXml' ) this._parseSubscriptionXml = sinon.spy( this.RecurlyWrapper, '_parseSubscriptionXml' ) return (this.cache = { user: (this.user = { _id: 'some_id', email: 'foo@bar.com', first_name: 'Foo', last_name: 'Bar', }), recurlyTokenIds: (this.recurlyTokenIds = { billing: 'a-token-id', threeDSecureActionResult: 'a-3d-token-id', }), subscriptionDetails: (this.subscriptionDetails = { currencyCode: 'EUR', plan_code: 'some_plan_code', coupon_code: '', isPaypal: true, address: { address1: 'addr_one', address2: 'addr_two', city: 'some_city', country: 'some_country', state: 'some_state', zip: 'some_zip', }, ITMCampaign: 'itm-campaign-value', ITMContent: 'itm-content-value', }), }) }) afterEach(function () { this.apiRequest.restore() this._parseAccountXml.restore() this._parseBillingInfoXml.restore() return this._parseSubscriptionXml.restore() }) describe('_paypal.checkAccountExists', function () { beforeEach(function () { return (this.call = callback => { return this.RecurlyWrapper._paypal.checkAccountExists( this.cache, callback ) }) }) describe('when the account exists', function () { beforeEach(function () { const resultXml = '<account><account_code>abc</account_code></account>' return this.apiRequest.callsArgWith( 1, null, { statusCode: 200 }, resultXml ) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) return done() }) }) it('should call _parseAccountXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseAccountXml.callCount.should.equal(1) return done() }) }) it('should add the account to the cumulative result', function (done) { return this.call((err, result) => { expect(result.account).to.not.equal(null) expect(result.account).to.not.equal(undefined) expect(result.account).to.deep.equal({ account_code: 'abc', }) return done() }) }) it('should set userExists to true', function (done) { return this.call((err, result) => { expect(result.userExists).to.equal(true) return done() }) }) }) describe('when the account does not exist', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, null, { statusCode: 404 }, '') }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) this.apiRequest.firstCall.args[0].method.should.equal('GET') return done() }) }) it('should not call _parseAccountXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseAccountXml.callCount.should.equal(0) return done() }) }) it('should not add the account to result', function (done) { return this.call((err, result) => { expect(result.account).to.equal(undefined) return done() }) }) it('should set userExists to false', function (done) { return this.call((err, result) => { expect(result.userExists).to.equal(false) return done() }) }) }) describe('when apiRequest produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500, }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) describe('_paypal.createAccount', function () { beforeEach(function () { return (this.call = callback => { return this.RecurlyWrapper._paypal.createAccount(this.cache, callback) }) }) describe('when address is missing from subscriptionDetails', function () { beforeEach(function () { return (this.cache.subscriptionDetails.address = null) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) describe('when country is missing from address', function () { beforeEach(function () { return (this.cache.subscriptionDetails.address = {}) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Errors.InvalidError) return done() }) }) }) describe('when account already exists', function () { beforeEach(function () { this.cache.userExists = true return (this.cache.account = { account_code: 'abc' }) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should produce cache object', function (done) { return this.call((err, result) => { expect(result).to.deep.equal(this.cache) expect(result.account).to.deep.equal({ account_code: 'abc', }) return done() }) }) it('should not call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(0) return done() }) }) it('should not call _parseAccountXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseAccountXml.callCount.should.equal(0) return done() }) }) }) describe('when account does not exist', function () { beforeEach(function () { this.cache.userExists = false const resultXml = '<account><account_code>abc</account_code></account>' return this.apiRequest.callsArgWith( 1, null, { statusCode: 200 }, resultXml ) }) it('sends correct XML', function (done) { return this.call((err, result) => { const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <account> <account_code>some_id</account_code> <email>foo@bar.com</email> <first_name>Foo</first_name> <last_name>Bar</last_name> <address> <address1>addr_one</address1> <address2>addr_two</address2> <city>some_city</city> <state>some_state</state> <zip>some_zip</zip> <country>some_country</country> </address> </account>\ `) return done() }) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) this.apiRequest.firstCall.args[0].method.should.equal('POST') return done() }) }) it('should call _parseAccountXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseAccountXml.callCount.should.equal(1) return done() }) }) describe('when apiRequest produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500, }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) }) describe('_paypal.createBillingInfo', function () { beforeEach(function () { this.cache.account = { account_code: 'abc' } return (this.call = callback => { return this.RecurlyWrapper._paypal.createBillingInfo( this.cache, callback ) }) }) describe('when account_code is missing from cache', function () { beforeEach(function () { return (this.cache.account.account_code = null) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) describe('when all goes well', function () { beforeEach(function () { const resultXml = '<billing_info><a>1</a></billing_info>' return this.apiRequest.callsArgWith( 1, null, { statusCode: 200 }, resultXml ) }) it('sends correct XML', function (done) { return this.call((err, result) => { const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <billing_info> <token_id>a-token-id</token_id> </billing_info>\ `) return done() }) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) this.apiRequest.firstCall.args[0].method.should.equal('POST') return done() }) }) it('should call _parseBillingInfoXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseBillingInfoXml.callCount.should.equal(1) return done() }) }) it('should set billingInfo on cache', function (done) { return this.call((err, result) => { expect(result.billingInfo).to.deep.equal({ a: '1', }) return done() }) }) }) describe('when apiRequest produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500, }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) describe('_paypal.setAddressAndCompanyBillingInfo', function () { beforeEach(function () { this.cache.account = { account_code: 'abc' } this.cache.billingInfo = {} return (this.call = callback => { return this.RecurlyWrapper._paypal.setAddressAndCompanyBillingInfo( this.cache, callback ) }) }) describe('when account_code is missing from cache', function () { beforeEach(function () { return (this.cache.account.account_code = null) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) describe('when country is missing', function () { beforeEach(function () { return (this.cache.subscriptionDetails.address = { country: '' }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Errors.InvalidError) return done() }) }) }) describe('when all goes well', function () { beforeEach(function () { const resultXml = '<billing_info><city>London</city></billing_info>' return this.apiRequest.callsArgWith( 1, null, { statusCode: 200 }, resultXml ) }) it('sends correct XML', function (done) { return this.call((err, result) => { const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <billing_info> <address1>addr_one</address1> <address2>addr_two</address2> <city>some_city</city> <state>some_state</state> <zip>some_zip</zip> <country>some_country</country> </billing_info>\ `) return done() }) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) this.apiRequest.firstCall.args[0].method.should.equal('PUT') return done() }) }) it('should call _parseBillingInfoXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseBillingInfoXml.callCount.should.equal(1) return done() }) }) it('should set billingInfo on cache', function (done) { return this.call((err, result) => { expect(result.billingInfo).to.deep.equal({ city: 'London', }) return done() }) }) }) describe('when apiRequest produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500, }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) describe('_paypal.createSubscription', function () { beforeEach(function () { this.cache.account = { account_code: 'abc' } this.cache.billingInfo = {} return (this.call = callback => { return this.RecurlyWrapper._paypal.createSubscription( this.cache, callback ) }) }) describe('when all goes well', function () { beforeEach(function () { const resultXml = '<subscription><a>1</a></subscription>' return this.apiRequest.callsArgWith( 1, null, { statusCode: 200 }, resultXml ) }) it('sends correct XML', function (done) { return this.call((err, result) => { const { body } = this.apiRequest.lastCall.args[0] expect(body).to.equal(`\ <subscription> <plan_code>some_plan_code</plan_code> <currency>EUR</currency> <coupon_code/> <account> <account_code>some_id</account_code> </account> <custom_fields> <custom_field> <name>itm_campaign</name> <value>itm-campaign-value</value> </custom_field> <custom_field> <name>itm_content</name> <value>itm-content-value</value> </custom_field> </custom_fields> </subscription>\ `) return done() }) }) it('should not produce an error', function (done) { return this.call((err, result) => { expect(err).to.not.be.instanceof(Error) return done() }) }) it('should call apiRequest', function (done) { return this.call((err, result) => { this.apiRequest.callCount.should.equal(1) this.apiRequest.firstCall.args[0].method.should.equal('POST') return done() }) }) it('should call _parseSubscriptionXml', function (done) { return this.call((err, result) => { this.RecurlyWrapper._parseSubscriptionXml.callCount.should.equal(1) return done() }) }) it('should set subscription on cache', function (done) { return this.call((err, result) => { expect(result.subscription).to.deep.equal({ a: '1', }) return done() }) }) }) describe('when apiRequest produces an error', function () { beforeEach(function () { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500, }) }) it('should produce an error', function (done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() }) }) }) }) }) describe('listAccountActiveSubscriptions', function () { beforeEach(function () { this.user_id = 'mock-user-id' this.callback = sinon.stub() this.RecurlyWrapper.apiRequest = sinon .stub() .yields( null, (this.response = { mock: 'response' }), (this.body = '<mock body/>') ) return (this.RecurlyWrapper._parseSubscriptionsXml = sinon .stub() .yields(null, (this.subscriptions = ['mock', 'subscriptions']))) }) describe('with an account', function () { beforeEach(function () { return this.RecurlyWrapper.listAccountActiveSubscriptions( this.user_id, this.callback ) }) it('should send a request to Recurly', function () { return this.RecurlyWrapper.apiRequest .calledWith({ url: `accounts/${this.user_id}/subscriptions`, qs: { state: 'active', }, expect404: true, }) .should.equal(true) }) it('should return the subscriptions', function () { return this.callback .calledWith(null, this.subscriptions) .should.equal(true) }) }) describe('without an account', function () { beforeEach(function () { this.response.statusCode = 404 return this.RecurlyWrapper.listAccountActiveSubscriptions( this.user_id, this.callback ) }) it('should return an empty array of subscriptions', function () { return this.callback.calledWith(null, []).should.equal(true) }) }) }) })
overleaf/web/test/unit/src/Subscription/RecurlyWrapperTests.js/0
{ "file_path": "overleaf/web/test/unit/src/Subscription/RecurlyWrapperTests.js", "repo_id": "overleaf", "token_count": 23298 }
575
const SandboxedModule = require('sandboxed-module') const sinon = require('sinon') const Errors = require('../../../../app/src/Features/Errors/Errors') const modulePath = require('path').join( __dirname, '../../../../app/src/Features/ThirdPartyDataStore/TpdsController.js' ) describe('TpdsController', function () { beforeEach(function () { this.TpdsUpdateHandler = {} this.SessionManager = { getLoggedInUserId: sinon.stub().returns('user-id'), } this.TpdsQueueManager = { promises: { getQueues: sinon.stub().returns('queues'), }, } this.TpdsController = SandboxedModule.require(modulePath, { requires: { './TpdsUpdateHandler': this.TpdsUpdateHandler, './UpdateMerger': (this.UpdateMerger = {}), '../Notifications/NotificationsBuilder': (this.NotificationsBuilder = { tpdsFileLimit: sinon.stub().returns({ create: sinon.stub() }), }), '../Authentication/SessionManager': this.SessionManager, './TpdsQueueManager': this.TpdsQueueManager, '@overleaf/metrics': { inc() {}, }, }, }) this.user_id = 'dsad29jlkjas' }) describe('getting an update', function () { it('should process the update with the update receiver', function (done) { const path = '/projectName/here.txt' const req = { pause() {}, params: { 0: path, user_id: this.user_id }, session: { destroy() {}, }, headers: { 'x-sl-update-source': (this.source = 'dropbox'), }, } this.TpdsUpdateHandler.newUpdate = sinon.stub().callsArg(5) const res = { sendStatus: () => { this.TpdsUpdateHandler.newUpdate .calledWith( this.user_id, 'projectName', '/here.txt', req, this.source ) .should.equal(true) done() }, } this.TpdsController.mergeUpdate(req, res) }) it('should return a 500 error when the update receiver fails', function () { const path = '/projectName/here.txt' const req = { pause() {}, params: { 0: path, user_id: this.user_id }, session: { destroy() {}, }, headers: { 'x-sl-update-source': (this.source = 'dropbox'), }, } this.TpdsUpdateHandler.newUpdate = sinon .stub() .callsArgWith(5, 'update-receiver-error') const res = { sendStatus: sinon.stub(), } this.TpdsController.mergeUpdate(req, res) res.sendStatus.calledWith(500).should.equal(true) }) it('should return a 400 error when the project is too big', function () { const path = '/projectName/here.txt' const req = { pause() {}, params: { 0: path, user_id: this.user_id, projectName: 'projectName' }, session: { destroy() {}, }, headers: { 'x-sl-update-source': (this.source = 'dropbox'), }, } this.TpdsUpdateHandler.newUpdate = sinon .stub() .callsArgWith(5, { message: 'project_has_too_many_files' }) const res = { sendStatus: sinon.stub(), } this.TpdsController.mergeUpdate(req, res) res.sendStatus.calledWith(400).should.equal(true) this.NotificationsBuilder.tpdsFileLimit .calledWith(this.user_id) .should.equal(true) }) it('should return a 429 error when the update receiver fails due to too many requests error', function () { const path = '/projectName/here.txt' const req = { pause() {}, params: { 0: path, user_id: this.user_id }, session: { destroy() {}, }, headers: { 'x-sl-update-source': (this.source = 'dropbox'), }, } this.TpdsUpdateHandler.newUpdate = sinon .stub() .callsArgWith(5, new Errors.TooManyRequestsError('project on cooldown')) const res = { sendStatus: sinon.stub(), } this.TpdsController.mergeUpdate(req, res) res.sendStatus.calledWith(429).should.equal(true) }) }) describe('getting a delete update', function () { it('should process the delete with the update receiver', function (done) { const path = '/projectName/here.txt' const req = { params: { 0: path, user_id: this.user_id }, session: { destroy() {}, }, headers: { 'x-sl-update-source': (this.source = 'dropbox'), }, } this.TpdsUpdateHandler.deleteUpdate = sinon.stub().callsArg(4) const res = { sendStatus: () => { this.TpdsUpdateHandler.deleteUpdate .calledWith(this.user_id, 'projectName', '/here.txt', this.source) .should.equal(true) done() }, } this.TpdsController.deleteUpdate(req, res) }) }) describe('parseParams', function () { it('should take the project name off the start and replace with slash', function () { const path = 'noSlashHere' const req = { params: { 0: path, user_id: this.user_id } } const result = this.TpdsController.parseParams(req) result.userId.should.equal(this.user_id) result.filePath.should.equal('/') result.projectName.should.equal(path) }) it('should take the project name off the start and it with no slashes in', function () { const path = '/project/file.tex' const req = { params: { 0: path, user_id: this.user_id } } const result = this.TpdsController.parseParams(req) result.userId.should.equal(this.user_id) result.filePath.should.equal('/file.tex') result.projectName.should.equal('project') }) it('should take the project name of and return a slash for the file path', function () { const path = '/project_name' const req = { params: { 0: path, user_id: this.user_id } } const result = this.TpdsController.parseParams(req) result.projectName.should.equal('project_name') result.filePath.should.equal('/') }) }) describe('updateProjectContents', function () { beforeEach(function () { this.UpdateMerger.mergeUpdate = sinon.stub().callsArg(5) this.req = { params: { 0: (this.path = 'chapters/main.tex'), project_id: (this.project_id = 'project-id-123'), }, session: { destroy: sinon.stub(), }, headers: { 'x-sl-update-source': (this.source = 'github'), }, } this.res = { sendStatus: sinon.stub() } this.TpdsController.updateProjectContents(this.req, this.res, this.next) }) it('should merge the update', function () { this.UpdateMerger.mergeUpdate .calledWith( null, this.project_id, `/${this.path}`, this.req, this.source ) .should.equal(true) }) it('should return a success', function () { this.res.sendStatus.calledWith(200).should.equal(true) }) }) describe('deleteProjectContents', function () { beforeEach(function () { this.UpdateMerger.deleteUpdate = sinon.stub().callsArg(4) this.req = { params: { 0: (this.path = 'chapters/main.tex'), project_id: (this.project_id = 'project-id-123'), }, session: { destroy: sinon.stub(), }, headers: { 'x-sl-update-source': (this.source = 'github'), }, } this.res = { sendStatus: sinon.stub() } this.TpdsController.deleteProjectContents(this.req, this.res, this.next) }) it('should delete the file', function () { this.UpdateMerger.deleteUpdate .calledWith(null, this.project_id, `/${this.path}`, this.source) .should.equal(true) }) it('should return a success', function () { this.res.sendStatus.calledWith(200).should.equal(true) }) }) describe('getQueues', function () { beforeEach(function () { this.req = {} this.res = { json: sinon.stub() } this.next = sinon.stub() }) describe('success', function () { beforeEach(async function () { await this.TpdsController.getQueues(this.req, this.res, this.next) }) it('should use userId from session', function () { this.SessionManager.getLoggedInUserId.should.have.been.calledOnce this.TpdsQueueManager.promises.getQueues.should.have.been.calledWith( 'user-id' ) }) it('should call json with response', function () { this.res.json.should.have.been.calledWith('queues') this.next.should.not.have.been.called }) }) describe('error', function () { beforeEach(async function () { this.err = new Error() this.TpdsQueueManager.promises.getQueues = sinon .stub() .rejects(this.err) await this.TpdsController.getQueues(this.req, this.res, this.next) }) it('should call next with error', function () { this.res.json.should.not.have.been.called this.next.should.have.been.calledWith(this.err) }) }) }) })
overleaf/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js/0
{ "file_path": "overleaf/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js", "repo_id": "overleaf", "token_count": 4164 }
576
const { expect } = require('chai') const sinon = require('sinon') const tk = require('timekeeper') const moment = require('moment') const SandboxedModule = require('sandboxed-module') const Errors = require('../../../../app/src/Features/Errors/Errors') const ObjectId = require('mongoose').Types.ObjectId const { User } = require('../helpers/models/User') const { DeletedUser } = require('../helpers/models/DeletedUser') const modulePath = '../../../../app/src/Features/User/UserDeleter.js' describe('UserDeleter', function () { beforeEach(function () { tk.freeze(Date.now()) this.userId = ObjectId() this.UserMock = sinon.mock(User) this.DeletedUserMock = sinon.mock(DeletedUser) this.mockedUser = sinon.mock( new User({ _id: this.userId, email: 'bob@bob.com', lastLoggedIn: Date.now() + 1000, signUpDate: Date.now() + 2000, loginCount: 10, overleaf: { id: 1234, }, refered_users: ['wombat', 'potato'], refered_user_count: 2, referal_id: ['giraffe'], }) ) this.user = this.mockedUser.object this.NewsletterManager = { promises: { unsubscribe: sinon.stub().resolves(), }, } this.ProjectDeleter = { promises: { deleteUsersProjects: sinon.stub().resolves(), }, } this.SubscriptionHandler = { promises: { cancelSubscription: sinon.stub().resolves(), }, } this.SubscriptionUpdater = { promises: { removeUserFromAllGroups: sinon.stub().resolves(), }, } this.SubscriptionLocator = { promises: { getUsersSubscription: sinon.stub().resolves(), }, } this.UserMembershipsHandler = { promises: { removeUserFromAllEntities: sinon.stub().resolves(), }, } this.UserSessionsManager = { promises: { revokeAllUserSessions: sinon.stub().resolves(), }, } this.InstitutionsApi = { promises: { deleteAffiliations: sinon.stub().resolves(), }, } this.UserDeleter = SandboxedModule.require(modulePath, { requires: { '../../models/User': { User: User }, '../../models/DeletedUser': { DeletedUser: DeletedUser }, '../Newsletter/NewsletterManager': this.NewsletterManager, './UserSessionsManager': this.UserSessionsManager, '../Subscription/SubscriptionHandler': this.SubscriptionHandler, '../Subscription/SubscriptionUpdater': this.SubscriptionUpdater, '../Subscription/SubscriptionLocator': this.SubscriptionLocator, '../UserMembership/UserMembershipsHandler': this.UserMembershipsHandler, '../Project/ProjectDeleter': this.ProjectDeleter, '../Institutions/InstitutionsAPI': this.InstitutionsApi, }, }) }) afterEach(function () { this.DeletedUserMock.restore() this.UserMock.restore() this.mockedUser.restore() }) describe('deleteUser', function () { beforeEach(function () { this.UserMock.expects('findById') .withArgs(this.userId) .chain('exec') .resolves(this.user) }) describe('when the user can be deleted', function () { beforeEach(function () { this.deletedUser = { user: this.user, deleterData: { deletedAt: new Date(), deletedUserId: this.userId, deleterIpAddress: undefined, deleterId: undefined, deletedUserLastLoggedIn: this.user.lastLoggedIn, deletedUserSignUpDate: this.user.signUpDate, deletedUserLoginCount: this.user.loginCount, deletedUserReferralId: this.user.referal_id, deletedUserReferredUsers: this.user.refered_users, deletedUserReferredUserCount: this.user.refered_user_count, deletedUserOverleafId: this.user.overleaf.id, }, } }) describe('when no options are passed', function () { beforeEach(function () { this.DeletedUserMock.expects('updateOne') .withArgs( { 'deleterData.deletedUserId': this.userId }, this.deletedUser, { upsert: true } ) .chain('exec') .resolves() }) describe('when unsubscribing in Mailchimp succeeds', function () { beforeEach(function () { this.UserMock.expects('deleteOne') .withArgs({ _id: this.userId }) .chain('exec') .resolves() }) it('should find and the user in mongo by its id', async function () { await this.UserDeleter.promises.deleteUser(this.userId) this.UserMock.verify() }) it('should delete the user from mailchimp', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.NewsletterManager.promises.unsubscribe ).to.have.been.calledWith(this.user, { delete: true }) }) it('should delete all the projects of a user', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.ProjectDeleter.promises.deleteUsersProjects ).to.have.been.calledWith(this.userId) }) it("should cancel the user's subscription", async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.SubscriptionHandler.promises.cancelSubscription ).to.have.been.calledWith(this.user) }) it('should delete user affiliations', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.InstitutionsApi.promises.deleteAffiliations ).to.have.been.calledWith(this.userId) }) it('should stop the user sessions', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.UserSessionsManager.promises.revokeAllUserSessions ).to.have.been.calledWith(this.userId, []) }) it('should remove user from group subscriptions', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.SubscriptionUpdater.promises.removeUserFromAllGroups ).to.have.been.calledWith(this.userId) }) it('should remove user memberships', async function () { await this.UserDeleter.promises.deleteUser(this.userId) expect( this.UserMembershipsHandler.promises.removeUserFromAllEntities ).to.have.been.calledWith(this.userId) }) it('rejects if the user is a subscription admin', async function () { this.SubscriptionLocator.promises.getUsersSubscription.rejects({ _id: 'some-subscription', }) await expect(this.UserDeleter.promises.deleteUser(this.userId)).to .be.rejected }) it('should create a deletedUser', async function () { await this.UserDeleter.promises.deleteUser(this.userId) this.DeletedUserMock.verify() }) }) describe('when unsubscribing from mailchimp fails', function () { beforeEach(function () { this.NewsletterManager.promises.unsubscribe.rejects( new Error('something went wrong') ) }) it('should return an error and not delete the user', async function () { await expect(this.UserDeleter.promises.deleteUser(this.userId)).to .be.rejected this.UserMock.verify() }) }) describe('when called as a callback', function () { beforeEach(function () { this.UserMock.expects('deleteOne') .withArgs({ _id: this.userId }) .chain('exec') .resolves() }) it('should delete the user', function (done) { this.UserDeleter.deleteUser(this.userId, err => { expect(err).not.to.exist this.UserMock.verify() this.DeletedUserMock.verify() done() }) }) }) }) describe('when a user and IP address are specified', function () { beforeEach(function () { this.ipAddress = '1.2.3.4' this.deleterId = ObjectId() this.deletedUser.deleterData.deleterIpAddress = this.ipAddress this.deletedUser.deleterData.deleterId = this.deleterId this.DeletedUserMock.expects('updateOne') .withArgs( { 'deleterData.deletedUserId': this.userId }, this.deletedUser, { upsert: true } ) .chain('exec') .resolves() this.UserMock.expects('deleteOne') .withArgs({ _id: this.userId }) .chain('exec') .resolves() }) it('should add the deleted user id and ip address to the deletedUser', async function () { await this.UserDeleter.promises.deleteUser(this.userId, { deleterUser: { _id: this.deleterId }, ipAddress: this.ipAddress, }) this.DeletedUserMock.verify() }) describe('when called as a callback', function () { it('should delete the user', function (done) { this.UserDeleter.deleteUser( this.userId, { deleterUser: { _id: this.deleterId }, ipAddress: this.ipAddress, }, err => { expect(err).not.to.exist this.UserMock.verify() this.DeletedUserMock.verify() done() } ) }) }) }) }) describe('when the user cannot be deleted because they are a subscription admin', function () { beforeEach(function () { this.SubscriptionLocator.promises.getUsersSubscription.resolves({ _id: 'some-subscription', }) }) it('fails with a SubscriptionAdminDeletionError', async function () { await expect( this.UserDeleter.promises.deleteUser(this.userId) ).to.be.rejectedWith(Errors.SubscriptionAdminDeletionError) }) it('should not create a deletedUser', async function () { await expect(this.UserDeleter.promises.deleteUser(this.userId)).to.be .rejected this.DeletedUserMock.verify() }) it('should not remove the user from mongo', async function () { await expect(this.UserDeleter.promises.deleteUser(this.userId)).to.be .rejected this.UserMock.verify() }) }) }) describe('ensureCanDeleteUser', function () { it('should not return error when user can be deleted', async function () { this.SubscriptionLocator.promises.getUsersSubscription.resolves(null) let error try { await this.UserDeleter.promises.ensureCanDeleteUser(this.user) } catch (e) { error = e } finally { expect(error).not.to.exist } }) it('should return custom error when user is group admin', async function () { this.SubscriptionLocator.promises.getUsersSubscription.resolves({ _id: '123abc', }) let error try { await this.UserDeleter.promises.ensureCanDeleteUser(this.user) } catch (e) { error = e } finally { expect(error).to.be.instanceof(Errors.SubscriptionAdminDeletionError) } }) it('propagates errors', async function () { this.SubscriptionLocator.promises.getUsersSubscription.rejects( new Error('Some error') ) let error try { await this.UserDeleter.promises.ensureCanDeleteUser(this.user) } catch (e) { error = e } finally { expect(error).to.be.instanceof(Error) } }) }) describe('expireDeletedUsersAfterDuration', function () { const userId1 = new ObjectId() const userId2 = new ObjectId() beforeEach(function () { this.deletedUsers = [ { user: { _id: userId1 }, deleterData: { deletedUserId: userId1 }, save: sinon.stub().resolves(), }, { user: { _id: userId2 }, deleterData: { deletedUserId: userId2 }, save: sinon.stub().resolves(), }, ] this.DeletedUserMock.expects('find') .withArgs({ 'deleterData.deletedAt': { $lt: new Date(moment().subtract(90, 'days')), }, user: { $ne: null, }, }) .chain('exec') .resolves(this.deletedUsers) for (const deletedUser of this.deletedUsers) { this.DeletedUserMock.expects('findOne') .withArgs({ 'deleterData.deletedUserId': deletedUser.deleterData.deletedUserId, }) .chain('exec') .resolves(deletedUser) } }) it('clears data from all deleted users', async function () { await this.UserDeleter.promises.expireDeletedUsersAfterDuration() for (const deletedUser of this.deletedUsers) { expect(deletedUser.user).to.be.undefined expect(deletedUser.save.called).to.be.true } }) }) describe('expireDeletedUser', function () { beforeEach(function () { this.mockedDeletedUser = sinon.mock( new DeletedUser({ user: this.user, deleterData: { deleterIpAddress: '1.1.1.1', deletedUserId: this.userId, }, }) ) this.deletedUser = this.mockedDeletedUser.object this.mockedDeletedUser.expects('save').resolves() this.DeletedUserMock.expects('findOne') .withArgs({ 'deleterData.deletedUserId': 'giraffe' }) .chain('exec') .resolves(this.deletedUser) }) afterEach(function () { this.mockedDeletedUser.restore() }) it('should find the user by user ID', async function () { await this.UserDeleter.promises.expireDeletedUser('giraffe') this.DeletedUserMock.verify() }) it('should remove the user data from mongo', async function () { await this.UserDeleter.promises.expireDeletedUser('giraffe') expect(this.deletedUser.user).not.to.exist }) it('should remove the IP address from mongo', async function () { await this.UserDeleter.promises.expireDeletedUser('giraffe') expect(this.deletedUser.deleterData.ipAddress).not.to.exist }) it('should not delete other deleterData fields', async function () { await this.UserDeleter.promises.expireDeletedUser('giraffe') expect(this.deletedUser.deleterData.deletedUserId).to.equal(this.userId) }) it('should save the record to mongo', async function () { await this.UserDeleter.promises.expireDeletedUser('giraffe') this.mockedDeletedUser.verify() }) describe('when called as a callback', function () { it('should expire the user', function (done) { this.UserDeleter.expireDeletedUser('giraffe', err => { expect(err).not.to.exist this.DeletedUserMock.verify() this.mockedDeletedUser.verify() expect(this.deletedUser.user).not.to.exist expect(this.deletedUser.deleterData.ipAddress).not.to.exist done() }) }) }) }) })
overleaf/web/test/unit/src/User/UserDeleterTests.js/0
{ "file_path": "overleaf/web/test/unit/src/User/UserDeleterTests.js", "repo_id": "overleaf", "token_count": 7242 }
577
/* eslint-disable no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ let MockClient const sinon = require('sinon') let idCounter = 0 module.exports = MockClient = class MockClient { constructor() { this.attributes = {} this.join = sinon.stub() this.emit = sinon.stub() this.disconnect = sinon.stub() this.id = idCounter++ } set(key, value, callback) { this.attributes[key] = value if (callback != null) { return callback() } } get(key, callback) { return callback(null, this.attributes[key]) } disconnect() {} }
overleaf/web/test/unit/src/helpers/MockClient.js/0
{ "file_path": "overleaf/web/test/unit/src/helpers/MockClient.js", "repo_id": "overleaf", "token_count": 310 }
578
/* eslint-disable max-len, no-unused-vars, */ // TODO: This file was created by bulk-decaffeinate. // Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const sinon = require('sinon') const assert = require('assert') const path = require('path') const modulePath = path.join( __dirname, '../../../../../app/src/infrastructure/LockManager.js' ) const lockKey = `lock:web:{${5678}}` const lockValue = '123456' const SandboxedModule = require('sandboxed-module') describe('LockManager - releasing the lock', function () { const deleteStub = sinon.stub().callsArgWith(4) const mocks = { '@overleaf/settings': { redis: {}, lockManager: { lockTestInterval: 50, maxTestInterval: 1000, maxLockWaitTime: 10000, redisLockExpiry: 30, slowExecutionThreshold: 5000, }, }, '@overleaf/metrics': {}, './RedisWrapper': { client() { return { auth() {}, eval: deleteStub, } }, }, } const LockManager = SandboxedModule.require(modulePath, { requires: mocks }) LockManager.unlockScript = 'this is the unlock script' it('should put a all data into memory', function (done) { return LockManager._releaseLock(lockKey, lockValue, () => { deleteStub .calledWith(LockManager.unlockScript, 1, lockKey, lockValue) .should.equal(true) return done() }) }) })
overleaf/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js/0
{ "file_path": "overleaf/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js", "repo_id": "overleaf", "token_count": 623 }
579
# The version of OCIS to use in pipelines that test against OCIS OCIS_COMMITID=e3e0a7ae3912af84cdae51f33f946cf3c3bd25a1 OCIS_BRANCH=master
owncloud/web/.drone.env/0
{ "file_path": "owncloud/web/.drone.env", "repo_id": "owncloud", "token_count": 60 }
580
Change: Move create new button We've moved the create new button in the files app bar to the left directly next to breadcrumbs. https://github.com/owncloud/web/pull/3622
owncloud/web/changelog/0.11.0_2020-06-26/move-create-button/0
{ "file_path": "owncloud/web/changelog/0.11.0_2020-06-26/move-create-button", "repo_id": "owncloud", "token_count": 48 }
581
Enhancement: Add favorites capabilities We've added a check of favorites capabilities to enable disabling of favorites list and favorite action. https://github.com/owncloud/ocis/issues/354 https://github.com/owncloud/web/pull/3754
owncloud/web/changelog/0.12.0_2020-07-10/favorites-capabilities/0
{ "file_path": "owncloud/web/changelog/0.12.0_2020-07-10/favorites-capabilities", "repo_id": "owncloud", "token_count": 60 }
582
Change: Move docs about hugo usage to ocis Since our documentation about how to work with hugo (for documentation) is a cross-extension topic, we have moved it to our main ocis docs. https://github.com/owncloud/web/pull/3828
owncloud/web/changelog/0.14.0_2020-08-17/remove-hugo-docs/0
{ "file_path": "owncloud/web/changelog/0.14.0_2020-08-17/remove-hugo-docs", "repo_id": "owncloud", "token_count": 65 }
583
Change: Renamed collaborators to people All visible occurrences of "collaborator" or "collaborators" have been replaced by "person" or "people" respectively. Additionally, the action "Add Collaborator" was changed to "Share". https://github.com/owncloud/web/pull/4070 https://github.com/owncloud/product/issues/231
owncloud/web/changelog/0.17.0_2020-09-25/rename-collaborators-to-people/0
{ "file_path": "owncloud/web/changelog/0.17.0_2020-09-25/rename-collaborators-to-people", "repo_id": "owncloud", "token_count": 86 }
584
Change: Update ODS to v1.12.2 We updated ODS to v1.12.2. Please refer to the changelog of ODS. https://github.com/owncloud/web/pull/4239 https://github.com/owncloud/owncloud-design-system/releases/tag/v1.12.2
owncloud/web/changelog/0.22.0_2020-10-26/update-ods-1.12.2/0
{ "file_path": "owncloud/web/changelog/0.22.0_2020-10-26/update-ods-1.12.2", "repo_id": "owncloud", "token_count": 83 }
585
Bugfix: Unavailable extensions causing route duplication There was an error in the extension loading handlers which caused routes to be loaded multiple times when extensions from the config.json were unavailable. We hardened the extension loading handlers to just skip those extensions. https://github.com/owncloud/web/pull/4382
owncloud/web/changelog/0.27.0_2020-11-24/extension-loading/0
{ "file_path": "owncloud/web/changelog/0.27.0_2020-11-24/extension-loading", "repo_id": "owncloud", "token_count": 69 }
586
Bugfix: Prevent jumpy behavior when loading user avatars When loading a user avatar, the container size was smaller so as soon as the avatar was loaded, it resulted in jumpy behavior. This is fixed now by applying the same size to the loading spinner element. https://github.com/owncloud/web/issues/2921 https://github.com/owncloud/web/pull/2927
owncloud/web/changelog/0.3.0_2020-01-31/2921/0
{ "file_path": "owncloud/web/changelog/0.3.0_2020-01-31/2921", "repo_id": "owncloud", "token_count": 92 }
587
Bugfix: Various fixes for files app in responsive mode Fixed properly alignment of header columns with the body of the files table which stays even after resizing. Removed the column label for the actions column as it looks nicer. https://github.com/owncloud/web/issues/2998 https://github.com/owncloud/web/pull/2999
owncloud/web/changelog/0.5.0_2020-03-02/2998/0
{ "file_path": "owncloud/web/changelog/0.5.0_2020-03-02/2998", "repo_id": "owncloud", "token_count": 82 }
588
Change: Stop support for deployment of Web as an ownCloud app We've stopped supporting deployment of Web as an ownCloud app. In the release is no longer available Web ownCloud 10 app package. https://github.com/owncloud/web/pull/3162
owncloud/web/changelog/0.6.0_2020-03-16/3162/0
{ "file_path": "owncloud/web/changelog/0.6.0_2020-03-16/3162", "repo_id": "owncloud", "token_count": 61 }
589
Bugfix: Show token string if link name is empty in FileLinkSidebar owncloud-js-client was parsing empty link name xml attribute as empty object. The empty object was changed with an empty string. Also, FileLinkSidebar behaviour fixed by showing token as name for the link shares without a name. https://github.com/owncloud/web/pull/3297 https://github.com/owncloud/web/issues/2517
owncloud/web/changelog/0.9.0_2020-04-27/3297/0
{ "file_path": "owncloud/web/changelog/0.9.0_2020-04-27/3297", "repo_id": "owncloud", "token_count": 101 }
590
Bugfix: Hide modals on logout Hide shown modal if user gets logged out while it's visible https://github.com/owncloud/ocis/issues/1064 https://github.com/owncloud/web/pull/4472
owncloud/web/changelog/1.0.0_2020-12-16/hide-modals/0
{ "file_path": "owncloud/web/changelog/1.0.0_2020-12-16/hide-modals", "repo_id": "owncloud", "token_count": 59 }
591
Bugfix: Fix missing translations in application menu https://github.com/owncloud/web/pull/4830
owncloud/web/changelog/2.1.0_2021-03-24/bugfix-missing-tanslations-in-applications-menu/0
{ "file_path": "owncloud/web/changelog/2.1.0_2021-03-24/bugfix-missing-tanslations-in-applications-menu", "repo_id": "owncloud", "token_count": 27 }
592
Enhancement: Use real page title for location picker We've added real page titles to the location picker. The title is consisted of the current action, target and product name. https://github.com/owncloud/web/pull/5009
owncloud/web/changelog/3.1.0_2021-05-12/enhancement-real-location-picker-title/0
{ "file_path": "owncloud/web/changelog/3.1.0_2021-05-12/enhancement-real-location-picker-title", "repo_id": "owncloud", "token_count": 57 }
593
Bugfix: Reduced Thumbnail Size We have greatly reduced the size of the images we request from the backend to display as thumbnail previews in order to minimize loading times. https://github.com/owncloud/web/pull/5194
owncloud/web/changelog/3.3.0_2021-06-23/bugfix-reduced-thumbnail-size/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/bugfix-reduced-thumbnail-size", "repo_id": "owncloud", "token_count": 56 }
594
Enhancement: Button appearance Changed the appearance of the "accept/decline share" buttons in the "Shared With Me" file list so they actually look like buttons. Also changed the "Clear selection" button in the files table batch actions from `raw` to `outline` appearance. https://github.com/owncloud/web/pull/5053 https://github.com/owncloud/web/pull/5148
owncloud/web/changelog/3.3.0_2021-06-23/enhancement-button-appearance/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-button-appearance", "repo_id": "owncloud", "token_count": 102 }
595
Enhancement: Request cancellation Requests (e.g. loading of images) can now be pragmatically cancelled from the client side. Before, obsolete requests would still create load on the server and return results that then would be discarded by the web frontend. https://github.com/owncloud/web/issues/5163 https://github.com/owncloud/web/pull/5194
owncloud/web/changelog/3.3.0_2021-06-23/enhancement-request-cancellation/0
{ "file_path": "owncloud/web/changelog/3.3.0_2021-06-23/enhancement-request-cancellation", "repo_id": "owncloud", "token_count": 97 }
596
Enhancement: Content Security Policy for known iframe integrations We added CSP rules for allowing iframe integrations of the onlyoffice and richdocuments documentservers. https://github.com/owncloud/web/pull/5420
owncloud/web/changelog/3.4.0_2021-07-09/enhancement-oc10-web-csp/0
{ "file_path": "owncloud/web/changelog/3.4.0_2021-07-09/enhancement-oc10-web-csp", "repo_id": "owncloud", "token_count": 56 }
597
Enhancement: Prevent binding to only loopback IP when running in watch mode This is required when running the acceptance tests on Windows, it allows the selenium docker containers to access the frontend due to the host binding in rollup (when running `yarn serve`). Does not break any existing functionality. https://github.com/owncloud/web/pull/5515
owncloud/web/changelog/4.0.0_2021-08-04/enhancement-prevent-bind-to-loopback-address/0
{ "file_path": "owncloud/web/changelog/4.0.0_2021-08-04/enhancement-prevent-bind-to-loopback-address", "repo_id": "owncloud", "token_count": 84 }
598
Enhancement: fetch file info in the Files sidebar We've started fetching the file info when a single item is selected and the Files sidebar is opened. With this change we have more information available in different lists e.g. private link in shared lists. https://github.com/owncloud/web/issues/5570 https://github.com/owncloud/web/pull/5665
owncloud/web/changelog/4.2.0_2021-09-14/enhancement-fetch-file-info-in-sidebar/0
{ "file_path": "owncloud/web/changelog/4.2.0_2021-09-14/enhancement-fetch-file-info-in-sidebar", "repo_id": "owncloud", "token_count": 89 }
599
Bugfix: External apps by shares Opening shares in "Shared with me" section was broken. We have added property `mimeType` by the build of a shared resource, so that the external apps can be found for it. We fixed passing the fileId property for the context actions. https://github.com/owncloud/web/pull/5907 https://github.com/owncloud/web/issues/5906
owncloud/web/changelog/4.4.0_2021-10-26/bugfix-external-apps-by-shares/0
{ "file_path": "owncloud/web/changelog/4.4.0_2021-10-26/bugfix-external-apps-by-shares", "repo_id": "owncloud", "token_count": 99 }
600
Enhancement: Default action order We've changed the order of actions which are being considered as default action. The order is now 1) installed editors, 2) external apps from the app provider, 3) system default actions. Previously the external apps took precedence. https://github.com/owncloud/web/pull/5952
owncloud/web/changelog/4.5.0_2021-11-16/enhancement-default-action-order/0
{ "file_path": "owncloud/web/changelog/4.5.0_2021-11-16/enhancement-default-action-order", "repo_id": "owncloud", "token_count": 73 }
601
Bugfix: Ensure route config is honored for new file handlers Only display the new file entries for the routes it belongs to. https://github.com/owncloud/web/pull/6135
owncloud/web/changelog/4.7.0_2021-12-16/bugfix-new-file-handler/0
{ "file_path": "owncloud/web/changelog/4.7.0_2021-12-16/bugfix-new-file-handler", "repo_id": "owncloud", "token_count": 45 }
602
Enhancement: Edit people shares without changing the panel We have reworked the full list view of sharees in the right sidebar for better overview and faster editing. https://github.com/owncloud/web/pull/6039 https://github.com/owncloud/web/issues/5763
owncloud/web/changelog/4.8.0_2021-12-22/enhancement-inline-edit-sharees/0
{ "file_path": "owncloud/web/changelog/4.8.0_2021-12-22/enhancement-inline-edit-sharees", "repo_id": "owncloud", "token_count": 71 }
603
Enhancement: Redesigned user menu We've redesigned the user menu. It now also features more detailed information about the user's quota and how much space they have left. https://github.com/owncloud/web/pull/6272 https://github.com/owncloud/web/issues/6101
owncloud/web/changelog/5.0.0_2022-02-14/enhancement-redesigned-user-menu/0
{ "file_path": "owncloud/web/changelog/5.0.0_2022-02-14/enhancement-redesigned-user-menu", "repo_id": "owncloud", "token_count": 74 }
604
Enhancement: Add quick rename button We've added a button for quick editing a resource name https://github.com/owncloud/web/pull/6645 https://github.com/owncloud/web/issues/6626
owncloud/web/changelog/5.2.0_2022-03-03/enhancement-add-quick-rename-button/0
{ "file_path": "owncloud/web/changelog/5.2.0_2022-03-03/enhancement-add-quick-rename-button", "repo_id": "owncloud", "token_count": 54 }
605
Bugfix: Sidebar panels in public links Public links were showing some panels (People, Links, Versions) that were not supposed to be visible in public links. We've fixed that by excluding those panels on public link routes. https://github.com/owncloud/web/issues/2090 https://github.com/owncloud/web/pull/6567
owncloud/web/changelog/5.3.0_2022-03-23/bugfix-public-link-sidebar-panels/0
{ "file_path": "owncloud/web/changelog/5.3.0_2022-03-23/bugfix-public-link-sidebar-panels", "repo_id": "owncloud", "token_count": 83 }
606
Enhancement: Load space images as preview We've added a new logic which renders space images as preview to minimize data traffic https://github.com/owncloud/web/pull/6529 https://github.com/owncloud/web/pull/6558
owncloud/web/changelog/5.3.0_2022-03-23/enhancement-load-space-images-as-preview/0
{ "file_path": "owncloud/web/changelog/5.3.0_2022-03-23/enhancement-load-space-images-as-preview", "repo_id": "owncloud", "token_count": 61 }
607
Enhancement: Trash bin We've improved the trash bin in general: * Add compatibility with owncloud-sdk 3.0.0-alpha 1 * Add a confirmation dialog while hitting the `Empty trash bin` button * Add trash bin for project spaces * Change personal trash bin route from `files/trash` to `files/trash/personal` https://github.com/owncloud/web/pull/6566 https://github.com/owncloud/web/issues/6544 https://github.com/owncloud/web/issues/5974
owncloud/web/changelog/5.3.0_2022-03-23/enhancement-trash-bin/0
{ "file_path": "owncloud/web/changelog/5.3.0_2022-03-23/enhancement-trash-bin", "repo_id": "owncloud", "token_count": 131 }
608
Enhancement: PDF viewer We've added a lightweight PDF viewer app which allows the user to bookmark PDF files. https://github.com/owncloud/web/pull/6654
owncloud/web/changelog/5.4.0_2022-04-11/enhancement-pdf-viewer/0
{ "file_path": "owncloud/web/changelog/5.4.0_2022-04-11/enhancement-pdf-viewer", "repo_id": "owncloud", "token_count": 43 }
609
Enhancement: Update ODS to v13.1.0-rc.2 We updated the ownCloud Design System to version 13.1.0-rc.2. Please refer to the full changelog in the ODS release (linked) for more details. Summary: - Enhancement - Replace deprecated String.prototype.substr(): https://github.com/owncloud/owncloud-design-system/pull/2059 - Enhancement - Redesign OcGhostElement: https://github.com/owncloud/owncloud-design-system/pull/2049 - Enhancement - Export package members: https://github.com/owncloud/owncloud-design-system/pull/2048 - Enhancement - Make OcResource inline-flex: https://github.com/owncloud/owncloud-design-system/pull/2041 - Bugfix - Disabled textarea color contrast in darkmode: https://github.com/owncloud/owncloud-design-system/pull/2055 - Bugfix - OcTextInput: Fix event handlers in loops: https://github.com/owncloud/owncloud-design-system/pull/2054 https://github.com/owncloud/web/pull/6701 https://github.com/owncloud/web/pull/6708 https://github.com/owncloud/owncloud-design-system/releases/tag/v13.1.0-rc.2
owncloud/web/changelog/5.4.0_2022-04-11/enhancement-update-ods/0
{ "file_path": "owncloud/web/changelog/5.4.0_2022-04-11/enhancement-update-ods", "repo_id": "owncloud", "token_count": 323 }
610
Bugfix: Prevent rename button from getting covered We've fixed a bug where the rename button next to the file name would get covered if there is not enough space available. https://github.com/owncloud/web/pull/7061 https://github.com/owncloud/web/issues/7007
owncloud/web/changelog/5.5.0_2022-06-20/bugfix-rename-button-visibility/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-rename-button-visibility", "repo_id": "owncloud", "token_count": 70 }
611
Bugfix: Spaces breadcrumbs not working correctly We've fixed a bug where clicking on the last breadcrumb navigation item not resulted in a reload of the current path but forwarded to the upper path. https://github.com/owncloud/web/pull/6993 https://github.com/owncloud/web/issues/6866
owncloud/web/changelog/5.5.0_2022-06-20/bugfix-spaces-breadcrumbs/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/bugfix-spaces-breadcrumbs", "repo_id": "owncloud", "token_count": 78 }
612
Enhancement: CERN features setting We've added a flag to enable CERN-specific features https://github.com/owncloud/web/pull/7034
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-cern-features/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-cern-features", "repo_id": "owncloud", "token_count": 40 }
613
Enhancement: Personal space id in URL We now include the personal space id in the URL instead of using a magic "home" alias. When using the old "home" alias the user gets redirected to the URL with their personal space id. https://github.com/owncloud/web/pull/7053
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-personal-storage-id/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-personal-storage-id", "repo_id": "owncloud", "token_count": 70 }
614
Enhancement: Enable tus upload for password protected public links Uploading files on password protected public links now features tus uploads if the backend supports it. https://github.com/owncloud/web/issues/6819 https://github.com/owncloud/web/pull/6890
owncloud/web/changelog/5.5.0_2022-06-20/enhancement-tus-uploads-on-public-pages/0
{ "file_path": "owncloud/web/changelog/5.5.0_2022-06-20/enhancement-tus-uploads-on-public-pages", "repo_id": "owncloud", "token_count": 69 }
615
Bugfix: Context menu misplaced when triggered by keyboard navigation We've fixed a bug where triggering the context menu by keyboard navigation misplaced the menu and made it inaccessible. https://github.com/owncloud/web/pull/7230 https://github.com/owncloud/web/pull/7314 https://github.com/owncloud/web/pull/7386 https://github.com/owncloud/web/issues/7187
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-context-menu-misplaced-triggered-by-keyboard-navigation/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-context-menu-misplaced-triggered-by-keyboard-navigation", "repo_id": "owncloud", "token_count": 100 }
616
Bugfix: Paste action (keyboard) not working in project spaces We've fixed a bug which caused the user to be unable to paste in project spaces. https://github.com/owncloud/web/issues/7510 https://github.com/owncloud/web/pull/7514
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-keyboard-not-working-spaces/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-keyboard-not-working-spaces", "repo_id": "owncloud", "token_count": 67 }
617
Bugfix: Prevent unnecessary PROPFIND request during upload We've removed the unnecessary PROPFIND request at the start of each upload, increasing upload performance especially in larger folders. https://github.com/owncloud/web/issues/7486 https://github.com/owncloud/web/pull/7488
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-prevent-unnecessary-propfind-during-upload/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-prevent-unnecessary-propfind-during-upload", "repo_id": "owncloud", "token_count": 73 }
618
Bugfix: Missing space image in sidebar We've fixed a bug where the image of a space was not showing in the sidebar. https://github.com/owncloud/web/issues/7480 https://github.com/owncloud/web/pull/7481
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-space-image-sidebar/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-space-image-sidebar", "repo_id": "owncloud", "token_count": 62 }
619
Bugfix: Versions of shared files not visible We've fixed a bug where the versions of shared files where not visible for the share receivers. https://github.com/owncloud/web/pull/7313 https://github.com/owncloud/web/issues/7159
owncloud/web/changelog/5.7.0_2022-09-09/bugfix-versions-of-shared-files-not-visible/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/bugfix-versions-of-shared-files-not-visible", "repo_id": "owncloud", "token_count": 65 }
620
Enhancement: Propose unique file name while creating a new file We're proposing unique file names when creating a new file or folder via the 'New' file menu. https://github.com/owncloud/web/pull/7555 https://github.com/owncloud/web/issues/7539
owncloud/web/changelog/5.7.0_2022-09-09/enhancement-propose-file-name-while-creating-file/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-propose-file-name-while-creating-file", "repo_id": "owncloud", "token_count": 71 }
621
Enhancement: Streamline UI sizings We've streamlined the font sizes and some other size related options to let the web UI appear a bit more condensed. In addition to that we've chosen a new font family for the UI ("Inter") which is embedded into the ownCloud Design System by default now. https://github.com/owncloud/web/pull/7363 https://github.com/owncloud/web/issues/7333 https://github.com/owncloud/owncloud-design-system/pull/2270
owncloud/web/changelog/5.7.0_2022-09-09/enhancement-streamline-ui-sizings/0
{ "file_path": "owncloud/web/changelog/5.7.0_2022-09-09/enhancement-streamline-ui-sizings", "repo_id": "owncloud", "token_count": 120 }
622
Bugfix: Editing text files on public pages We've fixed a bug where editing text files on public pages was not possible with the oC10 backend. https://github.com/owncloud/web/pull/7936 https://github.com/owncloud/web/issues/7932
owncloud/web/changelog/6.0.0_2022-11-29/bugfix-edit-text-files-on-public-pages/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-edit-text-files-on-public-pages", "repo_id": "owncloud", "token_count": 67 }
623
Bugfix: Public link loading on role change The loading and resolving of public links when their respective roles have changed has been fixed. https://github.com/owncloud/web/pull/8006 https://github.com/owncloud/web/issues/8003
owncloud/web/changelog/6.0.0_2022-11-29/bugfix-public-link-load-on-role-change/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-public-link-load-on-role-change", "repo_id": "owncloud", "token_count": 62 }
624
Bugfix: Spaces reactivity on update We've fixed a bug where updated data for a space would not show up in the UI before reloading. https://github.com/owncloud/web/issues/7521 https://github.com/owncloud/web/issues/7782 https://github.com/owncloud/web/pull/7546 https://github.com/owncloud/web/pull/7818
owncloud/web/changelog/6.0.0_2022-11-29/bugfix-spaces-reactivity-on-update/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/bugfix-spaces-reactivity-on-update", "repo_id": "owncloud", "token_count": 98 }
625
Enhancement: Align dark mode colors with given design The colors in the dark mode have been aligned with the given design. This improves the overall look and readability. https://github.com/owncloud/web/issues/7373 https://github.com/owncloud/web/issues/7353 https://github.com/owncloud/web/issues/7738 https://github.com/owncloud/web/pull/7862
owncloud/web/changelog/6.0.0_2022-11-29/enhancement-dark-mode-colors/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/enhancement-dark-mode-colors", "repo_id": "owncloud", "token_count": 103 }
626
Enhancement: Validate space names Spaces names are now being validated when creating or renaming spaces. The following special characters are not allowed: / \ . : ? * " > < | https://github.com/owncloud/web/pull/7890
owncloud/web/changelog/6.0.0_2022-11-29/enhancement-validate-space-names/0
{ "file_path": "owncloud/web/changelog/6.0.0_2022-11-29/enhancement-validate-space-names", "repo_id": "owncloud", "token_count": 60 }
627
Bugfix: Endless lazy loading indicator after sorting file table The endless lazy loading indicator when sorting the file table and re-entering it has been fixed. https://github.com/owncloud/web/issues/6434 https://github.com/owncloud/web/pull/8988
owncloud/web/changelog/7.0.0_2023-06-02/bugfix-endless-lazy-loading-when-sorting/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-endless-lazy-loading-when-sorting", "repo_id": "owncloud", "token_count": 67 }
628
Bugfix: Omit "page"-query in breadcrumb navigation We've omitted the "page"-query when navigating via breadcrumb. This solves an issue were the file list would be empty after navigating via breadcrumb from a paginated folder. https://github.com/owncloud/web/pull/8061 https://github.com/owncloud/web/issues/8060
owncloud/web/changelog/7.0.0_2023-06-02/bugfix-omit-page-query-in-breadcrumb-navigation/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-omit-page-query-in-breadcrumb-navigation", "repo_id": "owncloud", "token_count": 88 }
629
Bugfix: Resolving drives in search We've fixed a bug where folder listing was not reloaded when being in a space/share root and navigating into another space/share root via search. https://github.com/owncloud/web/pull/8045 https://github.com/owncloud/web/issues/8034
owncloud/web/changelog/7.0.0_2023-06-02/bugfix-resolving-drives-in-search/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-resolving-drives-in-search", "repo_id": "owncloud", "token_count": 75 }
630
Bugfix: Text editor appearance The text editor now looks normal again after its appearance had changed due to the inclusion of the ODS in the web repository. https://github.com/owncloud/web/pull/8026
owncloud/web/changelog/7.0.0_2023-06-02/bugfix-text-editor-appearance/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/bugfix-text-editor-appearance", "repo_id": "owncloud", "token_count": 51 }
631
Enhancement: Add notification setting to account page We've added notification setting to the account page, where the user can turn on or off receiving emails for notifications. https://github.com/owncloud/web/pull/8911 https://github.com/owncloud/web/pull/8972 https://github.com/owncloud/web/issues/8904
owncloud/web/changelog/7.0.0_2023-06-02/enhancement-add-notifications-setting/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-add-notifications-setting", "repo_id": "owncloud", "token_count": 86 }
632
Enhancement: Add switch to enable condensed resource table We've added a switch to have a more condensed resource table. The change gets saved to the url and persisted across folder navigation in all files, spaces and favorites views. https://github.com/owncloud/web/pull/7976 https://github.com/owncloud/web/pull/8105 https://github.com/owncloud/web/issues/6380
owncloud/web/changelog/7.0.0_2023-06-02/enhancement-condensed-files-view/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-condensed-files-view", "repo_id": "owncloud", "token_count": 102 }
633
Enhancement: Increase Searchbar height We've increased the height of the Searchbar to better fit the design. https://github.com/owncloud/web/pull/8056
owncloud/web/changelog/7.0.0_2023-06-02/enhancement-increase-searchbar-height/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-increase-searchbar-height", "repo_id": "owncloud", "token_count": 42 }
634
Enhancement: Preview app sorting The preview app now respects the sorting from the file list. https://github.com/owncloud/web/pull/8806 https://github.com/owncloud/web/issues/7978
owncloud/web/changelog/7.0.0_2023-06-02/enhancement-preview-app-sorting/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-preview-app-sorting", "repo_id": "owncloud", "token_count": 55 }
635
Enhancement: Show text file icon for empty text files We've changed the thumbnail of almost empty text files to the regular text icon. https://github.com/owncloud/web/pull/8057
owncloud/web/changelog/7.0.0_2023-06-02/enhancement-show-txt-icon-for-empty-txt-files/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/enhancement-show-txt-icon-for-empty-txt-files", "repo_id": "owncloud", "token_count": 47 }
636
Bugfix: Public link file previews We've fixed a bug with file previews not being loaded in the right sidebar `Details` panel and in the single file view for public links. https://github.com/owncloud/web/pull/9009
owncloud/web/changelog/7.0.0_2023-06-02/fix-public-link-file-previews/0
{ "file_path": "owncloud/web/changelog/7.0.0_2023-06-02/fix-public-link-file-previews", "repo_id": "owncloud", "token_count": 56 }
637