Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4e00691
Post structs have an anonymous boolean field
568cats Feb 6, 2026
21fb580
Updated post database schema to account for anon
568cats Feb 6, 2026
6018d76
added buttons for anonymous posting in quick reply and post
Feb 7, 2026
c4b5f4e
Add anonymous field tests for coverage report
568cats Feb 7, 2026
15e7366
add switching username to anonymous front-end
sliang-code Feb 8, 2026
ba6221f
Merge remote-tracking branch 'origin/anon-posts-struct' into 13-integ…
eseudieu Feb 8, 2026
710f0b3
Merge remote-tracking branch 'origin/anonymous_feature_display' into …
eseudieu Feb 8, 2026
6df9df6
Anonymous profile image
sliang-code Feb 8, 2026
85eea87
fixed indents
Feb 9, 2026
296e915
fixed incorrect modifications in src/topics/create.js
Feb 9, 2026
d6ad3d6
fixed ordering issue in create.js
Feb 9, 2026
4d4ff04
solving referencing/overwrite issue
sliang-code Feb 10, 2026
c5e4947
CI test fix
sliang-code Feb 10, 2026
39b3429
CI test fix2
sliang-code Feb 10, 2026
a360f94
Anonymous field in db schema has default value
568cats Feb 10, 2026
d0681b4
Remove flaky CI test
568cats Feb 10, 2026
d521513
Merge branch 'feat/anonymous-posting-buttons' of https://github.com/C…
568cats Feb 10, 2026
d696799
Anonymous field set for quickreplies
568cats Feb 10, 2026
64dd0d5
Anonymous field for posts read from 'Post Anonymously' checkbox
568cats Feb 10, 2026
dee299c
fix postObj.anonymous type issue
sliang-code Feb 11, 2026
8f34425
Merge pull request #25 from CMU-313/anonymous_feature_display
sliang-code Feb 11, 2026
fca7891
Merge pull request #27 from CMU-313/anon-posts-backend
568cats Feb 11, 2026
ce5d7d8
Merge branch 'main' into 13-integration
eseudieu Feb 11, 2026
0df6420
Merge pull request #23 from CMU-313/13-integration
eseudieu Feb 11, 2026
5fed818
Posts and replies have "Forward Post" button
568cats Feb 21, 2026
eed77b7
Composer text editor shows forwarded posts
568cats Feb 22, 2026
7cbb796
Create UserGuide.md
568cats Feb 23, 2026
956d452
Merge pull request #31 from CMU-313/create-UserGuide
568cats Feb 23, 2026
792f3b9
Merge branch 'main' of https://github.com/CMU-313/nodebb-spring-26-te…
568cats Feb 23, 2026
9e94de4
added heat to dropdown in front end
eseudieu Feb 26, 2026
a9f7632
Add forwarded posts reply test
568cats Feb 26, 2026
cb9641a
Create separate function to create forwarded text
568cats Feb 26, 2026
7cd58e2
Revert "Create separate function to create forwarded text"
568cats Feb 26, 2026
69aaf3c
added heat sorting functionality
eseudieu Feb 26, 2026
173441e
Maintain custom text when forwarding posts
568cats Feb 26, 2026
b465992
added test for topic heat sort
eseudieu Feb 26, 2026
4b35df0
fixed lint errors and warnings
eseudieu Feb 26, 2026
2858c50
Cannot forward post to its own topic
568cats Feb 27, 2026
af1ce7b
Revert "Cannot forward post to its own topic"
568cats Feb 27, 2026
000acb4
Cannot forward post to its own topic
568cats Feb 27, 2026
2cbdaf7
Ensure user chooses a topic to forward to
568cats Feb 27, 2026
1485003
Add error messages for forwarding posts
568cats Feb 27, 2026
8433189
Test that error thrown when forward to same topic
568cats Feb 27, 2026
5ea357e
Merge pull request #35 from CMU-313/30-sort-posts-by-attributes
568cats Feb 27, 2026
ae1cc80
Revert "30 sort posts by attributes"
568cats Feb 27, 2026
aef08e1
Merge pull request #38 from CMU-313/revert-35-30-sort-posts-by-attrib…
568cats Feb 27, 2026
4f93434
Add Forwarded posts feature to user guide
568cats Feb 27, 2026
ba2e8ea
Update UserGuide.md for forwarded posts
568cats Feb 27, 2026
403942b
Add a page refresh each time the user makes a reply or post. Fixed th…
sliang-code Feb 27, 2026
92c80ff
fixed test not passing, added more robust testing
eseudieu Feb 28, 2026
8bbb7f3
fixed lint issues in test/topic/heat.js
eseudieu Feb 28, 2026
f5a9813
updated userguide.md
eseudieu Feb 28, 2026
eaa277f
Revert "Revert "30 sort posts by attributes""
eseudieu Feb 28, 2026
61697cb
Assign Verify Post Privilege to Admin and Privilege Management
sliang-code Feb 28, 2026
bed1072
Add tests for privilege verify post
sliang-code Feb 28, 2026
acfb90f
node test fix - local verify = false
sliang-code Feb 28, 2026
97ea4de
Merge pull request #45 from CMU-313/revert-38-revert-35-30-sort-posts…
eseudieu Feb 28, 2026
f600021
Merge pull request #41 from CMU-313/30-sort-posts-by-attributes
eseudieu Feb 28, 2026
5be3311
node test fix - local verify = false fix2
sliang-code Feb 28, 2026
63511ef
Update User Guide with new features and testing details
568cats Feb 28, 2026
e8fb4e6
Merge pull request #46 from CMU-313/568cats-patch-1
568cats Feb 28, 2026
51f57e0
node test fix - local verify = false fix3
sliang-code Feb 28, 2026
0f0867b
node test fix - local verify = false fix4
sliang-code Feb 28, 2026
abf5566
Merge branch 'main' into feat/backend_verify_privilege_design
sliang-code Feb 28, 2026
ffa8de6
Merge pull request #40 from CMU-313/fix/anonymous_reply_page_refresh
sliang-code Feb 28, 2026
1b5d9c6
Merge pull request #43 from CMU-313/feat/backend_verify_privilege_design
sliang-code Mar 1, 2026
8ced81f
Add user specification for NodeBB service (reci 7)
568cats Mar 9, 2026
dde1d14
Merge pull request #47 from CMU-313/568cats-patch-1
568cats Mar 9, 2026
ec1fd61
Update VM Deploy.yml (reci 7)
Mar 9, 2026
c515023
Create 'VM Deploy.yml' (reci 7)
568cats Mar 9, 2026
18464d8
Merge pull request #48 from CMU-313/568cats-patch-1
568cats Mar 9, 2026
84d1fd0
Merge branch 'main' into feat/forward-posts
568cats Mar 9, 2026
fce991a
Merge pull request #33 from CMU-313/feat/forward-posts
568cats Mar 9, 2026
de792fa
completed setup and running retire.js
pebble-fish Mar 11, 2026
c1ab8df
Merge pull request #55 from CMU-313/tests/retirejs
568cats Mar 16, 2026
39baaaf
Add retire command to CI on GitHub
568cats Mar 16, 2026
515b93d
Install retire.js in github workflow
568cats Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/VM Deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: VM Deploy NodeBB

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
build-and-deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.17.0'

