Unable to edit the post privilages error

Best posts made by venkAT
-
Unable to edit the post privilages issues
-
How to setup admin user in config.json in nodebb
For build promotions we have to auto create the admin account from Jenkins or some environment variable
can we use config.json to setup admin accountplease guide us, How can we use the below command.
./nodebb setup [options] [config]We refer the below link but not successed:
https://community.nodebb.org/topic/14068/setting-up-nodebb-for-ci-cd-pipeline -
Tags are not updated while editing the post (/api/v2/posts/:pid)
My local Nodebb Version :
v1.16.2
I am trying to edit my own post and I want to update the
content
,title
andtags
Here is my payload
curl --location --request PUT 'http://localhost:4567/api/v2/posts/17' \ --header 'Authorization: Bearer 0257ecdd-ffd7-4a79-a2c4-2244aa490c2d' \ --header 'Content-Type: application/json' \ --header 'Cookie: express.sid=s%3AbIhfigykYJ3MKanc6ShQ2gGxoZ6xccjE.s02leB%2BLFWGPnXG1IBQQdaTb8gD%2BDobwa05UEYja1Ws' \ --data-raw '{ "pid": 17, "content": "Edit my own post alsong with tags", "title": "Edit post", "tags": ["edit", "update", "tagCheck"] }'
And I got response back
{ "code": "ok", "payload": {} }
But the tags are not updated, check the screenshot
These are my findings
STEP: 1 - Nodebb-WriteAPI
in write api plugin for the api/api/v2/posts/:pid
verify From line number 19 to 33
https://github.com/NodeBB/nodebb-plugin-write-api/blob/master/routes/v2/posts.js#L19Here the tags are added into
options
object - #Line: 29in write api the final object looks like this
{ uid: 18, pid: '17', content: 'Edit my own post alsong with tags', options: { tags: [ 'edit', 'update', 'tagCheck' ] }, title: 'Edit post' }
STEP:2 - NodeBB (POSTS section)
As par the above git link #lineNo: 31 we are calling parent funtionposts.edit
so that will come to NodeBBsrc/posts/edit.js
file.
Verify Here:
https://github.com/NodeBB/NodeBB/blob/master/src/posts/edit.js#L126You are access the tags from data object
data.tags
but Actually tags present indata.options.tags
Referencs Data object in Nodebb
{ uid: 18, pid: '17', content: 'Edit my own post alsong with tags', options: { tags: [ 'edit', 'update', 'tagCheck' ] }, title: 'Edit post' }
And finally The updated data object looks like
{ tid: 17, cid: 2, uid: 18, title: 'Edit post', oldTitle: 'Edit post', slug: '17/edit-post', isMainPost: true, renamed: false, tags: [] }
Because off the tags access from wrong place, causing issue for updating the tags while editing the post
my local practice
- in my local I changed the tags accessing in Nodebb(
/src/posts/edit.js#LineNo: 126
) fromdata.tags = data.tags || [];
todata.tags = data.options.tags || [];
After that the tags are updating for that post
CC: @vinu
- in my local I changed the tags accessing in Nodebb(
Latest posts made by venkAT
-
RE: Is it possible to use my application user name and id instead of creating new account in nodebb with random uid?
@pitaj Is it possible to add nodebb uid as a string
I did some code change in Nodebb repo for adding string as a uid, it is storing but while accessing I am not getting the proper data.
can you suggest me the better solution?
I need to use my identifier(string) as a nodebb uid instead of auto increment uid(number) ?
-
Is it possible to use my application user name and id instead of creating new account in nodebb with random uid?
@julian I am trying to use my own application user details (username and userID)
Example:
{ username: 'venkat', userId : "2a5t8862-88k52-48569df5" }
can I use above user details for nodebb.
As of now nodebb is creating incremental id (uid)
instead of that uid, can i use my own userId as nodebb
uidPresent Nodebb user details:
{ username: "venkat", uid: 5 }
my requirement is
{ username: 'venkat', uid: '2a5t8862-88k52-48569df5' }
is there any way to implement the above requirement ?
CC: @vinu
-
RE: Tags are not updated while editing the post (/api/v2/posts/:pid)
@julian Now it is working fine
Thank you for quick response
-
Tags are not updated while editing the post (/api/v2/posts/:pid)
My local Nodebb Version :
v1.16.2
I am trying to edit my own post and I want to update the
content
,title
andtags
Here is my payload
curl --location --request PUT 'http://localhost:4567/api/v2/posts/17' \ --header 'Authorization: Bearer 0257ecdd-ffd7-4a79-a2c4-2244aa490c2d' \ --header 'Content-Type: application/json' \ --header 'Cookie: express.sid=s%3AbIhfigykYJ3MKanc6ShQ2gGxoZ6xccjE.s02leB%2BLFWGPnXG1IBQQdaTb8gD%2BDobwa05UEYja1Ws' \ --data-raw '{ "pid": 17, "content": "Edit my own post alsong with tags", "title": "Edit post", "tags": ["edit", "update", "tagCheck"] }'
And I got response back
{ "code": "ok", "payload": {} }
But the tags are not updated, check the screenshot
These are my findings
STEP: 1 - Nodebb-WriteAPI
in write api plugin for the api/api/v2/posts/:pid
verify From line number 19 to 33
https://github.com/NodeBB/nodebb-plugin-write-api/blob/master/routes/v2/posts.js#L19Here the tags are added into
options
object - #Line: 29in write api the final object looks like this
{ uid: 18, pid: '17', content: 'Edit my own post alsong with tags', options: { tags: [ 'edit', 'update', 'tagCheck' ] }, title: 'Edit post' }
STEP:2 - NodeBB (POSTS section)
As par the above git link #lineNo: 31 we are calling parent funtionposts.edit
so that will come to NodeBBsrc/posts/edit.js
file.
Verify Here:
https://github.com/NodeBB/NodeBB/blob/master/src/posts/edit.js#L126You are access the tags from data object
data.tags
but Actually tags present indata.options.tags
Referencs Data object in Nodebb
{ uid: 18, pid: '17', content: 'Edit my own post alsong with tags', options: { tags: [ 'edit', 'update', 'tagCheck' ] }, title: 'Edit post' }
And finally The updated data object looks like
{ tid: 17, cid: 2, uid: 18, title: 'Edit post', oldTitle: 'Edit post', slug: '17/edit-post', isMainPost: true, renamed: false, tags: [] }
Because off the tags access from wrong place, causing issue for updating the tags while editing the post
my local practice
- in my local I changed the tags accessing in Nodebb(
/src/posts/edit.js#LineNo: 126
) fromdata.tags = data.tags || [];
todata.tags = data.options.tags || [];
After that the tags are updating for that post
CC: @vinu
- in my local I changed the tags accessing in Nodebb(
-
Unable to edit the post privilages issues
Unable to edit the post privilages error
-
Any api to get list of categories based on group
@baris
In nodebb privileges section we can add the group for a particular categoryso, Is there any api to get those category list which is having a particular group.
Example:
I created a group calledcategory_owner
and under privileges section, I added this group for some categories and gave some privileges.Now I want that category list which is having that group
category_owner
.How can I get that list?
is there any api to get those list?Thanks.
-
Any api to get all categories based on group
In nodebb privileges section we can add the group for a particular category
so, Is there any api to get those category list which is having a particular group.
-
Topic viewcount always increasing for every read call
Here
I am calling this api (topic details api)http://localhost:4567/api/topic/{topic_id}/{topic_slug}
from my proxy and it will always increases the viewcount.Example:
app.get('/check', (req,res)=> { const options = { url: 'http://localhost:4567/api/topic/11/testCount', method: 'GET', json: true }; request(options, (error, response, body) => { res.send(body) }) })
this is my CUrl
curl --location --request GET 'http://localhost:3002/check' \ --header 'Authorization: Bearer 5e8db636-89ec-41ea-9cf9-8309297f8ac4'
How can I get the correct viewcount.?
can anyone help on this? -
RE: Couldn't set default admin username and password in config.json
@PitaJ @vinu
I am using the above command what you mention in the post for nodebb setupnode app --setup="{\"url\":\"http://0.0.0.0:4567\",\"secret\":\"123456-eb70-4605-kkerg-720752bc4aca\",\"admin:username\":\"venkat\",\"admin:password\":\"[email protected]\",\"admin:password:confirm\":\"[email protected]\",\"admin:email\":\"[email protected]\",\"database\":\"mongo\",\"mongo\":{\"host\":\"127.0.0.1\",\"port\":\"27017\",\"username\":\"\",\"password\":\"\",\"database\":\"nodebb\"}}"
but I am unable perform login what ever the login details adding in the json string. It is always giving invalid credentials.
can you help me on that