diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-21 16:44:43 +0100 |
commit | e8cb44090e654fda339506dccfcec7fea8722723 (patch) | |
tree | 2a36d264cf44cededff0e272919316a3feabcbc1 /server/models/account/account.ts | |
parent | 276d03ed1a469fd4e3579f92392b6f9a1567d1ca (diff) | |
download | PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.gz PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.tar.zst PeerTube-e8cb44090e654fda339506dccfcec7fea8722723.zip |
Add links to comment mentions
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r-- | server/models/account/account.ts | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts index bc7595a0e..c5955ef3b 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts | |||
@@ -157,7 +157,6 @@ export class AccountModel extends Model<AccountModel> { | |||
157 | static loadLocalByName (name: string) { | 157 | static loadLocalByName (name: string) { |
158 | const query = { | 158 | const query = { |
159 | where: { | 159 | where: { |
160 | name, | ||
161 | [ Sequelize.Op.or ]: [ | 160 | [ Sequelize.Op.or ]: [ |
162 | { | 161 | { |
163 | userId: { | 162 | userId: { |
@@ -170,7 +169,41 @@ export class AccountModel extends Model<AccountModel> { | |||
170 | } | 169 | } |
171 | } | 170 | } |
172 | ] | 171 | ] |
173 | } | 172 | }, |
173 | include: [ | ||
174 | { | ||
175 | model: ActorModel, | ||
176 | required: true, | ||
177 | where: { | ||
178 | preferredUsername: name | ||
179 | } | ||
180 | } | ||
181 | ] | ||
182 | } | ||
183 | |||
184 | return AccountModel.findOne(query) | ||
185 | } | ||
186 | |||
187 | static loadLocalByNameAndHost (name: string, host: string) { | ||
188 | const query = { | ||
189 | include: [ | ||
190 | { | ||
191 | model: ActorModel, | ||
192 | required: true, | ||
193 | where: { | ||
194 | preferredUsername: name | ||
195 | }, | ||
196 | include: [ | ||
197 | { | ||
198 | model: ServerModel, | ||
199 | required: true, | ||
200 | where: { | ||
201 | host | ||
202 | } | ||
203 | } | ||
204 | ] | ||
205 | } | ||
206 | ] | ||
174 | } | 207 | } |
175 | 208 | ||
176 | return AccountModel.findOne(query) | 209 | return AccountModel.findOne(query) |