announcementcenter icon indicating copy to clipboard operation
announcementcenter copied to clipboard

Smart loading is broken (again)

Open dirdi opened this issue 3 years ago • 12 comments

Steps to reproduce

  1. Create more than seven announcements
  2. Go to announcement center
  3. Find only the seven most recent announcements being loaded and displayed

Expected behaviour

Older announcements should be loaded dynamically, once one reaches the bottom of the page, see https://github.com/nextcloud/announcementcenter/issues/201.

Actual behaviour

There seems to be no way to display older announcements.

Server configuration

Operating system: Linux 5.10.0-11-amd64 x86_64

Web server: Apache

Database: MariaDB 10.5.12

PHP version: 8.0.15

Nextcloud version: Nextcloud Hub II (23.0.2) (Bug was present on 22.x, too)

Where did you install Nextcloud from: Archive file downloaded from nextcloud.com/install

Signing status:

No errors have been found.

List of activated apps:

Enabled:
- accessibility: 1.9.0
- activity: 2.15.0 
- announcementcenter: 6.1.1 
- bruteforcesettings: 2.3.0 
- calendar: 3.0.6 
- cloud_federation_api: 1.6.0 
- comments: 1.13.0 
- contacts: 4.0.8 
- contactsinteraction: 1.4.0 
- dav: 1.21.0 
- federatedfilesharing: 1.13.0 
- files: 1.18.0 
- files_accesscontrol: 1.13.0 
- files_automatedtagging: 1.13.0 
- files_pdfviewer: 2.4.0 
- files_rightclick: 1.2.0 
- files_sharing: 1.15.0 
- files_trashbin: 1.13.0 
- files_versions: 1.16.0 
- files_videoplayer: 1.12.0 
- groupfolders: 11.1.2 
- impersonate: 1.10.0 
- logreader: 2.8.0 
- lookup_server_connector: 1.11.0 
- notifications: 2.11.1 
- oauth2: 1.11.0 
- password_policy: 1.13.0 
- photos: 1.5.0 
- polls: 3.5.4 
- privacy: 1.7.0 
- provisioning_api: 1.13.0 
- serverinfo: 1.13.0 
- settings: 1.5.0 
- spreed: 13.0.3 
- systemtags: 1.13.0 
- text: 3.4.0 
- theming: 1.14.0 
- twofactor_backupcodes: 1.12.0 
- updatenotification: 1.13.0 
- user_status: 1.3.1 
- viewer: 1.7.0 
- workflowengine: 2.5.0

Disabled: 
- admin_audit 
- circles: 22.2.0 
- dashboard: 7.0.0 
- encryption 
- federation: 1.10.1 
- files_external 
- firstrunwizard: 2.7.0 
- nextcloud_announcements: 1.7.0 
- recommendations: 0.6.0 
- sharebymail: 1.8.0 
- support: 1.1.1 
- survey_client: 1.6.0 
- user_ldap 
- weather_status: 1.3.0

Nextcloud configuration:

<?php
$CONFIG = array (
  'instanceid' => '*snip*',
  'passwordsalt' => '*snip*',
  'secret' => '*snip*',
  'trusted_domains' => 
  array (
    0 => '*snip*',
    1 => '*snip*',
  ),
  'datadirectory' => '/usr/www/users/*snip*/data',
  'dbtype' => 'mysql',
  'version' => '23.0.2.1',
  'overwrite.cli.url' => 'https://*snip*',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => '*snip*',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbdriveroptions' => 
  array (
    1009 => '/usr/www/users/*snip*/ssl-ca-cert.pem',
  ),
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*snip*',
  'installed' => true,
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'pipe',
  'mail_domain' => '*snip*',
  'mail_from_address' => '*snip*',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'default_language' => '*snip*',
  'updater.release.channel' => 'stable',
  'default_phone_region' => '*snip*',
  'allow_user_to_change_display_name' => false,
  'updater.secret' => '*snip*',
);

Are you using an external user-backend, if yes which one: no

Client configuration

Browser:

