Merge branch '459-activitypub-integration' of github.com:NuSkooler/enigma-bbs into 459-activitypub-integration
This commit is contained in:
commit
1065f14c2e
Binary file not shown.
Binary file not shown.
|
@ -472,6 +472,7 @@
|
||||||
BT2: {
|
BT2: {
|
||||||
width: 20
|
width: 20
|
||||||
focusTextStyle: upper
|
focusTextStyle: upper
|
||||||
|
submit: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,9 +484,32 @@
|
||||||
TL2: {
|
TL2: {
|
||||||
width: 70
|
width: 70
|
||||||
}
|
}
|
||||||
BT3: {
|
TL3: {
|
||||||
width: 20
|
width: 70
|
||||||
|
}
|
||||||
|
TL4: {
|
||||||
|
width: 10
|
||||||
|
}
|
||||||
|
TL5: {
|
||||||
|
width: 4
|
||||||
|
}
|
||||||
|
TL6: {
|
||||||
|
width: 4
|
||||||
|
}
|
||||||
|
MT7: {
|
||||||
|
focus: true
|
||||||
|
width: 69
|
||||||
|
height: 3
|
||||||
|
mode: preview
|
||||||
|
}
|
||||||
|
BT8: {
|
||||||
focusTextStyle: upper
|
focusTextStyle: upper
|
||||||
|
submit: true
|
||||||
|
}
|
||||||
|
BT9: {
|
||||||
|
text: back
|
||||||
|
focusTextStyle: upper
|
||||||
|
submit: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
const { MenuModule } = require('../menu_module');
|
const { MenuModule } = require('../menu_module');
|
||||||
const { Errors } = require('../enig_error');
|
const { Errors } = require('../enig_error');
|
||||||
const Actor = require('../activitypub/actor');
|
const Actor = require('../activitypub/actor');
|
||||||
|
const moment = require('moment');
|
||||||
|
const { htmlToMessageBody } = require('./util');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const { get, truncate } = require('lodash');
|
const { get, truncate, isEmpty } = require('lodash');
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
name: 'ActivityPub Actor Search',
|
name: 'ActivityPub Actor Search',
|
||||||
|
@ -20,11 +22,18 @@ const FormIds = {
|
||||||
const MciViewIds = {
|
const MciViewIds = {
|
||||||
main: {
|
main: {
|
||||||
searchUrl: 1,
|
searchUrl: 1,
|
||||||
searchOrCancel: 2,
|
searchButton: 2,
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
userName: 1,
|
userName: 1,
|
||||||
fullName: 2,
|
fullName: 2,
|
||||||
|
datePublished: 3,
|
||||||
|
manualFollowers: 4,
|
||||||
|
numberFollowers: 5,
|
||||||
|
numberFollowing: 6,
|
||||||
|
summary: 7,
|
||||||
|
followButton: 8,
|
||||||
|
cancelButton: 9,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,11 +51,8 @@ exports.getModule = class ActivityPubActorSearch extends MenuModule {
|
||||||
case MciViewIds.main.searchUrl: {
|
case MciViewIds.main.searchUrl: {
|
||||||
return this._search(formData.value, cb);
|
return this._search(formData.value, cb);
|
||||||
}
|
}
|
||||||
case MciViewIds.main.searchOrCancel: {
|
case MciViewIds.main.searchButton: {
|
||||||
const search = get(formData, 'value.searchOrCancel') === 0;
|
return this._search(formData.value, cb);
|
||||||
return search
|
|
||||||
? this._search(formData.value, cb)
|
|
||||||
: this.prevMenu(cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -96,11 +102,20 @@ exports.getModule = class ActivityPubActorSearch extends MenuModule {
|
||||||
async.series(
|
async.series(
|
||||||
[
|
[
|
||||||
callback => {
|
callback => {
|
||||||
|
if (this.viewControllers.main) {
|
||||||
|
this.viewControllers.main.setFocus(false);
|
||||||
|
}
|
||||||
|
|
||||||
return this.displayArtAndPrepViewController(
|
return this.displayArtAndPrepViewController(
|
||||||
'view',
|
'view',
|
||||||
FormIds.view,
|
FormIds.view,
|
||||||
{ clearScreen: true },
|
{ clearScreen: true },
|
||||||
callback
|
(err, artInfo, wasCreated) => {
|
||||||
|
if (!err && !wasCreated) {
|
||||||
|
this.viewControllers.view.setFocus(true);
|
||||||
|
}
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
callback => {
|
callback => {
|
||||||
|
@ -120,11 +135,34 @@ exports.getModule = class ActivityPubActorSearch extends MenuModule {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: FIXME: fullNameView.getWidth() is 0 - I'm thinking it's getting form 0 for some reason
|
|
||||||
const fullNameView = v(MciViewIds.view.fullName);
|
const fullNameView = v(MciViewIds.view.fullName);
|
||||||
fullNameView.setText(
|
fullNameView.setText(
|
||||||
truncate(remoteActor.name, { length: fullNameView.getWidth() })
|
truncate(remoteActor.name, { length: fullNameView.getWidth() })
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const datePublishedView = v(MciViewIds.view.datePublished);
|
||||||
|
if (isEmpty(remoteActor.published)) {
|
||||||
|
datePublishedView.setText('Not available.');
|
||||||
|
} else {
|
||||||
|
const publishedDate = moment(remoteActor.published);
|
||||||
|
datePublishedView.setText(
|
||||||
|
publishedDate.format(this.getDateFormat())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const manualFollowersView = v(MciViewIds.view.manualFollowers);
|
||||||
|
manualFollowersView.setText(remoteActor.manuallyApprovesFollowers);
|
||||||
|
|
||||||
|
// TODO: Number of followers, number following
|
||||||
|
|
||||||
|
const summaryView = v(MciViewIds.view.summary);
|
||||||
|
summaryView.setText(htmlToMessageBody(remoteActor.summary));
|
||||||
|
summaryView.redraw();
|
||||||
|
|
||||||
|
const followButtonView = v(MciViewIds.view.followButton);
|
||||||
|
// TODO: FIXME: Real status
|
||||||
|
followButtonView.setText('follow');
|
||||||
|
|
||||||
return callback(null);
|
return callback(null);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue