Improve Page
* ページをピン留めできるように * デッキでカラム内でページを見れるように
This commit is contained in:
parent
4b747d20b7
commit
bd8d7c3d0f
32 changed files with 295 additions and 55 deletions
|
@ -10,7 +10,7 @@ import extractHashtags from '../../../../misc/extract-hashtags';
|
|||
import * as langmap from 'langmap';
|
||||
import { updateHashtag } from '../../../../services/update-hashtag';
|
||||
import { ApiError } from '../../error';
|
||||
import { Users, DriveFiles, UserProfiles } from '../../../../models';
|
||||
import { Users, DriveFiles, UserProfiles, Pages } from '../../../../models';
|
||||
import { User } from '../../../../models/entities/user';
|
||||
import { UserProfile } from '../../../../models/entities/user-profile';
|
||||
import { ensure } from '../../../../prelude/ensure';
|
||||
|
@ -125,6 +125,13 @@ export const meta = {
|
|||
'ja-JP': 'アップロードするメディアをデフォルトで「閲覧注意」として設定するか'
|
||||
}
|
||||
},
|
||||
|
||||
pinnedPageId: {
|
||||
validator: $.optional.nullable.type(ID),
|
||||
desc: {
|
||||
'ja-JP': 'ピン留めするページID'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@ -150,7 +157,13 @@ export const meta = {
|
|||
message: 'The file specified as a banner is not an image.',
|
||||
code: 'BANNER_NOT_AN_IMAGE',
|
||||
id: '75aedb19-2afd-4e6d-87fc-67941256fa60'
|
||||
}
|
||||
},
|
||||
|
||||
noSuchPage: {
|
||||
message: 'No such page.',
|
||||
code: 'NO_SUCH_PAGE',
|
||||
id: '8e01b590-7eb9-431b-a239-860e086c408e'
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -203,6 +216,16 @@ export default define(meta, async (ps, user, app) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (ps.pinnedPageId) {
|
||||
const page = await Pages.findOne(ps.pinnedPageId);
|
||||
|
||||
if (page == null || page.userId !== user.id) throw new ApiError(meta.errors.noSuchPage);
|
||||
|
||||
profileUpdates.pinnedPageId = page.id;
|
||||
} else if (ps.pinnedPageId === null) {
|
||||
profileUpdates.pinnedPageId = null;
|
||||
}
|
||||
|
||||
//#region emojis/tags
|
||||
|
||||
let emojis = [] as string[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue