Skip to content

Commit

Permalink
Merge branch '2.x' into sm/messages
Browse files Browse the repository at this point in the history
# Conflicts:
#	framework/core/less/common/root.less
  • Loading branch information
SychO9 committed Sep 28, 2024
2 parents 9912df2 + 5cea3d3 commit f8c1b83
Show file tree
Hide file tree
Showing 75 changed files with 1,722 additions and 897 deletions.
26 changes: 26 additions & 0 deletions extensions/akismet/js/src/admin/extend.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';

export default [
new Extend.Admin()
.setting(() => ({
setting: 'flarum-akismet.api_key',
type: 'text',
label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),
}))
.setting(() => ({
// https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/
setting: 'flarum-akismet.delete_blatant_spam',
type: 'boolean',
label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),
help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),
}))
.permission(
() => ({
icon: 'fas fa-vote-yea',
label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),
permission: 'bypassAkismet',
}),
'start'
),
];
25 changes: 3 additions & 22 deletions extensions/akismet/js/src/admin/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
import app from 'flarum/admin/app';

export { default as extend } from './extend';

app.initializers.add('flarum-akismet', () => {
app.extensionData
.for('flarum-akismet')
.registerSetting({
setting: 'flarum-akismet.api_key',
type: 'text',
label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),
})
.registerSetting({
//https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/
setting: 'flarum-akismet.delete_blatant_spam',
type: 'boolean',
label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),
help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),
})
.registerPermission(
{
icon: 'fas fa-vote-yea',
label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),
permission: 'bypassAkismet',
},
'start'
);
// ...
});
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
import { extend } from 'flarum/common/extend';
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';

app.initializers.add('flarum-approval', () => {
extend(app, 'getRequiredPermissions', function (required, permission) {
if (permission === 'discussion.startWithoutApproval') {
required.push('startDiscussion');
}
if (permission === 'discussion.replyWithoutApproval') {
required.push('discussion.reply');
}
});

app.extensionData
.for('flarum-approval')
.registerPermission(
{
export default [
new Extend.Admin()
.permission(
() => ({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),
permission: 'discussion.startWithoutApproval',
},
}),
'start',
95
)
.registerPermission(
{
.permission(
() => ({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),
permission: 'discussion.replyWithoutApproval',
},
}),
'reply',
95
)
.registerPermission(
{
.permission(
() => ({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),
permission: 'discussion.approvePosts',
},
}),
'moderate',
65
);
});
),
];
15 changes: 15 additions & 0 deletions extensions/approval/js/src/admin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { extend } from 'flarum/common/extend';
import app from 'flarum/admin/app';

export { default as extend } from './extend';