- name: Deploy via SSH
uses: appleboy/ssh-action@v1.2.1
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_ADMIN }}
password: ${{ secrets.ADMIN_PASSWORD }}
script: |
cd ${{ secrets.REPO_NAME }}
git pull origin main
docker compose down
docker compose -f docker-compose-redis.yml up --build -d
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ jobs:
- name: Node tests
run: npm test

- name: Install retire.js
run: npm install -g retire

- name: Run retire.js
run: retire

- name: Extract coverage info
run: npm run coverage

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ test.sh
dump.rdb
.archiver_shadow/
.snapshots/

# stryker temp files
.stryker-tmp
249 changes: 249 additions & 0 deletions TOPIC_DISPLAY_ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
# Topic Display Architecture - Complete Tracing Guide

## Overview
When a user views a topic/post in NodeBB, multiple files work together to fetch, process, and display all the topic information (title, content, tags, posting user, etc.).

---

## Primary Files in the Display Flow

### 1. **Main Controller: `/src/controllers/topics.js`** ⭐ **PRIMARY FILE**

**This is the MAIN file responsible for displaying a topic with all information.**

**Key Function:** `topicsController.get()` (lines 25-157)

**What it does:**
- Receives HTTP GET request for a topic (line 25)
- Fetches basic topic data using `topics.getTopicData(tid)` (line 33)
- Gets user privileges and permissions (lines 37-43)
- Fetches all posts in the topic using `topics.getTopicWithPosts()` (line 85)
- Modifies posts based on user privileges (line 87)
- Builds breadcrumbs navigation (lines 176-184)
- Adds tags to the topic data (lines 199-274)
- Fetches topic author information (line 129)
- Gets crossposts (line 131)
- Creates pagination data (line 133-138)
- Prepares metadata tags (SEO, OpenGraph) (lines 193-272)
- **Finally renders the template with all data** (line 157):
```javascript
res.render('topic', topicData);
```

