mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-26 18:44:56 +03:00
Merge pull request #338 from filecoin-project/@martinalong/fix-links
fixed linking bug
This commit is contained in:
commit
f07889d670
@ -1,9 +1,23 @@
|
||||
import { runQuery } from "~/node_common/data/utilities";
|
||||
|
||||
export default async ({ slatename, ownerId }) => {
|
||||
export default async ({ slatename, ownerId, username }) => {
|
||||
return await runQuery({
|
||||
label: "GET_SLATE_BY_NAME",
|
||||
queryFn: async (DB) => {
|
||||
let id = ownerId;
|
||||
if (username && !ownerId) {
|
||||
const user = await DB.select("*")
|
||||
.from("users")
|
||||
.where({ username })
|
||||
.first();
|
||||
|
||||
if (!user || user.error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
id = user.id;
|
||||
}
|
||||
|
||||
const query = await DB.select("*").from("slates").where({ slatename });
|
||||
|
||||
if (!query || query.error) {
|
||||
@ -12,7 +26,7 @@ export default async ({ slatename, ownerId }) => {
|
||||
|
||||
let foundSlate;
|
||||
for (let slate of query) {
|
||||
if (slate.data.ownerId && slate.data.ownerId === ownerId) {
|
||||
if (slate.data.ownerId && slate.data.ownerId === id) {
|
||||
foundSlate = slate;
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ app.prepare().then(async () => {
|
||||
|
||||
const slate = await Data.getSlateByName({
|
||||
slatename: req.params.slatename,
|
||||
username: req.params.username,
|
||||
});
|
||||
|
||||
if (!slate) {
|
||||
@ -185,6 +186,7 @@ app.prepare().then(async () => {
|
||||
|
||||
const slate = await Data.getSlateByName({
|
||||
slatename: req.params.slatename,
|
||||
username: req.params.username,
|
||||
});
|
||||
|
||||
if (!slate) {
|
||||
|
Loading…
Reference in New Issue
Block a user