mirror of
https://github.com/chenasraf/nextcloud-forum.git
synced 2026-05-18 01:28:58 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae5ed0cbd4 | |||
| f2adfa8389 | |||
| b8da663739 | |||
| 0b2efa576e | |||
| c884e82505 | |||
| d8883aa40a | |||
| 6b049bdda3 | |||
| d84dd62cf0 |
@@ -1 +1 @@
|
||||
{".":"0.1.3"}
|
||||
{".":"0.1.5"}
|
||||
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
||||
# Changelog
|
||||
|
||||
## [0.1.5](https://github.com/chenasraf/nextcloud-forum/compare/v0.1.4...v0.1.5) (2025-11-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* schema seed stage ([f2adfa8](https://github.com/chenasraf/nextcloud-forum/commit/f2adfa838945c39f676292fe2119db996b9387bb))
|
||||
|
||||
## [0.1.4](https://github.com/chenasraf/nextcloud-forum/compare/v0.1.3...v0.1.4) (2025-11-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add app icon ([d8883aa](https://github.com/chenasraf/nextcloud-forum/commit/d8883aa40a419ceb93bf909b41f5e23ae008810e))
|
||||
* migration default values ([6b049bd](https://github.com/chenasraf/nextcloud-forum/commit/6b049bdda3016b437323202b1653f4db7a9b9dae))
|
||||
* migration seed step + admin user fetching ([0b2efa5](https://github.com/chenasraf/nextcloud-forum/commit/0b2efa576e2872c5a2115e45b537ea1bb7f63349))
|
||||
|
||||
## [0.1.3](https://github.com/chenasraf/nextcloud-forum/compare/v0.1.2...v0.1.3) (2025-11-15)
|
||||
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@@ -152,6 +152,7 @@ source:
|
||||
--exclude="node_modules" \
|
||||
--exclude="*.log" \
|
||||
--exclude="dist/js/*.log" \
|
||||
--exclude="rename-template.sh" \
|
||||
$(CURDIR)/ $(source_intermediate_directory)
|
||||
cd $(source_intermediate_directory) && \
|
||||
tar czf $(source_package_name).tar.gz ../$(app_name)
|
||||
@@ -190,6 +191,7 @@ appstore:
|
||||
--exclude=".*" \
|
||||
--exclude="dist/js/.*" \
|
||||
--exclude="src" \
|
||||
--exclude="rename-template.sh" \
|
||||
$(CURDIR)/ $(app_intermediate_directory)
|
||||
cd $(app_intermediate_directory) && \
|
||||
tar czf $(appstore_package_name).tar.gz ../$(app_name)
|
||||
|
||||
@@ -30,8 +30,7 @@ Install Forum directly from your Nextcloud instance through the Apps page.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
1. Download the latest release from the
|
||||
[releases page](https://github.com/yourusername/forum/releases)
|
||||
1. Download the latest release from the [releases page](https://github.com/chenasraf/forum/releases)
|
||||
2. Extract to your Nextcloud apps directory:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -33,7 +33,7 @@ Create discussions, share ideas, and collaborate with your community directly in
|
||||
|
||||
The forum integrates seamlessly with your Nextcloud instance, using your existing users and groups for authentication and access control.
|
||||
]]></description>
|
||||
<version>0.1.3</version>
|
||||
<version>0.1.5</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="contact@casraf.dev" homepage="https://casraf.dev">Chen Asraf</author>
|
||||
<namespace>Forum</namespace>
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0z" fill="none"/><path d="M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"/></svg>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path id="app-light" d="M17,12L17,3C17,2.451 16.549,2 16,2L3,2C2.451,2 2,2.451 2,3L2,17L6,13L16,13C16.549,13 17,12.549 17,12M21,6L19,6L19,15L6,15L6,17C6,17.549 6.451,18 7,18L18,18L22,22L22,7C22,6.451 21.549,6 21,6Z" style="fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 699 B |
@@ -1 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#fff"><path d="M0 0h24v24H0z" fill="none"/><path d="M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"/></svg>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path id="app" d="M17,12L17,3C17,2.451 16.549,2 16,2L3,2C2.451,2 2,2.451 2,3L2,17L6,13L16,13C16.549,13 17,12.549 17,12M21,6L19,6L19,15L6,15L6,17C6,17.549 6.451,18 7,18L18,18L22,22L22,7C22,6.451 21.549,6 21,6Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 704 B |
@@ -19,6 +19,7 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
* @param array $options
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,13 +66,16 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
'notnull' => false,
|
||||
]);
|
||||
$table->addColumn('can_access_admin_tools', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('can_edit_roles', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('can_edit_categories', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('created_at', 'integer', [
|
||||
'notnull' => true,
|
||||
@@ -257,16 +261,20 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
'unsigned' => true,
|
||||
]);
|
||||
$table->addColumn('can_view', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => true,
|
||||
]);
|
||||
$table->addColumn('can_post', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('can_reply', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('can_moderate', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
$table->addIndex(['category_id'], 'forum_cat_perms_category_idx');
|
||||
@@ -299,13 +307,16 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
'notnull' => false,
|
||||
]);
|
||||
$table->addColumn('enabled', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => true,
|
||||
]);
|
||||
$table->addColumn('parse_inner', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => true,
|
||||
]);
|
||||
$table->addColumn('is_builtin', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('special_handler', 'string', [
|
||||
'notnull' => false,
|
||||
@@ -362,13 +373,16 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
'unsigned' => true,
|
||||
]);
|
||||
$table->addColumn('is_locked', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('is_pinned', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('is_hidden', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('created_at', 'integer', [
|
||||
'notnull' => true,
|
||||
@@ -418,10 +432,12 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
'length' => 255,
|
||||
]);
|
||||
$table->addColumn('is_edited', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('is_first_post', 'boolean', [
|
||||
'notnull' => true,
|
||||
'notnull' => false,
|
||||
'default' => false,
|
||||
]);
|
||||
$table->addColumn('edited_at', 'integer', [
|
||||
'notnull' => false,
|
||||
@@ -520,8 +536,17 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
* @param array $options
|
||||
*/
|
||||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||
// Seed initial data after schema is created
|
||||
$this->seedInitialData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed initial data after schema is created
|
||||
*/
|
||||
private function seedInitialData(): void {
|
||||
$db = \OC::$server->get(\OCP\IDBConnection::class);
|
||||
$userManager = \OC::$server->get(\OCP\IUserManager::class);
|
||||
$groupManager = \OC::$server->get(\OCP\IGroupManager::class);
|
||||
$timestamp = time();
|
||||
|
||||
// Check if data has already been seeded by looking for the Admin role
|
||||
@@ -538,8 +563,18 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create default roles
|
||||
// Find first admin user (fallback to 'admin' if no admin group members found)
|
||||
$adminUserId = 'admin';
|
||||
$adminGroup = $groupManager->get('admin');
|
||||
if ($adminGroup) {
|
||||
$adminUsers = $adminGroup->getUsers();
|
||||
if (!empty($adminUsers)) {
|
||||
$firstAdmin = reset($adminUsers);
|
||||
$adminUserId = $firstAdmin->getUID();
|
||||
}
|
||||
}
|
||||
|
||||
// Create default roles
|
||||
$qb = $db->getQueryBuilder();
|
||||
$qb->insert('forum_roles')
|
||||
->values([
|
||||
@@ -670,9 +705,6 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
}
|
||||
|
||||
// Create default BBCodes
|
||||
// Note: Most BBCode tags (b, i, u, s, code, email, url, img, quote, youtube, font, size, color, etc.)
|
||||
// are provided by the chriskonnertz/bbcode library and don't need to be stored in the database.
|
||||
// We only store custom BBCodes that extend the library's functionality.
|
||||
$bbcodes = [
|
||||
[
|
||||
'tag' => 'icode',
|
||||
@@ -721,9 +753,6 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
}
|
||||
|
||||
// Assign roles to all Nextcloud users
|
||||
$groupManager = \OC::$server->get(\OCP\IGroupManager::class);
|
||||
$adminGroup = $groupManager->get('admin');
|
||||
|
||||
$userManager->callForAllUsers(function ($user) use ($db, $timestamp, $userRoleId, $adminRoleId, $adminGroup) {
|
||||
$userId = $user->getUID();
|
||||
$isAdmin = $adminGroup && $adminGroup->inGroup($user);
|
||||
@@ -756,7 +785,7 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
$qb->insert('forum_threads')
|
||||
->values([
|
||||
'category_id' => $qb->createNamedParameter($generalCategoryId, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
'author_id' => $qb->createNamedParameter('admin'),
|
||||
'author_id' => $qb->createNamedParameter($adminUserId),
|
||||
'title' => $qb->createNamedParameter('Welcome to Nextcloud Forums'),
|
||||
'slug' => $qb->createNamedParameter('welcome-to-nextcloud-forums'),
|
||||
'view_count' => $qb->createNamedParameter(0, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
@@ -796,7 +825,7 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
$qb->insert('forum_posts')
|
||||
->values([
|
||||
'thread_id' => $qb->createNamedParameter($threadId, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
'author_id' => $qb->createNamedParameter('admin'),
|
||||
'author_id' => $qb->createNamedParameter($adminUserId),
|
||||
'content' => $qb->createNamedParameter($welcomeContent),
|
||||
'slug' => $qb->createNamedParameter('welcome-to-nextcloud-forums-1'),
|
||||
'is_edited' => $qb->createNamedParameter(false, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_BOOL),
|
||||
@@ -815,11 +844,11 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($threadId, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT)))
|
||||
->executeStatement();
|
||||
|
||||
// Create user stats for admin (who created the welcome post/thread)
|
||||
// Create user stats for the admin user (who created the welcome post/thread)
|
||||
$qb = $db->getQueryBuilder();
|
||||
$qb->insert('forum_user_stats')
|
||||
->values([
|
||||
'user_id' => $qb->createNamedParameter('admin'),
|
||||
'user_id' => $qb->createNamedParameter($adminUserId),
|
||||
'post_count' => $qb->createNamedParameter(1, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
'thread_count' => $qb->createNamedParameter(1, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
'last_post_at' => $qb->createNamedParameter($timestamp, \OCP\DB\QueryBuilder\IQueryBuilder::PARAM_INT),
|
||||
@@ -828,4 +857,5 @@ class Version1Date20251106004226 extends SimpleMigrationStep {
|
||||
])
|
||||
->executeStatement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.1.3
|
||||
0.1.5
|
||||
|
||||
Reference in New Issue
Block a user