Merge branch 'main' into block
This commit is contained in:
commit
c042851184
|
@ -22,6 +22,9 @@
|
|||
"jsx"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-unresolved": [
|
||||
"off"
|
||||
],
|
||||
"indent": [
|
||||
"error",
|
||||
2
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"flags": {
|
||||
"gulpfile": "gulpfile.cjs"
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@ Connector for Mobilizon allows you to display the upcoming events of [Mobilizon]
|
|||
|
||||
More details can be found in the [WordPress Plugin Directory](https://wordpress.org/plugins/connector-mobilizon/).
|
||||
|
||||
The current changelog can be under [source/changelog.txt](source/changelog.txt).
|
||||
|
||||
## Development
|
||||
|
||||
### Setup
|
||||
|
|
File diff suppressed because it is too large
Load Diff
54
package.json
54
package.json
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"name": "connector-mobilizon",
|
||||
"version": "0.6.2",
|
||||
"version": "0.9.1",
|
||||
"description": "Display Mobilizon events in WordPress.",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build-dev": "webpack --mode=development && gulp inject",
|
||||
"build-prod": "ava && webpack --mode=production && gulp inject",
|
||||
|
@ -23,49 +24,46 @@
|
|||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"graphql": "^16.1.0",
|
||||
"graphql-request": "^3.7.0",
|
||||
"luxon": "^2.1.1",
|
||||
"object-hash": "^2.2.0"
|
||||
"graphql": "16.5.0",
|
||||
"graphql-request": "4.2.0",
|
||||
"luxon": "2.4.0",
|
||||
"object-hash": "3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.5",
|
||||
"@babel/core": "7.17.12",
|
||||
"@babel/eslint-parser": "^7.16.5",
|
||||
"@babel/preset-env": "^7.15.8",
|
||||
"@babel/preset-env": "7.17.12",
|
||||
"@babel/preset-react": "^7.16.5",
|
||||
"@wordpress/eslint-plugin": "^9.2.0",
|
||||
"ava": "^3.15.0",
|
||||
"babel-loader": "^8.2.3",
|
||||
"c8": "^7.10.0",
|
||||
"copy-webpack-plugin": "^10.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-ava": "^13.1.0",
|
||||
"@wordpress/eslint-plugin": "12.4.0",
|
||||
"ava": "4.2.0",
|
||||
"babel-loader": "8.2.5",
|
||||
"c8": "7.11.3",
|
||||
"copy-webpack-plugin": "11.0.0",
|
||||
"eslint": "8.15.0",
|
||||
"eslint-plugin-ava": "13.2.0",
|
||||
"eslint-plugin-jsx": "^0.1.0",
|
||||
"eslint-plugin-react": "^7.27.1",
|
||||
"esm": "^3.2.25",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-replace": "^1.1.3",
|
||||
"husky": "^7.0.4",
|
||||
"jsdom": "^19.0.0",
|
||||
"lint-staged": "^12.1.2",
|
||||
"prettier": "2.5.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1"
|
||||
"esm": "3.2.25",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-replace": "1.1.3",
|
||||
"husky": "8.0.1",
|
||||
"jsdom": "19.0.0",
|
||||
"lint-staged": "12.4.1",
|
||||
"prettier": "2.6.2",
|
||||
"rimraf": "3.0.2",
|
||||
"webpack": "5.72.1",
|
||||
"webpack-cli": "4.9.2"
|
||||
},
|
||||
"ava": {
|
||||
"files": [
|
||||
"./source/**/*test.js"
|
||||
],
|
||||
"require": [
|
||||
"esm"
|
||||
]
|
||||
},
|
||||
"additionalDetails": {
|
||||
"niceName": "Connector for Mobilizon",
|
||||
"phpMinimumVersion": 7.4,
|
||||
"wordpressMinimumVersion": 5.6,
|
||||
"wordpressTestedUpToVersion": 5.8
|
||||
"wordpressTestedUpToVersion": "6.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"source/**/*.js": "eslint",
|
||||
|
|
|
@ -1,16 +1,46 @@
|
|||
### [Unreleased]
|
||||
#### Added
|
||||
- Add specific error message for the case the group is not found
|
||||
- Add code formatter prettier
|
||||
#### Changed
|
||||
- Set minimum PHP version to oldest officially supported 7.4
|
||||
- Update dependencies
|
||||
- Simplify build process
|
||||
#### Deprecated
|
||||
#### Removed
|
||||
#### Fixed
|
||||
#### Security
|
||||
|
||||
### [0.9.1] - 2020-05-19
|
||||
#### Fixed
|
||||
- Fix WordPress compatibility version number
|
||||
|
||||
### [0.9.0] - 2020-05-19
|
||||
#### Added
|
||||
- Improve explanation of group name filter
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
- Confirm compatibility with WordPress 6.0
|
||||
#### Fixed
|
||||
- Fix displaying error message for the case the group is not found
|
||||
|
||||
### [0.8.0] - 2022-01-09
|
||||
#### Added
|
||||
- Add support for older browsers using babel
|
||||
#### Changed
|
||||
- Confirm compatibility with WordPress 5.9
|
||||
- Update dependencies
|
||||
#### Fixed
|
||||
- Use ES modules correctly
|
||||
- Trim events' location
|
||||
|
||||
### [0.7.0] - 2021-12-23
|
||||
#### Added
|
||||
- Add specific error message for the case the group is not found
|
||||
- Add code formatter prettier
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
- Simplify build process
|
||||
#### Fixed
|
||||
- Fix Invalid DateTime on event end time being null
|
||||
#### Security
|
||||
- Set minimum PHP version to oldest stable 7.4
|
||||
|
||||
### [0.6.2] - 2021-08-24
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import test from 'ava'
|
||||
import DateTimeWrapper from './date-time-wrapper'
|
||||
import DateTimeWrapper from './date-time-wrapper.js'
|
||||
|
||||
test('#getShortDate usual date', (t) => {
|
||||
const d = new DateTimeWrapper({ text: '2020-12-24T16:45:00Z' })
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import test from 'ava'
|
||||
import { JSDOM } from 'jsdom'
|
||||
|
||||
import { displayEvents, displayErrorMessage } from './events-displayer'
|
||||
import { displayEvents, displayErrorMessage } from './events-displayer.js'
|
||||
|
||||
let document
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Formatter from './formatter'
|
||||
import { createAnchorElement } from './html-creator'
|
||||
import Formatter from './formatter.js'
|
||||
import { createAnchorElement } from './html-creator.js'
|
||||
|
||||
export function displayEvents({ data, document, list }) {
|
||||
const locale = list.getAttribute('data-locale')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { displayEvents, displayErrorMessage } from './events-displayer'
|
||||
import * as GraphqlWrapper from './graphql-wrapper'
|
||||
import { displayEvents, displayErrorMessage } from './events-displayer.js'
|
||||
import * as GraphqlWrapper from './graphql-wrapper.js'
|
||||
|
||||
const NAME = '<wordpress-name>'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import test from 'ava'
|
||||
import Formatter from './formatter'
|
||||
import Formatter from './formatter.js'
|
||||
|
||||
test('#formatDate one date', (t) => {
|
||||
const date = Formatter.formatDate({
|
||||
|
@ -32,20 +32,42 @@ test('#formatDate two dates with short offset name', (t) => {
|
|||
end: '2021-04-16T15:30:00Z',
|
||||
isShortOffsetNameShown: true,
|
||||
})
|
||||
t.is(date, '15/04/2021 10:30 (UTC) - 16/04/2021 15:30 (UTC)')
|
||||
t.is(date, '15/04/2021 10:30 - 16/04/2021 15:30 (UTC)')
|
||||
})
|
||||
|
||||
test('#formatDate second date is null', (t) => {
|
||||
const date = Formatter.formatDate({
|
||||
start: '2021-04-15T10:30:00Z',
|
||||
end: null,
|
||||
})
|
||||
t.is(date, '15/04/2021 10:30')
|
||||
})
|
||||
|
||||
test('#formatDate second date is null with short offset name', (t) => {
|
||||
const date = Formatter.formatDate({
|
||||
start: '2021-04-15T10:30:00Z',
|
||||
end: null,
|
||||
isShortOffsetNameShown: true,
|
||||
})
|
||||
t.is(date, '15/04/2021 10:30 (UTC)')
|
||||
})
|
||||
|
||||
test('#formatLocation both parameters', (t) => {
|
||||
const date = Formatter.formatLocation({ description: 'a', locality: 'b' })
|
||||
t.is(date, 'a, b')
|
||||
const location = Formatter.formatLocation({ description: 'a', locality: 'b' })
|
||||
t.is(location, 'a, b')
|
||||
})
|
||||
|
||||
test('#formatLocation description only', (t) => {
|
||||
const date = Formatter.formatLocation({ description: 'a' })
|
||||
t.is(date, 'a')
|
||||
const location = Formatter.formatLocation({ description: 'a' })
|
||||
t.is(location, 'a')
|
||||
})
|
||||
|
||||
test('#formatLocation description with space only', (t) => {
|
||||
const location = Formatter.formatLocation({ description: ' ' })
|
||||
t.is(location, '')
|
||||
})
|
||||
|
||||
test('#formatLocation locality only', (t) => {
|
||||
const date = Formatter.formatLocation({ locality: 'a' })
|
||||
t.is(date, 'a')
|
||||
const location = Formatter.formatLocation({ locality: 'a' })
|
||||
t.is(location, 'a')
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import DateTimeWrapper from './date-time-wrapper'
|
||||
import DateTimeWrapper from './date-time-wrapper.js'
|
||||
|
||||
export default class Formatter {
|
||||
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {
|
||||
|
@ -7,13 +7,15 @@ export default class Formatter {
|
|||
text: start,
|
||||
timeZone,
|
||||
})
|
||||
const endDateTime = new DateTimeWrapper({ locale, text: end, timeZone })
|
||||
let dateText = startDateTime.getShortDate()
|
||||
dateText += ' ' + startDateTime.get24Time()
|
||||
if (!startDateTime.equalsDate(endDateTime)) {
|
||||
if (isShortOffsetNameShown) {
|
||||
if (!end && isShortOffsetNameShown) {
|
||||
dateText += ' (' + startDateTime.getShortOffsetName() + ')'
|
||||
}
|
||||
|
||||
if (end) {
|
||||
const endDateTime = new DateTimeWrapper({ locale, text: end, timeZone })
|
||||
if (!startDateTime.equalsDate(endDateTime)) {
|
||||
dateText += ' - '
|
||||
dateText += endDateTime.getShortDate() + ' '
|
||||
} else {
|
||||
|
@ -23,13 +25,14 @@ export default class Formatter {
|
|||
if (isShortOffsetNameShown) {
|
||||
dateText += ' (' + endDateTime.getShortOffsetName() + ')'
|
||||
}
|
||||
}
|
||||
return dateText
|
||||
}
|
||||
|
||||
static formatLocation({ description, locality }) {
|
||||
let location = ''
|
||||
if (description) {
|
||||
location += description
|
||||
if (description && description.trim()) {
|
||||
location += description.trim()
|
||||
}
|
||||
if (location && locality) {
|
||||
location += ', '
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import SessionCache from './session-cache'
|
||||
import SessionCache from './session-cache.js'
|
||||
import { request } from 'graphql-request'
|
||||
import DateTimeWrapper from './date-time-wrapper'
|
||||
import DateTimeWrapper from './date-time-wrapper.js'
|
||||
|
||||
export function getUpcomingEvents({ url, limit }) {
|
||||
const query = `
|
||||
|
@ -37,7 +37,7 @@ export function getUpcomingEvents({ url, limit }) {
|
|||
|
||||
export function getUpcomingEventsByGroupName({ url, limit, groupName }) {
|
||||
const query = `
|
||||
query ($afterDatetime: DateTime, $groupName: String, $limit: Int) {
|
||||
query ($afterDatetime: DateTime, $groupName: String!, $limit: Int) {
|
||||
group(preferredUsername: $groupName) {
|
||||
organizedEvents(afterDatetime: $afterDatetime, limit: $limit) {
|
||||
elements {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import test from 'ava'
|
||||
import { JSDOM } from 'jsdom'
|
||||
|
||||
import { createAnchorElement } from './html-creator'
|
||||
import { createAnchorElement } from './html-creator.js'
|
||||
|
||||
let document
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import test from 'ava'
|
||||
import hash from './object-hash-wrapper'
|
||||
import hash from './object-hash-wrapper.js'
|
||||
|
||||
test('#hash object', (t) => {
|
||||
t.is(hash({ foo: 'bar' }), 'a75c05bdca7d704bdfcd761913e5a4e4636e956b')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import test from 'ava'
|
||||
import SessionCache from './session-cache'
|
||||
import SessionCache from './session-cache.js'
|
||||
|
||||
const fakeStorage = {
|
||||
elements: {},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import hash from './object-hash-wrapper'
|
||||
import hash from './object-hash-wrapper.js'
|
||||
|
||||
const MAX_AGE_IN_MS = 120000
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ Features
|
|||
- Toggle adding named offset in brackets after the time in the settings
|
||||
|
||||
Shortcut format with limiting the number of events to show to 3 for example: `[<wordpress-name>-events-list events-count=3]`
|
||||
|
||||
Optionally, you can only show the events of a specific group by indicatings its name: `[<wordpress-name>-events-list events-count=3 group-name="mygroup"]`
|
||||
You have to use their username, e.g. `@nosliensvivants`, and append the name of their instance if they use a different one, e.g. `@yaam_berlin@mobilize.berlin`.
|
||||
|
||||
The source code is available on [Github](https://github.com/dwaxweiler/connector-mobilizon).
|
||||
|
||||
|
@ -36,6 +38,41 @@ The source code is available on [Github](https://github.com/dwaxweiler/connector
|
|||
|
||||
## Changelog
|
||||
|
||||
### [0.9.1] - 2020-05-19
|
||||
#### Fixed
|
||||
- Fix WordPress compatibility version number
|
||||
|
||||
### [0.9.0] - 2020-05-19
|
||||
#### Added
|
||||
- Improve explanation of group name filter
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
- Confirm compatibility with WordPress 6.0
|
||||
#### Fixed
|
||||
- Fix displaying error message for the case the group is not found
|
||||
|
||||
### [0.8.0] - 2022-01-09
|
||||
#### Added
|
||||
- Add support for older browsers using babel
|
||||
#### Changed
|
||||
- Confirm compatibility with WordPress 5.9
|
||||
- Update dependencies
|
||||
#### Fixed
|
||||
- Use ES modules correctly
|
||||
- Trim events' location
|
||||
|
||||
### [0.7.0] - 2021-12-23
|
||||
#### Added
|
||||
- Add specific error message for the case the group is not found
|
||||
- Add code formatter prettier
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
- Simplify build process
|
||||
#### Fixed
|
||||
- Fix Invalid DateTime on event end time being null
|
||||
#### Security
|
||||
- Set minimum PHP version to oldest stable 7.4
|
||||
|
||||
### [0.6.2] - 2021-08-24
|
||||
#### Changed
|
||||
- Update dependencies
|
||||
|
|
|
@ -25,6 +25,20 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [['@babel/preset-env', { targets: 'defaults' }]],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
Loading…
Reference in New Issue