**All Available Variables in `topicData`:**
- `tid` - Topic ID
- `cid` - Category ID
- `title` - Topic title (escaped)
- `titleRaw` - Topic title (raw)
- `content` - Main post content
- `posts` - Array of all posts in the topic
- Each post contains:
- `pid` - Post ID
- `uid` - User ID
- `content` - Post content
- `timestamp` - Post creation time
- `edited` - Last edit time
- `user` - User object with username, userslug, picture, reputation, etc.
- `index` - Post index/position
- `votes` - Vote count
- `replies` - Nested replies data
- `uid` - Topic creator ID
- `author` - Topic creator object (username, userslug)
- `category` - Category object (name, icon, slug, cid)
- `tags` - Array of tags
- `thumbs` - Array of thumbnail images
- `postcount` - Total number of posts
- `lastposttime` - Timestamp of last post
- `lastposter` - Last poster information
- `upvotes` - Total upvotes on topic
- `downvotes` - Total downvotes
- `views` - View count
- `privileges` - User privileges object
- `pagination` - Pagination data
- `breadcrumbs` - Navigation breadcrumbs
- And many more metadata fields...

---

### 2. **Topic Data Module: `/src/topics/index.js`**

**Provides data fetching functions used by the controller.**

**Key Functions:**
- `Topics.getTopicData(tid)` - Fetches single topic metadata
- Returns: topic ID, title, category, creator info, timestamps, etc.

- `Topics.getTopicWithPosts(topicData, set, uid, start, stop, reverse)` (line 158)
- **Fetches all posts for a topic with complete data**
- Calls `Topics.getTopicPosts()` to get posts array
- Each post includes: content, user data, timestamp, votes, etc.
- Returns enriched topicData with `posts` array attached

- `Topics.getTopicsData(tids)` - Gets metadata for multiple topics

- `Topics.addPostData(postData, uid)` - Enriches post data with user info

---

### 3. **Topic Posts Module: `/src/topics/posts.js`**

**Handles fetching and processing posts within a topic.**

**Key Functions:**
- `Topics.getTopicPosts(topicData, set, start, stop, uid, reverse)` (line 22)
- Gets posts from a specific range/index
- Includes main post and nested replies
- Filters based on user privileges
- Enriches with user data, timestamps, content

- `Topics.getTopicWithPosts()` - Main function that orchestrates the post fetching
- Uses `posts.getPostsByPids()` to fetch post content
- Enumerates events (edits, moves, etc.)

---

### 4. **Posts Module: `/src/posts/index.js`**

**Low-level post data retrieval.**

**Key Functions:**
- `Posts.getPostsByPids(pids, uid)` - Gets post content by post IDs
- Returns: pid, uid, content, timestamp, edited, votes, etc.

- `Posts.getPostsFields(pids, fields)` - Gets specific fields from posts

---

### 5. **Main Template: `/vendor/nodebb-theme-harmony-main/templates/topic.tpl`** ⭐ **PRIMARY TEMPLATE**

**This is the main HTML template that renders all topic information.**

