Skip to content

Commit

Permalink
Merge pull request #26 from CMU-313/anonymous-feature
Browse files Browse the repository at this point in the history
Anonymous feature - merge to main branch (front & back)
  • Loading branch information
Driftedboat authored Sep 25, 2024
2 parents aef0de0 + 6135e58 commit 1ba80bc
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 27 deletions.
67 changes: 46 additions & 21 deletions node_modules/nodebb-plugin-composer-default/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/posts/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = function (Posts) {
tid: tid,
content: content,
timestamp: timestamp,
anonymous: data.anonymous ? 1 : 0, // Added anonymous status

Check failure on line 38 in src/posts/create.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Multiple spaces found before '// Added anony...'
};

if (data.toPid) {
Expand Down
16 changes: 14 additions & 2 deletions src/posts/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,25 @@ module.exports = function (Posts) {
posts: postData,
fields: fields,
});
result.posts.forEach(post => modifyPost(post, fields));
result.posts.forEach(post => {

Check failure on line 25 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Expected parentheses around arrow function argument having a body with curly braces
modifyPost(post, fields);
if (post.anonymous ==1){

Check failure on line 27 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Operator '==' must be spaced

Check failure on line 27 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Expected '===' and instead saw '=='

Check failure on line 27 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Missing space before opening brace
post.uid = null;

Check failure on line 28 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Trailing spaces not allowed
}
});
return result.posts;
};

Posts.getPostData = async function (pid) {
const posts = await Posts.getPostsFields([pid], []);
return posts && posts.length ? posts[0] : null;
if (posts && posts.length) {
const post = posts[0];
if (post.anonymous == 1) {

Check failure on line 38 in src/posts/data.js

View workflow job for this annotation

GitHub Actions / lint-and-test / test

Expected '===' and instead saw '=='
post.uid = null;
}
return post;
}
return null;
};

Posts.getPostsData = async function (pids) {
Expand Down

0 comments on commit 1ba80bc

Please sign in to comment.