0.7.0 Breaking Changes
-
Hook changes
Filter
filter:topic.get
see this commitfilter:topic.thread_tools
see this commitfilter:post.save
changed tofilter:post.edit
when editing a post. see this commitfilter:templates.get_config
andfilter:templates.get_virtual
removed.filter:search.query
parameters changed, see this commit
Other changes
- app.uid and friends are removed see this commit. Please use app.user.uid from now on.
- All templates in widget-essentials has been moved to a subfolder called
widgets
. see this commit - Home.tpl has been renamed to categories.tpl see this commit
settings.language
has been renamed tosettings.userLang
to match the config see this commit- Updates to search system, upgrading to 0.7.0 requires clearing and reindexing content from the appropriate search plugin.
- the _key, value index changed to a unique/sparse index. Only affects mongodb.
posts.getPostsByTid
renamed toposts.getPostsFromSet
, first param removed.
TBD
-
-
home.tpl has been renamed to categories.tpl, If you have custom themes that are overriding home.tpl you should rename it to categories.tpl.
Also widget-essentials has been updated so that all the widgets are in a subfolder now. This should prevent conflicts with template files from core.
-
Deprecation Notice:
For plugin developers, previously, this method was the only way to add a button to the composer, but it had the disadvantage of only appending buttons, which also happened to mean the "Help" button ended up in the middle of the buttons, when it should rightfully be at the end.
A new server-side hook: filter:composer.formatting was added, allowing you more control over where buttons are placed.
Inspect how the Markdown plugin adds buttons to the composer
-
filter:search.query
paramaters changed, The new hook looks likeplugins.fireHook('filter:search.query', { index: index, content: content, cid: cids, uid: uids }, callback);
Updating to latest master/0.7.0 requires a reindex of content from the search plugin ACP.
-
Made a index change for mongodb, relevant commit https://github.com/NodeBB/NodeBB/commit/484ad33549ce78d2907b1a1b9bde373b2737491a
If you update to latest, stop nodebb, go into your mongodb database and drop the indexes on the objects collection with
db.objects.dropIndexes()
they will be recreated when you restart nodebb. -
templates.js 0.2.x changes
1. Namespace Assumption - deprecated
Previously within a loop you had a choice of doing
{myarray.myprop}
or just{myprop}
. The latter has been deprecated:myarray: [ { myprop: myval } ]
<!-- BEGIN myarray --> {myarray.myprop} {myprop} // this will now only reference myprop from the root, and no longer work for myarray.myprop <!-- END myarray -->
That said, you can use
{../myprop}
which will reference the current namespace. This is useful when you re-use partials in multiple templates. For example:// partials/mypartial.tpl {../myproperty}
<!-- BEGIN loop1 --> <!-- IMPORT partials/mypartial.tpl --> // {loop1.myproperty} <!-- END loop1 --> <!-- BEGIN loop2 --> <!-- IMPORT partials/mypartial.tpl --> // {loop2.myproperty} <!-- END loop2 -->
2. All keys are now escaped by default
If you happen to include JavaScript in your template, (ex.
{code}
) please use{{code}}
instead to ensure your JS isn't escaped. -
@psychobunny Is it possible to make this more backwards compatible by making
{{code}}
escape and{code}
not escape? I feel like this would be a better way of making this change. -
I want to escape by default, to prevent accidental XSS. If you intentionally want to allow scripts then you should use double curly brackets
I think its something I would rather break today than worry about it in future