bertvandepoel / tabby

A friendly tool to manage debt
GNU Affero General Public License v3.0
71 stars 11 forks source link

Unable to delete activity #16

Closed wychwitch closed 2 years ago

wychwitch commented 2 years ago

Hello! I've been using tabby lately and it's pretty great!! However I noticed when I try to delete an activity, whether debit or credit, it simply doesn't do anything. Does anyone have any idea what's going on? Everything else works fine, it's just this one issue.

I would attach error logs, but I'm not even sure where to look for them...

Here's a gif of the behavior, though I will add that the page reloads after clicking the trash icon (very briefly I might add!)

image

bertvandepoel commented 2 years ago

Hi there! That's a very strange bug! Took me a bit to try and replicate it, since I noticed an upgrade bug for those coming from database schema v1 (which is no one except me, since Tabby wasn't known back then), but now that I'm working with a working schema v3 (Tabby 1.2).

I've added a bunch of dummy events, and tried to remove them from both the people and activity edit buttons, as well as the full activity delete. I also tried to delete a credit entry. Strangely, these all work fine, so I can't seem to replicate your problem. Could you tell me a bit more about your setup perhaps? Are you using MySQL or PostgreSQL? Are you running Tabby 1.2? Did you upgrade from a previous version or did you install 1.2 right away? That way I can try to replicate your conditions and hopefully locate the bug.

wychwitch commented 2 years ago

Could you tell me a bit more about your setup perhaps?

Yes! I'm sorry I should've done so in the first place.

Are you using MySQL or PostgreSQL?

Originally I was using a mariadb instance through a docker installation, but to just make sure it wasn't something weird with that, I re-set up tabby using my locally installed mariadb to verify the bug. I'm using mariadb instead of plain MySQL because debian won't even attempt to install MySQL and instead install mariadb for reasons I cannot remember... As far as I know mariadb should be fully compatible?

Are you running Tabby 1.2? Did you upgrade from a previous version or did you install 1.2 right away?

I started out on tabby 1.2! I just cloned master and didn't even need to upgrade.

Also I'm using nginx and not apache if that changes anything! If there's any more questions I can answer about my set up or logs to check I'll be sure to!

bertvandepoel commented 2 years ago

Whether it's MariaDB or MySQL doesn't really matter. Under most (if not all) circumstances, the behaviour is identical for the very basic tables and queries that Tabby uses. It's mostly for me to know whether it might be PostgreSQL related. Apache or Nginx shouldn't make a difference as long as everything maps on index.php correctly.

I've just done a fresh install with MariaDB 10.1.48 and PHP 7.4.24 with Tabby 1.2. I've added a person, then created an activity and a credit line. I could easily delete both the credit and debt for this person without any errors. Could you give me the versions of MariaDB and PHP you're using, as well as maybe the minimal steps to reproduce the issue from a clean install?

wychwitch commented 2 years ago

Could you give me the versions of MariaDB and PHP you're using, as well as maybe the minimal steps to reproduce the issue from a clean install?

Yes! The MariaDB version is 10.3.29 running on debian 10, and my php version is 7.3.29

I will set up a clean install with a new database / database user and update on the minimal steps to reproduce in a few minutes!

wychwitch commented 2 years ago

Okay here is the list of steps I've done to reproduce, which is going to be my basic set up.

  1. Clone git repo into a new folder in /var/www/
  2. Sign into MariaDB and create a new database, new user, and grant all privileges to that user on the database (flush privileges)
  3. run chown www-data:www-data on the site folder
  4. Edit Nginx and restart it
  5. Go to the website and complete set up (I chose to use Webcron if that matters)
  6. Add new person
  7. Add Activity, select new person, add debt and select + More Debt to add another
  8. Return to main page and add a credit, then hit edit
  9. Try to delete any of the debts or credits

Let me know if there's any more information you need!

bertvandepoel commented 2 years ago

I've been trying on my local setup with Ubuntu 18.04 (and ondrej sury's PHP 7.4 packages) as well as Ubuntu 20.04 at a webhoster, but can't seem to replicate this problem. I'm testing with Apache instead of Nginx and with cron instead of webcron, but all of that should not matter at all.

If you hover over the little delete button, does the link look like http://domain.whatever/tabby/people/detail/test@example.com?del=d7 or something along those lines? It should clearly feature the email address of the debtor, followed by del and then a d for debt or a c for credit and the corresponding database ID. Could you visit that link in a separate tab and see what happens then? I'm trying to rule out whether it might be something vaguely browser related.

In case the above doesn't lead to anything, I was wondering how familiar you are with editing code. I could maybe tell you where to add some debug information to get an idea, since I'm unable to replicate things. But hopefully that's not necessary.

wychwitch commented 2 years ago

If you hover over the little delete button, does the link look like http://domain.whatever/tabby/people/detail/test@example.com?del=d7 or something along those lines? Could you visit that link in a separate tab and see what happens then? I'm trying to rule out whether it might be something vaguely browser related.

Yep!! Opening it in a new window doesn't work either. I also tried in chrome and it didn't work either (I mainly use firefox)

In case the above doesn't lead to anything, I was wondering how familiar you are with editing code. I could maybe tell you where to add some debug information to get an idea, since I'm unable to replicate things. But hopefully that's not necessary.

Yeah I'm used to editing code! I'm mostly used to python and c# but as long as I'm pointed in the right direction I can add whatever!

bertvandepoel commented 2 years ago

I was talking to some friends who also use Tabby, and we were wondering if maybe it's because this is one of the very few places where a query string (?foo=bar) is used. Could you maybe give me an idea what your nginx config looks like? It might actually turn out to be that, which would be way easier to debug!

The only other place a query string is used in Tabby is when resetting a token link (the link supplied via email so no account is needed for debtors). So you could always try to visit a token link and then request a reset to see if the problem also persists there, and then we know for sure it's something to do with that and nginx not parsing it correctly or not passing it on to PHP.

wychwitch commented 2 years ago

Could you maybe give me an idea what your nginx config looks like? It might actually turn out to be that, which would be way easier to debug!

Sure thing!! I won't post the whole thing but this is the relevant serverblock

NGINX ```nginx server { listen 80; listen [::]:80; root /var/www/tabtest; index index.php index.html index.htm; server_name www.sitename.com; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; } } ```

The only other place a query string is used in Tabby is when resetting a token link (the link supplied via email so no account is needed for debtors). So you could always try to visit a token link and then request a reset to see if the problem also persists there, and then we know for sure it's something to do with that and nginx not parsing it correctly or not passing it on to PHP.

If anything was supposed to happen after clicking on the Reset unique token then yeah it's safe to say it's happening here too;;; Same deal, instant page reload and nothing popping up or changing even when copying the link and pasting in a new tab

Thank you so much for helping me with this so far btw!! This is such a strange error;

bertvandepoel commented 2 years ago

Don't you need something like fastcgi_param QUERY_STRING $args; in your PHP block so it also passes the part after ? on to PHP, used in both instances where you experience problems? I believe by default nginx fastcgi doesn't pass on the query string.

wychwitch commented 2 years ago

THE MISSING QUERY STRING WAS IT WAS IT!!! THANK YOU SO MUCH... I would've never been able to figure that out alone! I had no idea you had to pass in query strings manually like that.

For other people on the future, this should work just fine:

My Nginx Setup ```nginx server { listen 80; listen [::]:80; root /var/www/folder; index index.php index.html index.htm; server_name site.name.com; location / { try_files $uri $uri/ /index.php$is_args$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; } } ```

Again, I can't thank you enough;;;