**What it displays:**
```html
<!-- Breadcrumbs navigation -->
<!-- IMPORT partials/breadcrumbs-json-ld.tpl -->

<!-- Topic title and metadata -->
<h1 component="post/header">{title}</h1>

<!-- Topic labels (scheduled, pinned, locked) -->
<!-- Topic category and tags -->
<span component="topic/tags">
<!-- IMPORT partials/topic/tags.tpl -->
</span>

<!-- Topic statistics (replies, views, votes) -->
<div component="topic/stats">
<!-- IMPORT partials/topic/stats.tpl -->
</div>

<!-- Topic thumbnails -->
<div component="topic/thumb/list">
<!-- IMPORT partials/topic/thumbs.tpl -->
</div>

<!-- Posts list -->
<ul component="topic" class="posts timeline">
{{{ each posts }}}
<li component="post">
<!-- IMPORT partials/topic/post.tpl -->
<!-- Each post displays:
- Post content
- User info (avatar, username, reputation)
- Timestamp
- Edit history
- Votes
- Reply buttons
-->
</li>
{{{ end }}}
</ul>

<!-- Pagination -->
<!-- IMPORT partials/paginator.tpl -->

<!-- Sidebar widgets -->
```

---

### 6. **Supporting Partial Templates:**

- `/src/views/partials/topic/post.tpl` - Renders individual post with user info
- `/src/views/partials/topic/tags.tpl` - Renders topic tags
- `/src/views/partials/topic/stats.tpl` - Renders topic statistics (replies, views)
- `/src/views/partials/topic/thumbs.tpl` - Renders thumbnail images
- `/src/views/partials/data/topic.tpl` - Post data attributes (line 1 shows data structure)

---

## Data Flow Diagram

```
HTTP GET /topic/123/slug
/src/controllers/topics.js::getTopic()
topics.getTopicData(tid) → Fetch topic metadata
topics.getTopicWithPosts() → Fetch posts array
/src/topics/index.js::getTopicWithPosts()
Topics.getTopicPosts() → Get posts from set
/src/topics/posts.js::getTopicPosts()
posts.getPostsByPids(pids, uid) → Get post content
user.getUsersFields() → Get user info for each post
Enrich with: votes, edits, timestamps, privileges, etc.
Build topicData object with all fields (title, posts, author, category, tags, etc.)
res.render('topic', topicData)
/vendor/nodebb-theme-harmony-main/templates/topic.tpl
HTML rendered with all topic information displayed
```

---

## Variable Mapping: From Controller to Template

### Controller Variables → Template Usage

| Controller Variable | Template Variable | Template File |
|---|---|---|
| `tid` | `{tid}` | topic.tpl |
| `title` | `{title}` | topic.tpl |
| `titleRaw` | `{titleRaw}` | For SEO |
| `posts[]` | `{posts}` | topic.tpl (each loop) |
| `posts[].content` | `{posts.content}` | partials/topic/post.tpl |
| `posts[].user` | `{posts.user}` | Shows username, avatar, reputation |
| `posts[].timestamp` | `{posts.timestamp}` | Shows post time |
| `posts[].index` | `{posts.index}` | Post position tracking |
| `category` | `{category}` | Topic header - shows category badge |
| `tags` | `{tags}` | partials/topic/tags.tpl |
| `author` | `{author}` | Topic creator info |
| `upvotes` | `{upvotes}` | Statistics display |
| `postcount` | `{postcount}` | Statistics - total replies |
| `thumbs` | `{thumbs}` | partials/topic/thumbs.tpl |
| `privileges` | `{privileges}` | Controls edit/delete buttons visibility |

---

## Summary

**To trace any topic display variable:**

1. **START**: `/src/controllers/topics.js` - Line 25 `getTopic()` function
2. **DATA FETCH**: Uses functions from `/src/topics/index.js` and `/src/topics/posts.js`
3. **BUILD DATA**: Assembles `topicData` object with all fields
4. **RENDER**: Passes `topicData` to template engine
5. **DISPLAY**: Template `/vendor/nodebb-theme-harmony-main/templates/topic.tpl` renders HTML

All variable names are consistent between controller and template, making it easy to trace any field back to its source.

Loading
Loading