Commit Graph

7572 Commits

Author SHA1 Message Date
renovate[bot]
502fb7a705 chore(deps): update dependency @types/ws to v8.5.4 2023-01-22 15:13:24 +01:00
renovate[bot]
c854d27d3d chore(deps): update dependency sqlite3 to v5.1.4 2023-01-22 15:13:24 +01:00
Max Leiter
2803018c5a
Merge pull request #4669 from thelounge/collapseAway
allow away and back to be collapsed
2023-01-20 15:30:53 -08:00
Reto Brunner
0ebc3a574c search: ignore searchResults if it isn't the active query
Prior to this, the search is still racy but one tends to notice
this only when the DB is large or network is involved.
The user can initiate a search, get bored, navigate to another chan
issue a different search.

Now however, the results of the first search come back in and
hilarity ensues as we are now confused with the state.

To avoid this, keep track of the last search done and any result
that comes in that isn't equal to the active query is garbage and
can be dropped.
2023-01-08 11:41:09 +01:00
Reto Brunner
958a948456 sqlite: Remove client from sqlitestorage
The only reason we accepted a client was that so we have access
to the next message id when we need it.
So let's accept an id provider function instead.
2022-12-30 16:52:04 +01:00
Reto Brunner
52b8a2a78e textStorage: rip out client instance
We don't need the client, so there's no need to accept it.
2022-12-30 16:42:48 +01:00
Reto Brunner
661d5cb5b0 messagestorage: remove implementation details from interface
The interface should not contain things that aren't the API of the
storage interface.
Further, rename ISqliteMessageStorage to SearchableMessageStorage,
as that's also an implementation detail.
We'll never have a second sqlite backend, so the name seems
strange.
2022-12-30 16:42:48 +01:00
Reto Brunner
e597e75847 allow away and back to be collapsed
This means we also apply the collapsing to normal queries,
which might also collapse other things like joins / quits
which may be undesired by some

