Skip to content

internal_link: Generate narrow links with "channel", not "stream" #781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/api/model/narrow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sealed class ApiNarrowElement {
}

class ApiNarrowStream extends ApiNarrowElement {
@override String get operator => 'stream';
@override String get operator => 'channel';

@override final int operand;

Expand Down
4 changes: 2 additions & 2 deletions test/api/route/messages_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ void main() {

checkNarrow(const CombinedFeedNarrow().apiEncode(), jsonEncode([]));
checkNarrow(const StreamNarrow(12).apiEncode(), jsonEncode([
{'operator': 'stream', 'operand': 12},
{'operator': 'channel', 'operand': 12},
]));
checkNarrow(const TopicNarrow(12, 'stuff').apiEncode(), jsonEncode([
{'operator': 'stream', 'operand': 12},
{'operator': 'channel', 'operand': 12},
{'operator': 'topic', 'operand': 'stuff'},
]));

Expand Down
26 changes: 13 additions & 13 deletions test/model/compose_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,22 @@ hello
.equals(store.realmUrl.resolve(expectedFragment));
}

checkNarrow(streamId: 1, name: 'announce', '#narrow/stream/1-announce');
checkNarrow(streamId: 378, name: 'api design', '#narrow/stream/378-api-design');
checkNarrow(streamId: 391, name: 'Outreachy', '#narrow/stream/391-Outreachy');
checkNarrow(streamId: 415, name: 'chat.zulip.org', '#narrow/stream/415-chat.2Ezulip.2Eorg');
checkNarrow(streamId: 419, name: 'français', '#narrow/stream/419-fran.C3.A7ais');
checkNarrow(streamId: 403, name: 'Hshs[™~}(.', '#narrow/stream/403-Hshs.5B.E2.84.A2~.7D.28.2E');
checkNarrow(streamId: 60, name: 'twitter', nearMessageId: 1570686, '#narrow/stream/60-twitter/near/1570686');
checkNarrow(streamId: 1, name: 'announce', '#narrow/channel/1-announce');
checkNarrow(streamId: 378, name: 'api design', '#narrow/channel/378-api-design');
checkNarrow(streamId: 391, name: 'Outreachy', '#narrow/channel/391-Outreachy');
checkNarrow(streamId: 415, name: 'chat.zulip.org', '#narrow/channel/415-chat.2Ezulip.2Eorg');
checkNarrow(streamId: 419, name: 'français', '#narrow/channel/419-fran.C3.A7ais');
checkNarrow(streamId: 403, name: 'Hshs[™~}(.', '#narrow/channel/403-Hshs.5B.E2.84.A2~.7D.28.2E');
checkNarrow(streamId: 60, name: 'twitter', nearMessageId: 1570686, '#narrow/channel/60-twitter/near/1570686');

checkNarrow(streamId: 48, name: 'mobile', topic: 'Welcome screen UI',
'#narrow/stream/48-mobile/topic/Welcome.20screen.20UI');
'#narrow/channel/48-mobile/topic/Welcome.20screen.20UI');
checkNarrow(streamId: 243, name: 'mobile-team', topic: 'Podfile.lock clash #F92',
'#narrow/stream/243-mobile-team/topic/Podfile.2Elock.20clash.20.23F92');
'#narrow/channel/243-mobile-team/topic/Podfile.2Elock.20clash.20.23F92');
checkNarrow(streamId: 377, name: 'translation/zh_tw', topic: '翻譯 "stream"',
'#narrow/stream/377-translation.2Fzh_tw/topic/.E7.BF.BB.E8.AD.AF.20.22stream.22');
'#narrow/channel/377-translation.2Fzh_tw/topic/.E7.BF.BB.E8.AD.AF.20.22stream.22');
checkNarrow(streamId: 42, name: 'Outreachy 2016-2017', topic: '2017-18 Stream?', nearMessageId: 302690,
'#narrow/stream/42-Outreachy-2016-2017/topic/2017-18.20Stream.3F/near/302690');
'#narrow/channel/42-Outreachy-2016-2017/topic/2017-18.20Stream.3F/near/302690');
});

test('DmNarrow', () {
Expand Down Expand Up @@ -344,11 +344,11 @@ hello
await store.addUser(sender);

check(quoteAndReplyPlaceholder(store, message: message)).equals('''
@_**Full Name|123** [said](${eg.selfAccount.realmUrl}#narrow/stream/1-test-here/topic/some.20topic/near/${message.id}): *(loading message ${message.id})*
@_**Full Name|123** [said](${eg.selfAccount.realmUrl}#narrow/channel/1-test-here/topic/some.20topic/near/${message.id}): *(loading message ${message.id})*
''');

check(quoteAndReply(store, message: message, rawContent: 'Hello world!')).equals('''
@_**Full Name|123** [said](${eg.selfAccount.realmUrl}#narrow/stream/1-test-here/topic/some.20topic/near/${message.id}):
@_**Full Name|123** [said](${eg.selfAccount.realmUrl}#narrow/channel/1-test-here/topic/some.20topic/near/${message.id}):
```quote
Hello world!
```
Expand Down
Loading