wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.66k stars 1.11k forks source link

Followed Tags: tags that contain multiple words are hyphenated #15985

Open momo-ozawa opened 3 years ago

momo-ozawa commented 3 years ago

Expected behavior

Tags that contain multiple words are shown as is. (i.e. The tag "social media" should be displayed as "social media")

Actual behavior

Tags that contain multiple words are hyphenated. (i.e. The tag "social media" is displayed as "social-media")

Steps to reproduce the behavior

  1. Go to the Reader tab
  2. Tap on the settings icon
  3. On the Followed Topics tab, add a topic that contains multiple words
  4. 👀 Notice that the topic is hyphenated
Tested on iPhone SE, iOS 14.4, WPiOS 16.7
momo-ozawa commented 3 years ago

Investigation Notes

When we sync the remotely fetched topic with the locally stored topic, "display_name" value is mapped to the local topic's title instead of the "title" value, if it exists

topic.title = [topicDict stringForKey:TopicDictionaryDisplayNameKey] ?: [topicDict stringForKey:TopicDictionaryTitleKey];

Ref for more context: normalizeTopicDictionary:subscribed:recommended:

Debugger output

{
    ID = 49818;
    URL = "https://public-api.wordpress.com/rest/v1.2/read/tags/social-media/posts";
    "display_name" = "social-media";
    slug = "social-media";
    title = "Social Media";
    type = tag;
}

Questions

Will there be any side-effects if we change the mapping logic for the topic title to

topic.title = [topicDict stringForKey:TopicDictionaryTitleKey];