FIX: Don't warn users about duplicate links for:
- The original post - If the post is older than (x) (Two Weeks for now)
This commit is contained in:
parent
bb32364642
commit
b301b69d00
|
@ -228,8 +228,6 @@ export default Ember.Controller.extend({
|
|||
if (topic.get('posts_count') === 1) { return; }
|
||||
|
||||
const post = this.get('model.post');
|
||||
if (post && post.get('user_id') !== this.currentUser.id) { return; }
|
||||
|
||||
const $links = $('a[href]', $preview);
|
||||
$links.each((idx, l) => {
|
||||
const href = $(l).prop('href');
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const _warned = {};
|
||||
|
||||
const NO_RESULT = [false, null];
|
||||
|
||||
export default class LinkLookup {
|
||||
|
@ -16,8 +15,18 @@ export default class LinkLookup {
|
|||
|
||||
const linkInfo = this._links[normalized];
|
||||
if (linkInfo) {
|
||||
// Skip edits to the same post
|
||||
if (post && post.get('post_number') === linkInfo.post_number) { return NO_RESULT; }
|
||||
|
||||
if (post) {
|
||||
// Skip edits to the OP
|
||||
const postNumber = post.get('post_number');
|
||||
if (postNumber === 1) { return NO_RESULT; }
|
||||
|
||||
// Don't warn on older posts
|
||||
const createdAt = moment(post.get('created_at'));
|
||||
if (createdAt.isBefore(moment().subtract(2, 'weeks'))) {
|
||||
return NO_RESULT;
|
||||
}
|
||||
}
|
||||
|
||||
_warned[href] = true;
|
||||
_warned[normalized] = true;
|
||||
|
|
Loading…
Reference in New Issue