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

Removing a circle breaks the Activity app #1543

Closed
paulvt opened this issue Apr 9, 2024 · 3 comments
Closed

Removing a circle breaks the Activity app #1543

paulvt opened this issue Apr 9, 2024 · 3 comments
Labels

Comments

@paulvt
Copy link

paulvt commented Apr 9, 2024

Once you created and deleted a circle (via the Contacts) app, the Activity app cannot be used any more.

Steps to reproduce:

  1. Go to the Contacts app
  2. Add a circle "Test"
  3. Delete this circle
  4. Switch to the Activity app

The overview now spams "Could not load activities" messages (very quickly).

This is Circles app version 28.0.0 on Nextcloud 28.0.4.1. Installed via Docker (community) on PHP 8.2/Apache with PostgreSQL as database.

Exception in the logs:

{  "reqId": "SM1NThrV4KlxaekTbvfN",
  "level": 3,
  [...]
  "app": "no app in context",
  "method": "GET",
  "url": "/ocs/v2.php/apps/activity/api/v2/activity/all?format=json&previews=true&since=0",
  "message": "Exception thrown: RuntimeException",
  "userAgent": "[...]",
  "version": "28.0.4.1",
  "exception": {
    "Exception": "RuntimeException",
    "Message": "image not found: image:png webroot: serverroot:/var/www/html",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/apps/circles/lib/Activity/Provider.php",
        "line": 96,
        "function": "imagePath",
        "class": "OC\\URLGenerator",
        "type": "->",
        "args": [
          "circles",
          "png"
        ]
      },
      {
        "file": "/var/www/html/apps/circles/lib/Activity/Provider.php",
        "line": 67,
        "function": "setIcon",
        "class": "OCA\\Circles\\Activity\\Provider",
        "type": "->",
        "args": [
          [
            "OC\\Activity\\Event"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/activity/lib/GroupHelper.php",
        "line": 72,
        "function": "parse",
        "class": "OCA\\Circles\\Activity\\Provider",
        "type": "->",
        "args": [
          "en_GB",
          [
            "OC\\Activity\\Event"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/activity/lib/Data.php",
        "line": 248,
        "function": "addActivity",
        "class": "OCA\\Activity\\GroupHelper",
        "type": "->",
        "args": [
          [
            845,
            1712666130,
            30,
            "circles_as_member",
            "",
            "And 10 more entries, set log level to debug to see all entries"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/activity/lib/Controller/APIv2Controller.php",
        "line": 205,
        "function": "get",
        "class": "OCA\\Activity\\Data",
        "type": "->",
        "args": [
          [
            "OCA\\Activity\\GroupHelper"
          ],
          [
            "OCA\\Activity\\UserSettings"
          ],
          "paul",
          0,
          50,
          "desc",
          "all",
          "",
          0
        ]
      },
      {
        "file": "/var/www/html/apps/activity/lib/Controller/APIv2Controller.php",
        "line": 152,
        "function": "get",
        "class": "OCA\\Activity\\Controller\\APIv2Controller",
        "type": "->",
        "args": [
          "all",
          0,
          50,
          true,
          "",
          0,
          "desc"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "getFilter",
        "class": "OCA\\Activity\\Controller\\APIv2Controller",
        "type": "->",
        "args": [
          "all",
          0,
          50,
          true,
          "",
          0,
          "desc"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Activity\\Controller\\APIv2Controller"
          ],
          "getFilter"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Activity\\Controller\\APIv2Controller"
          ],
          "getFilter"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Activity\\Controller\\APIv2Controller",
          "getFilter",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "all",
            "ocs.activity.APIv2.getFilter"
          ]
        ]
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 65,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/activity/api/v2/activity/all"
        ]
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/URLGenerator.php",
    "Line": 274,
    "CustomMessage": "Exception thrown: RuntimeException"
  }
}
@paulvt
Copy link
Author

paulvt commented Apr 9, 2024

@excho0
Copy link

excho0 commented Apr 17, 2024

The code that causes the error:

/var/www/nextcloud/apps/circles/lib/Activity/Provider.php

private function setIcon(IEvent $event): void {
	$path = $this->urlGenerator->imagePath(
		Application::APP_ID,
		'circles.' . $this->activityManager->getRequirePNG() ? 'png' : 'svg'
	);
	$event->setIcon($this->urlGenerator->getAbsoluteURL($path));
}

and here is the fix:

private function setIcon(IEvent $event): void {
	$extension = $this->activityManager->getRequirePNG() ? 'png' : 'svg';
	$path = $this->urlGenerator->imagePath(
		Application::APP_ID,
		'circles.' . $extension
	);
	$event->setIcon($this->urlGenerator->getAbsoluteURL($path));
}

UPDATE:

I was looking in to the source code and It appears that they have already fixed the bug using a different version from the provided fix above. You can either use my version or simply wait for an update. I believe both versions should work. 🤗

@joshtrichards
Copy link
Member

Fixed in #1544 / #1620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants