mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-29 03:40:27 +01:00
* acp sidebar
* gap in nav
* remove shadow
* label fixes
* color fixes
* feat: settings page wip
* feat: scroll spy 👓
move social into general, store social in meta.config like other settings
write upgrade script
* remove social
* rermove openapi routes
* cleanup, highlight selected nav item
* more cleanup
* advanced margin top
* derp
* match design
* bring back version alert
fix homepage js, since it moved to general settings
* remove unused tpls
these moved to general settings
* remove more css
* offcanvas for mobile
fix search
* add timeout
* add new props
* manage categories
* small fixes
* category-edit
* feat category page fixes
* add title to settings pages
add user settings page
* small fixes
* some more settings pages
* fix: plugin page titles
* more settings pages
* more padding
* more pages, add acp paginator.tpl
so it doesn't change when active theme changes
* remove placeholder
* dashboard table
* fix: openapi
* fix: controller tests
* use fonts from core
* some small fixes
* fix rep page
* refactor: fix name of upgrade script
* create category modal
group edit
* group/groups pages
* admins mods
* privs
* uploads
* missing margin
* more acp pages
* more pages
* plugins/rewards/widgets
* wrap rewards
* fix widgets
* fix widget clone button
* fix group acp edit link
* update search dropdown
* remove display block from tbody
* use less css
* remove some derp links
* remove striped tables
* remove p tags from lang files
* update email settings
* Update api.tpl
* move tag-whitelist
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
const plugins = require('./plugins');
|
|
const db = require('./database');
|
|
const meta = require('./meta');
|
|
|
|
const social = module.exports;
|
|
|
|
social.postSharing = null;
|
|
|
|
social.getPostSharing = async function () {
|
|
if (social.postSharing) {
|
|
return _.cloneDeep(social.postSharing);
|
|
}
|
|
|
|
let networks = [
|
|
{
|
|
id: 'facebook',
|
|
name: 'Facebook',
|
|
class: 'fa-facebook',
|
|
},
|
|
{
|
|
id: 'twitter',
|
|
name: 'Twitter',
|
|
class: 'fa-twitter',
|
|
},
|
|
];
|
|
networks = await plugins.hooks.fire('filter:social.posts', networks);
|
|
networks.forEach((network) => {
|
|
network.activated = parseInt(meta.config[`post-sharing-${network.id}`], 10) === 1;
|
|
});
|
|
|
|
social.postSharing = networks;
|
|
return _.cloneDeep(networks);
|
|
};
|
|
|
|
social.getActivePostSharing = async function () {
|
|
const networks = await social.getPostSharing();
|
|
return networks.filter(network => network && network.activated);
|
|
};
|
|
|
|
social.setActivePostSharingNetworks = async function (networkIDs) {
|
|
// keeping for 1.0.0 upgrade script that uses this function
|
|
social.postSharing = null;
|
|
if (!networkIDs.length) {
|
|
return;
|
|
}
|
|
const data = {};
|
|
networkIDs.forEach((id) => {
|
|
data[`post-sharing-${id}`] = 1;
|
|
});
|
|
await db.setObject('config', data);
|
|
};
|
|
|
|
require('./promisify')(social);
|