Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't get the original post content in the Revised event #3715

Closed
AntoineFr opened this issue Jan 7, 2023 · 0 comments · Fixed by #3789
Closed

Can't get the original post content in the Revised event #3715

AntoineFr opened this issue Jan 7, 2023 · 0 comments · Fixed by #3789
Assignees
Labels

Comments

@AntoineFr
Copy link

Current Behavior

When I listen to the Flarum\Post\Event\Revised event, I can't get the post content as it was before editing.

I expected to have the old post content as a parameter of this event, but it wasn't there, so I used the getOriginal() method. This method returns the post content after being edited and not before.

Steps to Reproduce

  1. Add code to listen to the event Flarum\Post\Event\Revised
  2. Edit a post using the website
  3. $event->post->content will be the same as $event->post->getOriginal('content', '') and the old text is not present in the object

Expected Behavior

Get the old content using $event->post->getOriginal('content', '') or include the old post as a parameter in the Revised event.

Screenshots

No response

Environment

  • Flarum version: 1.6.2
  • Webserver: Apache
  • Hosting environment: WAMPserver
  • PHP version: 8.0.13
  • Browser: Firefox 108.0.1

Output of php flarum info

Flarum core 1.6.2
PHP version: 8.0.13
MySQL version: 5.7.36
Loaded extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, readline, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, xmlreader, xmlwriter, openssl, curl, com_dotnet, fileinfo, gd, gettext, gmp, intl, imap, ldap, mbstring, exif, mysqli, Phar, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, xsl
+----------------------------+-----------------+------------------------------------------+
| Flarum Extensions          |                 |                                          |
+----------------------------+-----------------+------------------------------------------+
| ID                         | Version         | Commit                                   |
+----------------------------+-----------------+------------------------------------------+
| askvortsov-auto-moderator  | v0.1.2          |                                          |
| flarum-likes               | v1.6.1          |                                          |
| afrux-forum-widgets-core   | v0.1.7          |                                          |
| v17development-user-badges | v1.1.0          |                                          |
| flarum-tags                | v1.6.1          |                                          |
| flarum-suspend             | v1.6.1          |                                          |
| flarum-subscriptions       | v1.6.1          |                                          |
| flarum-sticky              | v1.6.1          |                                          |
| flarum-statistics          | v1.6.1          |                                          |
| flarum-package-manager     | v1.0.0-beta.1.1 |                                          |
| flarum-nicknames           | v1.6.1          |                                          |
| flarum-mentions            | v1.6.1          |                                          |
| flarum-markdown            | v1.6.1          |                                          |
| flarum-lock                | v1.6.1          |                                          |
| flarum-lang-french         | v4.4.0          |                                          |
| flarum-lang-english        | v1.6.0          |                                          |
| flarum-flags               | v1.6.1          |                                          |
| flarum-emoji               | v1.6.1          |                                          |
| flarum-bbcode              | v1.6.0          |                                          |
| antoinefr-online           | dev-master      | 1ceb40df49496faae4581f1bca419d0cd413ac06 |
| antoinefr-money            | dev-master      | c8a014b7b2d02f0d1ccf7364d3768003058f6453 |
| antoinefr-bbcode-fa        | dev-master      | 63acbdf0ed1636e6713c5a224cfb11a9b12ccb44 |
| afrux-online-users-widget  | v0.1.6          |                                          |
| afrux-news-widget          | v0.1.1          |                                          |
+----------------------------+-----------------+------------------------------------------+
Base URL: http://flarum.local
Installation path: C:\wamp64\www\flarum.local
Queue driver: sync
Session driver: file
Mail driver: log
Debug mode: ON

Possible Solution

No response

Additional Context

No response

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

Successfully merging a pull request may close this issue.

2 participants