Skip to content
Snippets Groups Projects
Commit 4601d4a8 authored by Jure's avatar Jure
Browse files

fix: a few small fixes

parent 1cc066f5
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ const App = ({ ...@@ -43,7 +43,7 @@ const App = ({
match, match,
}) => { }) => {
const journal = useContext(JournalContext) const journal = useContext(JournalContext)
const [conversion, _] = useContext(XpubContext) const [conversion] = useContext(XpubContext)
const { pathname } = history.location const { pathname } = history.location
const showLinks = pathname.match(/submit|manuscript/g) const showLinks = pathname.match(/submit|manuscript/g)
......
...@@ -49,11 +49,14 @@ class XpubCollabraMode { ...@@ -49,11 +49,14 @@ class XpubCollabraMode {
let membershipCondition let membershipCondition
if (object) { if (object) {
// We're asking if a user is a member of a team for a specific object // We're asking if a user is a member of a team for a specific object
membershipCondition = team => membershipCondition = team => {
team.role === role && team.object && team.object.objectId === object.id // TODO: This needs to be fixed...
const objectId = team.objectId || (team.object && team.object.objectId)
return team.role === role && objectId === object.id
}
} else { } else {
// We're asking if a user is a member of a global team // We're asking if a user is a member of a global team
membershipCondition = team => team.role === role && !team.object membershipCondition = team => team.role === role && team.global
} }
const memberships = await Promise.all( const memberships = await Promise.all(
...@@ -515,7 +518,9 @@ class XpubCollabraMode { ...@@ -515,7 +518,9 @@ class XpubCollabraMode {
} }
async isAllowedToReview(object) { async isAllowedToReview(object) {
this.user = await this.context.models.User.find(this.userId) this.user = await this.context.models.User.query()
.findById(this.userId)
.eager('teams')
const permission = await this.isAssignedReviewerEditor({ const permission = await this.isAssignedReviewerEditor({
id: object.manuscriptId, id: object.manuscriptId,
}) })
...@@ -752,7 +757,6 @@ module.exports = { ...@@ -752,7 +757,6 @@ module.exports = {
read: async (userId, operation, object, context) => { read: async (userId, operation, object, context) => {
const mode = new XpubCollabraMode(userId, operation, object, context) const mode = new XpubCollabraMode(userId, operation, object, context)
console.log(userId, operation, object, object.name, object.constructor.name)
if (object === 'Manuscript' || object === 'Review') { if (object === 'Manuscript' || object === 'Review') {
return true return true
} }
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
"pubsweet-component-xpub-formbuilder", "pubsweet-component-xpub-formbuilder",
"@pubsweet/model-team", "@pubsweet/model-team",
"@pubsweet/model-user", "@pubsweet/model-user",
"server/journal/src/", "./server/journal/src/",
"server/manuscript/src/", "./server/manuscript/src/",
"server/review/src/", "./server/review/src/",
"server/file/src/", "./server/file/src/",
"server/formbuilder/src/", "./server/formbuilder/src/",
"@pubsweet/job-xsweet", "@pubsweet/job-xsweet",
"@pubsweet/component-password-reset-server" "@pubsweet/component-password-reset-server"
] ]
...@@ -13,6 +13,10 @@ module.exports = { ...@@ -13,6 +13,10 @@ module.exports = {
'pubsweet-client': { 'pubsweet-client': {
baseUrl: 'http://localhost:4000/', baseUrl: 'http://localhost:4000/',
}, },
mailer: {
from: 'simplej@simplej.com',
path: `${__dirname}/test-mailer`,
},
dbManager: { dbManager: {
username: 'admin', username: 'admin',
password: '12345678', password: '12345678',
......
// This is a test mailer setup, according to instructions on:
// https://nodemailer.com/smtp/testing/
module.exports = {
transport: {
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: 'patrick23@ethereal.email',
pass: 'VbnXvJ9UW9BHevDnxk',
},
},
}
...@@ -56,10 +56,10 @@ ...@@ -56,10 +56,10 @@
"styled-components": "^4.1.1", "styled-components": "^4.1.1",
"supertest": "^3.0.0", "supertest": "^3.0.0",
"winston": "^2.4.0", "winston": "^2.4.0",
"xpub-journal": "^0.0.22", "xpub-journal": "^0.1.0",
"xpub-selectors": "^0.2.0", "xpub-selectors": "^0.2.0",
"xpub-theme": "^0.0.23", "xpub-theme": "^0.0.23",
"xpub-with-context": "^0.1.4" "xpub-with-context": "^0.2.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.0.0", "@babel/core": "^7.0.0",
......
...@@ -92,15 +92,14 @@ const resolvers = { ...@@ -92,15 +92,14 @@ const resolvers = {
.eager('members') .eager('members')
team.members = team.members.map(m => { team.members = team.members.map(m => {
if (m.user && m.user.id === currentUserId) { if (m.userId === currentUserId) {
m.status = action m.status = action
} }
return m return m
}) })
if (!team) throw new Error('No team was found') if (!team) throw new Error('No team was found')
await new Team(team).save() await new Team(team).saveGraph()
if (action === 'accepted') { if (action === 'accepted') {
const review = { const review = {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment