Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[WIP] Added new create-poll button in post drafting interface (no forms linked yet) #43

Merged
merged 10 commits into from
Feb 11, 2025
Merged
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
dist/
yarn.lock
npm-debug.log
node_modules/
node_modules/*
!/node_modules/nodebb-plugin-composer-default
/node_modules/nodebb-plugin-composer-default/*
!/node_modules/nodebb-plugin-composer-default/static/
/node_modules/nodebb-plugin-composer-default/static/*
!/node_modules/nodebb-plugin-composer-default/static/templates/
/node_modules/nodebb-plugin-composer-default/static/templates/*
!/node_modules/nodebb-plugin-composer-default/static/templates/partials/
/node_modules/nodebb-plugin-composer-default/static/templates/partials/*
!/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl
sftp-config.json
config.json
jsconfig.json
Expand Down
Binary file added dump.rdb
Binary file not shown.
2 changes: 2 additions & 0 deletions public/language/en-US/admin/manage/categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"optional-clone-settings": "(Optional) Clone Settings From Category",
"clone-children": "Clone Children Categories And Settings",
"purge": "Purge Category",
"upload-files": "Upload Files",
"create-poll": "Create Poll",

"enable": "Enable",
"disable": "Disable",
Expand Down
1 change: 1 addition & 0 deletions public/language/en-US/admin/manage/privileges.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"chat-with-privileged": "Chat with Privileged",
"upload-images": "Upload Images",
"upload-files": "Upload Files",
"create-poll": "Create Poll",
"signature": "Signature",
"ban": "Ban",
"mute": "Mute",
Expand Down
1 change: 1 addition & 0 deletions public/language/en-US/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"ip-address": "IP Address",
"enter-page-number": "Enter page number",
"upload-file": "Upload file",
"create-poll": "Create Poll",
"upload": "Upload",
"uploads": "Uploads",
"allowed-file-types": "Allowed file types are %1",
Expand Down
1 change: 1 addition & 0 deletions public/language/en-US/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"composer.upload-picture": "Upload Image",
"composer.upload-file": "Upload File",
"composer.zen-mode": "Zen Mode",
"composer.create-poll": "Create Poll",
"composer.select-category": "Select a category",
"composer.textarea.placeholder": "Enter your post content here, drag and drop images",
"composer.post-queue-alert": "Hello👋!<br/>This forum uses a post queue system, since you are a new user your post will be hidden until it is approved by our moderation team.",
Expand Down
1 change: 1 addition & 0 deletions src/cli/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function setup(initConfig) {
configFile = path.resolve(paths.baseDir, config);
}

console.log('===000===000=== SETTING UP');
const data = await install.setup();

prestart.loadConfig(configFile);
Expand Down
31 changes: 27 additions & 4 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,26 @@ async function createGlobalModeratorsGroup() {
await groups.show('Global Moderators');
}

async function createInstructorsGroup() {
console.log('===000===000===CREATING INSTRUCTORS');
const groups = require('./groups');
const exists = await groups.exists('Instructors');
if (exists) {
winston.info('Instructor group found, skipping creation!');
} else {
await groups.create({
name: 'Instructors',
userTitle: 'Instructor',
userTitleEnabled: 1,
description: 'Professors and TAs',
hidden: 0,
private: 1,
disableJoinRequests: 1,
});
}
await groups.show('Instructors');
}

async function giveGlobalPrivileges() {
const privileges = require('./privileges');
const defaultPrivileges = [
Expand All @@ -431,11 +451,13 @@ async function giveGlobalPrivileges() {
'groups:local:login',
];
await privileges.global.give(defaultPrivileges, 'registered-users');
await privileges.global.give(defaultPrivileges.concat(['groups:view:users:info']), 'Instructors');
console.log('===000===000===GAVE INSTRUCTORS PERMS');
await privileges.global.give(defaultPrivileges.concat([
'groups:ban', 'groups:upload:post:file', 'groups:view:users:info',
]), 'Global Moderators');
await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:view:groups'], 'guests');
await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:view:groups'], 'spiders');
'groups:ban', 'groups:upload:post:file', 'create-poll']), 'Global Moderators');
await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:view:groups', 'create-poll'], 'guests');
await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:view:groups', 'create-poll'], 'spiders');
await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:upload:post:file', 'groups:view:groups', 'create-poll'], 'Instructors');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwjulie can you review this and see if these changes will break anything (I don't think they will but I'm also not 100% sure if this is necessary). I was attempting to add create-poll as a privilege to all the current roles. 😆 ❤️ ☮️ ✌️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Adding the create-polls privilege should not cause issues with anything I have implemented.

}

async function createCategories() {
Expand Down Expand Up @@ -587,6 +609,7 @@ install.setup = async function () {
await createDefaultUserGroups();
const adminInfo = await createAdministrator();
await createGlobalModeratorsGroup();
await createInstructorsGroup();
await giveGlobalPrivileges();
await createMenuItems();
await createWelcomePost();
Expand Down