A Flarum extension. Follow tags and be notified of new discussions.
Install with composer:
composer require fof/follow-tags:"*"
composer update fof/follow-tags:"*"
An extension by FriendsOfFlarum.
Follow tags and be notified of new discussions and replies
License: MIT License
A Flarum extension. Follow tags and be notified of new discussions.
Install with composer:
composer require fof/follow-tags:"*"
composer update fof/follow-tags:"*"
An extension by FriendsOfFlarum.
Is your feature request related to a problem? Please describe.
This is an idea that came up from a use case we have on discuss.flarum.org. We want more people to know they can follow the Blog tag for important updates by email.
Describe the solution you'd like
We could add an option in the tag edit modal, something like "Promote tag following".
When you read a discussion in a promoted tag, a banner would be shown, for example above the first post content or in the Hero, to promote following the tag.
Something like "Follow [Tag] for important news and security updates [Tag Follow Dropdown]". Maybe it should even include a dropdown or checkbox to enable the email notifications for Follow Tags.
Most likely the text would need to be customizable. Or we could just have a default translation and people can customize with Linguist. If we pass the tag slug as a translator parameter, the new ICU translation format could even be used by the forum owner to have different translations for different tags.
When I was thinking of this feature I was thinking of something like the Discord "follow this channel" banner. But either they changed it or I misremembered because it no longer looks as impressive as I thought it once was.
Describe alternatives you've considered
Right now we need to tell people to visit the tag page to see the dropdown. Many people either never visited the tag page or might have never noticed the follow dropdown.
I could work on this feature. I'll just leave this as a suggestion for now in case anyone has feedback. This could also be made as a standalone companion extension if we don't want it in the base extension.
I was thinking back to the combined index view issue (reverted in 72d06ba), and I think there might be a solution: we could run it through visibility scoping. This was much more confusing before with events, but now, all we need is an EloquentBuilder instance for Flarum\Discussion\Discussion
. Unfortunately the query available under $search->getQuery()
is a QueryBuilder
, but we can wrap it in an EloquentBuilder
to get access: core does a similar thing in https://github.com/flarum/core/blob/master/src/Post/Access/ScopePostVisibility.php#L55.
It would probably be a fair bit slower since visibility scoping is applied twice, but it should make it possible to restore combined view functionality.
This extension expects $discussion->firstPost
to be a CommentPost
. The template reads $post->content
and expect it to be text.
In the case of my Premium Wordpress extension, the first post may be an EventPost
whose content is a JSON object, returned as a PHP array.
The consequence is a PHP notice for Array to string conversion that's rendered in the email if notices are visible, and where the text should be I can read just Array
.
I have implemented some workarounds for other extensions. For example the SEO extension calls $post->formatContent()
, which I have been able to implement in a way that's compatible with CommentPost.
However I cannot re-implement $post->content
, or it would break the functionality of the JSON payload.
In order for the two extensions to work together, Follow Tags should call another method where third-party extensions can provide custom implementations for event posts. Another option would be to ignore non-comment posts, which would remove the enigmatic Array
from the email, but would prevent integration with extensions like mine.
My suggestion would be to call formatContent()
, and inject the HTML in the email. It would both solve this issue and add formatting. But I'm sure there were some concerns adding the post HTML in the email.
I actually would like to open a proposal in core to add an interface for posts that can be rendered as HTML. That way extensions will be free to register new post types, and other extensions will be able to know whether they can output their content or not.
This occured after update to flarum beta 14. After enabling it, I get,
Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.
error message in admin interface, dev console says:
admin:93 Uncaught TypeError: Vnodes must either always have keys or never have keys!
at Function.r.normalizeChildren (vnode.js:21)
at t.exports (hyperscript.js:93)
at a (index.js:7)
at t (patchMithril.js:11)
at Object.app.initializers.add.app.extensionSettings.fof-follow-tags (index.js:16)
at e.n.mount (AdminApplication.js:47)
at e.boot (Application.js:176)
at admin:88
The forum itself does not load (only header and footer), dev console says:
Error: Ensure the DOM element that was passed to `m.route` is not undefined
at Function.y [as route] (router.js:36)
at k (isFollowingPage.js:1)
at e.<anonymous> (addFollowedTagsDiscussions.js:37)
at e.t.<computed> [as viewItems] (extend.js:27)
at e.n.view (IndexPage.js:59)
at e.t.<computed> [as view] (extend.js:25)
at Function.a (render.js:30)
at render.js:155
at render.js:160
at l (render.js:66)
May be a duplicate of #14, but that was before beta 14. I also do not have any logs about that, last log file was from 2020-07-22.
Btw, the GitHub link is broken.
It would be quite handy to be able to follow all discussions across all tags, so speaking to have a global "Follow" button on the main site.
I need some translations in German. Would you be willing to merge a PR with German translations?
When both fof/follow-tags and fof/byobu are enabled, a private discussion under a tag which is followed by users is notified, and therefore leaks the content (and existence) of that discussion.
After enabling it, I get,
"Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error."
error message.
Hello, auto merge does not work when follow tags is enabled.
Here is the error:
"errors": [
{
"status": "404",
"code": "not_found",
"detail": "Illuminate\\Database\\Eloquent\\ModelNotFoundException: No query results for model [Flarum\\Post\\CommentPost]. in /var/www/html/playcb.eu/forum/vendor/illuminate/database/Eloquent/Builder.php:452\nStack trace:\n#0 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/SerializesAndRestoresModelIdentifiers.php(85): Illuminate\\Database\\Eloquent\\Builder->firstOrFail()\n#1 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/SerializesAndRestoresModelIdentifiers.php(55): FoF\\FollowTags\\Jobs\\SendNotificationWhenReplyIsPosted->restoreModel()\n#2 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/SerializesModels.php(45): FoF\\FollowTags\\Jobs\\SendNotificationWhenReplyIsPosted->getRestoredPropertyValue()\n#3 [internal function]: FoF\\FollowTags\\Jobs\\SendNotificationWhenReplyIsPosted->__wakeup()\n#4 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/CallQueuedHandler.php(146): unserialize()\n#5 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/Jobs/Job.php(172): Illuminate\\Queue\\CallQueuedHandler->failed()\n#6 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/FailingJob.php(33): Illuminate\\Queue\\Jobs\\Job->failed()\n#7 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/CallQueuedHandler.php(131): Illuminate\\Queue\\FailingJob::handle()\n#8 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/CallQueuedHandler.php(45): Illuminate\\Queue\\CallQueuedHandler->handleModelNotFound()\n#9 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/Jobs/Job.php(83): Illuminate\\Queue\\CallQueuedHandler->call()\n#10 /var/www/html/playcb.eu/forum/vendor/illuminate/queue/SyncQueue.php(42): Illuminate\\Queue\\Jobs\\Job->fire()\n#11 /var/www/html/playcb.eu/forum/vendor/fof/follow-tags/src/Listeners/QueueNotificationJobs.php(43): Illuminate\\Queue\\SyncQueue->push()\n#12 /var/www/html/playcb.eu/forum/vendor/illuminate/events/Dispatcher.php(360): FoF\\FollowTags\\Listeners\\QueueNotificationJobs->whenPostCreated()\n#13 /var/www/html/playcb.eu/forum/vendor/illuminate/events/Dispatcher.php(209): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}()\n#14 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Foundation/DispatchEventsTrait.php(33): Illuminate\\Events\\Dispatcher->dispatch()\n#15 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Post/Command/PostReplyHandler.php(106): Flarum\\Post\\Command\\PostReplyHandler->dispatchEventsFor()\n#16 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Notification/NotificationSyncer.php(148): Flarum\\Post\\Command\\PostReplyHandler->Flarum\\Post\\Command\\{closure}()\n#17 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Post/Command/PostReplyHandler.php(107): Flarum\\Notification\\NotificationSyncer->onePerUser()\n#18 /var/www/html/playcb.eu/forum/vendor/illuminate/bus/Dispatcher.php(90): Flarum\\Post\\Command\\PostReplyHandler->handle()\n#19 /var/www/html/playcb.eu/forum/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()\n#20 /var/www/html/playcb.eu/forum/vendor/illuminate/pipeline/Pipeline.php(104): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()\n#21 /var/www/html/playcb.eu/forum/vendor/illuminate/bus/Dispatcher.php(98): Illuminate\\Pipeline\\Pipeline->then()\n#22 /var/www/html/playcb.eu/forum/vendor/illuminate/bus/Dispatcher.php(76): Illuminate\\Bus\\Dispatcher->dispatchNow()\n#23 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Api/Controller/CreatePostController.php(73): Illuminate\\Bus\\Dispatcher->dispatch()\n#24 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(96): Flarum\\Api\\Controller\\CreatePostController->data()\n#25 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Api/Controller/AbstractCreateController.php(22): Flarum\\Api\\Controller\\AbstractSerializeController->handle()\n#26 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(38): Flarum\\Api\\Controller\\AbstractCreateController->handle()\n#27 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/DispatchRoute.php(65): Flarum\\Http\\RouteHandlerFactory->Flarum\\Http\\{closure}()\n#28 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\DispatchRoute->process()\n#29 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(50): Laminas\\Stratigility\\Next->handle()\n#30 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\SetLocale->process()\n#31 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(45): Laminas\\Stratigility\\Next->handle()\n#32 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\CheckCsrfToken->process()\n#33 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(55): Laminas\\Stratigility\\Next->handle()\n#34 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\AuthenticateWithHeader->process()\n#35 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(32): Laminas\\Stratigility\\Next->handle()\n#36 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\AuthenticateWithSession->process()\n#37 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(51): Laminas\\Stratigility\\Next->handle()\n#38 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\RememberFromCookie->process()\n#39 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\\Stratigility\\Next->handle()\n#40 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\StartSession->process()\n#41 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\\Stratigility\\Next->handle()\n#42 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Api\\Middleware\\FakeHttpMethods->process()\n#43 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\\Stratigility\\Next->handle()\n#44 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\ParseJsonBody->process()\n#45 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\\Stratigility\\Next->handle()\n#46 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\\Http\\Middleware\\HandleErrors->process()\n#47 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\\Stratigility\\Next->handle()\n#48 /var/www/html/playcb.eu/forum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\\Stratigility\\MiddlewarePipe->process()\n#49 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\\RequestHandler->process()\n#50 /var/www/html/playcb.eu/forum/vendor/middlewares/base-path-router/src/BasePathRouter.php(97): Laminas\\Stratigility\\Next->handle()\n#51 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\\BasePathRouter->process()\n#52 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(42): Laminas\\Stratigility\\Next->handle()\n#53 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Laminas\\Stratigility\\Middleware\\OriginalMessages->process()\n#54 /var/www/html/playcb.eu/forum/vendor/middlewares/base-path/src/BasePath.php(53): Laminas\\Stratigility\\Next->handle()\n#55 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\\BasePath->process()\n#56 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\\Stratigility\\Next->handle()\n#57 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(73): Laminas\\Stratigility\\MiddlewarePipe->process()\n#58 /var/www/html/playcb.eu/forum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\\Stratigility\\MiddlewarePipe->handle()\n#59 /var/www/html/playcb.eu/forum/vendor/flarum/core/src/Http/Server.php(42): Laminas\\HttpHandlerRunner\\RequestHandlerRunner->run()\n#60 /var/www/html/playcb.eu/forum/public/index.php(26): Flarum\\Http\\Server->listen()\n#61 {main}"
}
]
}
Please note, this error log is from a user on discuss.
Kind Regards
As I can see in this code: https://github.com/FriendsOfFlarum/follow-tags/blob/master/src/Jobs/SendNotificationWhenReplyIsPosted.php#L67 the email notification is sent only to users who view the last post of the discussion, right?
There are many users who read the replies in the email notification, so they don't enter in the forum and stop receiving more updates of the discussion.
I'd love to have an option in the plugin to change this behavior and send the emails to all subscribed users, no matter if they read the last post.
When looking at tags or /all, discussions from hidden tags were still showing up.
There was a small typo which incorrectly selected discussions belonging to hidden tags.
Current Behavior
My users are reporting an issue where they receive email notifications from tags they are not following and none from the one they follow !
After some testing, the email were sent by "FOF Subscribed".
When disabled, the users weren't receiving anything !
Expected Behavior
Users should get notifications from tags they follow.
Environment
Flarum core: 1.8.5
PHP version: 8.1.27
MySQL version: 10.5.23-MariaDB-0+deb11u1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+--------------------------------------+----------+--------+
| Flarum Extensions | | |
+--------------------------------------+----------+--------+
| ID | Version | Commit |
+--------------------------------------+----------+--------+
| flarum-flags | v1.8.0 | |
| flarum-approval | v1.8.1 | |
| flarum-suspend | v1.8.1 | |
| flarum-subscriptions | v1.8.0 | |
| flarum-tags | v1.8.0 | |
| flarum-sticky | v1.8.0 | |
| fof-user-directory | 1.3.3 | |
| fof-follow-tags | 1.2.2 | |
| flarum-markdown | v1.8.0 | |
| zerosonesfun-composer-preview | 1.3 | |
| v17development-seo | v1.8.1 | |
| tohsakarat-tags-filter | v1.0.5 | |
| the-turk-stickiest | 3.0.1 | |
| ramesh-dada-download-button | v8.1.4 | |
| ianm-log-viewer | 0.1.1 | |
| ianm-follow-users | 1.4.6 | |
| fof-upload | 1.5.4 | |
| fof-terms | 1.3.0 | |
| fof-subscribed | 1.1.4 | |
| fof-sitemap | 2.2.1 | |
| fof-nightmode | 1.5.3 | |
| fof-masquerade | 2.1.4 | |
| fof-linguist | 1.1.2 | |
| fof-impersonate | 1.1.1 | |
| fof-disposable-emails | 1.0.0 | |
| fof-default-user-preferences | 1.2.1 | |
| fof-bbcode-details | 1.1.2 | |
| fof-ban-ips | 1.1.1 | |
| fof-analytics | 1.1.0 | |
| flarum-statistics | v1.8.0 | |
| flarum-lock | v1.8.0 | |
| flarum-lang-italian | 1.11.0 | |
| flarum-lang-german | 1.9.0 | |
| flarum-lang-french | v4.22.0 | |
| flarum-lang-english | v1.8.0 | |
| flarum-bbcode | v1.8.0 | |
| flamarkt-signup-page | dev-main | |
| datlechin-landing-page | 0.1.0 | |
| clarkwinkelmann-discussion-bookmarks | 2.0.1 | |
| blomstra-database-queue | 1.1.0 | |
| askvortsov-rich-text | v2.1.7 | |
+--------------------------------------+----------+--------+
Base URL: https://www.swisslib.org
Installation path: /var/www/html/flarum
Queue driver: database
Session driver: file
Scheduler status: Actif
Mail driver: smtp
Debug mode: off
Additional Context
The forum is huge with 3274 members and I use the "Database Queue" extension for processing the emails.
Feature request from the giffgaff community
We all know that there are many threads that are started under the wrong section of the forum and between us and the Eds we try to keep things in apple pie order.
My main interest on the forum are Contribute, Labs and Feedback which I've flagged as following and is very useful in keeping up to date with what is happening.
However, I've found that when a tag is changed on a post and moved to these areas I don't receive a notification.
I guess that the same applies to threads moved to H&S and why the ED's sometimes need to bump a post to get help.
I think that extending notification to re-tagged threads would be nice to have
Test test test
Current Behavior
As shown in the attached screenshot, the follow button is positioned over the navigation bar. This overlap affects user experience and navigation.
Steps to Reproduce
Expected Behavior
The follow button for tags should be correctly positioned, ensuring there's no interference with other UI elements.
Screenshots
Environment
if ($event->isSerializer(TagSerializer::class)
&& ($state = $event->model->stateFor($event->actor))) {
$event->attributes['subscription'] = $state->subscription;
}
This causes over 300 queries to run on larger forums.
The ability to set up some tags that are automatically followed by new users (or even force-followed so they can't unfollow) would be a great addition for things like Announcement sections on forums where the admins might want to make sure everyone sees what's posted there.
I'll probably be implementing this myself as I need it for a project, but I'm posting this here to to check if it would be accepted and track it so effort isn't duplicated.
We need to provide an option for users to view discussions from tags they follow.
As I don't think it's wise to use another menu item next to "following", let's see whether we can split the page into two and provide one list of discussions followed and one that shows new discussions/activity from tags a user follows.
When most messages get sent via Flarum the message ID looks something like: [email protected]
however when emails are sent for this extension they are sent using a message ID like: [email protected]
although this is generally speaking fine and emails will still get delivered it can cause some spam filters to flag the messages as more suspicious or in some cases send messages straight to spam.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.