Skip to content

Commit

Permalink
Merge branch 'hotfix/3.13.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 27, 2024
2 parents db85fe6 + 49f0ce8 commit 0edb247
Show file tree
Hide file tree
Showing 103 changed files with 573 additions and 669 deletions.
7 changes: 7 additions & 0 deletions build/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import SentryPlugin from '@sentry/webpack-plugin'
import ZipPlugin from 'zip-webpack-plugin'
import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin'
import PostCompilePlugin from 'post-compile-webpack-plugin'
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
import initEnv from './env'
import * as staticFiles from './static-files'
import { output } from './config'
Expand All @@ -35,6 +37,7 @@ export default function ({
runSentry = false,
notifsEnabled = false,
shouldPackage = false,
shouldAnalyze = false,
packagePath = '../dist',
extPackageName = 'extension.zip',
sourcePackageName = 'source-code.zip',
Expand Down Expand Up @@ -78,6 +81,10 @@ export default function ({
new IgnorePlugin(/^\.\/locale$/, /moment$/),
]

if (shouldAnalyze) {
plugins.unshift(new BundleAnalyzerPlugin())
}

if (mode === 'development' && process.env.NO_CACHE !== 'true') {
plugins.push(
new HardSourcePlugin({
Expand Down
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-common
2 changes: 1 addition & 1 deletion external/@worldbrain/memex-stemmer
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "worldbrain-extension",
"version": "3.13.2",
"version": "3.13.3",
"homepage": "https://memex.garden",
"repository": "https://github.com/WorldBrain/Memex",
"scripts": {
Expand Down Expand Up @@ -77,7 +77,6 @@
"cheerio": "1.0.0-rc.6",
"chrono-node": "^1.3.1",
"classnames": "^2.2.5",
"core-js": "^3.6.4",
"dataurl-to-blob": "^0.0.1",
"deserialize-error": "^0.0.3",
"dexie": "3.2.2",
Expand Down Expand Up @@ -106,7 +105,6 @@
"markdown-it": "^13.0.1",
"marked": "^4.0.2",
"moment": "^2.18.1",
"moment-timezone": "^0.5.14",
"mousetrap": "^1.6.5",
"mustache": "^4.0.1",
"normalize-url": "^4.3.0",
Expand Down Expand Up @@ -226,6 +224,7 @@
"better-sqlite3": "^7.5.3",
"chrome-webstore-upload": "^0.2.2",
"copy-webpack-plugin": "^4.5.1",
"core-js": "3.6.4",
"crx": "^3.2.1",
"css-loader": "^0.28.11",
"datauri": "^1.1.0",
Expand Down
8 changes: 5 additions & 3 deletions src/annotations/components/AnnotationEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,25 @@ class AnnotationEdit extends React.Component<Props> {

async componentDidMount() {
await this.youtubeKeyboardShortcut()
this.editorRef?.setEditable(this.props?.isEditMode ?? false)
this.editorRef?.setEditable(this.props?.isEditMode)

if (!this.editorRef?.checkIfHasContent() && !this.props.isEditMode) {
this.setState({ shouldShowEditor: false })
} else if (this.props.isEditMode) {
this.setState({ shouldShowEditor: true })
}
}

componentDidUpdate(prevProps: Props) {
if (prevProps.isEditMode !== this.props.isEditMode) {
this.editorRef?.setEditable(this.props?.isEditMode ?? false)
this.editorRef?.setEditable(this.props?.isEditMode)

if (
!this.editorRef?.checkIfHasContent() &&
!this.props.isEditMode
) {
this.setState({ shouldShowEditor: false })
} else {
} else if (this.props.isEditMode) {
this.setState({ shouldShowEditor: true })
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/annotations/components/AnnotationEditable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { RGBAobjectToString } from '@worldbrain/memex-common/lib/common-ui/compo
import { SPECIAL_LIST_IDS } from '@worldbrain/memex-common/lib/storage/modules/lists/constants'
import { sleepPromise } from 'src/util/promises'
import CreationInfo from '@worldbrain/memex-common/lib/common-ui/components/creation-info'
import { Checkbox } from 'src/common-ui/components'
import Checkbox from 'src/common-ui/components/Checkbox'
import KeyboardShortcuts from '@worldbrain/memex-common/lib/common-ui/components/keyboard-shortcuts'
import type { HighlightColor } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/types'

Expand Down
2 changes: 1 addition & 1 deletion src/background-script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ interface Dependencies {
}

class BackgroundScript {
private remoteFunctions: RemoteBGScriptInterface
remoteFunctions: RemoteBGScriptInterface

constructor(public deps: Dependencies) {
this.remoteFunctions = {
Expand Down
41 changes: 31 additions & 10 deletions src/background-script/quick-and-dirty-migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import { ROOT_NODE_PARENT_ID } from '@worldbrain/memex-common/lib/content-sharin
import {
DEFAULT_KEY,
DEFAULT_SPACE_BETWEEN,
defaultOrderableSorter,
recalculateOrders,
} from '@worldbrain/memex-common/lib/utils/item-ordering'
import { HIGHLIGHT_COLOR_KEY } from 'src/highlighting/constants'
import { DEFAULT_HIGHLIGHT_COLOR } from '@worldbrain/memex-common/lib/annotations/constants'
import type { SyncSettingsByFeature } from 'src/sync-settings/background/types'
import { HIGHLIGHT_COLORS_DEFAULT } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/constants'
import type { CustomListTree } from '@worldbrain/memex-common/lib/types/core-data-types/client'
import type { Template } from 'src/copy-paster/types'

export interface MigrationProps {
db: Dexie
Expand Down Expand Up @@ -68,6 +69,33 @@ export const MIGRATION_PREFIX = '@QnDMigration-'
// __IMPORTANT NOTE__

export const migrations: Migrations = {
/*
* This exists as we released the templates with a new order field, same as cuomstListTrees,
* though we set the values for the static default templates to be less than the default space between.
* Thus it thinks it is out of room from the start and new templates cannot be added.
*/
[MIGRATION_PREFIX + 'reset-template-order-01']: async ({
storex,
bgModules,
}) => {
await bgModules.personalCloud.waitForSync()
const templates: Template[] = await storex
.collection('templates')
.findAllObjects({})
if (!templates.length) {
return
}
const reorderedTemplates = recalculateOrders(templates)
const batch: OperationBatch = reorderedTemplates.map((template) => ({
operation: 'updateObjects' as const,
collection: 'templates',
placeholder: `template-reorder-${template.id}`,
where: { id: template.id },
updates: { order: template.order },
}))

await storex.operation('executeBatch', batch)
},
/*
* This exists as I messed up the order assignments for new lists, which get inserted at the beginning.
* Previously they got order set to half of whatever the prev first list's order was. Though things
Expand Down Expand Up @@ -96,16 +124,9 @@ export const migrations: Migrations = {
const batch: OperationBatch = []

for (const nodes of nodesByParent.values()) {
nodes.sort(defaultOrderableSorter)
const middleIdx = Math.floor(nodes.length / 2)
for (let idx = 0; idx < nodes.length; idx++) {
const orderOffest = (idx - middleIdx) * DEFAULT_SPACE_BETWEEN
nodes[idx].order =
idx === middleIdx ? DEFAULT_KEY : DEFAULT_KEY + orderOffest
}

const reorderedNodes = recalculateOrders(nodes)
batch.push(
...nodes.map((node) => ({
...reorderedNodes.map((node) => ({
operation: 'updateObjects' as const,
collection: 'customListTrees',
placeholder: `tree-reorder-${node.id}`,
Expand Down
1 change: 0 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'core-js'
import browser from 'webextension-polyfill'

import initStorex from './search/memex-storex'
Expand Down
5 changes: 1 addition & 4 deletions src/backup-restore/ui/backup-pane/panes/running-process.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react'
import styled from 'styled-components'
import { remoteFunction } from 'src/util/webextensionRPC'
const localStyles = require('./running-process.css')
import { ProgressBar } from 'src/common-ui/components'
import LoadingBlocker from '../../../../common-ui/components/loading-blocker'
import ProgressBar from 'src/common-ui/components/ProgressBar'
import { FailedOverlay } from '../components/overlays'
import { PrimaryAction } from '@worldbrain/memex-common/lib/common-ui/components/PrimaryAction'
import { WhiteSpacer20 } from 'src/common-ui/components/design-library/typography'
Expand All @@ -12,9 +11,7 @@ import type { LocalBackupSettings } from 'src/backup-restore/background/types'
import SettingSection from '@worldbrain/memex-common/lib/common-ui/components/setting-section'
import LoadingIndicator from '@worldbrain/memex-common/lib/common-ui/components/loading-indicator'

const overviewStyles = require('src/backup-restore/ui/styles.css')
const settingsStyle = require('src/options/settings/components/settings.css')
const STYLES = require('../../styles.css')

interface Props {
functionNames: {
Expand Down
2 changes: 1 addition & 1 deletion src/bulk-edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export default class BulkEditWidget extends StatefulUIElement<
const BulkEditWidgetContainer = styled.div<{
bulkDeleteLoadingState: UITaskState
}>`
position: fixed;
position: absolute;
bottom: 0;
height: 44px;
background-color: ${(props) => props.theme.colors.black}80;
Expand Down
23 changes: 0 additions & 23 deletions src/common-ui/components/index.ts

This file was deleted.

8 changes: 3 additions & 5 deletions src/common-ui/containers/AddListDropdownContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import debounce from 'lodash/fp/debounce'
import noop from 'lodash/fp/noop'

import { remoteFunction } from '../../util/webextensionRPC'
import {
IndexDropdownNewRow,
IndexDropdown,
IndexDropdownRow,
} from '../components'
import IndexDropdown from '../components/IndexDropdown'
import IndexDropdownNewRow from '../components/IndexDropdownNewRow'
import IndexDropdownRow from '../components/IndexDropdownRow'
import { PageList } from '../../custom-lists/background/types'
import { ClickHandler } from '../../popup/types'
import { handleDBQuotaErrors } from 'src/util/error-handler'
Expand Down
8 changes: 3 additions & 5 deletions src/common-ui/containers/IndexDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import debounce from 'lodash/fp/debounce'
import noop from 'lodash/fp/noop'

import { remoteFunction } from 'src/util/webextensionRPC'
import {
IndexDropdown,
IndexDropdownNewRow,
IndexDropdownRow,
} from '../components'
import IndexDropdown from '../components/IndexDropdown'
import IndexDropdownNewRow from '../components/IndexDropdownNewRow'
import IndexDropdownRow from '../components/IndexDropdownRow'
import { ClickHandler } from 'src/popup/types'
import { getLocalStorage, setLocalStorage } from 'src/util/storage'
import { TAG_SUGGESTIONS_KEY } from 'src/constants'
Expand Down
4 changes: 0 additions & 4 deletions src/common-ui/containers/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/common-ui/crowdfunding/components/CFModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent, MouseEventHandler } from 'react'
import browser, { Tabs } from 'webextension-polyfill'

import { Overlay } from '../../components'
import Overlay from '../../components/Overlay'
import Message from './Message'

const styles = require('./CFModal.css')
Expand Down
Loading

0 comments on commit 0edb247

Please sign in to comment.