Fixes: https://github.com/thelounge/thelounge/issues/4583
2022-12-30 13:35:38 +01:00
aab12345
8b1a4f72fa Add password param to /join docs 2022-12-29 13:12:15 +01:00
Pavel Djundik
502780c5a3 Fix sidebar swipe flicker after letting go 2022-12-23 10:50:20 +02:00
Reto
073a38ef1e
Fix previous-source calculation (#4656)
CondensedMessage is a proxy object, outside of the templates
we need to unwrap it manually
2022-12-17 13:59:07 -08:00
Reto Brunner
c67df36a29 update dependency @types/lodash to v4.14.191 2022-12-04 12:58:15 +01:00
Reto Brunner
d50296385f Merge branch 'sqliteHotFix' 2022-12-04 12:54:45 +01:00
Reto Brunner
068de0c10c Merge branch 'nickColorScope' 2022-12-04 12:53:31 +01:00
renovate[bot]
d61ab7e7a0
chore(deps): update dependency @types/lodash to v4.14.191 2022-12-01 21:36:32 +00:00
Reto Brunner
2d4143b779 sqlite: synchronize enable() internally
TL is stupid and doesn't wait for message{Provider,Storage} to
settle before it starts using the store.

While this should be fixed globally, we can hack around the problem
by pushing everything onto the call stack and hope that we'll eventually
finish the setup before we blow the stack.
2022-11-30 10:28:26 +01:00
Reto Brunner
f55f772659 style: Put user colors into the smallest possible scope
The only thing that cares about user colors is the user component.
Putting a class value on the chat component seems to be the wrong
place.

This also allows us to remove various css selectors so that we
don't need to be that specific.
After all whatever has that class needs to be colored, we don't
care where it is.
2022-11-27 16:04:56 +01:00
Reto Brunner
982816ff20 store: addMessageSearchResults shouldn't accept null
It makes no sense to emit a add mutation with null, so let's
forbid it.
2022-11-27 14:06:14 +01:00
Reto Brunner
8204c3481a search: fix order of result merging
During a search, we get the results from oldest --> newest.
When we hit the more button, we get the results of the second batch
in the same order.
However, logically to the first batch everything is older, so we
need to prepend it to the result array, not
append.

msg  DB  logical ID
A    3     5
B    2     4
C    1     3

D    3     2
E    2     1
F    1     0
2022-11-27 14:06:14 +01:00
Reto Brunner
deeea274da Merge branch 'sqlite_cleanup'
Converts sqlite to async, providing a way forward
for migrations to actually happen
2022-11-24 09:45:01 +01:00
Reto Brunner
d34b58811a Merge branch 'search' 2022-11-24 09:34:24 +01:00
Reto Brunner
dfb4217167 remove VueApp from router
Nothing actually depends on the vue app being monkey patched onto
the router, so let's get rid of it.
2022-11-22 21:27:19 +01:00
dependabot[bot]
f8eb0ebafd
Bump engine.io from 6.2.0 to 6.2.1
Bumps [engine.io](https://github.com/socketio/engine.io) from 6.2.0 to 6.2.1.
- [Release notes](https://github.com/socketio/engine.io/releases)
- [Changelog](https://github.com/socketio/engine.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/engine.io/compare/6.2.0...6.2.1)

---
updated-dependencies:
- dependency-name: engine.io
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-22 08:33:49 +00:00
Reto Brunner
fd14b4a172 make getClientConfiguration type safe
TS type assertions need to be avoided.

The following trivial example demonstrates why

```
type Person = {
	name: string;
	isBad: boolean;
};

function makePerson(): Person {
	const p: Person = {name: 'whatever'} as Person
	p.isBad = false
	return p // theoretically we are now good, p is a Person
}
```

Should the type ever change though, TS will happily trot along

```
type Person = {
	name: string;
	isBad: boolean;
	omgHowCouldYou: number;
};

function makePerson(): Person {
	const p: Person = {name: 'whatever'} as Person
	p.isBad = true
	return p // p is *not* a Person, omgHowCouldYou is missing
}
```

But we pinky swore to the compiler that p is in fact a Person.
In other words, the types are now wrong and you will fail during
runtime.
2022-11-22 03:07:29 +01:00
Reto Brunner
1597c2c56e server: the http{,s} server can't be null 2022-11-22 02:21:27 +01:00
Reto Brunner
4c7337b625 bump socket.io-client to 4.5.0 2022-11-16 07:18:26 +01:00
Reto Brunner
0765d209f2 keybinds: Fix invalid return
Mousetrap doesn't take an async function.
It either accepts False (stop key propagation) or any other
value (bubble up the event)
2022-11-16 06:50:56 +01:00
Reto Brunner
7ee4b80a6e update dependency @types/mousetrap to v1.6.11 2022-11-16 06:32:22 +01:00
Reto Brunner
21c8b0d17f Bump loader-utils from 2.0.2 to 2.0.4 2022-11-16 06:31:19 +01:00
dependabot[bot]
89245455ce
Bump loader-utils from 2.0.2 to 2.0.4
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.2 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.2...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-16 05:29:50 +00:00
Reto Brunner
d4bbd9191c bump socket.io to 4.5.2 2022-11-16 06:28:03 +01:00
renovate[bot]
5037383c4c
chore(deps): update dependency @types/mousetrap to v1.6.11 2022-11-16 00:46:37 +00:00
Reto Brunner
83e11b0143 Search: Clear earlier searches when a new one is executed
Fixes: https://github.com/thelounge/thelounge/issues/4637
2022-11-15 18:50:52 +01:00
Reto Brunner
51c9ce078d Search: fix off by one offset error
Offset is eventually passed to sqlite as an OFFSET clause.

This works as follows:

sqlite> select num from seq limit 5 offset 0;
┌─────┐
│ num │
├─────┤
│ 1   │
│ 2   │
│ 3   │
│ 4   │
│ 5   │
└─────┘

sqlite> select num from seq limit 5 offset 5;
┌─────┐
│ num │
├─────┤
│ 6   │
│ 7   │
│ 8   │
│ 9   │
│ 10  │
└─────┘

However, the code currently emits a request for offset + 1, which ends
up skipping a message

sqlite> select num from seq limit 5 offset 5+1;
┌─────┐
│ num │
├─────┤
│ 7   │
│ 8   │
│ 9   │
│ 10  │
│ 11  │
└─────┘
2022-11-15 18:50:52 +01:00
Reto Brunner
8095d9e88a SearchQuery: offset is always a number
Fix type confusion that specified offset to be a string, it is
always a number.
2022-11-15 18:50:52 +01:00
renovate[bot]
221884166d
chore(deps): update dependency postcss to v8.4.19 2022-11-13 17:56:51 +00:00
renovate[bot]
19307d05e7
chore(deps): update dependency @types/chai to v4.3.4 2022-11-13 17:49:23 +00:00
renovate[bot]
dfe288ef16 chore(deps): update dependency @types/lodash to v4.14.188 2022-11-13 18:11:48 +01:00
renovate[bot]
b5ea7cceb3 chore(deps): update dependency @types/is-utf8 to v0.2.1 2022-11-13 18:11:48 +01:00
renovate[bot]
0ad033fe0a chore(deps): update dependency chai to v4.3.7 2022-11-13 18:11:48 +01:00
renovate[bot]
5a4a39b9d1 chore(deps): update dependency postcss to v8.4.18 2022-11-13 18:11:48 +01:00
renovate[bot]
cb17f8d87f chore(deps): update dependency @vue/test-utils to v2.2.1 2022-11-13 18:11:48 +01:00
renovate[bot]
5a803ccd23 chore(deps): update dependency sqlite3 to v5.1.2 2022-11-13 18:11:48 +01:00
Reto
53f6041f42
SearchResults: remove dead code (#4639)
Nachtalb put some infra in place that was never actually working.
It errors out when a user clicks on a message.

Remove the offending code, but keep it all in place so that we
can improve on it.
2022-11-12 22:34:41 -08:00
Reto Brunner
dca202427a SearchResults: Fix search progess upon search
When we hit doSearch, we always reset the offset value to 0,
meaning we always hit the conditional (!0) and always set the
messageSearchInProgress flag to undefined.
This is wrong, we do want to set this flag when we initiate a search.
2022-11-12 23:14:53 +01:00
Reto Brunner
6b617f893d SearchResults: remove computed search prop
It is only used in one location, and not from the template.
In other words we should inline it to make the code simpler.
2022-11-12 23:14:53 +01:00
Reto Brunner
d62dd3e62d messageStorage: convert to async
Message stores are more complicated that a sync "fire and forget"
API allows for.
For starters, non trivial stores (say sqlite) can fail during init
and we want to be able to catch that.
Second, we really need to be able to run migrations and such, which
may block (and fail) the activation of the store.

On the plus side, this pushes error handling to the caller rather
than the stores, which is a good thing as that allows us to eventually
push this to the client in the UI, rather than just logging it in the
server on stdout
2022-11-02 00:01:36 +01:00
Reto Brunner
f068fd4290 sqlite: convert migrations to async
This removes quite a bunch of indention and callbacks
2022-11-01 22:23:47 +01:00
Reto Brunner
bbe81bb2fa sqlite: add serialize_get 2022-11-01 22:23:47 +01:00
Reto Brunner
f04a06682d extract migrations 2022-11-01 22:23:47 +01:00