mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-19 06:33:32 +00:00
keep follow suggestions until user clicks done or follows > 10
This commit is contained in:
parent
15f478ad04
commit
3584d4796a
@ -13,8 +13,8 @@ import { language, translate as t } from './translations/Translation';
|
||||
|
||||
const emojiRegex =
|
||||
/([\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]+)/gu;
|
||||
const pubKeyRegex = /(?:^|\s)(?:@)?(npub[a-zA-Z0-9]{59,60})(?![\w\/])/g;
|
||||
const noteRegex = /(?:^|\s)(?:@)?(note[a-zA-Z0-9]{59,60})(?![\w\/])/g;
|
||||
const pubKeyRegex = /(?:^|\s)(?:@)?(npub[a-zA-Z0-9]{59,60})(?![\w/])/g;
|
||||
const noteRegex = /(?:^|\s)(?:@)?(note[a-zA-Z0-9]{59,60})(?![\w/])/g;
|
||||
|
||||
function setImgSrc(el: JQuery<HTMLElement>, src: string): JQuery<HTMLElement> {
|
||||
if (src) {
|
||||
|
@ -910,7 +910,9 @@ const Nostr = {
|
||||
}
|
||||
}
|
||||
if (event.pubkey === myPub && event.tags.length) {
|
||||
iris.local().get('noFollows').put(false);
|
||||
if (this.followedByUser.get(myPub)?.size > 10) {
|
||||
iris.local().get('showFollowSuggestions').put(false);
|
||||
}
|
||||
}
|
||||
if (event.pubkey === myPub && event.content?.length) {
|
||||
try {
|
||||
|
@ -6,6 +6,7 @@ import Helpers from '../Helpers';
|
||||
import Nostr from '../Nostr';
|
||||
import { translate as t } from '../translations/Translation';
|
||||
|
||||
import Button from './basic/Button';
|
||||
import CopyButton from './CopyButton';
|
||||
import FollowButton from './FollowButton';
|
||||
import Identicon from './Identicon';
|
||||
@ -15,11 +16,11 @@ export default class OnboardingNotification extends Component {
|
||||
componentDidMount() {
|
||||
iris.local().get('noFollowers').on(this.inject());
|
||||
iris.local().get('hasNostrFollowers').on(this.inject());
|
||||
iris.local().get('noFollows').on(this.inject());
|
||||
iris.local().get('showFollowSuggestions').on(this.inject());
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.noFollows) {
|
||||
if (this.state.showFollowSuggestions) {
|
||||
return html`
|
||||
<div class="msg">
|
||||
<div class="msg-content">
|
||||
@ -36,6 +37,11 @@ export default class OnboardingNotification extends Component {
|
||||
</div>
|
||||
`,
|
||||
)}
|
||||
<p>
|
||||
<${Button} onClick=${() => iris.local().get('showFollowSuggestions').put(false)}>
|
||||
${t('done')}
|
||||
</Button>
|
||||
</p>
|
||||
<p>
|
||||
${t('alternatively')}<i> </i>
|
||||
<a
|
||||
|
@ -200,22 +200,6 @@ class PublicMessage extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (this.state.msg && !this.linksDone) {
|
||||
$(this.base)
|
||||
.find('a')
|
||||
.off()
|
||||
.on('click', (e) => {
|
||||
const href = $(e.target).attr('href');
|
||||
if (href && href.indexOf('https://iris.to/') === 0) {
|
||||
e.preventDefault();
|
||||
window.location = href.replace('https://iris.to/', '');
|
||||
}
|
||||
});
|
||||
this.linksDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
onClickName(e) {
|
||||
e.stopPropagation();
|
||||
route(`/${this.state.msg.info.from}`);
|
||||
@ -229,7 +213,6 @@ class PublicMessage extends Message {
|
||||
boostBtnClicked() {
|
||||
if (!this.state.boosted) {
|
||||
const author = this.state.msg?.event?.pubkey;
|
||||
|
||||
const nostrId = Nostr.toNostrHexAddress(this.props.hash);
|
||||
if (nostrId) {
|
||||
Nostr.publish({
|
||||
|
@ -39,7 +39,7 @@ type ResultItem = {
|
||||
type State = {
|
||||
results: Array<Result>;
|
||||
query: string;
|
||||
noFollows: boolean;
|
||||
showFollowSuggestions: boolean;
|
||||
offsetLeft: number;
|
||||
selected: number;
|
||||
};
|
||||
@ -50,7 +50,7 @@ class SearchBox extends Component<Props, State> {
|
||||
this.state = {
|
||||
results: [],
|
||||
query: '',
|
||||
noFollows: true,
|
||||
showFollowSuggestions: true,
|
||||
offsetLeft: 0,
|
||||
selected: -1, // -1 - 'search by keyword'
|
||||
};
|
||||
@ -77,7 +77,7 @@ class SearchBox extends Component<Props, State> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
iris.local().get('noFollows').on(this.inject());
|
||||
iris.local().get('showFollowSuggestions').on(this.inject());
|
||||
iris
|
||||
.local()
|
||||
.get('searchIndexUpdated')
|
||||
|
@ -114,6 +114,7 @@ class Login extends Component {
|
||||
e.preventDefault();
|
||||
let name = document.getElementById('login-form-name').value;
|
||||
iris.session.loginAsNewUser({ name, autofollow: false });
|
||||
iris.local().get('showFollowSuggestions').put(true);
|
||||
name && setTimeout(() => {
|
||||
Nostr.setMetadata({ name });
|
||||
}, 100);
|
||||
|
Loading…
Reference in New Issue
Block a user