app.initializers.add('flarum-approval', () => {
extend(app, 'getRequiredPermissions', function (required, permission) {
if (permission === 'discussion.startWithoutApproval') {
required.push('startDiscussion');
}
if (permission === 'discussion.replyWithoutApproval') {
required.push('discussion.reply');
}
});
});
15 changes: 15 additions & 0 deletions extensions/approval/js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use Flarum's tsconfig as a starting point
"extends": "flarum-tsconfig",
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
// and also tells your Typescript server to read core's global typings for
// access to `dayjs` and `$` in the global namespace.
"include": ["src/**/*", "../../../*/*/js/dist-typings/@types/**/*", "@types/**/*"],
"compilerOptions": {
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';
import { version } from '../common/cdn';

app.initializers.add('flarum-emoji', () => {
app.extensionData.for('flarum-emoji').registerSetting({
export default [
new Extend.Admin().setting(() => ({
setting: 'flarum-emoji.cdn',
type: 'text',
label: app.translator.trans('flarum-emoji.admin.settings.cdn_label'),
help: app.translator.trans('flarum-emoji.admin.settings.cdn_help', {
version: version,
}),
});
});
})),
];
7 changes: 7 additions & 0 deletions extensions/emoji/js/src/admin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import app from 'flarum/admin/app';

export { default as extend } from './extend';

app.initializers.add('flarum-emoji', () => {
// ...
});
15 changes: 15 additions & 0 deletions extensions/emoji/js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use Flarum's tsconfig as a starting point
"extends": "flarum-tsconfig",
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
// and also tells your Typescript server to read core's global typings for
// access to `dayjs` and `$` in the global namespace.
"include": ["src/**/*", "../../../*/*/js/dist-typings/@types/**/*", "@types/**/*"],
"compilerOptions": {
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
37 changes: 37 additions & 0 deletions extensions/flags/js/src/admin/extend.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';

export default [
new Extend.Admin()
.setting(
() => ({
setting: 'flarum-flags.guidelines_url',
type: 'text',
label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'),
}),
15
)
.setting(() => ({
setting: 'flarum-flags.can_flag_own',
type: 'boolean',
label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'),
}))
.permission(
() => ({
icon: 'fas fa-flag',
label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
permission: 'discussion.viewFlags',
}),
'moderate',
65
)
.permission(
() => ({
icon: 'fas fa-flag',
label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),
permission: 'discussion.flagPosts',
}),
'reply',
65
),
];
37 changes: 3 additions & 34 deletions extensions/flags/js/src/admin/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
import app from 'flarum/admin/app';

app.initializers.add('flarum-flags', () => {
app.extensionData
.for('flarum-flags')
.registerSetting(
{
setting: 'flarum-flags.guidelines_url',
type: 'text',
label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'),
},
15
)
.registerSetting({
setting: 'flarum-flags.can_flag_own',
type: 'boolean',
label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'),
})
.registerPermission(
{
icon: 'fas fa-flag',
label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
permission: 'discussion.viewFlags',
},
'moderate',
65
)
export { default as extend } from './extend';

.registerPermission(
{
icon: 'fas fa-flag',
label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),
permission: 'discussion.flagPosts',
},
'reply',
65
);
app.initializers.add('flarum-flags', () => {
// ...
});
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';
import commonExtend from '../common/extend';

app.initializers.add('flarum-likes', () => {
app.extensionData
.for('flarum-likes')
.registerPermission(
{
export default [
...commonExtend,

new Extend.Admin()
.permission(
() => ({
icon: 'far fa-thumbs-up',
label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'),
permission: 'discussion.likePosts',
},
}),
'reply'
)
.registerSetting({
.setting(() => ({
setting: 'flarum-likes.like_own_post',
type: 'bool',
label: app.translator.trans('flarum-likes.admin.settings.like_own_posts_label'),
help: app.translator.trans('flarum-likes.admin.settings.like_own_posts_help'),
});
});
})),
];
7 changes: 7 additions & 0 deletions extensions/likes/js/src/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import app from 'flarum/admin/app';

export { default as extend } from './extend';

app.initializers.add('flarum-likes', () => {
// ...
});
1 change: 0 additions & 1 deletion extensions/lock/js/src/admin/extend.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';
import commonExtend from '../common/extend';

export { default as extend } from './extend';
export default [
...commonExtend,

app.initializers.add('flarum-lock', () => {
app.extensionData.for('flarum-lock').registerPermission(
{
new Extend.Admin().permission(
() => ({
icon: 'fas fa-lock',
label: app.translator.trans('flarum-lock.admin.permissions.lock_discussions_label'),
permission: 'discussion.lock',
},
}),
'moderate',
95
);
});
),
];
7 changes: 7 additions & 0 deletions extensions/lock/js/src/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import app from 'flarum/admin/app';

export { default as extend } from './extend';

app.initializers.add('flarum-lock', () => {
// ...
});
22 changes: 21 additions & 1 deletion extensions/mentions/js/src/admin/extend.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
import Extend from 'flarum/common/extenders';
import app from 'flarum/admin/app';
import commonExtend from '../common/extend';

export default [...commonExtend];
export default [
...commonExtend,

new Extend.Admin()
.setting(() => ({
setting: 'flarum-mentions.allow_username_format',
type: 'boolean',
label: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_label'),
help: app.translator.trans('flarum-mentions.admin.settings.allow_username_format_text'),
}))
.permission(
() => ({
permission: 'mentionGroups',
label: app.translator.trans('flarum-mentions.admin.permissions.mention_groups_label'),
icon: 'fas fa-at',
}),
'start'
),
];
22 changes: 0 additions & 22 deletions extensions/mentions/js/src/admin/index.js

This file was deleted.

Loading

0 comments on commit f8c1b83

Please sign in to comment.