$ firefox --version
Mozilla Firefox 96.0.3

Operating system:

$ uname -a
Linux hostname 5.16.0-1-amd64 #1 SMP PREEMPT Debian 5.16.7-2 (2022-02-09) x86_64 GNU/Linux

Logs

Nextcloud log (data/owncloud.log)

Nothing suspicious.

Browser log

Console

dirdi avatar Feb 19 '22 17:02 dirdi

Right, seems to have been dropped by accident when migrating to Vue and redoing the UI

nickvergessen avatar Feb 22 '22 09:02 nickvergessen

is there a workaround ? or does dropped mean it was omitted when migrating ?

zhksh avatar Mar 31 '22 09:03 zhksh

Last time it was possible to edit an PHP file and set the number of announcements that will be loaded by default to a high number.

dirdi avatar Mar 31 '22 09:03 dirdi

which PHP file ?

zhksh avatar Mar 31 '22 09:03 zhksh

I do not remember \o/

dirdi avatar Mar 31 '22 10:03 dirdi

in case anyone besides me is wondering :

announcementcenter/lib/Model/AnnouncementMapper.php
76: 	public function getAnnouncements(array $userGroups, int $offsetId = 0): array {
77: 		$query = $this->db->getQueryBuilder();
78: 
79: 		$query->select('a.announcement_id')
80: 			->from($this->getTableName(), 'a')
81: 			->orderBy('a.announcement_time', 'DESC')
82: 			->groupBy('a.announcement_id')
83: 			->setMaxResults(7);

zhksh avatar Mar 31 '22 10:03 zhksh

https://github.com/nextcloud/announcementcenter/blob/master/lib/Model/AnnouncementMapper.php#L83

nickvergessen avatar Mar 31 '22 11:03 nickvergessen

@nickvergessen from all featured nextcloud apps announcement center is way behind in introducing a new feature or at least fixing some basic bugs like this one does this app no longer supported?

elhananjair avatar Nov 06 '22 18:11 elhananjair

I maintain it with minimal effort (will make sure an update is available for new Nextcloud versions) due to multiple reasons. Most of all:

  • It's still good enough for most of my usecases (announcing down times and major updates) as no one ever scrolls back 7+ downtimes, i could even delete directly after being online again.
  • I'm a backend developer and this is a frontend task where I don't have enough energy and time at the moment to figure it out (which is why I always say that I will accept a PR when someone fixes this)
  • Due to historic reasons I maintain roughly 15 apps, so yeah when the focus shifts away or my personal usecase changes/disappears the effort I put into apps is reduced.

There are many things that could be done in this app if someone is willing to invest all the time, most of the things are frontend related like: files/image/attachment support, mentions, emoji picker, reactions, etc.

But yeah as said I don't need them for my usecase so I'm not adding them myself to avoid things breaking going forward, resulting in more work. If someone else adds them, happy to merge them.

nickvergessen avatar Nov 06 '22 21:11 nickvergessen

Bug is still present on 6.5.1. Current workaround:

+++ AnnouncementMapper.php	2023-03-04 12:32:55.000000000 +0100
@@ -84,8 +84,7 @@
 		$query->select('a.announcement_id')
 			->from($this->getTableName(), 'a')
 			->orderBy('a.announcement_time', 'DESC')
-			->groupBy('a.announcement_id')
-			->setMaxResults($limit);
+			->groupBy('a.announcement_id');
 
 		if (!empty($userGroups)) {
 			$query->leftJoin('a', 'announcements_map', 'ag', $query->expr()->eq(```

dirdi avatar Mar 04 '23 11:03 dirdi

There is really no need to report "Bug is still present in X" It will always be present until someone helps to fix it.

Currently it's beyond my level of expertise as I'm a Backend developer just capable of basic Frontend work 🥲

nickvergessen avatar Mar 04 '23 11:03 nickvergessen

[ot] @nickvergessen my primary intention was to provide an updated workaround, since the old one stopped working. Sorry for the noise. [/ot]

dirdi avatar Mar 04 '23 11:03 dirdi