Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag to get only info/system messages of chat #2132

Merged
merged 8 commits into from
Jan 18, 2021

Conversation

Simon-Laux
Copy link
Member

useful for creating an "audit log" view of a chat that helps to find
actions like who added/removed who quickly and without endless scrolling.

@Simon-Laux Simon-Laux requested review from r10s and link2xt January 7, 2021 22:38
@link2xt
Copy link
Collaborator

link2xt commented Jan 9, 2021

I miss background for this, was this "audit log" discussed anywhere? Is it going to be implemented in all clients?

@Simon-Laux
Copy link
Member Author

Simon-Laux commented Jan 10, 2021

Right, I forgot to link the forum entry https://support.delta.chat/t/show-audit-log-of-group/512.
I'm also working on the desktop part of this but the branch isn't ready for an pr yet.
In essence it's just a system-/info-message only view of a chat.

Is it going to be implemented in all clients?

First it goes into desktop as an experimental feature, as there are still some UX questions (as where to put the menu item and where to display the time of the info messages.) Then afterwards we can put it into the mobile clients too. So in the first stage this will be a desktop only feature. I discussed this a bit in an av with @r10s so there is unfortunately not much more logged conversation I can point you to other than the forum entry.

@Simon-Laux Simon-Laux changed the title add flag to get only info/system messages of chat 🚧 add flag to get only info/system messages of chat Jan 10, 2021
@Simon-Laux Simon-Laux changed the title 🚧 add flag to get only info/system messages of chat add flag to get only info/system messages of chat Jan 10, 2021
Copy link
Member

@r10s r10s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some minor comments, in general, this lgtm. i am not so sure how useful the audit log is at all, but we will see :)

src/chat.rs Outdated Show resolved Hide resolved
src/chat.rs Show resolved Hide resolved
deltachat-ffi/deltachat.h Outdated Show resolved Hide resolved
deltachat-ffi/deltachat.h Outdated Show resolved Hide resolved
Simon-Laux and others added 6 commits January 18, 2021 17:35
useful for creating an "audit log" view of a chat that helps to find
actions like who added/removed who quickly and without endless scrolling
(that it test without daymarker)
Co-authored-by: bjoern <r10s@b44t.com>
@r10s r10s force-pushed the add_chat_audit_log_view branch from d0bb120 to 7154a47 Compare January 18, 2021 16:36
@r10s
Copy link
Member

r10s commented Jan 18, 2021

i also could not reproduce the clippy errors locally.
i rebased the pr, we've meanwhile switch rust-version, maybe it is getting better :)

Copy link
Member

@r10s r10s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm now :)

@Simon-Laux Simon-Laux merged commit 6d5ccdf into master Jan 18, 2021
@Simon-Laux Simon-Laux deleted the add_chat_audit_log_view branch January 18, 2021 20:44
link2xt added a commit that referenced this pull request Mar 28, 2021
dignifiedquire added a commit that referenced this pull request Apr 6, 2021
* refactor: move sql into own mod

* refactor: resultify sql interface

* fixup

* start usage of sqlx

* compile again

* migrate exists

* migrate query_row and query_row_optional

* migrate table_exists

* migrate with_conn

* migrate rowid

* migrate most of query_map

* finish query_map migration

* remove rusqlite and fixup examples

* improve migrations and ensure closing

* fix rust tests

* wip

* fixup rebase and get things to compile

* start fixing tests

* use sqlx fork

* debugging

* fix receive imf insert

* fix message loading

* fix grpid bug

* exists() expects COUNT() in sql-statement

* fix two more exists() statements

* fix test_audit_log_view_without_daymarker

* Fix clippy warnings

* fix test_fetch_existing

dc_get_config() must never return NULL, instead return ""

* ffi: make render_info accept non-option BTreeMap

* fix a typo

* Restore changes from PR #2258

They have been accidentally reverted during sqlx rebasing

* Remove useless cast that was not there before switch to sqlx

* Split long query into several lines so rustfmt does not fail

* Remove outdated comment

DC_CONTACT_ID_SELF is bound into the query now.

* Split long lines to make rustfmt work

* Restore accidentally removed part of PR #2132

* Make rustfmt work

* Use exists() instead of count() in is_group_explicitly_left

* Make rustfmt work

* Fix a typo ("foreing")

* Fix rustfmt

* Fix formatting

* Replace 0x100 constant with Origin::IncomingReplyTo

* Replace constant 100 with Chattype::Single

* Remove commented out code

* peerstate: make rustfmt work

* Move the code to make msg immutable

* do not re-use bind parameters

sqlx does not bind the first `?` implicitly to `?1`,
therefore the sql-statement fails.

we could use `?1` several times, however,
i did not find good documentation about that,
and even if that works now, that could fail with other db
or even with sqlite in newer versions.

therefore, we just bind every parameter explicitly.

* Do not use read only sqlite mode

* Factor out database pool creation

* Open reader pool in readonly mode if database is opened in readonly mode

* Add a test for reopening the database

* sql::table_exists: drain response stream to avoid breaking connection

* Drain the stream in Sql.col_exists

* sqlx: fix failing TestOnlineAccount::test_saved_mime_on_received_message (#2323)

* add failing tests for save_mime_headers

* fix saving mime

if an encrypted message is received,
and we do not have the decoded data,
for whatever reason, save the raw data.

* let dc_get_mime_headers return NULL on empty string

* let test_save_mime_headers_*() tests return anyhow::Result<()>

* make clippy happy

* Remove 5 unwraps

* Remove another unwrap

* Replace {:?} with {:#} for error handling

* Remove all dbg! statements

* set max_connections=10 (default), show num_cpus in get_info()

setting the number of connections
to the number of cpus seems to be to low in general:

- on a mac i5 from 2017, that would result in 4 connections
- on an iphone7, that would result in only 2 connections

the sqlx-default is 10 connections,
so, this pr uses that default (plus 1 connection for the writer tag).

on the iphone7, that change was directly noticable -
sqlx with 2 connections feelt not much faster that rusqlite with 10 connections,
however, using sqlx with the 10+1 connection was a real boost,
at least at a first glance :)

might be, fewer connections would be sufficient as well,
however, i do not see much reasons not to go with the default here.

* Disable sqlx statement cache

This is a workaround for launchbadge/sqlx#1147

Draining statement results is no longer needed.

* Make clippy happy

* Do not pass NULL to mime_headers column nor expect it from there. Treat existing NULL as "empty string".

* Increase SQL busy timeout to 100 seconds

No need to abort the connection if all connections are stalled for 10 seconds.

This did not happen, just to make sure each timeout is a result of an actual deadlock.

* README: specify log target to get rid of sqlx query logging

* Remove 3 unwrap()'s

* Remove two more unwrap()'s

Co-authored-by: B. Petersen <r10s@b44t.com>
Co-authored-by: Hocuri <hocuri@gmx.de>
Co-authored-by: link2xt <link2xt@testrun.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants