Merge branch 'link-footer-improvements' into 'develop'
Link footer improvements See merge request soapbox-pub/soapbox-fe!461
This commit is contained in:
commit
e0df861658
9 changed files with 84 additions and 12 deletions
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
- Heart reaction works on Pleroma >= 2.3.0
|
||||
- Pagination of Blocks and Mutes
|
||||
|
||||
## [1.1.0] - 2020-10-05
|
||||
### Fixed
|
||||
|
|
|
@ -7,14 +7,7 @@ import { connect } from 'react-redux';
|
|||
import { openModal } from '../../../actions/modal';
|
||||
import { logOut } from 'soapbox/actions/auth';
|
||||
import { isStaff } from 'soapbox/utils/accounts';
|
||||
|
||||
// FIXME: Let this be configured
|
||||
const sourceCode = {
|
||||
name: 'soapbox-fe',
|
||||
url: 'https://gitlab.com/soapbox-pub/soapbox-fe',
|
||||
repository: 'soapbox-pub/soapbox-fe',
|
||||
version: '1.1.0',
|
||||
};
|
||||
import sourceCode from 'soapbox/utils/code';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const me = state.get('me');
|
||||
|
|
|
@ -154,11 +154,10 @@ const LAYOUT = {
|
|||
RIGHT: null,
|
||||
},
|
||||
DEFAULT: {
|
||||
LEFT: [
|
||||
<LinkFooter key='1' />,
|
||||
],
|
||||
LEFT: null,
|
||||
RIGHT: [
|
||||
<FeaturesPanel key='0' />,
|
||||
<LinkFooter key='1' />,
|
||||
],
|
||||
},
|
||||
STATUS: {
|
||||
|
|
39
app/soapbox/utils/code.js
Normal file
39
app/soapbox/utils/code.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
// @preval
|
||||
const pkg = require('../../../package.json');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const shortRepoName = url => new URL(url).pathname.substring(1);
|
||||
const trimHash = hash => hash.substring(0, 7);
|
||||
|
||||
const version = pkg => {
|
||||
// Try to discern from GitLab CI first
|
||||
const { CI_COMMIT_TAG, CI_COMMIT_REF_NAME, CI_COMMIT_SHA } = process.env;
|
||||
|
||||
if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') {
|
||||
return pkg.version;
|
||||
}
|
||||
|
||||
if (typeof CI_COMMIT_SHA === 'string') {
|
||||
return `${pkg.version}-${trimHash(CI_COMMIT_SHA)}`;
|
||||
}
|
||||
|
||||
// Fall back to git directly
|
||||
try {
|
||||
const head = String(execSync('git rev-parse HEAD'));
|
||||
const tag = String(execSync(`git rev-parse v${pkg.version}`));
|
||||
|
||||
if (head !== tag) return `${pkg.version}-${trimHash(head)}`;
|
||||
} catch (e) {
|
||||
// Continue
|
||||
}
|
||||
|
||||
// Fall back to version in package.json
|
||||
return pkg.version;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: pkg.name,
|
||||
url: pkg.repository.url,
|
||||
repository: shortRepoName(pkg.repository.url),
|
||||
version: version(pkg),
|
||||
};
|
|
@ -5,7 +5,7 @@
|
|||
"homepage": "https://soapbox.pub/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitlab.com/soapbox-pub/soapbox-fe.git"
|
||||
"url": "https://gitlab.com/soapbox-pub/soapbox-fe"
|
||||
},
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
|
|
8
webpack/loaders/git-loader.js
Normal file
8
webpack/loaders/git-loader.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const { resolve } = require('path');
|
||||
|
||||
// Forces recompile whenever the current commit changes
|
||||
// Useful for generating the version hash in the UI
|
||||
module.exports = function(source, map) {
|
||||
this.addDependency(resolve(__dirname, '../../.git/logs/HEAD'));
|
||||
this.callback(null, source, map);
|
||||
};
|
19
webpack/rules/babel-git.js
Normal file
19
webpack/rules/babel-git.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const { resolve } = require('path');
|
||||
const { env } = require('../configuration');
|
||||
|
||||
// This is a hack, used in conjunction with rules/git-refresh.js
|
||||
// https://github.com/kentcdodds/babel-plugin-preval/issues/19
|
||||
|
||||
module.exports = {
|
||||
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: false,
|
||||
cacheCompression: env.NODE_ENV === 'production',
|
||||
compact: env.NODE_ENV === 'production',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
9
webpack/rules/git-refresh.js
Normal file
9
webpack/rules/git-refresh.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const { resolve } = require('path');
|
||||
|
||||
// Recompile code.js whenever git changes
|
||||
module.exports = {
|
||||
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
|
||||
use: {
|
||||
loader: resolve(__dirname, '../loaders/git-loader.js'),
|
||||
},
|
||||
};
|
|
@ -1,4 +1,6 @@
|
|||
const babel = require('./babel');
|
||||
const git = require('./babel-git');
|
||||
const gitRefresh = require('./git-refresh');
|
||||
const css = require('./css');
|
||||
const file = require('./file');
|
||||
const nodeModules = require('./node_modules');
|
||||
|
@ -11,4 +13,6 @@ module.exports = [
|
|||
css,
|
||||
nodeModules,
|
||||
babel,
|
||||
git,
|
||||
gitRefresh,
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue